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

@ -22,11 +22,11 @@ namespace Web::CSS {
GC_DEFINE_ALLOCATOR(CSSRuleList);
GC::Ref<CSSRuleList> CSSRuleList::create(JS::Realm& realm, GC::RootVector<CSSRule*> const& rules)
GC::Ref<CSSRuleList> CSSRuleList::create(JS::Realm& realm, ReadonlySpan<GC::Ref<CSSRule>> rules)
{
auto rule_list = realm.create<CSSRuleList>(realm);
for (auto* rule : rules)
rule_list->m_rules.append(*rule);
for (auto rule : rules)
rule_list->m_rules.append(rule);
return rule_list;
}
@ -36,11 +36,6 @@ CSSRuleList::CSSRuleList(JS::Realm& realm)
m_legacy_platform_object_flags = LegacyPlatformObjectFlags { .supports_indexed_properties = 1 };
}
GC::Ref<CSSRuleList> CSSRuleList::create_empty(JS::Realm& realm)
{
return realm.create<CSSRuleList>(realm);
}
void CSSRuleList::initialize(JS::Realm& realm)
{
WEB_SET_PROTOTYPE_FOR_INTERFACE(CSSRuleList);