mirror of
https://github.com/servo/servo.git
synced 2025-08-05 21:50:18 +01:00
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
This commit is contained in:
parent
72a0dbacc7
commit
a3f84f85e3
3 changed files with 5 additions and 69 deletions
|
@ -14,13 +14,10 @@ use crate::string_cache::{Atom, Namespace, WeakAtom, WeakNamespace};
|
||||||
use crate::values::{AtomIdent, AtomString};
|
use crate::values::{AtomIdent, AtomString};
|
||||||
use cssparser::{BasicParseError, BasicParseErrorKind, Parser};
|
use cssparser::{BasicParseError, BasicParseErrorKind, Parser};
|
||||||
use cssparser::{CowRcStr, SourceLocation, ToCss, Token};
|
use cssparser::{CowRcStr, SourceLocation, ToCss, Token};
|
||||||
use selectors::parser::{SelectorParseErrorKind, ParseErrorRecovery};
|
use selectors::parser::{ParseErrorRecovery, SelectorParseErrorKind};
|
||||||
use selectors::parser::{self as selector_parser, Selector};
|
|
||||||
use selectors::visitor::SelectorVisitor;
|
|
||||||
use selectors::SelectorList;
|
use selectors::SelectorList;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss as ToCss_};
|
use style_traits::{CssWriter, ParseError, StyleParseErrorKind, ToCss as ToCss_};
|
||||||
use thin_slice::ThinBoxedSlice;
|
|
||||||
|
|
||||||
pub use crate::gecko::pseudo_element::{
|
pub use crate::gecko::pseudo_element::{
|
||||||
PseudoElement, EAGER_PSEUDOS, EAGER_PSEUDO_COUNT, PSEUDO_COUNT,
|
PseudoElement, EAGER_PSEUDOS, EAGER_PSEUDO_COUNT, PSEUDO_COUNT,
|
||||||
|
@ -54,11 +51,6 @@ macro_rules! pseudo_class_name {
|
||||||
Lang(Lang),
|
Lang(Lang),
|
||||||
/// The `:dir` pseudo-class.
|
/// The `:dir` pseudo-class.
|
||||||
Dir(Direction),
|
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.
|
/// The non-standard `:-moz-locale-dir` pseudo-class.
|
||||||
MozLocaleDir(Direction),
|
MozLocaleDir(Direction),
|
||||||
}
|
}
|
||||||
|
@ -90,17 +82,6 @@ impl ToCss for NonTSPseudoClass {
|
||||||
dir.to_css(&mut CssWriter::new(dest))?;
|
dir.to_css(&mut CssWriter::new(dest))?;
|
||||||
return dest.write_char(')')
|
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::$name => check_flag!($flags),)*
|
||||||
NonTSPseudoClass::MozLocaleDir(_) |
|
NonTSPseudoClass::MozLocaleDir(_) |
|
||||||
NonTSPseudoClass::Lang(_) |
|
NonTSPseudoClass::Lang(_) |
|
||||||
NonTSPseudoClass::Dir(_) |
|
NonTSPseudoClass::Dir(_) => false,
|
||||||
NonTSPseudoClass::MozAny(_) => false,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -181,8 +161,7 @@ impl NonTSPseudoClass {
|
||||||
$(NonTSPseudoClass::$name => flag!($state),)*
|
$(NonTSPseudoClass::$name => flag!($state),)*
|
||||||
NonTSPseudoClass::Dir(..) |
|
NonTSPseudoClass::Dir(..) |
|
||||||
NonTSPseudoClass::MozLocaleDir(..) |
|
NonTSPseudoClass::MozLocaleDir(..) |
|
||||||
NonTSPseudoClass::Lang(..) |
|
NonTSPseudoClass::Lang(..) => ElementState::empty(),
|
||||||
NonTSPseudoClass::MozAny(..) => ElementState::empty(),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -202,12 +181,7 @@ impl NonTSPseudoClass {
|
||||||
/// revalidation.
|
/// revalidation.
|
||||||
pub fn needs_cache_revalidation(&self) -> bool {
|
pub fn needs_cache_revalidation(&self) -> bool {
|
||||||
self.state_flag().is_empty() &&
|
self.state_flag().is_empty() &&
|
||||||
!matches!(
|
!matches!(*self,
|
||||||
*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(_) |
|
|
||||||
// :dir() depends on state only, but doesn't use state_flag
|
// :dir() depends on state only, but doesn't use state_flag
|
||||||
// because its semantics don't quite match. Nevertheless, it
|
// because its semantics don't quite match. Nevertheless, it
|
||||||
// doesn't need cache revalidation, because we already compare
|
// 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
|
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.
|
/// The dummy struct we use to implement our selector parsing.
|
||||||
|
@ -359,7 +318,6 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn is_is_alias(&self, function: &str) -> bool {
|
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")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -396,14 +354,6 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
|
||||||
"dir" => {
|
"dir" => {
|
||||||
NonTSPseudoClass::Dir(Direction::parse(parser)?)
|
NonTSPseudoClass::Dir(Direction::parse(parser)?)
|
||||||
},
|
},
|
||||||
"-moz-any" => {
|
|
||||||
NonTSPseudoClass::MozAny(
|
|
||||||
selector_parser::parse_compound_selector_list(
|
|
||||||
self,
|
|
||||||
parser,
|
|
||||||
)?.into()
|
|
||||||
)
|
|
||||||
},
|
|
||||||
_ => return Err(parser.new_custom_error(
|
_ => return Err(parser.new_custom_error(
|
||||||
SelectorParseErrorKind::UnsupportedPseudoClassOrElement(name.clone())
|
SelectorParseErrorKind::UnsupportedPseudoClassOrElement(name.clone())
|
||||||
))
|
))
|
||||||
|
|
|
@ -2136,10 +2136,6 @@ impl<'le> ::selectors::Element for GeckoElement<'le> {
|
||||||
self.document_state().contains(state_bit)
|
self.document_state().contains(state_bit)
|
||||||
},
|
},
|
||||||
NonTSPseudoClass::MozPlaceholder => false,
|
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::Lang(ref lang_arg) => self.match_element_lang(None, lang_arg),
|
||||||
NonTSPseudoClass::MozLocaleDir(ref dir) => {
|
NonTSPseudoClass::MozLocaleDir(ref dir) => {
|
||||||
let state_bit = DocumentState::NS_DOCUMENT_STATE_RTL_LOCALE;
|
let state_bit = DocumentState::NS_DOCUMENT_STATE_RTL_LOCALE;
|
||||||
|
|
|
@ -178,16 +178,6 @@ where
|
||||||
// Some pseudo-classes need special handling to evaluate them against
|
// Some pseudo-classes need special handling to evaluate them against
|
||||||
// the snapshot.
|
// the snapshot.
|
||||||
match *pseudo_class {
|
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
|
// :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
|
// 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
|
// just add its state flags to the NonTSPseudoClass, because if we
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue