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

@ -33,7 +33,7 @@ GC::Ref<CSSStyleSheet> CSSStyleSheet::create(JS::Realm& realm, CSSRuleList& rule
WebIDL::ExceptionOr<GC::Ref<CSSStyleSheet>> CSSStyleSheet::construct_impl(JS::Realm& realm, Optional<CSSStyleSheetInit> const& options)
{
// 1. Construct a new CSSStyleSheet object sheet.
auto sheet = create(realm, CSSRuleList::create_empty(realm), CSS::MediaList::create(realm, {}), {});
auto sheet = create(realm, CSSRuleList::create(realm), CSS::MediaList::create(realm, {}), {});
// 2. Set sheets location to the base URL of the associated Document for the current principal global object.
auto associated_document = as<HTML::Window>(HTML::current_principal_global_object()).document();