mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-10-02 06:09:51 +00:00
LibWeb: Set the correct prototype for SVGAElement instances
This commit is contained in:
parent
a84261ee7a
commit
4db05ecf69
Notes:
sideshowbarker
2024-07-17 06:20:50 +09:00
Author: https://github.com/awesomekling
Commit: 4db05ecf69
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/304
Reviewed-by: https://github.com/nico ✅
4 changed files with 19 additions and 2 deletions
1
Tests/LibWeb/Text/expected/SVG/a-element-prototype.txt
Normal file
1
Tests/LibWeb/Text/expected/SVG/a-element-prototype.txt
Normal file
|
@ -0,0 +1 @@
|
|||
true
|
7
Tests/LibWeb/Text/input/SVG/a-element-prototype.html
Normal file
7
Tests/LibWeb/Text/input/SVG/a-element-prototype.html
Normal file
|
@ -0,0 +1,7 @@
|
|||
<script src="../include.js"></script>
|
||||
<script>
|
||||
test(() => {
|
||||
let a = document.createElementNS("http://www.w3.org/2000/svg", "a");
|
||||
println(a.__proto__ === SVGAElement.prototype);
|
||||
});
|
||||
</script>
|
|
@ -4,6 +4,7 @@
|
|||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/Bindings/SVGAElementPrototype.h>
|
||||
#include <LibWeb/Layout/SVGGraphicsBox.h>
|
||||
#include <LibWeb/SVG/SVGAElement.h>
|
||||
|
||||
|
@ -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<Layout::Node> SVGAElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)
|
||||
{
|
||||
return heap().allocate_without_realm<Layout::SVGGraphicsBox>(document(), *this, move(style));
|
||||
|
|
|
@ -17,9 +17,11 @@ class SVGAElement final : public SVGGraphicsElement {
|
|||
public:
|
||||
virtual ~SVGAElement() override;
|
||||
|
||||
SVGAElement(DOM::Document&, DOM::QualifiedName);
|
||||
|
||||
virtual JS::GCPtr<Layout::Node> create_layout_node(NonnullRefPtr<CSS::StyleProperties>) override;
|
||||
|
||||
private:
|
||||
SVGAElement(DOM::Document&, DOM::QualifiedName);
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue