Bug 1340683 - stylo: Implement the :-moz-any pseudo-class

This commit is contained in:
Matt Brubeck 2017-03-15 11:32:12 -07:00
parent e34aac03ff
commit 2872c8bfab
10 changed files with 146 additions and 40 deletions

View file

@ -14,7 +14,8 @@ use restyle_hints::ElementSnapshot;
use selector_parser::{ElementExt, PseudoElementCascadeType, SelectorParser};
use selector_parser::{attr_equals_selector_is_shareable, attr_exists_selector_is_shareable};
use selectors::{Element, MatchAttrGeneric};
use selectors::parser::AttrSelector;
use selectors::matching::{ElementSelectorFlags, StyleRelations};
use selectors::parser::{AttrSelector, SelectorMethods};
use std::borrow::Cow;
use std::fmt;
use std::fmt::Debug;
@ -60,7 +61,6 @@ impl ToCss for PseudoElement {
}
}
impl PseudoElement {
/// Whether the current pseudo element is :before or :after.
#[inline]
@ -150,6 +150,13 @@ impl ToCss for NonTSPseudoClass {
}
}
impl SelectorMethods for NonTSPseudoClass {
#[inline]
fn affects_siblings(&self) -> bool { false }
#[inline]
fn matches_non_common_style_affecting_attribute(&self) -> bool { false }
}
impl NonTSPseudoClass {
/// Gets a given state flag for this pseudo-class. This is used to do
/// selector matching, and it's set from the DOM.
@ -450,7 +457,9 @@ impl MatchAttrGeneric for ServoElementSnapshot {
impl<E: Element<Impl=SelectorImpl> + Debug> ElementExt for E {
fn is_link(&self) -> bool {
self.match_non_ts_pseudo_class(&NonTSPseudoClass::AnyLink)
self.match_non_ts_pseudo_class(&NonTSPseudoClass::AnyLink,
&mut StyleRelations::empty(),
&mut ElementSelectorFlags::empty())
}
#[inline]