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:
Emilio Cobos Álvarez 2020-09-14 22:33:01 +00:00
parent 83448b6889
commit f2e765296a

View file

@ -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