mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 13:37:44 +00:00
LibWeb: Move passing of Web object prototypes out of constructors
This commit is contained in:
parent
834202aeb9
commit
af75493883
35 changed files with 157 additions and 23 deletions
|
@ -26,7 +26,7 @@ CSSRuleList* CSSRuleList::create(JS::Realm& realm, JS::MarkedVector<CSSRule*> co
|
|||
}
|
||||
|
||||
CSSRuleList::CSSRuleList(JS::Realm& realm)
|
||||
: Bindings::LegacyPlatformObject(Bindings::ensure_web_prototype<Bindings::CSSRuleListPrototype>(realm, "CSSRuleList"))
|
||||
: Bindings::LegacyPlatformObject(realm)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,12 @@ CSSRuleList* CSSRuleList::create_empty(JS::Realm& realm)
|
|||
return realm.heap().allocate<CSSRuleList>(realm, realm);
|
||||
}
|
||||
|
||||
void CSSRuleList::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSRuleListPrototype>(realm, "CSSRuleList"));
|
||||
}
|
||||
|
||||
void CSSRuleList::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
|
|
|
@ -66,6 +66,7 @@ public:
|
|||
private:
|
||||
explicit CSSRuleList(JS::Realm&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
Vector<CSSRule&> m_rules;
|
||||
|
|
|
@ -18,11 +18,17 @@ MediaList* MediaList::create(JS::Realm& realm, NonnullRefPtrVector<MediaQuery>&&
|
|||
}
|
||||
|
||||
MediaList::MediaList(JS::Realm& realm, NonnullRefPtrVector<MediaQuery>&& media)
|
||||
: Bindings::LegacyPlatformObject(Bindings::ensure_web_prototype<Bindings::MediaListPrototype>(realm, "MediaList"))
|
||||
: Bindings::LegacyPlatformObject(realm)
|
||||
, m_media(move(media))
|
||||
{
|
||||
}
|
||||
|
||||
void MediaList::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::MediaListPrototype>(realm, "MediaList"));
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/cssom-1/#dom-medialist-mediatext
|
||||
DeprecatedString MediaList::media_text() const
|
||||
{
|
||||
|
|
|
@ -39,6 +39,8 @@ public:
|
|||
private:
|
||||
MediaList(JS::Realm&, NonnullRefPtrVector<MediaQuery>&&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
|
||||
NonnullRefPtrVector<MediaQuery> m_media;
|
||||
};
|
||||
|
||||
|
|
|
@ -52,11 +52,17 @@ StyleSheetList* StyleSheetList::create(DOM::Document& document)
|
|||
}
|
||||
|
||||
StyleSheetList::StyleSheetList(DOM::Document& document)
|
||||
: Bindings::LegacyPlatformObject(Bindings::ensure_web_prototype<Bindings::StyleSheetListPrototype>(document.realm(), "StyleSheetList"))
|
||||
: Bindings::LegacyPlatformObject(document.realm())
|
||||
, m_document(document)
|
||||
{
|
||||
}
|
||||
|
||||
void StyleSheetList::initialize(JS::Realm& realm)
|
||||
{
|
||||
Base::initialize(realm);
|
||||
set_prototype(&Bindings::ensure_web_prototype<Bindings::StyleSheetListPrototype>(realm, "StyleSheetList"));
|
||||
}
|
||||
|
||||
void StyleSheetList::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
|
|
|
@ -41,6 +41,7 @@ public:
|
|||
private:
|
||||
explicit StyleSheetList(DOM::Document&);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
|
||||
void sort_sheets();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue