diff options
author | Emilio Cobos Álvarez <emilio@crisal.io> | 2020-09-14 22:33:01 +0000 |
---|---|---|
committer | Emilio Cobos Álvarez <emilio@crisal.io> | 2021-02-26 16:44:05 +0100 |
commit | f2e765296a73c28c3583c04c2695075078f914ea (patch) | |
tree | a3cf1851b3bcd6a40de98e2c6f2cf109fab1f438 /components/style/gecko/selector_parser.rs | |
parent | 83448b68890fc625be6b4d6f13370fc3bbe58169 (diff) | |
download | servo-f2e765296a73c28c3583c04c2695075078f914ea.tar.gz servo-f2e765296a73c28c3583c04c2695075078f914ea.zip |
style: Allow :is() and :where() to have better error recovery.
Adjust is-where-parsing.html to work with both the new and old behavior,
and add a test for the new behavior.
Depends on D90049
Differential Revision: https://phabricator.services.mozilla.com/D90050
Diffstat (limited to 'components/style/gecko/selector_parser.rs')
-rw-r--r-- | components/style/gecko/selector_parser.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/components/style/gecko/selector_parser.rs b/components/style/gecko/selector_parser.rs index f5662d6871d..3c25a43fe2e 100644 --- a/components/style/gecko/selector_parser.rs +++ b/components/style/gecko/selector_parser.rs @@ -14,7 +14,7 @@ use crate::string_cache::{Atom, Namespace, WeakAtom, WeakNamespace}; use crate::values::serialize_atom_identifier; use cssparser::{BasicParseError, BasicParseErrorKind, Parser}; use cssparser::{CowRcStr, SourceLocation, ToCss, Token}; -use selectors::parser::SelectorParseErrorKind; +use selectors::parser::{SelectorParseErrorKind, ParseErrorRecovery}; use selectors::parser::{self as selector_parser, Selector}; use selectors::visitor::SelectorVisitor; use selectors::SelectorList; @@ -342,6 +342,15 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> { } #[inline] + fn is_and_where_error_recovery(&self) -> ParseErrorRecovery { + if static_prefs::pref!("layout.css.is-and-where-better-error-recovery.enabled") { + ParseErrorRecovery::IgnoreInvalidSelector + } else { + ParseErrorRecovery::DiscardList + } + } + + #[inline] fn parse_part(&self) -> bool { true } |