diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2020-12-16 20:24:03 +0000 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2021-02-26 16:44:05 +0100 |
commit | a3f84f85e34805b1f23407fc85b30a58533632a0 (patch) | |
tree | 2b4c21316161af9c818e523fe021a01fd7147f4a /components/style | |
parent | 72a0dbacc79a7e2f861aa6eb8a1976d8fdcc65a6 (diff) | |
download | servo-a3f84f85e34805b1f23407fc85b30a58533632a0.tar.gz servo-a3f84f85e34805b1f23407fc85b30a58533632a0.zip |
style: Remove layout.css.moz-any-is-is.enabled.
We shipped this, let's remove the MozAny code.
Differential Revision: https://phabricator.services.mozilla.com/D99607
Diffstat (limited to 'components/style')
-rw-r--r-- | components/style/gecko/selector_parser.rs | 60 | ||||
-rw-r--r-- | components/style/gecko/wrapper.rs | 4 | ||||
-rw-r--r-- | components/style/invalidation/element/element_wrapper.rs | 10 |
3 files changed, 5 insertions, 69 deletions
diff --git a/components/style/gecko/selector_parser.rs b/components/style/gecko/selector_parser.rs index 0a7e2922c93..b619f58af60 100644 --- a/components/style/gecko/selector_parser.rs +++ b/components/style/gecko/selector_parser.rs @@ -14,13 +14,10 @@ use crate::string_cache::{Atom, Namespace, WeakAtom, WeakNamespace}; use crate::values::{AtomIdent, AtomString}; use cssparser::{BasicParseError, BasicParseErrorKind, Parser}; use cssparser::{CowRcStr, SourceLocation, ToCss, Token}; -use selectors::parser::{SelectorParseErrorKind, ParseErrorRecovery}; -use selectors::parser::{self as selector_parser, Selector}; -use selectors::visitor::SelectorVisitor; +use selectors::parser::{ParseErrorRecovery, SelectorParseErrorKind}; use selectors::SelectorList; use std::fmt; use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss as ToCss_}; -use thin_slice::ThinBoxedSlice; pub use crate::gecko::pseudo_element::{ PseudoElement, EAGER_PSEUDOS, EAGER_PSEUDO_COUNT, PSEUDO_COUNT, @@ -54,11 +51,6 @@ macro_rules! pseudo_class_name { Lang(Lang), /// The `:dir` pseudo-class. Dir(Direction), - /// The non-standard `:-moz-any` pseudo-class. - /// - /// TODO(emilio): We disallow combinators and pseudos here, so we - /// should use SimpleSelector instead - MozAny(ThinBoxedSlice<Selector<SelectorImpl>>), /// The non-standard `:-moz-locale-dir` pseudo-class. MozLocaleDir(Direction), } @@ -90,17 +82,6 @@ impl ToCss for NonTSPseudoClass { dir.to_css(&mut CssWriter::new(dest))?; return dest.write_char(')') }, - NonTSPseudoClass::MozAny(ref selectors) => { - dest.write_str(":-moz-any(")?; - let mut iter = selectors.iter(); - let first = iter.next().expect(":-moz-any must have at least 1 selector"); - first.to_css(dest)?; - for selector in iter { - dest.write_str(", ")?; - selector.to_css(dest)?; - } - return dest.write_char(')') - } } } } @@ -145,8 +126,7 @@ impl NonTSPseudoClass { $(NonTSPseudoClass::$name => check_flag!($flags),)* NonTSPseudoClass::MozLocaleDir(_) | NonTSPseudoClass::Lang(_) | - NonTSPseudoClass::Dir(_) | - NonTSPseudoClass::MozAny(_) => false, + NonTSPseudoClass::Dir(_) => false, } } } @@ -181,8 +161,7 @@ impl NonTSPseudoClass { $(NonTSPseudoClass::$name => flag!($state),)* NonTSPseudoClass::Dir(..) | NonTSPseudoClass::MozLocaleDir(..) | - NonTSPseudoClass::Lang(..) | - NonTSPseudoClass::MozAny(..) => ElementState::empty(), + NonTSPseudoClass::Lang(..) => ElementState::empty(), } } } @@ -202,12 +181,7 @@ impl NonTSPseudoClass { /// revalidation. pub fn needs_cache_revalidation(&self) -> bool { self.state_flag().is_empty() && - !matches!( - *self, - // :-moz-any is handled by the revalidation visitor walking - // the things inside it; it does not need to cause - // revalidation on its own. - NonTSPseudoClass::MozAny(_) | + !matches!(*self, // :dir() depends on state only, but doesn't use state_flag // because its semantics don't quite match. Nevertheless, it // doesn't need cache revalidation, because we already compare @@ -251,21 +225,6 @@ impl ::selectors::parser::NonTSPseudoClass for NonTSPseudoClass { NonTSPseudoClass::Hover | NonTSPseudoClass::Active | NonTSPseudoClass::Focus ) } - - 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. @@ -359,8 +318,7 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> { #[inline] fn is_is_alias(&self, function: &str) -> bool { - static_prefs::pref!("layout.css.moz-any-is-is.enabled") && - function.eq_ignore_ascii_case("-moz-any") + function.eq_ignore_ascii_case("-moz-any") } fn parse_non_ts_pseudo_class( @@ -396,14 +354,6 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> { "dir" => { NonTSPseudoClass::Dir(Direction::parse(parser)?) }, - "-moz-any" => { - NonTSPseudoClass::MozAny( - selector_parser::parse_compound_selector_list( - self, - parser, - )?.into() - ) - }, _ => return Err(parser.new_custom_error( SelectorParseErrorKind::UnsupportedPseudoClassOrElement(name.clone()) )) diff --git a/components/style/gecko/wrapper.rs b/components/style/gecko/wrapper.rs index 0e0486133a9..397e6e491c9 100644 --- a/components/style/gecko/wrapper.rs +++ b/components/style/gecko/wrapper.rs @@ -2136,10 +2136,6 @@ impl<'le> ::selectors::Element for GeckoElement<'le> { self.document_state().contains(state_bit) }, NonTSPseudoClass::MozPlaceholder => false, - NonTSPseudoClass::MozAny(ref sels) => context.nest(|context| { - sels.iter() - .any(|s| matches_complex_selector(s.iter(), self, context, flags_setter)) - }), NonTSPseudoClass::Lang(ref lang_arg) => self.match_element_lang(None, lang_arg), NonTSPseudoClass::MozLocaleDir(ref dir) => { let state_bit = DocumentState::NS_DOCUMENT_STATE_RTL_LOCALE; diff --git a/components/style/invalidation/element/element_wrapper.rs b/components/style/invalidation/element/element_wrapper.rs index 953c07f46c7..d79e1402228 100644 --- a/components/style/invalidation/element/element_wrapper.rs +++ b/components/style/invalidation/element/element_wrapper.rs @@ -178,16 +178,6 @@ where // Some pseudo-classes need special handling to evaluate them against // the snapshot. match *pseudo_class { - #[cfg(feature = "gecko")] - NonTSPseudoClass::MozAny(ref selectors) => { - use selectors::matching::matches_complex_selector; - return context.nest(|context| { - selectors - .iter() - .any(|s| matches_complex_selector(s.iter(), self, context, _setter)) - }); - }, - // :dir is implemented in terms of state flags, but which state flag // it maps to depends on the argument to :dir. That means we can't // just add its state flags to the NonTSPseudoClass, because if we |