LibWeb/CSS: Combine the CSSRuleList constructors

This commit is contained in:
Sam Atkins 2025-04-14 16:02:29 +01:00
parent 3d1665cc80
commit 9465492edf
Notes: github-actions[bot] 2025-04-23 10:40:08 +00:00
7 changed files with 19 additions and 25 deletions

View file

@ -141,7 +141,7 @@ GC::Ref<CSS::CSSStyleSheet> Parser::parse_as_css_stylesheet(Optional<::URL::URL>
auto const& style_sheet = parse_a_stylesheet(m_token_stream, location);
// Interpret all of the resulting top-level qualified rules as style rules, defined below.
GC::RootVector<CSSRule*> rules(realm().heap());
GC::RootVector<GC::Ref<CSSRule>> rules(realm().heap());
for (auto const& raw_rule : style_sheet.rules) {
auto rule = convert_to_rule(raw_rule, Nested::No);
// If any style rule is invalid, or any at-rule is not recognized or is invalid according to its grammar or context, its a parse error.
@ -150,7 +150,7 @@ GC::Ref<CSS::CSSStyleSheet> Parser::parse_as_css_stylesheet(Optional<::URL::URL>
log_parse_error();
continue;
}
rules.append(rule);
rules.append(*rule);
}
auto rule_list = CSSRuleList::create(realm(), rules);