mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
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
This commit is contained in:
parent
83448b6889
commit
f2e765296a
1 changed files with 10 additions and 1 deletions
|
@ -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;
|
||||
|
@ -341,6 +341,15 @@ impl<'a, 'i> ::selectors::Parser<'i> for SelectorParser<'a> {
|
|||
true
|
||||
}
|
||||
|
||||
#[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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue