From 4db05ecf69bee07a060f2e4513e9d53b6110dcc4 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Fri, 28 Jun 2024 14:51:57 +0200 Subject: [PATCH] LibWeb: Set the correct prototype for SVGAElement instances --- Tests/LibWeb/Text/expected/SVG/a-element-prototype.txt | 1 + Tests/LibWeb/Text/input/SVG/a-element-prototype.html | 7 +++++++ Userland/Libraries/LibWeb/SVG/SVGAElement.cpp | 7 +++++++ Userland/Libraries/LibWeb/SVG/SVGAElement.h | 6 ++++-- 4 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 Tests/LibWeb/Text/expected/SVG/a-element-prototype.txt create mode 100644 Tests/LibWeb/Text/input/SVG/a-element-prototype.html diff --git a/Tests/LibWeb/Text/expected/SVG/a-element-prototype.txt b/Tests/LibWeb/Text/expected/SVG/a-element-prototype.txt new file mode 100644 index 000000000000..27ba77ddaf61 --- /dev/null +++ b/Tests/LibWeb/Text/expected/SVG/a-element-prototype.txt @@ -0,0 +1 @@ +true diff --git a/Tests/LibWeb/Text/input/SVG/a-element-prototype.html b/Tests/LibWeb/Text/input/SVG/a-element-prototype.html new file mode 100644 index 000000000000..fba38cfa4689 --- /dev/null +++ b/Tests/LibWeb/Text/input/SVG/a-element-prototype.html @@ -0,0 +1,7 @@ + + diff --git a/Userland/Libraries/LibWeb/SVG/SVGAElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGAElement.cpp index 04af8c846a3a..a2b480d894e3 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGAElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGAElement.cpp @@ -4,6 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include #include #include @@ -18,6 +19,12 @@ SVGAElement::SVGAElement(DOM::Document& document, DOM::QualifiedName qualified_n SVGAElement::~SVGAElement() = default; +void SVGAElement::initialize(JS::Realm& realm) +{ + Base::initialize(realm); + WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGAElement); +} + JS::GCPtr SVGAElement::create_layout_node(NonnullRefPtr style) { return heap().allocate_without_realm(document(), *this, move(style)); diff --git a/Userland/Libraries/LibWeb/SVG/SVGAElement.h b/Userland/Libraries/LibWeb/SVG/SVGAElement.h index c18e1f9d6dde..98bc1d12f319 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGAElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGAElement.h @@ -17,9 +17,11 @@ class SVGAElement final : public SVGGraphicsElement { public: virtual ~SVGAElement() override; - SVGAElement(DOM::Document&, DOM::QualifiedName); - virtual JS::GCPtr create_layout_node(NonnullRefPtr) override; + +private: + SVGAElement(DOM::Document&, DOM::QualifiedName); + virtual void initialize(JS::Realm&) override; }; }