mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:17:45 +00:00
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
This commit is contained in:
parent
7a225a380c
commit
12a787ef8a
2 changed files with 3 additions and 3 deletions
|
@ -2134,7 +2134,7 @@ RefPtr<CSSRule> Parser::convert_to_rule(NonnullRefPtr<StyleRule> rule)
|
||||||
return {};
|
return {};
|
||||||
|
|
||||||
auto child_tokens = TokenStream { rule->block()->values() };
|
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;
|
NonnullRefPtrVector<CSSRule> child_rules;
|
||||||
for (auto& raw_rule : parser_rules) {
|
for (auto& raw_rule : parser_rules) {
|
||||||
if (auto child_rule = convert_to_rule(raw_rule))
|
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())
|
if (!rule->block())
|
||||||
return {};
|
return {};
|
||||||
auto child_tokens = TokenStream { rule->block()->values() };
|
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;
|
NonnullRefPtrVector<CSSRule> child_rules;
|
||||||
for (auto& raw_rule : parser_rules) {
|
for (auto& raw_rule : parser_rules) {
|
||||||
if (auto child_rule = convert_to_rule(raw_rule))
|
if (auto child_rule = convert_to_rule(raw_rule))
|
||||||
|
|
|
@ -139,7 +139,7 @@ private:
|
||||||
template<typename T>
|
template<typename T>
|
||||||
ParsedStyleSheet parse_a_stylesheet(TokenStream<T>&, Optional<AK::URL> location);
|
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>
|
template<typename T>
|
||||||
NonnullRefPtrVector<StyleRule> parse_a_list_of_rules(TokenStream<T>&);
|
NonnullRefPtrVector<StyleRule> parse_a_list_of_rules(TokenStream<T>&);
|
||||||
template<typename T>
|
template<typename T>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue