зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1682174 - Remove layout.css.moz-any-is-is.enabled. r=boris
We shipped this, let's remove the MozAny code. Differential Revision: https://phabricator.services.mozilla.com/D99607
This commit is contained in:
Родитель
3424a95ee0
Коммит
076ee57756
|
@ -1245,20 +1245,17 @@ function runTests() {
|
|||
|
||||
// :-moz-any()
|
||||
let parseable_if_any_is_is_and_has_better_error_recovery =
|
||||
SpecialPowers.getBoolPref("layout.css.moz-any-is-is.enabled") &&
|
||||
SpecialPowers.getBoolPref("layout.css.is-and-where-better-error-recovery.enabled")
|
||||
? test_parseable : test_balanced_unparseable;
|
||||
parseable_if_any_is_is_and_has_better_error_recovery(":-moz-any()");
|
||||
parseable_if_any_is_is_and_has_better_error_recovery(":-moz-any('foo')");
|
||||
let parseable_if_any_is_is = SpecialPowers.getBoolPref("layout.css.moz-any-is-is.enabled")
|
||||
? test_parseable : test_balanced_unparseable;
|
||||
parseable_if_any_is_is(":-moz-any(div p)");
|
||||
parseable_if_any_is_is(":-moz-any(div ~ p)");
|
||||
parseable_if_any_is_is(":-moz-any(div~p)");
|
||||
parseable_if_any_is_is(":-moz-any(div + p)");
|
||||
parseable_if_any_is_is(":-moz-any(div+p)");
|
||||
parseable_if_any_is_is(":-moz-any(div > p)");
|
||||
parseable_if_any_is_is(":-moz-any(div>p)");
|
||||
test_parseable(":-moz-any(div p)");
|
||||
test_parseable(":-moz-any(div ~ p)");
|
||||
test_parseable(":-moz-any(div~p)");
|
||||
test_parseable(":-moz-any(div + p)");
|
||||
test_parseable(":-moz-any(div+p)");
|
||||
test_parseable(":-moz-any(div > p)");
|
||||
test_parseable(":-moz-any(div>p)");
|
||||
test_parseable(":-moz-any(div, p)");
|
||||
test_parseable(":-moz-any( div , p )");
|
||||
test_parseable(":-moz-any(div,p)");
|
||||
|
|
|
@ -6015,13 +6015,6 @@
|
|||
mirror: always
|
||||
rust: true
|
||||
|
||||
# Whether :-moz-any is an alias of the :is selector.
|
||||
- name: layout.css.moz-any-is-is.enabled
|
||||
type: RelaxedAtomicBool
|
||||
value: true
|
||||
mirror: always
|
||||
rust: true
|
||||
|
||||
# Whether the `no-preference` value for `prefers-color-scheme` is parsed.
|
||||
#
|
||||
# It never matches regardless.
|
||||
|
|
|
@ -416,22 +416,6 @@ where
|
|||
)
|
||||
}
|
||||
|
||||
/// Parse a comma separated list of compound selectors.
|
||||
pub fn parse_compound_selector_list<'i, 't, P, Impl>(
|
||||
parser: &P,
|
||||
input: &mut CssParser<'i, 't>,
|
||||
) -> Result<Box<[Selector<Impl>]>, ParseError<'i, P::Error>>
|
||||
where
|
||||
P: Parser<'i, Impl = Impl>,
|
||||
Impl: SelectorImpl,
|
||||
{
|
||||
input
|
||||
.parse_comma_separated(|input| {
|
||||
parse_inner_compound_selector(parser, input, SelectorParsingState::empty())
|
||||
})
|
||||
.map(|selectors| selectors.into_boxed_slice())
|
||||
}
|
||||
|
||||
/// Ancestor hashes for the bloom filter. We precompute these and store them
|
||||
/// inline with selectors to optimize cache performance during matching.
|
||||
/// This matters a lot.
|
||||
|
|
|
@ -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::{self as selector_parser, Selector};
|
||||
use selectors::parser::{ParseErrorRecovery, SelectorParseErrorKind};
|
||||
use selectors::visitor::SelectorVisitor;
|
||||
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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -203,10 +182,6 @@ impl NonTSPseudoClass {
|
|||
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(_) |
|
||||
// :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
|
||||
|
@ -250,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.
|
||||
|
@ -358,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(
|
||||
|
@ -395,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())
|
||||
))
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче