diff options
Diffstat (limited to 'components/style/gecko/selector_parser.rs')
-rw-r--r-- | components/style/gecko/selector_parser.rs | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/components/style/gecko/selector_parser.rs b/components/style/gecko/selector_parser.rs index 3c944bbc6eb..4baac4164ad 100644 --- a/components/style/gecko/selector_parser.rs +++ b/components/style/gecko/selector_parser.rs @@ -15,7 +15,7 @@ use crate::values::serialize_atom_identifier; use cssparser::{BasicParseError, BasicParseErrorKind, Parser}; use cssparser::{CowRcStr, SourceLocation, ToCss, Token}; use selectors::parser::{self as selector_parser, Selector}; -use selectors::parser::{SelectorParseErrorKind, Visit}; +use selectors::parser::SelectorParseErrorKind; use selectors::visitor::SelectorVisitor; use selectors::SelectorList; use std::fmt; @@ -109,25 +109,6 @@ impl ToCss for NonTSPseudoClass { } } -impl Visit for NonTSPseudoClass { - type Impl = SelectorImpl; - - fn visit<V>(&self, visitor: &mut V) -> bool - where - V: SelectorVisitor<Impl = Self::Impl>, - { - if let NonTSPseudoClass::MozAny(ref selectors) = *self { - for selector in selectors.iter() { - if !selector.visit(visitor) { - return false; - } - } - } - - true - } -} - impl NonTSPseudoClass { /// Parses the name and returns a non-ts-pseudo-class if succeeds. /// None otherwise. It doesn't check whether the pseudo-class is enabled @@ -280,6 +261,21 @@ impl ::selectors::parser::NonTSPseudoClass for NonTSPseudoClass { fn has_zero_specificity(&self) -> bool { matches!(*self, NonTSPseudoClass::MozNativeAnonymousNoSpecificity) } + + fn visit<V>(&self, visitor: &mut V) -> bool + where + V: SelectorVisitor<Impl = Self::Impl>, + { + if let NonTSPseudoClass::MozAny(ref selectors) = *self { + for selector in selectors.iter() { + if !selector.visit(visitor) { + return false; + } + } + } + + true + } } /// The dummy struct we use to implement our selector parsing. @@ -355,6 +351,11 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> { } #[inline] + fn parse_is_and_where(&self) -> bool { + static_prefs::pref!("layout.css.is-where-selectors.enabled") + } + + #[inline] fn parse_part(&self) -> bool { self.chrome_rules_enabled() || static_prefs::pref!("layout.css.shadow-parts.enabled") } |