diff options
author | Timothy Flynn <trflynn89@pm.me> | 2023-01-10 06:28:20 -0500 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-01-10 16:08:14 +0100 |
commit | 834202aeb9a47c544ab4e61deb813de50bc03946 (patch) | |
tree | c120e9231fa5451b527131f6e423fac2645253bb /Userland/Libraries/LibWeb/SVG | |
parent | 7bd8fd000f3f8e92ff632be2370a279ac2309250 (diff) | |
download | serenity-834202aeb9a47c544ab4e61deb813de50bc03946.zip |
LibWeb: Move setting of Web object prototypes to initialize()
This needs to happen before prototype/constructor intitialization can be
made lazy. Otherwise, GC could run during the C++ constructor and try to
collect the object currently being created.
Diffstat (limited to 'Userland/Libraries/LibWeb/SVG')
33 files changed, 127 insertions, 18 deletions
diff --git a/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.cpp b/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.cpp index cb0e635aad..124e2ed960 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.cpp @@ -19,14 +19,18 @@ SVGAnimatedLength::SVGAnimatedLength(JS::Realm& realm, JS::NonnullGCPtr<SVGLengt , m_base_val(move(base_val)) , m_anim_val(move(anim_val)) { - set_prototype(&Bindings::cached_web_prototype(realm, "SVGAnimatedLength")); - // The object referenced by animVal will always be distinct from the one referenced by baseVal, even when the attribute is not animated. VERIFY(m_base_val.ptr() != m_anim_val.ptr()); } SVGAnimatedLength::~SVGAnimatedLength() = default; +void SVGAnimatedLength::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGAnimatedLengthPrototype>(realm, "SVGAnimatedLength")); +} + void SVGAnimatedLength::visit_edges(Cell::Visitor& visitor) { Base::visit_edges(visitor); diff --git a/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.h b/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.h index 452d8b65e7..cb96977d03 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.h +++ b/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.h @@ -25,6 +25,7 @@ public: private: SVGAnimatedLength(JS::Realm&, JS::NonnullGCPtr<SVGLength> base_val, JS::NonnullGCPtr<SVGLength> anim_val); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::NonnullGCPtr<SVGLength> m_base_val; diff --git a/Userland/Libraries/LibWeb/SVG/SVGCircleElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGCircleElement.cpp index 886f8f2320..cb7ca7177b 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGCircleElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGCircleElement.cpp @@ -14,7 +14,12 @@ namespace Web::SVG { SVGCircleElement::SVGCircleElement(DOM::Document& document, DOM::QualifiedName qualified_name) : SVGGeometryElement(document, qualified_name) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGCircleElement")); +} + +void SVGCircleElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGCircleElementPrototype>(realm, "SVGCircleElement")); } void SVGCircleElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) diff --git a/Userland/Libraries/LibWeb/SVG/SVGCircleElement.h b/Userland/Libraries/LibWeb/SVG/SVGCircleElement.h index d51459a202..376002299c 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGCircleElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGCircleElement.h @@ -28,6 +28,8 @@ public: private: SVGCircleElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + Optional<Gfx::Path> m_path; Optional<float> m_center_x; diff --git a/Userland/Libraries/LibWeb/SVG/SVGClipPathElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGClipPathElement.cpp index c7127dff91..4ded39d8c9 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGClipPathElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGClipPathElement.cpp @@ -12,13 +12,18 @@ namespace Web::SVG { SVGClipPathElement::SVGClipPathElement(DOM::Document& document, DOM::QualifiedName qualified_name) : SVGElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGClipPathElement")); } SVGClipPathElement::~SVGClipPathElement() { } +void SVGClipPathElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGClipPathElementPrototype>(realm, "SVGClipPathElement")); +} + JS::GCPtr<Layout::Node> SVGClipPathElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties>) { return nullptr; diff --git a/Userland/Libraries/LibWeb/SVG/SVGClipPathElement.h b/Userland/Libraries/LibWeb/SVG/SVGClipPathElement.h index 36712c18b4..e5d562eba6 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGClipPathElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGClipPathElement.h @@ -20,6 +20,8 @@ public: private: SVGClipPathElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/SVG/SVGDefsElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGDefsElement.cpp index 86e7d87ff0..1403ed8380 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGDefsElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGDefsElement.cpp @@ -12,13 +12,18 @@ namespace Web::SVG { SVGDefsElement::SVGDefsElement(DOM::Document& document, DOM::QualifiedName qualified_name) : SVGGraphicsElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGDefsElement")); } SVGDefsElement::~SVGDefsElement() { } +void SVGDefsElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGDefsElementPrototype>(realm, "SVGDefsElement")); +} + JS::GCPtr<Layout::Node> SVGDefsElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties>) { return nullptr; diff --git a/Userland/Libraries/LibWeb/SVG/SVGDefsElement.h b/Userland/Libraries/LibWeb/SVG/SVGDefsElement.h index ddb2eeb437..a875239cca 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGDefsElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGDefsElement.h @@ -20,6 +20,8 @@ public: private: SVGDefsElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/SVG/SVGElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGElement.cpp index 10c1a2e10c..6fd8c1c605 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGElement.cpp @@ -14,7 +14,12 @@ SVGElement::SVGElement(DOM::Document& document, DOM::QualifiedName qualified_nam : Element(document, move(qualified_name)) , m_dataset(HTML::DOMStringMap::create(*this)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGElement")); +} + +void SVGElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGElementPrototype>(realm, "SVGElement")); } void SVGElement::visit_edges(Cell::Visitor& visitor) diff --git a/Userland/Libraries/LibWeb/SVG/SVGElement.h b/Userland/Libraries/LibWeb/SVG/SVGElement.h index 8752f71961..5cfca6517f 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGElement.h @@ -22,6 +22,7 @@ public: protected: SVGElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; virtual void visit_edges(Cell::Visitor&) override; JS::NonnullGCPtr<HTML::DOMStringMap> m_dataset; diff --git a/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.cpp index ae17c54d03..d062616c6a 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.cpp @@ -14,7 +14,12 @@ namespace Web::SVG { SVGEllipseElement::SVGEllipseElement(DOM::Document& document, DOM::QualifiedName qualified_name) : SVGGeometryElement(document, qualified_name) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGEllipseElement")); +} + +void SVGEllipseElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGEllipseElementPrototype>(realm, "SVGEllipseElement")); } void SVGEllipseElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) diff --git a/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.h b/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.h index 4ed5d584f5..72e179896e 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.h @@ -29,6 +29,8 @@ public: private: SVGEllipseElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + Optional<Gfx::Path> m_path; Optional<float> m_center_x; diff --git a/Userland/Libraries/LibWeb/SVG/SVGForeignObjectElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGForeignObjectElement.cpp index 75bd7a2c00..d2297e9730 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGForeignObjectElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGForeignObjectElement.cpp @@ -17,7 +17,6 @@ namespace Web::SVG { SVGForeignObjectElement::SVGForeignObjectElement(DOM::Document& document, DOM::QualifiedName qualified_name) : SVGGraphicsElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGForeignObjectElement")); } SVGForeignObjectElement::~SVGForeignObjectElement() = default; @@ -25,6 +24,7 @@ SVGForeignObjectElement::~SVGForeignObjectElement() = default; void SVGForeignObjectElement::initialize(JS::Realm& realm) { Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGForeignObjectElementPrototype>(realm, "SVGForeignObjectElement")); // FIXME: These never actually get updated! m_x = SVGAnimatedLength::create(realm, SVGLength::create(realm, 0, 0), SVGLength::create(realm, 0, 0)); diff --git a/Userland/Libraries/LibWeb/SVG/SVGGeometryElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGGeometryElement.cpp index 974f966797..6e3979d736 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGGeometryElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGGeometryElement.cpp @@ -13,7 +13,12 @@ namespace Web::SVG { SVGGeometryElement::SVGGeometryElement(DOM::Document& document, DOM::QualifiedName qualified_name) : SVGGraphicsElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGGeometryElement")); +} + +void SVGGeometryElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGGeometryElementPrototype>(realm, "SVGGeometryElement")); } JS::GCPtr<Layout::Node> SVGGeometryElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style) diff --git a/Userland/Libraries/LibWeb/SVG/SVGGeometryElement.h b/Userland/Libraries/LibWeb/SVG/SVGGeometryElement.h index bf01c92a93..3a32b82e1c 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGGeometryElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGGeometryElement.h @@ -25,6 +25,8 @@ public: protected: SVGGeometryElement(DOM::Document& document, DOM::QualifiedName qualified_name); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp index 6479629eb2..9714587c71 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.cpp @@ -16,7 +16,12 @@ namespace Web::SVG { SVGGraphicsElement::SVGGraphicsElement(DOM::Document& document, DOM::QualifiedName qualified_name) : SVGElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGGraphicsElement")); +} + +void SVGGraphicsElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGGraphicsElementPrototype>(realm, "SVGGraphicsElement")); } void SVGGraphicsElement::apply_presentational_hints(CSS::StyleProperties& style) const diff --git a/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.h b/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.h index 2ce716ec3a..b62703ca94 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGGraphicsElement.h @@ -26,6 +26,8 @@ public: protected: SVGGraphicsElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } diff --git a/Userland/Libraries/LibWeb/SVG/SVGLength.cpp b/Userland/Libraries/LibWeb/SVG/SVGLength.cpp index 2a268304ce..ae53ce61e0 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGLength.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGLength.cpp @@ -19,7 +19,12 @@ SVGLength::SVGLength(JS::Realm& realm, u8 unit_type, float value) , m_unit_type(unit_type) , m_value(value) { - set_prototype(&Bindings::cached_web_prototype(realm, "SVGLength")); +} + +void SVGLength::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGLengthPrototype>(realm, "SVGLength")); } SVGLength::~SVGLength() = default; diff --git a/Userland/Libraries/LibWeb/SVG/SVGLength.h b/Userland/Libraries/LibWeb/SVG/SVGLength.h index afd248ad11..02e129d748 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGLength.h +++ b/Userland/Libraries/LibWeb/SVG/SVGLength.h @@ -27,6 +27,8 @@ public: private: SVGLength(JS::Realm&, u8 unit_type, float value); + virtual void initialize(JS::Realm&) override; + u8 m_unit_type { 0 }; float m_value { 0 }; }; diff --git a/Userland/Libraries/LibWeb/SVG/SVGLineElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGLineElement.cpp index 50731211ef..3e79cf16a9 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGLineElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGLineElement.cpp @@ -14,7 +14,12 @@ namespace Web::SVG { SVGLineElement::SVGLineElement(DOM::Document& document, DOM::QualifiedName qualified_name) : SVGGeometryElement(document, qualified_name) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGLineElement")); +} + +void SVGLineElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGLineElementPrototype>(realm, "SVGLineElement")); } void SVGLineElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) diff --git a/Userland/Libraries/LibWeb/SVG/SVGLineElement.h b/Userland/Libraries/LibWeb/SVG/SVGLineElement.h index bf28fcc846..01ed6b136c 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGLineElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGLineElement.h @@ -29,6 +29,8 @@ public: private: SVGLineElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + Optional<Gfx::Path> m_path; Optional<float> m_x1; diff --git a/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp index 0616067969..2e30643663 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGPathElement.cpp @@ -87,7 +87,12 @@ namespace Web::SVG { SVGPathElement::SVGPathElement(DOM::Document& document, DOM::QualifiedName qualified_name) : SVGGeometryElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGPathElement")); +} + +void SVGPathElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGPathElementPrototype>(realm, "SVGPathElement")); } void SVGPathElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) diff --git a/Userland/Libraries/LibWeb/SVG/SVGPathElement.h b/Userland/Libraries/LibWeb/SVG/SVGPathElement.h index 7333bd5ad6..93b06bb340 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGPathElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGPathElement.h @@ -26,6 +26,8 @@ public: private: SVGPathElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + Vector<PathInstruction> m_instructions; Optional<Gfx::Path> m_path; }; diff --git a/Userland/Libraries/LibWeb/SVG/SVGPolygonElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGPolygonElement.cpp index e4de039957..a17630bae6 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGPolygonElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGPolygonElement.cpp @@ -14,7 +14,12 @@ namespace Web::SVG { SVGPolygonElement::SVGPolygonElement(DOM::Document& document, DOM::QualifiedName qualified_name) : SVGGeometryElement(document, qualified_name) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGPolygonElement")); +} + +void SVGPolygonElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGPolygonElementPrototype>(realm, "SVGPolygonElement")); } void SVGPolygonElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) diff --git a/Userland/Libraries/LibWeb/SVG/SVGPolygonElement.h b/Userland/Libraries/LibWeb/SVG/SVGPolygonElement.h index 017b57b10a..021392c743 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGPolygonElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGPolygonElement.h @@ -23,6 +23,8 @@ public: private: SVGPolygonElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + Optional<Gfx::Path> m_path; Vector<Gfx::FloatPoint> m_points; diff --git a/Userland/Libraries/LibWeb/SVG/SVGPolylineElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGPolylineElement.cpp index e92d604b97..5275fcd606 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGPolylineElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGPolylineElement.cpp @@ -14,7 +14,12 @@ namespace Web::SVG { SVGPolylineElement::SVGPolylineElement(DOM::Document& document, DOM::QualifiedName qualified_name) : SVGGeometryElement(document, qualified_name) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGPolylineElement")); +} + +void SVGPolylineElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGPolylineElementPrototype>(realm, "SVGPolylineElement")); } void SVGPolylineElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) diff --git a/Userland/Libraries/LibWeb/SVG/SVGPolylineElement.h b/Userland/Libraries/LibWeb/SVG/SVGPolylineElement.h index 77015550cb..8ad2a9da82 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGPolylineElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGPolylineElement.h @@ -23,6 +23,8 @@ public: private: SVGPolylineElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + Optional<Gfx::Path> m_path; Vector<Gfx::FloatPoint> m_points; diff --git a/Userland/Libraries/LibWeb/SVG/SVGRectElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGRectElement.cpp index 1bd6ce469b..c14c1be515 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGRectElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGRectElement.cpp @@ -16,7 +16,12 @@ namespace Web::SVG { SVGRectElement::SVGRectElement(DOM::Document& document, DOM::QualifiedName qualified_name) : SVGGeometryElement(document, qualified_name) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGRectElement")); +} + +void SVGRectElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGRectElementPrototype>(realm, "SVGRectElement")); } void SVGRectElement::parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) diff --git a/Userland/Libraries/LibWeb/SVG/SVGRectElement.h b/Userland/Libraries/LibWeb/SVG/SVGRectElement.h index 6b079a3f05..eea648ae1d 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGRectElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGRectElement.h @@ -31,6 +31,8 @@ public: private: SVGRectElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + Gfx::FloatPoint calculate_used_corner_radius_values(); Optional<Gfx::Path> m_path; diff --git a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp index 256e3c0be8..cf1caff20a 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp @@ -20,7 +20,12 @@ namespace Web::SVG { SVGSVGElement::SVGSVGElement(DOM::Document& document, DOM::QualifiedName qualified_name) : SVGGraphicsElement(document, qualified_name) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGSVGElement")); +} + +void SVGSVGElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGSVGElementPrototype>(realm, "SVGSVGElement")); } JS::GCPtr<Layout::Node> SVGSVGElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style) diff --git a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.h b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.h index 05fae1059e..7834df2154 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.h @@ -28,6 +28,8 @@ public: private: SVGSVGElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; + virtual bool is_svg_svg_element() const override { return true; } virtual void parse_attribute(DeprecatedFlyString const& name, DeprecatedString const& value) override; diff --git a/Userland/Libraries/LibWeb/SVG/SVGTextContentElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGTextContentElement.cpp index 11086090b7..1cb956395f 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGTextContentElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGTextContentElement.cpp @@ -15,7 +15,12 @@ namespace Web::SVG { SVGTextContentElement::SVGTextContentElement(DOM::Document& document, DOM::QualifiedName qualified_name) : SVGGraphicsElement(document, move(qualified_name)) { - set_prototype(&Bindings::cached_web_prototype(realm(), "SVGTextContentElement")); +} + +void SVGTextContentElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGTextContentElementPrototype>(realm, "SVGTextContentElement")); } // https://svgwg.org/svg2-draft/text.html#__svg__SVGTextContentElement__getNumberOfChars diff --git a/Userland/Libraries/LibWeb/SVG/SVGTextContentElement.h b/Userland/Libraries/LibWeb/SVG/SVGTextContentElement.h index 74ded56554..719ee102f3 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGTextContentElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGTextContentElement.h @@ -20,6 +20,8 @@ public: protected: SVGTextContentElement(DOM::Document&, DOM::QualifiedName); + + virtual void initialize(JS::Realm&) override; }; } |