summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp18
-rw-r--r--Userland/Libraries/LibWeb/CSS/Parser/Parser.h1
2 files changed, 17 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
index e634822f8a..a8c6ff4d39 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
+++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
@@ -491,6 +491,8 @@ Result<Selector::SimpleSelector, Parser::SelectorParsingResult> Parser::parse_si
}
auto pseudo_name = name_token.token().ident();
+ if (has_ignored_vendor_prefix(pseudo_name))
+ return SelectorParsingResult::IncludesIgnoredVendorPrefix;
if (pseudo_name.equals_ignoring_case("after")) {
simple_selector.pseudo_element = Selector::SimpleSelector::PseudoElement::After;
@@ -518,6 +520,9 @@ Result<Selector::SimpleSelector, Parser::SelectorParsingResult> Parser::parse_si
if (pseudo_class_token.is(Token::Type::Ident)) {
auto pseudo_name = pseudo_class_token.token().ident();
+ if (has_ignored_vendor_prefix(pseudo_name))
+ return SelectorParsingResult::IncludesIgnoredVendorPrefix;
+
if (pseudo_name.equals_ignoring_case("active")) {
simple_selector.pseudo_class.type = Selector::SimpleSelector::PseudoClass::Type::Active;
} else if (pseudo_name.equals_ignoring_case("checked")) {
@@ -1223,8 +1228,17 @@ RefPtr<CSSRule> Parser::convert_to_rule(NonnullRefPtr<StyleRule> rule)
} else {
auto prelude_stream = TokenStream(rule->m_prelude);
auto selectors = parse_a_selector(prelude_stream);
- if (selectors.is_error() || selectors.value().is_empty()) {
- dbgln("CSSParser: style rule selectors invalid; discarding.");
+
+ if (selectors.is_error()) {
+ if (selectors.error() != SelectorParsingResult::IncludesIgnoredVendorPrefix) {
+ dbgln("CSSParser: style rule selectors invalid; discarding.");
+ prelude_stream.dump_all_tokens();
+ }
+ return {};
+ }
+
+ if (selectors.value().is_empty()) {
+ dbgln("CSSParser: empty selector; discarding.");
prelude_stream.dump_all_tokens();
return {};
}
diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.h b/Userland/Libraries/LibWeb/CSS/Parser/Parser.h
index bad9bd0a2c..50a344ce4d 100644
--- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.h
+++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.h
@@ -102,6 +102,7 @@ public:
private:
enum class SelectorParsingResult {
Done,
+ IncludesIgnoredVendorPrefix,
SyntaxError,
};