diff options
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML')
180 files changed, 706 insertions, 99 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/CanvasGradient.cpp b/Userland/Libraries/LibWeb/HTML/CanvasGradient.cpp index e1468820b6..e704ceebf2 100644 --- a/Userland/Libraries/LibWeb/HTML/CanvasGradient.cpp +++ b/Userland/Libraries/LibWeb/HTML/CanvasGradient.cpp @@ -43,11 +43,16 @@ CanvasGradient::CanvasGradient(JS::Realm& realm, Type type) : PlatformObject(realm) , m_type(type) { - set_prototype(&Bindings::cached_web_prototype(realm, "CanvasGradient")); } CanvasGradient::~CanvasGradient() = default; +void CanvasGradient::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::CanvasGradientPrototype>(realm, "CanvasGradient")); +} + // https://html.spec.whatwg.org/multipage/canvas.html#dom-canvasgradient-addcolorstop WebIDL::ExceptionOr<void> CanvasGradient::add_color_stop(double offset, DeprecatedString const& color) { diff --git a/Userland/Libraries/LibWeb/HTML/CanvasGradient.h b/Userland/Libraries/LibWeb/HTML/CanvasGradient.h index 72aad2570d..92f2c1f551 100644 --- a/Userland/Libraries/LibWeb/HTML/CanvasGradient.h +++ b/Userland/Libraries/LibWeb/HTML/CanvasGradient.h @@ -32,6 +32,8 @@ public: private: CanvasGradient(JS::Realm&, Type); + virtual void initialize(JS::Realm&) override; + Type m_type {}; struct ColorStop { diff --git a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp index 39ac26198f..2b7a30705f 100644 --- a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp +++ b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp @@ -33,11 +33,16 @@ CanvasRenderingContext2D::CanvasRenderingContext2D(JS::Realm& realm, HTMLCanvasE , CanvasPath(static_cast<Bindings::PlatformObject&>(*this)) , m_element(element) { - set_prototype(&Bindings::cached_web_prototype(realm, "CanvasRenderingContext2D")); } CanvasRenderingContext2D::~CanvasRenderingContext2D() = default; +void CanvasRenderingContext2D::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::CanvasRenderingContext2DPrototype>(realm, "CanvasRenderingContext2D")); +} + void CanvasRenderingContext2D::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h index 995517eb9e..66fe651176 100644 --- a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h +++ b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.h @@ -86,6 +86,7 @@ public: private: explicit CanvasRenderingContext2D(JS::Realm&, HTMLCanvasElement&); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; struct PreparedTextGlyph { diff --git a/Userland/Libraries/LibWeb/HTML/CloseEvent.cpp b/Userland/Libraries/LibWeb/HTML/CloseEvent.cpp index 1dbd77d1d1..d74105da24 100644 --- a/Userland/Libraries/LibWeb/HTML/CloseEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/CloseEvent.cpp @@ -25,9 +25,14 @@ CloseEvent::CloseEvent(JS::Realm& realm, DeprecatedFlyString const& event_name, , m_code(event_init.code) , m_reason(event_init.reason) { - set_prototype(&Bindings::cached_web_prototype(realm, "CloseEvent")); } CloseEvent::~CloseEvent() = default; +void CloseEvent::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::CloseEventPrototype>(realm, "CloseEvent")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/CloseEvent.h b/Userland/Libraries/LibWeb/HTML/CloseEvent.h index 6c94be526d..548f4d489d 100644 --- a/Userland/Libraries/LibWeb/HTML/CloseEvent.h +++ b/Userland/Libraries/LibWeb/HTML/CloseEvent.h @@ -33,6 +33,8 @@ public: private: CloseEvent(JS::Realm&, DeprecatedFlyString const& event_name, CloseEventInit const& event_init); + virtual void initialize(JS::Realm&) override; + bool m_was_clean { false }; u16 m_code { 0 }; DeprecatedString m_reason; diff --git a/Userland/Libraries/LibWeb/HTML/DOMParser.cpp b/Userland/Libraries/LibWeb/HTML/DOMParser.cpp index 987447a034..bb40b3574c 100644 --- a/Userland/Libraries/LibWeb/HTML/DOMParser.cpp +++ b/Userland/Libraries/LibWeb/HTML/DOMParser.cpp @@ -21,11 +21,16 @@ WebIDL::ExceptionOr<JS::NonnullGCPtr<DOMParser>> DOMParser::construct_impl(JS::R DOMParser::DOMParser(JS::Realm& realm) : PlatformObject(realm) { - set_prototype(&Bindings::cached_web_prototype(realm, "DOMParser")); } DOMParser::~DOMParser() = default; +void DOMParser::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::DOMParserPrototype>(realm, "DOMParser")); +} + // https://html.spec.whatwg.org/multipage/dynamic-markup-insertion.html#dom-domparser-parsefromstring JS::NonnullGCPtr<DOM::Document> DOMParser::parse_from_string(DeprecatedString const& string, Bindings::DOMParserSupportedType type) { diff --git a/Userland/Libraries/LibWeb/HTML/DOMParser.h b/Userland/Libraries/LibWeb/HTML/DOMParser.h index 58ed38f0b8..85f696e46b 100644 --- a/Userland/Libraries/LibWeb/HTML/DOMParser.h +++ b/Userland/Libraries/LibWeb/HTML/DOMParser.h @@ -27,6 +27,8 @@ public: private: explicit DOMParser(JS::Realm&); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/ErrorEvent.cpp b/Userland/Libraries/LibWeb/HTML/ErrorEvent.cpp index e557705fc7..2e83004d95 100644 --- a/Userland/Libraries/LibWeb/HTML/ErrorEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/ErrorEvent.cpp @@ -27,11 +27,16 @@ ErrorEvent::ErrorEvent(JS::Realm& realm, DeprecatedFlyString const& event_name, , m_colno(event_init.colno) , m_error(event_init.error) { - set_prototype(&Bindings::cached_web_prototype(realm, "ErrorEvent")); } ErrorEvent::~ErrorEvent() = default; +void ErrorEvent::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::ErrorEventPrototype>(realm, "ErrorEvent")); +} + void ErrorEvent::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/ErrorEvent.h b/Userland/Libraries/LibWeb/HTML/ErrorEvent.h index e4ce4ba2fd..c34b6cf430 100644 --- a/Userland/Libraries/LibWeb/HTML/ErrorEvent.h +++ b/Userland/Libraries/LibWeb/HTML/ErrorEvent.h @@ -47,6 +47,7 @@ public: private: ErrorEvent(JS::Realm&, DeprecatedFlyString const& event_name, ErrorEventInit const& event_init); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; DeprecatedString m_message { "" }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp index 6482ff09c0..8a6956f3c6 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.cpp @@ -13,8 +13,6 @@ namespace Web::HTML { HTMLAnchorElement::HTMLAnchorElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLAnchorElement")); - activation_behavior = [this](auto const& event) { run_activation_behavior(event); }; @@ -22,6 +20,12 @@ HTMLAnchorElement::HTMLAnchorElement(DOM::Document& document, DOM::QualifiedName HTMLAnchorElement::~HTMLAnchorElement() = default; +void HTMLAnchorElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLAnchorElementPrototype>(realm, "HTMLAnchorElement")); +} + void HTMLAnchorElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) { HTMLElement::parse_attribute(name, value); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h index 88cba8c554..3b0805a9ab 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLAnchorElement.h @@ -32,6 +32,8 @@ public: private: HTMLAnchorElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + void run_activation_behavior(Web::DOM::Event const&); // ^DOM::Element diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp index ab3efa3f34..dea9e96b16 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.cpp @@ -13,11 +13,16 @@ namespace Web::HTML { HTMLAreaElement::HTMLAreaElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLAreaElement")); } HTMLAreaElement::~HTMLAreaElement() = default; +void HTMLAreaElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLAreaElementPrototype>(realm, "HTMLAreaElement")); +} + void HTMLAreaElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) { HTMLElement::parse_attribute(name, value); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h index 4140fdea31..f38a79f846 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLAreaElement.h @@ -23,6 +23,8 @@ public: private: HTMLAreaElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + // ^DOM::Element virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override; virtual i32 default_tab_index_value() const override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.cpp index 86bd83230d..f480581aa2 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.cpp @@ -12,8 +12,14 @@ namespace Web::HTML { HTMLAudioElement::HTMLAudioElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLMediaElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLAudioElement")); } HTMLAudioElement::~HTMLAudioElement() = default; + +void HTMLAudioElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLAudioElementPrototype>(realm, "HTMLAudioElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.h b/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.h index e2117f069e..4d32b7e9b3 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLAudioElement.h @@ -18,6 +18,8 @@ public: private: HTMLAudioElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp index 3dc799c88b..a13ae96957 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLBRElement.cpp @@ -13,11 +13,16 @@ namespace Web::HTML { HTMLBRElement::HTMLBRElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLBRElement")); } HTMLBRElement::~HTMLBRElement() = default; +void HTMLBRElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLBRElementPrototype>(realm, "HTMLBRElement")); +} + JS::GCPtr<Layout::Node> HTMLBRElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style) { return heap().allocate_without_realm<Layout::BreakNode>(document(), *this, move(style)); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBRElement.h b/Userland/Libraries/LibWeb/HTML/HTMLBRElement.h index d3c8af7440..f6b1cf2f7e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBRElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLBRElement.h @@ -20,6 +20,8 @@ public: private: HTMLBRElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp index 4bbbf5584c..7b515c87b1 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.cpp @@ -12,11 +12,16 @@ namespace Web::HTML { HTMLBaseElement::HTMLBaseElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLBaseElement")); } HTMLBaseElement::~HTMLBaseElement() = default; +void HTMLBaseElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLBaseElementPrototype>(realm, "HTMLBaseElement")); +} + void HTMLBaseElement::inserted() { HTMLElement::inserted(); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.h b/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.h index 3634f847d9..2a69da35ef 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLBaseElement.h @@ -28,6 +28,7 @@ public: private: HTMLBaseElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; virtual bool is_html_base_element() const override { return true; } // https://html.spec.whatwg.org/multipage/semantics.html#frozen-base-url diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp index ea1f4015e2..4edc01ca4c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.cpp @@ -15,11 +15,16 @@ namespace Web::HTML { HTMLBodyElement::HTMLBodyElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLBodyElement")); } HTMLBodyElement::~HTMLBodyElement() = default; +void HTMLBodyElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLBodyElementPrototype>(realm, "HTMLBodyElement")); +} + void HTMLBodyElement::apply_presentational_hints(CSS::StyleProperties& style) const { for_each_attribute([&](auto& name, auto& value) { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h index 1fb06052d5..fe5679114b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLBodyElement.h @@ -29,6 +29,8 @@ public: private: HTMLBodyElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + // ^HTML::GlobalEventHandlers virtual EventTarget& global_event_handlers_to_event_target(DeprecatedFlyString const& event_name) override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp index ad62b38fc6..6705b3e5fb 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.cpp @@ -13,8 +13,6 @@ namespace Web::HTML { HTMLButtonElement::HTMLButtonElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLButtonElement")); - // https://html.spec.whatwg.org/multipage/form-elements.html#the-button-element:activation-behaviour activation_behavior = [this](auto&) { // 1. If element is disabled, then return. @@ -53,6 +51,12 @@ HTMLButtonElement::HTMLButtonElement(DOM::Document& document, DOM::QualifiedName HTMLButtonElement::~HTMLButtonElement() = default; +void HTMLButtonElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLButtonElementPrototype>(realm, "HTMLButtonElement")); +} + DeprecatedString HTMLButtonElement::type() const { auto value = attribute(HTML::AttributeNames::type); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h index 82f9646fdd..86d88e5e95 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLButtonElement.h @@ -26,6 +26,8 @@ class HTMLButtonElement final public: virtual ~HTMLButtonElement() override; + virtual void initialize(JS::Realm&) override; + enum class TypeAttributeState { #define __ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTE(_, state) state, ENUMERATE_HTML_BUTTON_TYPE_ATTRIBUTES diff --git a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp index 3c4eb53e67..52090b55d5 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.cpp @@ -21,11 +21,16 @@ static constexpr auto max_canvas_area = 16384 * 16384; HTMLCanvasElement::HTMLCanvasElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLCanvasElement")); } HTMLCanvasElement::~HTMLCanvasElement() = default; +void HTMLCanvasElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLCanvasElementPrototype>(realm, "HTMLCanvasElement")); +} + void HTMLCanvasElement::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h index b9e88a7a53..51a0f11292 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLCanvasElement.h @@ -40,6 +40,7 @@ public: private: HTMLCanvasElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDListElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDListElement.cpp index 384407b89c..eed2efc709 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDListElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDListElement.cpp @@ -12,8 +12,14 @@ namespace Web::HTML { HTMLDListElement::HTMLDListElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLDListElement")); } HTMLDListElement::~HTMLDListElement() = default; + +void HTMLDListElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLDListElementPrototype>(realm, "HTMLDListElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDListElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDListElement.h index 020dc63caf..d0c1dbdd8e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDListElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLDListElement.h @@ -18,6 +18,8 @@ public: private: HTMLDListElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDataElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDataElement.cpp index 982dfd649f..0ec6a42b80 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDataElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDataElement.cpp @@ -12,8 +12,14 @@ namespace Web::HTML { HTMLDataElement::HTMLDataElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLDataElement")); } HTMLDataElement::~HTMLDataElement() = default; + +void HTMLDataElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLDataElementPrototype>(realm, "HTMLDataElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDataElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDataElement.h index 45b4e0aa34..6fd5497aa1 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDataElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLDataElement.h @@ -22,6 +22,8 @@ public: private: HTMLDataElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.cpp index 60bc4e31df..7c3f9619ca 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.cpp @@ -12,8 +12,14 @@ namespace Web::HTML { HTMLDataListElement::HTMLDataListElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLDataListElement")); } HTMLDataListElement::~HTMLDataListElement() = default; + +void HTMLDataListElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLDataListElementPrototype>(realm, "HTMLDataListElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.h index 1decc6f6a0..df60c1b2c5 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLDataListElement.h @@ -21,6 +21,8 @@ public: private: HTMLDataListElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp index 57a416647a..a6f6401ae3 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.cpp @@ -12,8 +12,14 @@ namespace Web::HTML { HTMLDetailsElement::HTMLDetailsElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLDetailsElement")); } HTMLDetailsElement::~HTMLDetailsElement() = default; + +void HTMLDetailsElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLDetailsElementPrototype>(realm, "HTMLDetailsElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.h index 11082c9ea4..46c2ce8236 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLDetailsElement.h @@ -22,6 +22,8 @@ public: private: HTMLDetailsElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.cpp index b63e78faea..f283602cc6 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.cpp @@ -12,8 +12,14 @@ namespace Web::HTML { HTMLDialogElement::HTMLDialogElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLDialogElement")); } HTMLDialogElement::~HTMLDialogElement() = default; + +void HTMLDialogElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLDialogElementPrototype>(realm, "HTMLDialogElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.h index 4dbb6fc034..89e42c47c7 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLDialogElement.h @@ -22,6 +22,8 @@ public: private: HTMLDialogElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.cpp index 3f44578d1f..7e76c9ee3c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.cpp @@ -12,8 +12,14 @@ namespace Web::HTML { HTMLDirectoryElement::HTMLDirectoryElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLDirectoryElement")); } HTMLDirectoryElement::~HTMLDirectoryElement() = default; + +void HTMLDirectoryElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLDirectoryElementPrototype>(realm, "HTMLDirectoryElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.h index d0d8cb0cc9..fd53d1dc37 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLDirectoryElement.h @@ -19,6 +19,8 @@ public: private: HTMLDirectoryElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDivElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLDivElement.cpp index 7ff717f1e0..050187c916 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDivElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLDivElement.cpp @@ -12,8 +12,14 @@ namespace Web::HTML { HTMLDivElement::HTMLDivElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLDivElement")); } HTMLDivElement::~HTMLDivElement() = default; + +void HTMLDivElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLDivElementPrototype>(realm, "HTMLDivElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLDivElement.h b/Userland/Libraries/LibWeb/HTML/HTMLDivElement.h index 064515fa9b..0d7c9172cd 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLDivElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLDivElement.h @@ -22,6 +22,8 @@ public: private: HTMLDivElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp index 35a146ac07..701699ddad 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLElement.cpp @@ -36,7 +36,6 @@ namespace Web::HTML { HTMLElement::HTMLElement(DOM::Document& document, DOM::QualifiedName qualified_name) : Element(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLElement")); } HTMLElement::~HTMLElement() = default; @@ -44,6 +43,8 @@ HTMLElement::~HTMLElement() = default; void HTMLElement::initialize(JS::Realm& realm) { Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLElementPrototype>(realm, "HTMLElement")); + m_dataset = DOMStringMap::create(*this); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.cpp index 9e9b8c2211..7ba220f5c1 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.cpp @@ -12,8 +12,14 @@ namespace Web::HTML { HTMLEmbedElement::HTMLEmbedElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLEmbedElement")); } HTMLEmbedElement::~HTMLEmbedElement() = default; + +void HTMLEmbedElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLEmbedElementPrototype>(realm, "HTMLEmbedElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.h b/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.h index ff30ccab6c..311ad16d3a 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLEmbedElement.h @@ -18,6 +18,8 @@ public: private: HTMLEmbedElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.cpp index 9df7a9e9a4..59297ca6cc 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.cpp @@ -13,11 +13,16 @@ namespace Web::HTML { HTMLFieldSetElement::HTMLFieldSetElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLFieldSetElement")); } HTMLFieldSetElement::~HTMLFieldSetElement() = default; +void HTMLFieldSetElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLFieldSetElementPrototype>(realm, "HTMLFieldSetElement")); +} + // https://html.spec.whatwg.org/multipage/form-elements.html#concept-fieldset-disabled bool HTMLFieldSetElement::is_disabled() const { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h index 6b2e3ab1fa..bf1e54c4ec 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLFieldSetElement.h @@ -40,6 +40,8 @@ public: private: HTMLFieldSetElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp index 89032edfd0..75243d89c4 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFontElement.cpp @@ -14,11 +14,16 @@ namespace Web::HTML { HTMLFontElement::HTMLFontElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLFontElement")); } HTMLFontElement::~HTMLFontElement() = default; +void HTMLFontElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLFontElementPrototype>(realm, "HTMLFontElement")); +} + void HTMLFontElement::apply_presentational_hints(CSS::StyleProperties& style) const { for_each_attribute([&](auto& name, auto& value) { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFontElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFontElement.h index 44be85a8a2..89a3b0783d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFontElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLFontElement.h @@ -20,6 +20,8 @@ public: private: HTMLFontElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp index 9149a10c77..54c13cbea7 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.cpp @@ -26,11 +26,16 @@ namespace Web::HTML { HTMLFormElement::HTMLFormElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLFormElement")); } HTMLFormElement::~HTMLFormElement() = default; +void HTMLFormElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLFormElementPrototype>(realm, "HTMLFormElement")); +} + void HTMLFormElement::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.h index 928c469d3b..df6bc49fe6 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFormElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLFormElement.h @@ -43,6 +43,7 @@ public: private: HTMLFormElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; bool m_firing_submission_events { false }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.cpp index 75597fed8d..3256104e30 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.cpp @@ -12,11 +12,16 @@ namespace Web::HTML { HTMLFrameElement::HTMLFrameElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLFrameElement")); } HTMLFrameElement::~HTMLFrameElement() = default; +void HTMLFrameElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLFrameElementPrototype>(realm, "HTMLFrameElement")); +} + // https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex i32 HTMLFrameElement::default_tab_index_value() const { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.h index de3a5cc3a8..ab36507102 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLFrameElement.h @@ -19,6 +19,9 @@ public: private: HTMLFrameElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; + // ^DOM::Element virtual i32 default_tab_index_value() const override; }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.cpp index 90af8cf910..b36b77f494 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.cpp @@ -13,11 +13,16 @@ namespace Web::HTML { HTMLFrameSetElement::HTMLFrameSetElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLFrameSetElement")); } HTMLFrameSetElement::~HTMLFrameSetElement() = default; +void HTMLFrameSetElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLFrameSetElementPrototype>(realm, "HTMLFrameSetElement")); +} + void HTMLFrameSetElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) { HTMLElement::parse_attribute(name, value); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.h b/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.h index 0a3ef76f58..24a4c295c9 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLFrameSetElement.h @@ -23,9 +23,9 @@ public: private: HTMLFrameSetElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; virtual void parse_attribute(DeprecatedFlyString const&, DeprecatedString const&) override; -private: // ^HTML::GlobalEventHandlers virtual EventTarget& global_event_handlers_to_event_target(DeprecatedFlyString const& event_name) override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHRElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLHRElement.cpp index 7312265757..f97a7814f8 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHRElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLHRElement.cpp @@ -12,8 +12,14 @@ namespace Web::HTML { HTMLHRElement::HTMLHRElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLHRElement")); } HTMLHRElement::~HTMLHRElement() = default; + +void HTMLHRElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLHRElementPrototype>(realm, "HTMLHRElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHRElement.h b/Userland/Libraries/LibWeb/HTML/HTMLHRElement.h index e1c4e9ef84..7176ba61b4 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHRElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLHRElement.h @@ -22,6 +22,8 @@ public: private: HTMLHRElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.cpp index e6bc7a4754..ff17191036 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.cpp @@ -12,8 +12,14 @@ namespace Web::HTML { HTMLHeadElement::HTMLHeadElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLHeadElement")); } HTMLHeadElement::~HTMLHeadElement() = default; + +void HTMLHeadElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLHeadElementPrototype>(realm, "HTMLHeadElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.h b/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.h index 921bdfd6db..6d88ab8034 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLHeadElement.h @@ -18,6 +18,8 @@ public: private: HTMLHeadElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp index b1bc336ee9..e6fe3dddfc 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.cpp @@ -12,11 +12,16 @@ namespace Web::HTML { HTMLHeadingElement::HTMLHeadingElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLHeadingElement")); } HTMLHeadingElement::~HTMLHeadingElement() = default; +void HTMLHeadingElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLHeadingElementPrototype>(realm, "HTMLHeadingElement")); +} + // https://html.spec.whatwg.org/multipage/rendering.html#tables-2 void HTMLHeadingElement::apply_presentational_hints(CSS::StyleProperties& style) const { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.h b/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.h index 892c1fcbe0..8289679077 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLHeadingElement.h @@ -29,6 +29,8 @@ public: private: HTMLHeadingElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.cpp index d8d0eeff00..f2758c9c67 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.cpp @@ -12,11 +12,16 @@ namespace Web::HTML { HTMLHtmlElement::HTMLHtmlElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLHtmlElement")); } HTMLHtmlElement::~HTMLHtmlElement() = default; +void HTMLHtmlElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLHtmlElementPrototype>(realm, "HTMLHtmlElement")); +} + bool HTMLHtmlElement::should_use_body_background_properties() const { auto background_color = layout_node()->computed_values().background_color(); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.h b/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.h index 88014cdaeb..6cc03a8f71 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.h @@ -25,6 +25,7 @@ public: private: HTMLHtmlElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; virtual bool is_html_html_element() const override { return true; } }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp index 92b760a7e2..98131a22a1 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.cpp @@ -17,11 +17,16 @@ namespace Web::HTML { HTMLIFrameElement::HTMLIFrameElement(DOM::Document& document, DOM::QualifiedName qualified_name) : BrowsingContextContainer(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLIFrameElement")); } HTMLIFrameElement::~HTMLIFrameElement() = default; +void HTMLIFrameElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLIFrameElementPrototype>(realm, "HTMLIFrameElement")); +} + JS::GCPtr<Layout::Node> HTMLIFrameElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style) { return heap().allocate_without_realm<Layout::FrameBox>(document(), *this, move(style)); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h index d10dd68e30..e0a5f897e1 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLIFrameElement.h @@ -28,6 +28,8 @@ public: private: HTMLIFrameElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + // ^DOM::Element virtual void inserted() override; virtual void removed_from(Node*) override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp index 411717ee0b..13f6da07e2 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.cpp @@ -23,8 +23,6 @@ HTMLImageElement::HTMLImageElement(DOM::Document& document, DOM::QualifiedName q : HTMLElement(document, move(qualified_name)) , m_image_loader(*this) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLImageElement")); - m_image_loader.on_load = [this] { set_needs_style_update(true); this->document().set_needs_layout(); @@ -50,6 +48,12 @@ HTMLImageElement::HTMLImageElement(DOM::Document& document, DOM::QualifiedName q HTMLImageElement::~HTMLImageElement() = default; +void HTMLImageElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLImageElementPrototype>(realm, "HTMLImageElement")); +} + void HTMLImageElement::apply_presentational_hints(CSS::StyleProperties& style) const { for_each_attribute([&](auto& name, auto& value) { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h index 94b6d8a5c5..4119f3dad6 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLImageElement.h @@ -48,6 +48,7 @@ public: private: HTMLImageElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; virtual void apply_presentational_hints(CSS::StyleProperties&) const override; void animate(); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp index 3c20012d63..ef6a08ef94 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.cpp @@ -29,8 +29,6 @@ HTMLInputElement::HTMLInputElement(DOM::Document& document, DOM::QualifiedName q : HTMLElement(document, move(qualified_name)) , m_value(DeprecatedString::empty()) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLInputElement")); - activation_behavior = [this](auto&) { // The activation behavior for input elements are these steps: @@ -43,6 +41,12 @@ HTMLInputElement::HTMLInputElement(DOM::Document& document, DOM::QualifiedName q HTMLInputElement::~HTMLInputElement() = default; +void HTMLInputElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLInputElementPrototype>(realm, "HTMLInputElement")); +} + void HTMLInputElement::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h index f9e0b369dc..3a6a863a14 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLInputElement.h @@ -134,6 +134,7 @@ private: // ^DOM::Element virtual i32 default_tab_index_value() const override; + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; static TypeAttributeState parse_type_attribute(StringView); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLIElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLIElement.cpp index 307461215f..41cf0533e6 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLIElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLLIElement.cpp @@ -12,8 +12,14 @@ namespace Web::HTML { HTMLLIElement::HTMLLIElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLLIElement")); } HTMLLIElement::~HTMLLIElement() = default; + +void HTMLLIElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLLIElementPrototype>(realm, "HTMLLIElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLIElement.h b/Userland/Libraries/LibWeb/HTML/HTMLLIElement.h index 082670302a..2e4c0baeca 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLIElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLLIElement.h @@ -22,6 +22,8 @@ public: private: HTMLLIElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp index 940d880007..6d8372bf23 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.cpp @@ -13,11 +13,16 @@ namespace Web::HTML { HTMLLabelElement::HTMLLabelElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLLabelElement")); } HTMLLabelElement::~HTMLLabelElement() = default; +void HTMLLabelElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLLabelElementPrototype>(realm, "HTMLLabelElement")); +} + JS::GCPtr<Layout::Node> HTMLLabelElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style) { return heap().allocate_without_realm<Layout::Label>(document(), this, move(style)); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.h b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.h index 7ebdd6e129..489ab4db4b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLLabelElement.h @@ -22,6 +22,8 @@ public: private: HTMLLabelElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.cpp index c1f5c4fb95..dd004bc08d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.cpp @@ -12,8 +12,14 @@ namespace Web::HTML { HTMLLegendElement::HTMLLegendElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLLegendElement")); } HTMLLegendElement::~HTMLLegendElement() = default; + +void HTMLLegendElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLLegendElementPrototype>(realm, "HTMLLegendElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.h b/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.h index 3e1d94e225..dc10820eda 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLLegendElement.h @@ -18,6 +18,8 @@ public: private: HTMLLegendElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp index e0f657d246..7787da4572 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.cpp @@ -22,11 +22,16 @@ namespace Web::HTML { HTMLLinkElement::HTMLLinkElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLLinkElement")); } HTMLLinkElement::~HTMLLinkElement() = default; +void HTMLLinkElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLLinkElementPrototype>(realm, "HTMLLinkElement")); +} + void HTMLLinkElement::inserted() { if (has_attribute(AttributeNames::disabled) && (m_relationship & Relationship::Stylesheet)) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h index 73edcfe137..bb8cdfbc34 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLLinkElement.h @@ -33,6 +33,7 @@ public: private: HTMLLinkElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; void parse_attribute(DeprecatedFlyString const&, DeprecatedString const&) override; // ^ResourceClient diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMapElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMapElement.cpp index 43c3dce152..ebcfa407b3 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMapElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMapElement.cpp @@ -12,8 +12,14 @@ namespace Web::HTML { HTMLMapElement::HTMLMapElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLMapElement")); } HTMLMapElement::~HTMLMapElement() = default; + +void HTMLMapElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLMapElementPrototype>(realm, "HTMLMapElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMapElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMapElement.h index c0afa994b1..c862ba7cc1 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMapElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLMapElement.h @@ -18,6 +18,8 @@ public: private: HTMLMapElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp index ed5b523297..194f9e9cb7 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.cpp @@ -12,11 +12,16 @@ namespace Web::HTML { HTMLMarqueeElement::HTMLMarqueeElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLMarqueeElement")); } HTMLMarqueeElement::~HTMLMarqueeElement() = default; +void HTMLMarqueeElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLMarqueeElementPrototype>(realm, "HTMLMarqueeElement")); +} + void HTMLMarqueeElement::apply_presentational_hints(CSS::StyleProperties& style) const { HTMLElement::apply_presentational_hints(style); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.h index 996c447373..3c85d41bc2 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLMarqueeElement.h @@ -19,6 +19,8 @@ public: private: HTMLMarqueeElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; virtual void apply_presentational_hints(CSS::StyleProperties&) const override; }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp index 5273e680d0..a1325ce359 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.cpp @@ -13,11 +13,16 @@ namespace Web::HTML { HTMLMediaElement::HTMLMediaElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLMediaElement")); } HTMLMediaElement::~HTMLMediaElement() = default; +void HTMLMediaElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLMediaElementPrototype>(realm, "HTMLMediaElement")); +} + // https://html.spec.whatwg.org/multipage/media.html#dom-navigator-canplaytype Bindings::CanPlayTypeResult HTMLMediaElement::can_play_type(DeprecatedString const& type) const { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h index a809226085..d1f3139bb6 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLMediaElement.h @@ -23,6 +23,8 @@ public: protected: HTMLMediaElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.cpp index 1499835d44..b4b7575005 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLMenuElement::HTMLMenuElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLMenuElement")); } HTMLMenuElement::~HTMLMenuElement() = default; +void HTMLMenuElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLMenuElementPrototype>(realm, "HTMLMenuElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.h index 7517b6a927..1577bce29f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLMenuElement.h @@ -22,6 +22,8 @@ public: private: HTMLMenuElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.cpp index 425f077fb0..b40bb5507e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLMetaElement::HTMLMetaElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLMetaElement")); } HTMLMetaElement::~HTMLMetaElement() = default; +void HTMLMetaElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLMetaElementPrototype>(realm, "HTMLMetaElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.h index 743d0042e4..bd21f42c14 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLMetaElement.h @@ -18,6 +18,8 @@ public: private: HTMLMetaElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.cpp index f299750c9d..6f8ce5e8fa 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLMeterElement::HTMLMeterElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLMeterElement")); } HTMLMeterElement::~HTMLMeterElement() = default; +void HTMLMeterElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLMeterElementPrototype>(realm, "HTMLMeterElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.h b/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.h index 9bb413df88..0c2907461b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLMeterElement.h @@ -27,6 +27,8 @@ public: private: HTMLMeterElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp index b8326ea34a..bc5a40c4c7 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLModElement.cpp @@ -13,11 +13,16 @@ namespace Web::HTML { HTMLModElement::HTMLModElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLModElement")); } HTMLModElement::~HTMLModElement() = default; +void HTMLModElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLModElementPrototype>(realm, "HTMLModElement")); +} + DeprecatedFlyString HTMLModElement::default_role() const { // https://www.w3.org/TR/html-aria/#el-del diff --git a/Userland/Libraries/LibWeb/HTML/HTMLModElement.h b/Userland/Libraries/LibWeb/HTML/HTMLModElement.h index 908f56c12f..710cf9a471 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLModElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLModElement.h @@ -21,6 +21,8 @@ public: private: HTMLModElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOListElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOListElement.cpp index 7f4b85e1c5..74de79aa2b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOListElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLOListElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLOListElement::HTMLOListElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLOListElement")); } HTMLOListElement::~HTMLOListElement() = default; +void HTMLOListElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLOListElementPrototype>(realm, "HTMLOListElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOListElement.h b/Userland/Libraries/LibWeb/HTML/HTMLOListElement.h index 81f63c1247..776fd1fb2b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOListElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLOListElement.h @@ -22,6 +22,8 @@ public: private: HTMLOListElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp index 68a1a1c87f..dbbfada928 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.cpp @@ -19,8 +19,6 @@ namespace Web::HTML { HTMLObjectElement::HTMLObjectElement(DOM::Document& document, DOM::QualifiedName qualified_name) : BrowsingContextContainer(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLObjectElement")); - // https://html.spec.whatwg.org/multipage/iframe-embed-object.html#the-object-element // Whenever one of the following conditions occur: // - the element is created, @@ -32,6 +30,12 @@ HTMLObjectElement::HTMLObjectElement(DOM::Document& document, DOM::QualifiedName HTMLObjectElement::~HTMLObjectElement() = default; +void HTMLObjectElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLObjectElementPrototype>(realm, "HTMLObjectElement")); +} + void HTMLObjectElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) { BrowsingContextContainer::parse_attribute(name, value); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h index a83ecafc4d..46567c275e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLObjectElement.h @@ -46,6 +46,8 @@ public: private: HTMLObjectElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override; bool has_ancestor_media_element_or_object_element_not_showing_fallback_content() const; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.cpp index 81cc1c0afe..77c433c961 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLOptGroupElement::HTMLOptGroupElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLOptGroupElement")); } HTMLOptGroupElement::~HTMLOptGroupElement() = default; +void HTMLOptGroupElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLOptGroupElementPrototype>(realm, "HTMLOptGroupElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.h b/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.h index d6875b1dc6..cef892b5c7 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLOptGroupElement.h @@ -22,6 +22,8 @@ public: private: HTMLOptGroupElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp index 9c2cfc224d..17027c98b5 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.cpp @@ -21,11 +21,16 @@ namespace Web::HTML { HTMLOptionElement::HTMLOptionElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLOptionElement")); } HTMLOptionElement::~HTMLOptionElement() = default; +void HTMLOptionElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLOptionElementPrototype>(realm, "HTMLOptionElement")); +} + void HTMLOptionElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) { HTMLElement::parse_attribute(name, value); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.h b/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.h index 1f0c9546ea..9633a7c85b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLOptionElement.h @@ -38,6 +38,8 @@ private: HTMLOptionElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override; void did_remove_attribute(DeprecatedFlyString const& name) override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.cpp index 4782523d10..61fd922053 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.cpp @@ -21,11 +21,16 @@ JS::NonnullGCPtr<HTMLOptionsCollection> HTMLOptionsCollection::create(DOM::Paren HTMLOptionsCollection::HTMLOptionsCollection(DOM::ParentNode& root, Function<bool(DOM::Element const&)> filter) : DOM::HTMLCollection(root, move(filter)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLOptionsCollection")); } HTMLOptionsCollection::~HTMLOptionsCollection() = default; +void HTMLOptionsCollection::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLOptionsCollectionPrototype>(realm, "HTMLOptionsCollection")); +} + // https://html.spec.whatwg.org/multipage/common-dom-interfaces.html#dom-htmloptionscollection-add WebIDL::ExceptionOr<void> HTMLOptionsCollection::add(HTMLOptionOrOptGroupElement element, Optional<HTMLElementOrElementIndex> before) { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.h b/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.h index 813b202ded..ee3d7ff5a0 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLOptionsCollection.h @@ -26,6 +26,8 @@ public: private: HTMLOptionsCollection(DOM::ParentNode& root, Function<bool(DOM::Element const&)> filter); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.cpp index a50ac4232b..99a9d89ba9 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.cpp @@ -12,11 +12,16 @@ namespace Web::HTML { HTMLOutputElement::HTMLOutputElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLOutputElement")); } HTMLOutputElement::~HTMLOutputElement() = default; +void HTMLOutputElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLOutputElementPrototype>(realm, "HTMLOutputElement")); +} + // https://html.spec.whatwg.org/multipage/form-elements.html#the-output-element:concept-form-reset-control void HTMLOutputElement::reset_algorithm() { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h index 9d46c7d8b6..bc4a574b9e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLOutputElement.h @@ -49,6 +49,8 @@ public: private: HTMLOutputElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp index f6057fea88..72a77736ef 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.cpp @@ -12,11 +12,16 @@ namespace Web::HTML { HTMLParagraphElement::HTMLParagraphElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLParagraphElement")); } HTMLParagraphElement::~HTMLParagraphElement() = default; +void HTMLParagraphElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLParagraphElementPrototype>(realm, "HTMLParagraphElement")); +} + // https://html.spec.whatwg.org/multipage/rendering.html#tables-2 void HTMLParagraphElement::apply_presentational_hints(CSS::StyleProperties& style) const { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.h b/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.h index e0572366ec..d124674dec 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLParagraphElement.h @@ -24,6 +24,8 @@ public: private: HTMLParagraphElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLParamElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLParamElement.cpp index aded0af35b..b71bdbaed9 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLParamElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLParamElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLParamElement::HTMLParamElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLParamElement")); } HTMLParamElement::~HTMLParamElement() = default; +void HTMLParamElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLParamElementPrototype>(realm, "HTMLParamElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLParamElement.h b/Userland/Libraries/LibWeb/HTML/HTMLParamElement.h index 17004cbdc0..8ae224061a 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLParamElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLParamElement.h @@ -18,6 +18,8 @@ public: private: HTMLParamElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.cpp index 31986daad6..d9e4bb99a5 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLPictureElement::HTMLPictureElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLPictureElement")); } HTMLPictureElement::~HTMLPictureElement() = default; +void HTMLPictureElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLPictureElementPrototype>(realm, "HTMLPictureElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.h b/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.h index 6aaa861419..c27e99ee34 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLPictureElement.h @@ -18,6 +18,8 @@ public: private: HTMLPictureElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp index 70e641396a..684e4e49f1 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.cpp @@ -12,11 +12,16 @@ namespace Web::HTML { HTMLPreElement::HTMLPreElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLPreElement")); } HTMLPreElement::~HTMLPreElement() = default; +void HTMLPreElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLPreElementPrototype>(realm, "HTMLPreElement")); +} + void HTMLPreElement::apply_presentational_hints(CSS::StyleProperties& style) const { HTMLElement::apply_presentational_hints(style); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLPreElement.h b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.h index bfb623ab52..d2fc64fa2f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLPreElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLPreElement.h @@ -22,6 +22,8 @@ public: private: HTMLPreElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; virtual void apply_presentational_hints(CSS::StyleProperties&) const override; }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp index d31e5e8107..cde41d2594 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.cpp @@ -17,11 +17,16 @@ namespace Web::HTML { HTMLProgressElement::HTMLProgressElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLProgressElement")); } HTMLProgressElement::~HTMLProgressElement() = default; +void HTMLProgressElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLProgressElementPrototype>(realm, "HTMLProgressElement")); +} + JS::GCPtr<Layout::Node> HTMLProgressElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style) { if (style->appearance().value_or(CSS::Appearance::Auto) == CSS::Appearance::None) diff --git a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h index 00689839f5..aa39a9f9db 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLProgressElement.h @@ -39,6 +39,8 @@ public: private: HTMLProgressElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + void progress_position_updated(); bool is_determinate() const { return has_attribute(HTML::AttributeNames::value); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.cpp index 116842758e..2547d64dd7 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.cpp @@ -14,11 +14,16 @@ namespace Web::HTML { HTMLQuoteElement::HTMLQuoteElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLQuoteElement")); } HTMLQuoteElement::~HTMLQuoteElement() = default; +void HTMLQuoteElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLQuoteElementPrototype>(realm, "HTMLQuoteElement")); +} + DeprecatedFlyString HTMLQuoteElement::default_role() const { // https://www.w3.org/TR/html-aria/#el-blockquote diff --git a/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.h b/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.h index 79748de6f3..f12877b04c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLQuoteElement.h @@ -20,6 +20,8 @@ public: private: HTMLQuoteElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp index 4a39299a27..0af9dd888d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.cpp @@ -26,11 +26,16 @@ namespace Web::HTML { HTMLScriptElement::HTMLScriptElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLScriptElement")); } HTMLScriptElement::~HTMLScriptElement() = default; +void HTMLScriptElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLScriptElementPrototype>(realm, "HTMLScriptElement")); +} + void HTMLScriptElement::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.h b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.h index b4537d6880..049e5aa994 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLScriptElement.h @@ -57,6 +57,7 @@ public: virtual void resource_did_load() override; virtual void resource_did_fail() override; + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; // https://html.spec.whatwg.org/multipage/scripting.html#prepare-the-script-element diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp index 5ed7612b83..cc5ddb6906 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.cpp @@ -16,11 +16,16 @@ namespace Web::HTML { HTMLSelectElement::HTMLSelectElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLSelectElement")); } HTMLSelectElement::~HTMLSelectElement() = default; +void HTMLSelectElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLSelectElementPrototype>(realm, "HTMLSelectElement")); +} + void HTMLSelectElement::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h index 0e1c211bda..985edd49fc 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLSelectElement.h @@ -65,6 +65,7 @@ public: private: HTMLSelectElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; // ^DOM::Element diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.cpp index 49a434777a..7a43cb4ee1 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLSlotElement::HTMLSlotElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLSlotElement")); } HTMLSlotElement::~HTMLSlotElement() = default; +void HTMLSlotElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLSlotElementPrototype>(realm, "HTMLSlotElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.h b/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.h index 8924b5847f..9f7cc04950 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLSlotElement.h @@ -18,6 +18,8 @@ public: private: HTMLSlotElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.cpp index 40f6d0141a..5031b6b25b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLSourceElement::HTMLSourceElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLSourceElement")); } HTMLSourceElement::~HTMLSourceElement() = default; +void HTMLSourceElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLSourceElementPrototype>(realm, "HTMLSourceElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.h b/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.h index 2fba7bb28d..98c98a4e05 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLSourceElement.h @@ -18,6 +18,8 @@ public: private: HTMLSourceElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.cpp index b7f41ee0c6..dd5559e20c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLSpanElement::HTMLSpanElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLSpanElement")); } HTMLSpanElement::~HTMLSpanElement() = default; +void HTMLSpanElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLSpanElementPrototype>(realm, "HTMLSpanElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.h b/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.h index 75e165fcad..20d6a7d7bd 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLSpanElement.h @@ -22,6 +22,8 @@ public: private: HTMLSpanElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp index 7624f26152..cf42ecc56a 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.cpp @@ -14,11 +14,16 @@ namespace Web::HTML { HTMLStyleElement::HTMLStyleElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLStyleElement")); } HTMLStyleElement::~HTMLStyleElement() = default; +void HTMLStyleElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLStyleElementPrototype>(realm, "HTMLStyleElement")); +} + void HTMLStyleElement::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.h b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.h index 413ceb04d5..522390128b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLStyleElement.h @@ -29,6 +29,7 @@ public: private: HTMLStyleElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; // https://www.w3.org/TR/cssom/#associated-css-style-sheet diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp index 82074e21ec..25354fdb42 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.cpp @@ -12,11 +12,16 @@ namespace Web::HTML { HTMLTableCaptionElement::HTMLTableCaptionElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLTableCaptionElement")); } HTMLTableCaptionElement::~HTMLTableCaptionElement() = default; +void HTMLTableCaptionElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLTableCaptionElementPrototype>(realm, "HTMLTableCaptionElement")); +} + // https://html.spec.whatwg.org/multipage/rendering.html#tables-2 void HTMLTableCaptionElement::apply_presentational_hints(CSS::StyleProperties& style) const { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.h index 259dbb101d..94f44b41a8 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCaptionElement.h @@ -24,6 +24,8 @@ public: private: HTMLTableCaptionElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp index a97862b517..e554128132 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.cpp @@ -14,11 +14,16 @@ namespace Web::HTML { HTMLTableCellElement::HTMLTableCellElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLTableCellElement")); } HTMLTableCellElement::~HTMLTableCellElement() = default; +void HTMLTableCellElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLTableCellElementPrototype>(realm, "HTMLTableCellElement")); +} + void HTMLTableCellElement::apply_presentational_hints(CSS::StyleProperties& style) const { for_each_attribute([&](auto& name, auto& value) { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.h index c3e02ded3b..7eb0138762 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableCellElement.h @@ -26,6 +26,8 @@ public: private: HTMLTableCellElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; virtual void apply_presentational_hints(CSS::StyleProperties&) const override; }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.cpp index 4055e3bddf..06e94dd8b6 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLTableColElement::HTMLTableColElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLTableColElement")); } HTMLTableColElement::~HTMLTableColElement() = default; +void HTMLTableColElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLTableColElementPrototype>(realm, "HTMLTableColElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.h index c887819d2f..6b4a0f1da9 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableColElement.h @@ -18,6 +18,8 @@ public: private: HTMLTableColElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp index 9d78f4fd81..821d0e684f 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.cpp @@ -20,11 +20,16 @@ namespace Web::HTML { HTMLTableElement::HTMLTableElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLTableElement")); } HTMLTableElement::~HTMLTableElement() = default; +void HTMLTableElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLTableElementPrototype>(realm, "HTMLTableElement")); +} + void HTMLTableElement::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.h index 40b8eff682..5ed3f57edf 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableElement.h @@ -48,6 +48,7 @@ public: private: HTMLTableElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; virtual void apply_presentational_hints(CSS::StyleProperties&) const override; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp index aa44d76d9f..16be11e4b2 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.cpp @@ -18,11 +18,16 @@ namespace Web::HTML { HTMLTableRowElement::HTMLTableRowElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLTableRowElement")); } HTMLTableRowElement::~HTMLTableRowElement() = default; +void HTMLTableRowElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLTableRowElementPrototype>(realm, "HTMLTableRowElement")); +} + void HTMLTableRowElement::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.h index ea80fe5bc2..9d404aed0e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableRowElement.h @@ -30,6 +30,7 @@ public: private: HTMLTableRowElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::GCPtr<DOM::HTMLCollection> mutable m_cells; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp index 9c2a669692..146a0197b8 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.cpp @@ -17,11 +17,16 @@ namespace Web::HTML { HTMLTableSectionElement::HTMLTableSectionElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLTableSectionElement")); } HTMLTableSectionElement::~HTMLTableSectionElement() = default; +void HTMLTableSectionElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLTableSectionElementPrototype>(realm, "HTMLTableSectionElement")); +} + void HTMLTableSectionElement::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.h index 025ff5a874..83cfc5830e 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTableSectionElement.h @@ -30,6 +30,7 @@ public: private: HTMLTableSectionElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::GCPtr<DOM::HTMLCollection> mutable m_rows; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp index 109417fd12..9712909d70 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTemplateElement.cpp @@ -13,7 +13,6 @@ namespace Web::HTML { HTMLTemplateElement::HTMLTemplateElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLTemplateElement")); } HTMLTemplateElement::~HTMLTemplateElement() = default; @@ -21,6 +20,8 @@ HTMLTemplateElement::~HTMLTemplateElement() = default; void HTMLTemplateElement::initialize(JS::Realm& realm) { Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLTemplateElementPrototype>(realm, "HTMLTemplateElement")); + m_content = heap().allocate<DOM::DocumentFragment>(realm, m_document->appropriate_template_contents_owner_document()); m_content->set_host(this); } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp index c2347f66c4..ac1443b100 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.cpp @@ -12,11 +12,16 @@ namespace Web::HTML { HTMLTextAreaElement::HTMLTextAreaElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLTextAreaElement")); } HTMLTextAreaElement::~HTMLTextAreaElement() = default; +void HTMLTextAreaElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLTextAreaElementPrototype>(realm, "HTMLTextAreaElement")); +} + // https://html.spec.whatwg.org/multipage/interaction.html#dom-tabindex i32 HTMLTextAreaElement::default_tab_index_value() const { diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h index 7b5af5691f..86805985ab 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTextAreaElement.h @@ -57,6 +57,8 @@ public: private: HTMLTextAreaElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + // ^DOM::Element virtual i32 default_tab_index_value() const override; }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.cpp index 27a06c1a6c..77692b083d 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.cpp @@ -12,7 +12,12 @@ namespace Web::HTML { HTMLTimeElement::HTMLTimeElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLTimeElement")); +} + +void HTMLTimeElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLTimeElementPrototype>(realm, "HTMLTimeElement")); } HTMLTimeElement::~HTMLTimeElement() = default; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.h index f6962c6695..02655140f4 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTimeElement.h @@ -22,6 +22,8 @@ public: private: HTMLTimeElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.cpp index 27bcb0a15e..998a4b5b24 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.cpp @@ -13,11 +13,16 @@ namespace Web::HTML { HTMLTitleElement::HTMLTitleElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLTitleElement")); } HTMLTitleElement::~HTMLTitleElement() = default; +void HTMLTitleElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLTitleElementPrototype>(realm, "HTMLTitleElement")); +} + void HTMLTitleElement::children_changed() { HTMLElement::children_changed(); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.h index ac6dc7f163..545b24b6f3 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTitleElement.h @@ -19,6 +19,7 @@ public: private: HTMLTitleElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; virtual void children_changed() override; }; diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.cpp index e02d866cd6..286d94b73a 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLTrackElement::HTMLTrackElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLTrackElement")); } HTMLTrackElement::~HTMLTrackElement() = default; +void HTMLTrackElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLTrackElementPrototype>(realm, "HTMLTrackElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.h b/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.h index 2c8172702d..17be218974 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLTrackElement.h @@ -18,6 +18,8 @@ public: private: HTMLTrackElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLUListElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLUListElement.cpp index adc74730ce..04e1fd451c 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLUListElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLUListElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLUListElement::HTMLUListElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLUListElement")); } HTMLUListElement::~HTMLUListElement() = default; +void HTMLUListElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLUListElementPrototype>(realm, "HTMLUListElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLUListElement.h b/Userland/Libraries/LibWeb/HTML/HTMLUListElement.h index 9c7b275f5c..45e4af2754 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLUListElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLUListElement.h @@ -22,6 +22,8 @@ public: private: HTMLUListElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.cpp index aca3da01ab..ae683a1b35 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLUnknownElement::HTMLUnknownElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLUnknownElement")); } HTMLUnknownElement::~HTMLUnknownElement() = default; +void HTMLUnknownElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLUnknownElementPrototype>(realm, "HTMLUnknownElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.h b/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.h index e0bf9c64a3..9e46892771 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLUnknownElement.h @@ -18,6 +18,8 @@ public: private: HTMLUnknownElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp b/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp index 04810b30b5..eea5bfd1d5 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp +++ b/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.cpp @@ -12,9 +12,14 @@ namespace Web::HTML { HTMLVideoElement::HTMLVideoElement(DOM::Document& document, DOM::QualifiedName qualified_name) : HTMLMediaElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "HTMLVideoElement")); } HTMLVideoElement::~HTMLVideoElement() = default; +void HTMLVideoElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HTMLVideoElementPrototype>(realm, "HTMLVideoElement")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.h b/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.h index a83b90289b..0d4470a583 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLVideoElement.h @@ -18,6 +18,8 @@ public: private: HTMLVideoElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/History.cpp b/Userland/Libraries/LibWeb/HTML/History.cpp index 63deb9f798..7034c04ea5 100644 --- a/Userland/Libraries/LibWeb/HTML/History.cpp +++ b/Userland/Libraries/LibWeb/HTML/History.cpp @@ -19,11 +19,16 @@ History::History(JS::Realm& realm, DOM::Document& document) : PlatformObject(realm) , m_associated_document(document) { - set_prototype(&Bindings::cached_web_prototype(realm, "History")); } History::~History() = default; +void History::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::HistoryPrototype>(realm, "History")); +} + void History::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/History.h b/Userland/Libraries/LibWeb/HTML/History.h index b873aabdff..c20902b1fe 100644 --- a/Userland/Libraries/LibWeb/HTML/History.h +++ b/Userland/Libraries/LibWeb/HTML/History.h @@ -30,6 +30,7 @@ public: private: History(JS::Realm&, DOM::Document&); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; enum class IsPush { diff --git a/Userland/Libraries/LibWeb/HTML/ImageData.cpp b/Userland/Libraries/LibWeb/HTML/ImageData.cpp index 8f16de3eac..426385033f 100644 --- a/Userland/Libraries/LibWeb/HTML/ImageData.cpp +++ b/Userland/Libraries/LibWeb/HTML/ImageData.cpp @@ -36,11 +36,16 @@ ImageData::ImageData(JS::Realm& realm, NonnullRefPtr<Gfx::Bitmap> bitmap, JS::No , m_bitmap(move(bitmap)) , m_data(move(data)) { - set_prototype(&Bindings::cached_web_prototype(realm, "ImageData")); } ImageData::~ImageData() = default; +void ImageData::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::ImageDataPrototype>(realm, "ImageData")); +} + void ImageData::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/ImageData.h b/Userland/Libraries/LibWeb/HTML/ImageData.h index e56f026c1b..86c25ce578 100644 --- a/Userland/Libraries/LibWeb/HTML/ImageData.h +++ b/Userland/Libraries/LibWeb/HTML/ImageData.h @@ -31,6 +31,7 @@ public: private: ImageData(JS::Realm&, NonnullRefPtr<Gfx::Bitmap>, JS::NonnullGCPtr<JS::Uint8ClampedArray>); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; NonnullRefPtr<Gfx::Bitmap> m_bitmap; diff --git a/Userland/Libraries/LibWeb/HTML/MessageChannel.cpp b/Userland/Libraries/LibWeb/HTML/MessageChannel.cpp index b0c706a57a..069564c3e2 100644 --- a/Userland/Libraries/LibWeb/HTML/MessageChannel.cpp +++ b/Userland/Libraries/LibWeb/HTML/MessageChannel.cpp @@ -19,8 +19,6 @@ JS::NonnullGCPtr<MessageChannel> MessageChannel::construct_impl(JS::Realm& realm MessageChannel::MessageChannel(JS::Realm& realm) : PlatformObject(realm) { - set_prototype(&Bindings::cached_web_prototype(realm, "MessageChannel")); - // 1. Set this's port 1 to a new MessagePort in this's relevant Realm. m_port1 = MessagePort::create(realm); @@ -40,6 +38,12 @@ void MessageChannel::visit_edges(Cell::Visitor& visitor) visitor.visit(m_port2.ptr()); } +void MessageChannel::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::MessageChannelPrototype>(realm, "MessageChannel")); +} + MessagePort* MessageChannel::port1() { return m_port1; diff --git a/Userland/Libraries/LibWeb/HTML/MessageChannel.h b/Userland/Libraries/LibWeb/HTML/MessageChannel.h index 4fc9c2c2e4..1dfe15520c 100644 --- a/Userland/Libraries/LibWeb/HTML/MessageChannel.h +++ b/Userland/Libraries/LibWeb/HTML/MessageChannel.h @@ -28,6 +28,7 @@ public: private: explicit MessageChannel(JS::Realm&); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::GCPtr<MessagePort> m_port1; diff --git a/Userland/Libraries/LibWeb/HTML/MessageEvent.cpp b/Userland/Libraries/LibWeb/HTML/MessageEvent.cpp index 907b869114..910a94b5ae 100644 --- a/Userland/Libraries/LibWeb/HTML/MessageEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/MessageEvent.cpp @@ -25,11 +25,16 @@ MessageEvent::MessageEvent(JS::Realm& realm, DeprecatedFlyString const& event_na , m_origin(event_init.origin) , m_last_event_id(event_init.last_event_id) { - set_prototype(&Bindings::cached_web_prototype(realm, "MessageEvent")); } MessageEvent::~MessageEvent() = default; +void MessageEvent::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::MessageEventPrototype>(realm, "MessageEvent")); +} + void MessageEvent::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/MessageEvent.h b/Userland/Libraries/LibWeb/HTML/MessageEvent.h index 675c1eeffe..73cd28d29c 100644 --- a/Userland/Libraries/LibWeb/HTML/MessageEvent.h +++ b/Userland/Libraries/LibWeb/HTML/MessageEvent.h @@ -32,6 +32,7 @@ public: DeprecatedString const& last_event_id() const { return m_last_event_id; } private: + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::Value m_data; diff --git a/Userland/Libraries/LibWeb/HTML/MessagePort.cpp b/Userland/Libraries/LibWeb/HTML/MessagePort.cpp index 461ff967b6..52159660e0 100644 --- a/Userland/Libraries/LibWeb/HTML/MessagePort.cpp +++ b/Userland/Libraries/LibWeb/HTML/MessagePort.cpp @@ -22,11 +22,16 @@ JS::NonnullGCPtr<MessagePort> MessagePort::create(JS::Realm& realm) MessagePort::MessagePort(JS::Realm& realm) : DOM::EventTarget(realm) { - set_prototype(&Bindings::cached_web_prototype(realm, "MessagePort")); } MessagePort::~MessagePort() = default; +void MessagePort::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::MessagePortPrototype>(realm, "MessagePort")); +} + void MessagePort::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/MessagePort.h b/Userland/Libraries/LibWeb/HTML/MessagePort.h index 6dba0493ee..84de2b7288 100644 --- a/Userland/Libraries/LibWeb/HTML/MessagePort.h +++ b/Userland/Libraries/LibWeb/HTML/MessagePort.h @@ -46,6 +46,7 @@ public: private: explicit MessagePort(JS::Realm&); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; bool is_entangled() const { return m_remote_port; } diff --git a/Userland/Libraries/LibWeb/HTML/Navigator.cpp b/Userland/Libraries/LibWeb/HTML/Navigator.cpp index ed25204e08..b53263418b 100644 --- a/Userland/Libraries/LibWeb/HTML/Navigator.cpp +++ b/Userland/Libraries/LibWeb/HTML/Navigator.cpp @@ -23,11 +23,16 @@ JS::NonnullGCPtr<Navigator> Navigator::create(JS::Realm& realm) Navigator::Navigator(JS::Realm& realm) : PlatformObject(realm) { - set_prototype(&Bindings::cached_web_prototype(realm, "Navigator")); } Navigator::~Navigator() = default; +void Navigator::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::NavigatorPrototype>(realm, "Navigator")); +} + // https://w3c.github.io/webdriver/#dfn-webdriver bool Navigator::webdriver() const { diff --git a/Userland/Libraries/LibWeb/HTML/Navigator.h b/Userland/Libraries/LibWeb/HTML/Navigator.h index 699bc6557a..a6447ed749 100644 --- a/Userland/Libraries/LibWeb/HTML/Navigator.h +++ b/Userland/Libraries/LibWeb/HTML/Navigator.h @@ -45,6 +45,8 @@ public: private: explicit Navigator(JS::Realm&); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.cpp b/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.cpp index 177277ffa4..33393346db 100644 --- a/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.cpp @@ -23,9 +23,14 @@ PageTransitionEvent::PageTransitionEvent(JS::Realm& realm, DeprecatedFlyString c : DOM::Event(realm, event_name, event_init) , m_persisted(event_init.persisted) { - set_prototype(&Bindings::cached_web_prototype(realm, "PageTransitionEvent")); } PageTransitionEvent::~PageTransitionEvent() = default; +void PageTransitionEvent::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::PageTransitionEventPrototype>(realm, "PageTransitionEvent")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.h b/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.h index e809bc9f59..6409d141c8 100644 --- a/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.h +++ b/Userland/Libraries/LibWeb/HTML/PageTransitionEvent.h @@ -28,6 +28,8 @@ public: bool persisted() const { return m_persisted; } private: + virtual void initialize(JS::Realm&) override; + bool m_persisted { false }; }; diff --git a/Userland/Libraries/LibWeb/HTML/Path2D.cpp b/Userland/Libraries/LibWeb/HTML/Path2D.cpp index 58d5383156..3803c7f019 100644 --- a/Userland/Libraries/LibWeb/HTML/Path2D.cpp +++ b/Userland/Libraries/LibWeb/HTML/Path2D.cpp @@ -22,8 +22,6 @@ Path2D::Path2D(JS::Realm& realm, Optional<Variant<JS::Handle<Path2D>, Deprecated : PlatformObject(realm) , CanvasPath(static_cast<Bindings::PlatformObject&>(*this)) { - set_prototype(&Bindings::cached_web_prototype(realm, "Path2D")); - // 1. Let output be a new Path2D object. // 2. If path is not given, then return output. if (!path.has_value()) @@ -56,4 +54,10 @@ Path2D::Path2D(JS::Realm& realm, Optional<Variant<JS::Handle<Path2D>, Deprecated Path2D::~Path2D() = default; +void Path2D::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::Path2DPrototype>(realm, "Path2D")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/Path2D.h b/Userland/Libraries/LibWeb/HTML/Path2D.h index 915717c8a6..db3d781d09 100644 --- a/Userland/Libraries/LibWeb/HTML/Path2D.h +++ b/Userland/Libraries/LibWeb/HTML/Path2D.h @@ -27,6 +27,8 @@ public: private: Path2D(JS::Realm&, Optional<Variant<JS::Handle<Path2D>, DeprecatedString>> const&); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.cpp b/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.cpp index f16a98a2c6..b27adcc40d 100644 --- a/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.cpp @@ -24,7 +24,6 @@ PromiseRejectionEvent::PromiseRejectionEvent(JS::Realm& realm, DeprecatedFlyStri , m_promise(const_cast<JS::Promise*>(event_init.promise.cell())) , m_reason(event_init.reason) { - set_prototype(&Bindings::cached_web_prototype(realm, "PromiseRejectionEvent")); } PromiseRejectionEvent::~PromiseRejectionEvent() = default; @@ -36,4 +35,10 @@ void PromiseRejectionEvent::visit_edges(Cell::Visitor& visitor) visitor.visit(m_reason); } +void PromiseRejectionEvent::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::PromiseRejectionEventPrototype>(realm, "PromiseRejectionEvent")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.h b/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.h index 0f79732f60..6b4f4e01ee 100644 --- a/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.h +++ b/Userland/Libraries/LibWeb/HTML/PromiseRejectionEvent.h @@ -35,6 +35,7 @@ public: private: PromiseRejectionEvent(JS::Realm&, DeprecatedFlyString const& event_name, PromiseRejectionEventInit const& event_init); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::Promise* m_promise { nullptr }; diff --git a/Userland/Libraries/LibWeb/HTML/Storage.cpp b/Userland/Libraries/LibWeb/HTML/Storage.cpp index a21e2d89b8..e826eb44b7 100644 --- a/Userland/Libraries/LibWeb/HTML/Storage.cpp +++ b/Userland/Libraries/LibWeb/HTML/Storage.cpp @@ -18,11 +18,16 @@ JS::NonnullGCPtr<Storage> Storage::create(JS::Realm& realm) Storage::Storage(JS::Realm& realm) : PlatformObject(realm) { - set_prototype(&Bindings::cached_web_prototype(realm, "Storage")); } Storage::~Storage() = default; +void Storage::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::StoragePrototype>(realm, "Storage")); +} + // https://html.spec.whatwg.org/multipage/webstorage.html#dom-storage-length size_t Storage::length() const { diff --git a/Userland/Libraries/LibWeb/HTML/Storage.h b/Userland/Libraries/LibWeb/HTML/Storage.h index 0090431d45..6b3323bc81 100644 --- a/Userland/Libraries/LibWeb/HTML/Storage.h +++ b/Userland/Libraries/LibWeb/HTML/Storage.h @@ -35,6 +35,8 @@ public: private: explicit Storage(JS::Realm&); + virtual void initialize(JS::Realm&) override; + void reorder(); void broadcast(DeprecatedString const& key, DeprecatedString const& old_value, DeprecatedString const& new_value); diff --git a/Userland/Libraries/LibWeb/HTML/SubmitEvent.cpp b/Userland/Libraries/LibWeb/HTML/SubmitEvent.cpp index 9d3cc07ff5..ee1a535447 100644 --- a/Userland/Libraries/LibWeb/HTML/SubmitEvent.cpp +++ b/Userland/Libraries/LibWeb/HTML/SubmitEvent.cpp @@ -23,11 +23,16 @@ SubmitEvent::SubmitEvent(JS::Realm& realm, DeprecatedFlyString const& event_name : DOM::Event(realm, event_name, event_init) , m_submitter(event_init.submitter) { - set_prototype(&Bindings::cached_web_prototype(realm, "SubmitEvent")); } SubmitEvent::~SubmitEvent() = default; +void SubmitEvent::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::SubmitEventPrototype>(realm, "SubmitEvent")); +} + void SubmitEvent::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/HTML/SubmitEvent.h b/Userland/Libraries/LibWeb/HTML/SubmitEvent.h index 56dc9b604b..51398d9a46 100644 --- a/Userland/Libraries/LibWeb/HTML/SubmitEvent.h +++ b/Userland/Libraries/LibWeb/HTML/SubmitEvent.h @@ -29,6 +29,7 @@ public: private: SubmitEvent(JS::Realm&, DeprecatedFlyString const& event_name, SubmitEventInit const& event_init); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::GCPtr<HTMLElement> m_submitter; diff --git a/Userland/Libraries/LibWeb/HTML/TextMetrics.cpp b/Userland/Libraries/LibWeb/HTML/TextMetrics.cpp index 5041db4006..fda88cba77 100644 --- a/Userland/Libraries/LibWeb/HTML/TextMetrics.cpp +++ b/Userland/Libraries/LibWeb/HTML/TextMetrics.cpp @@ -17,9 +17,14 @@ JS::NonnullGCPtr<TextMetrics> TextMetrics::create(JS::Realm& realm) TextMetrics::TextMetrics(JS::Realm& realm) : PlatformObject(realm) { - set_prototype(&Bindings::cached_web_prototype(realm, "TextMetrics")); } TextMetrics::~TextMetrics() = default; +void TextMetrics::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::TextMetricsPrototype>(realm, "TextMetrics")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/TextMetrics.h b/Userland/Libraries/LibWeb/HTML/TextMetrics.h index 54bdfd29b1..8c969a2545 100644 --- a/Userland/Libraries/LibWeb/HTML/TextMetrics.h +++ b/Userland/Libraries/LibWeb/HTML/TextMetrics.h @@ -47,6 +47,8 @@ public: private: explicit TextMetrics(JS::Realm&); + virtual void initialize(JS::Realm&) override; + double m_width { 0 }; double m_actual_bounding_box_left { 0 }; double m_actual_bounding_box_right { 0 }; diff --git a/Userland/Libraries/LibWeb/HTML/Worker.cpp b/Userland/Libraries/LibWeb/HTML/Worker.cpp index 3aac30ea98..cf5179dc6a 100644 --- a/Userland/Libraries/LibWeb/HTML/Worker.cpp +++ b/Userland/Libraries/LibWeb/HTML/Worker.cpp @@ -28,7 +28,12 @@ Worker::Worker(DeprecatedFlyString const& script_url, WorkerOptions const option , m_interpreter_scope(*m_interpreter) , m_implicit_port(MessagePort::create(document.realm())) { - set_prototype(&Bindings::cached_web_prototype(document.realm(), "Worker")); +} + +void Worker::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::WorkerPrototype>(realm, "Worker")); } void Worker::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/HTML/Worker.h b/Userland/Libraries/LibWeb/HTML/Worker.h index 303ce77153..9650cd39ea 100644 --- a/Userland/Libraries/LibWeb/HTML/Worker.h +++ b/Userland/Libraries/LibWeb/HTML/Worker.h @@ -68,6 +68,7 @@ private: return static_cast<Bindings::WebEngineCustomData*>(target_vm.custom_data())->event_loop; } + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; DeprecatedFlyString m_script_url; diff --git a/Userland/Libraries/LibWeb/HTML/WorkerNavigator.cpp b/Userland/Libraries/LibWeb/HTML/WorkerNavigator.cpp index e86d942b56..2585f260b4 100644 --- a/Userland/Libraries/LibWeb/HTML/WorkerNavigator.cpp +++ b/Userland/Libraries/LibWeb/HTML/WorkerNavigator.cpp @@ -19,9 +19,14 @@ JS::NonnullGCPtr<WorkerNavigator> WorkerNavigator::create(WorkerGlobalScope& glo WorkerNavigator::WorkerNavigator(WorkerGlobalScope& global_scope) : PlatformObject(global_scope.realm()) { - set_prototype(&Bindings::cached_web_prototype(global_scope.realm(), "WorkerNavigator")); } WorkerNavigator::~WorkerNavigator() = default; +void WorkerNavigator::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::WorkerNavigatorPrototype>(realm, "WorkerNavigator")); +} + } diff --git a/Userland/Libraries/LibWeb/HTML/WorkerNavigator.h b/Userland/Libraries/LibWeb/HTML/WorkerNavigator.h index a9557aa3d3..54fdb2b263 100644 --- a/Userland/Libraries/LibWeb/HTML/WorkerNavigator.h +++ b/Userland/Libraries/LibWeb/HTML/WorkerNavigator.h @@ -28,6 +28,8 @@ public: private: explicit WorkerNavigator(WorkerGlobalScope&); + + virtual void initialize(JS::Realm&) override; }; } |