瀏覽代碼

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
> <CDO-token> and <CDC-token>.
- https://www.w3.org/TR/css-syntax-3/#ref-for-parse-a-list-of-rules
Sam Atkins 3 年之前
父節點
當前提交
12a787ef8a
共有 2 個文件被更改,包括 3 次插入3 次删除
  1. 2 2
      Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp
  2. 1 1
      Userland/Libraries/LibWeb/CSS/Parser/Parser.h

+ 2 - 2
Userland/Libraries/LibWeb/CSS/Parser/Parser.cpp

@@ -2134,7 +2134,7 @@ RefPtr<CSSRule> Parser::convert_to_rule(NonnullRefPtr<StyleRule> 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<CSSRule> child_rules;
             for (auto& raw_rule : parser_rules) {
                 if (auto child_rule = convert_to_rule(raw_rule))
@@ -2158,7 +2158,7 @@ RefPtr<CSSRule> Parser::convert_to_rule(NonnullRefPtr<StyleRule> 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<CSSRule> child_rules;
             for (auto& raw_rule : parser_rules) {
                 if (auto child_rule = convert_to_rule(raw_rule))

+ 1 - 1
Userland/Libraries/LibWeb/CSS/Parser/Parser.h

@@ -139,7 +139,7 @@ private:
     template<typename T>
     ParsedStyleSheet parse_a_stylesheet(TokenStream<T>&, Optional<AK::URL> location);
 
-    // For the content of at-rules such as @media. It differs from "Parse a stylesheet" in the handling of <CDO-token> and <CDC-token>.
+    // "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 <CDO-token> and <CDC-token>.
     template<typename T>
     NonnullRefPtrVector<StyleRule> parse_a_list_of_rules(TokenStream<T>&);
     template<typename T>