From 12a787ef8aab556232d183f4f2fbc27b8874b2ca Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Wed, 30 Mar 2022 11:36:38 +0100 Subject: [PATCH] LibWeb: Use parse_a_list_of_rules() for `@media` and `@supports` From the spec: > "Parse a list of rules" is intended for the content of at-rules such > as @media. It differs from "Parse a stylesheet" in the handling of > and . - https://www.w3.org/TR/css-syntax-3/#ref-for-parse-a-list-of-rules --- Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp | 4 ++-- Userland/Libraries/LibWeb/CSS/Parser/Parser.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp index e5c5d788d8..78a50680eb 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp @@ -2134,7 +2134,7 @@ RefPtr Parser::convert_to_rule(NonnullRefPtr rule) return {}; auto child_tokens = TokenStream { rule->block()->values() }; - auto parser_rules = consume_a_list_of_rules(child_tokens, TopLevel::No); + auto parser_rules = parse_a_list_of_rules(child_tokens); NonnullRefPtrVector child_rules; for (auto& raw_rule : parser_rules) { if (auto child_rule = convert_to_rule(raw_rule)) @@ -2158,7 +2158,7 @@ RefPtr Parser::convert_to_rule(NonnullRefPtr rule) if (!rule->block()) return {}; auto child_tokens = TokenStream { rule->block()->values() }; - auto parser_rules = consume_a_list_of_rules(child_tokens, TopLevel::No); + auto parser_rules = parse_a_list_of_rules(child_tokens); NonnullRefPtrVector child_rules; for (auto& raw_rule : parser_rules) { if (auto child_rule = convert_to_rule(raw_rule)) diff --git a/Userland/Libraries/LibWeb/CSS/Parser/Parser.h b/Userland/Libraries/LibWeb/CSS/Parser/Parser.h index 5f37f05e4b..cea43aae45 100644 --- a/Userland/Libraries/LibWeb/CSS/Parser/Parser.h +++ b/Userland/Libraries/LibWeb/CSS/Parser/Parser.h @@ -139,7 +139,7 @@ private: template ParsedStyleSheet parse_a_stylesheet(TokenStream&, Optional location); - // For the content of at-rules such as @media. It differs from "Parse a stylesheet" in the handling of and . + // "Parse a list of rules" is intended for the content of at-rules such as @media. It differs from "Parse a stylesheet" in the handling of and . template NonnullRefPtrVector parse_a_list_of_rules(TokenStream&); template