diff --git a/Userland/Libraries/LibWeb/Forward.h b/Userland/Libraries/LibWeb/Forward.h index aa85a14291..9a61726477 100644 --- a/Userland/Libraries/LibWeb/Forward.h +++ b/Userland/Libraries/LibWeb/Forward.h @@ -473,8 +473,6 @@ class ResizeObserverWrapper; class SelectionWrapper; class StorageWrapper; class SubtleCryptoWrapper; -class SVGAnimatedLengthWrapper; -class SVGLengthWrapper; class TextDecoderWrapper; class TextEncoderWrapper; class TextMetricsWrapper; diff --git a/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.cpp b/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.cpp index cca546d9d3..87ac513cb4 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.cpp @@ -4,21 +4,35 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include +#include #include namespace Web::SVG { -NonnullRefPtr SVGAnimatedLength::create(NonnullRefPtr base_val, NonnullRefPtr anim_val) +JS::NonnullGCPtr SVGAnimatedLength::create(HTML::Window& window, JS::NonnullGCPtr base_val, JS::NonnullGCPtr anim_val) { - return adopt_ref(*new SVGAnimatedLength(move(base_val), move(anim_val))); + return *window.heap().allocate(window.realm(), window, move(base_val), move(anim_val)); } -SVGAnimatedLength::SVGAnimatedLength(NonnullRefPtr base_val, NonnullRefPtr anim_val) - : m_base_val(move(base_val)) +SVGAnimatedLength::SVGAnimatedLength(HTML::Window& window, JS::NonnullGCPtr base_val, JS::NonnullGCPtr anim_val) + : PlatformObject(window.realm()) + , m_base_val(move(base_val)) , m_anim_val(move(anim_val)) { + set_prototype(&window.ensure_web_prototype("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::visit_edges(Cell::Visitor& visitor) +{ + Base::visit_edges(visitor); + visitor.visit(m_base_val.ptr()); + visitor.visit(m_anim_val.ptr()); +} + } diff --git a/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.h b/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.h index 72c338cfed..2d92ef6f96 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.h +++ b/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.h @@ -6,32 +6,31 @@ #pragma once -#include -#include -#include +#include #include namespace Web::SVG { // https://www.w3.org/TR/SVG11/types.html#InterfaceSVGAnimatedLength -class SVGAnimatedLength - : public RefCounted - , public Bindings::Wrappable - , public Weakable { +class SVGAnimatedLength final : public Bindings::PlatformObject { + WEB_PLATFORM_OBJECT(SVGAnimatedLength, Bindings::PlatformObject); + public: - using WrapperType = Bindings::SVGAnimatedLengthWrapper; + static JS::NonnullGCPtr create(HTML::Window&, JS::NonnullGCPtr base_val, JS::NonnullGCPtr anim_val); + virtual ~SVGAnimatedLength() override; - static NonnullRefPtr create(NonnullRefPtr base_val, NonnullRefPtr anim_val); - virtual ~SVGAnimatedLength() = default; - - NonnullRefPtr const& base_val() const { return m_base_val; } - NonnullRefPtr const& anim_val() const { return m_anim_val; } + JS::NonnullGCPtr base_val() const { return m_base_val; } + JS::NonnullGCPtr anim_val() const { return m_anim_val; } private: - SVGAnimatedLength(NonnullRefPtr base_val, NonnullRefPtr anim_val); + SVGAnimatedLength(HTML::Window&, JS::NonnullGCPtr base_val, JS::NonnullGCPtr anim_val); - NonnullRefPtr m_base_val; - NonnullRefPtr m_anim_val; + virtual void visit_edges(Cell::Visitor&) override; + + JS::NonnullGCPtr m_base_val; + JS::NonnullGCPtr m_anim_val; }; } + +WRAPPER_HACK(SVGAnimatedLength, Web::SVG) diff --git a/Userland/Libraries/LibWeb/SVG/SVGCircleElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGCircleElement.cpp index b2c1af6143..b77779a53b 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGCircleElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGCircleElement.cpp @@ -74,33 +74,33 @@ Gfx::Path& SVGCircleElement::get_path() } // https://www.w3.org/TR/SVG11/shapes.html#CircleElementCXAttribute -NonnullRefPtr SVGCircleElement::cx() const +JS::NonnullGCPtr SVGCircleElement::cx() const { // FIXME: Populate the unit type when it is parsed (0 here is "unknown"). // FIXME: Create a proper animated value when animations are supported. - auto base_length = SVGLength::create(0, m_center_x.value_or(0)); - auto anim_length = SVGLength::create(0, m_center_x.value_or(0)); - return SVGAnimatedLength::create(move(base_length), move(anim_length)); + auto base_length = SVGLength::create(window(), 0, m_center_x.value_or(0)); + auto anim_length = SVGLength::create(window(), 0, m_center_x.value_or(0)); + return SVGAnimatedLength::create(window(), move(base_length), move(anim_length)); } // https://www.w3.org/TR/SVG11/shapes.html#CircleElementCYAttribute -NonnullRefPtr SVGCircleElement::cy() const +JS::NonnullGCPtr SVGCircleElement::cy() const { // FIXME: Populate the unit type when it is parsed (0 here is "unknown"). // FIXME: Create a proper animated value when animations are supported. - auto base_length = SVGLength::create(0, m_center_y.value_or(0)); - auto anim_length = SVGLength::create(0, m_center_y.value_or(0)); - return SVGAnimatedLength::create(move(base_length), move(anim_length)); + auto base_length = SVGLength::create(window(), 0, m_center_y.value_or(0)); + auto anim_length = SVGLength::create(window(), 0, m_center_y.value_or(0)); + return SVGAnimatedLength::create(window(), move(base_length), move(anim_length)); } // https://www.w3.org/TR/SVG11/shapes.html#CircleElementRAttribute -NonnullRefPtr SVGCircleElement::r() const +JS::NonnullGCPtr SVGCircleElement::r() const { // FIXME: Populate the unit type when it is parsed (0 here is "unknown"). // FIXME: Create a proper animated value when animations are supported. - auto base_length = SVGLength::create(0, m_radius.value_or(0)); - auto anim_length = SVGLength::create(0, m_radius.value_or(0)); - return SVGAnimatedLength::create(move(base_length), move(anim_length)); + auto base_length = SVGLength::create(window(), 0, m_radius.value_or(0)); + auto anim_length = SVGLength::create(window(), 0, m_radius.value_or(0)); + return SVGAnimatedLength::create(window(), move(base_length), move(anim_length)); } } diff --git a/Userland/Libraries/LibWeb/SVG/SVGCircleElement.h b/Userland/Libraries/LibWeb/SVG/SVGCircleElement.h index 4d8a940118..c5a0e4cc74 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGCircleElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGCircleElement.h @@ -21,9 +21,9 @@ public: virtual Gfx::Path& get_path() override; - NonnullRefPtr cx() const; - NonnullRefPtr cy() const; - NonnullRefPtr r() const; + JS::NonnullGCPtr cx() const; + JS::NonnullGCPtr cy() const; + JS::NonnullGCPtr r() const; private: SVGCircleElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.cpp index 2a906800e9..dc9bbd2b2f 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.cpp @@ -79,43 +79,43 @@ Gfx::Path& SVGEllipseElement::get_path() } // https://www.w3.org/TR/SVG11/shapes.html#EllipseElementCXAttribute -NonnullRefPtr SVGEllipseElement::cx() const +JS::NonnullGCPtr SVGEllipseElement::cx() const { // FIXME: Populate the unit type when it is parsed (0 here is "unknown"). // FIXME: Create a proper animated value when animations are supported. - auto base_length = SVGLength::create(0, m_center_x.value_or(0)); - auto anim_length = SVGLength::create(0, m_center_x.value_or(0)); - return SVGAnimatedLength::create(move(base_length), move(anim_length)); + auto base_length = SVGLength::create(window(), 0, m_center_x.value_or(0)); + auto anim_length = SVGLength::create(window(), 0, m_center_x.value_or(0)); + return SVGAnimatedLength::create(window(), move(base_length), move(anim_length)); } // https://www.w3.org/TR/SVG11/shapes.html#EllipseElementCYAttribute -NonnullRefPtr SVGEllipseElement::cy() const +JS::NonnullGCPtr SVGEllipseElement::cy() const { // FIXME: Populate the unit type when it is parsed (0 here is "unknown"). // FIXME: Create a proper animated value when animations are supported. - auto base_length = SVGLength::create(0, m_center_y.value_or(0)); - auto anim_length = SVGLength::create(0, m_center_y.value_or(0)); - return SVGAnimatedLength::create(move(base_length), move(anim_length)); + auto base_length = SVGLength::create(window(), 0, m_center_y.value_or(0)); + auto anim_length = SVGLength::create(window(), 0, m_center_y.value_or(0)); + return SVGAnimatedLength::create(window(), move(base_length), move(anim_length)); } // https://www.w3.org/TR/SVG11/shapes.html#EllipseElementRXAttribute -NonnullRefPtr SVGEllipseElement::rx() const +JS::NonnullGCPtr SVGEllipseElement::rx() const { // FIXME: Populate the unit type when it is parsed (0 here is "unknown"). // FIXME: Create a proper animated value when animations are supported. - auto base_length = SVGLength::create(0, m_radius_x.value_or(0)); - auto anim_length = SVGLength::create(0, m_radius_x.value_or(0)); - return SVGAnimatedLength::create(move(base_length), move(anim_length)); + auto base_length = SVGLength::create(window(), 0, m_radius_x.value_or(0)); + auto anim_length = SVGLength::create(window(), 0, m_radius_x.value_or(0)); + return SVGAnimatedLength::create(window(), move(base_length), move(anim_length)); } // https://www.w3.org/TR/SVG11/shapes.html#EllipseElementRYAttribute -NonnullRefPtr SVGEllipseElement::ry() const +JS::NonnullGCPtr SVGEllipseElement::ry() const { // FIXME: Populate the unit type when it is parsed (0 here is "unknown"). // FIXME: Create a proper animated value when animations are supported. - auto base_length = SVGLength::create(0, m_radius_y.value_or(0)); - auto anim_length = SVGLength::create(0, m_radius_y.value_or(0)); - return SVGAnimatedLength::create(move(base_length), move(anim_length)); + auto base_length = SVGLength::create(window(), 0, m_radius_y.value_or(0)); + auto anim_length = SVGLength::create(window(), 0, m_radius_y.value_or(0)); + return SVGAnimatedLength::create(window(), move(base_length), move(anim_length)); } } diff --git a/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.h b/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.h index af6fbf6eae..1495fe2f4a 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGEllipseElement.h @@ -21,10 +21,10 @@ public: virtual Gfx::Path& get_path() override; - NonnullRefPtr cx() const; - NonnullRefPtr cy() const; - NonnullRefPtr rx() const; - NonnullRefPtr ry() const; + JS::NonnullGCPtr cx() const; + JS::NonnullGCPtr cy() const; + JS::NonnullGCPtr rx() const; + JS::NonnullGCPtr ry() const; private: SVGEllipseElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/SVG/SVGLength.cpp b/Userland/Libraries/LibWeb/SVG/SVGLength.cpp index 11c3865479..912feee65b 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGLength.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGLength.cpp @@ -4,21 +4,27 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include +#include #include namespace Web::SVG { -NonnullRefPtr SVGLength::create(u8 unit_type, float value) +JS::NonnullGCPtr SVGLength::create(HTML::Window& window, u8 unit_type, float value) { - return adopt_ref(*new SVGLength(unit_type, value)); + return *window.heap().allocate(window.realm(), window, unit_type, value); } -SVGLength::SVGLength(u8 unit_type, float value) - : m_unit_type(unit_type) +SVGLength::SVGLength(HTML::Window& window, u8 unit_type, float value) + : PlatformObject(window.realm()) + , m_unit_type(unit_type) , m_value(value) { + set_prototype(&window.ensure_web_prototype("SVGLength")); } +SVGLength::~SVGLength() = default; + // https://www.w3.org/TR/SVG11/types.html#__svg__SVGLength__value DOM::ExceptionOr SVGLength::set_value(float value) { diff --git a/Userland/Libraries/LibWeb/SVG/SVGLength.h b/Userland/Libraries/LibWeb/SVG/SVGLength.h index 9e838775eb..6532f6a05a 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGLength.h +++ b/Userland/Libraries/LibWeb/SVG/SVGLength.h @@ -6,24 +6,18 @@ #pragma once -#include -#include -#include -#include +#include #include namespace Web::SVG { // https://www.w3.org/TR/SVG11/types.html#InterfaceSVGLength -class SVGLength - : public RefCounted - , public Bindings::Wrappable - , public Weakable { -public: - using WrapperType = Bindings::SVGLengthWrapper; +class SVGLength : public Bindings::PlatformObject { + WEB_PLATFORM_OBJECT(SVGLength, Bindings::PlatformObject); - static NonnullRefPtr create(u8 unit_type, float value); - virtual ~SVGLength() = default; +public: + static JS::NonnullGCPtr create(HTML::Window&, u8 unit_type, float value); + virtual ~SVGLength() override; u8 unit_type() const { return m_unit_type; } @@ -31,10 +25,12 @@ public: DOM::ExceptionOr set_value(float value); private: - SVGLength(u8 unit_type, float value); + SVGLength(HTML::Window&, u8 unit_type, float value); u8 m_unit_type { 0 }; float m_value { 0 }; }; } + +WRAPPER_HACK(SVGLength, Web::SVG) diff --git a/Userland/Libraries/LibWeb/SVG/SVGLineElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGLineElement.cpp index 3a78b4a006..c02ce0f6b9 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGLineElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGLineElement.cpp @@ -59,43 +59,43 @@ Gfx::Path& SVGLineElement::get_path() } // https://www.w3.org/TR/SVG11/shapes.html#LineElementX1Attribute -NonnullRefPtr SVGLineElement::x1() const +JS::NonnullGCPtr SVGLineElement::x1() const { // FIXME: Populate the unit type when it is parsed (0 here is "unknown"). // FIXME: Create a proper animated value when animations are supported. - auto base_length = SVGLength::create(0, m_x1.value_or(0)); - auto anim_length = SVGLength::create(0, m_x1.value_or(0)); - return SVGAnimatedLength::create(move(base_length), move(anim_length)); + auto base_length = SVGLength::create(window(), 0, m_x1.value_or(0)); + auto anim_length = SVGLength::create(window(), 0, m_x1.value_or(0)); + return SVGAnimatedLength::create(window(), move(base_length), move(anim_length)); } // https://www.w3.org/TR/SVG11/shapes.html#LineElementY1Attribute -NonnullRefPtr SVGLineElement::y1() const +JS::NonnullGCPtr SVGLineElement::y1() const { // FIXME: Populate the unit type when it is parsed (0 here is "unknown"). // FIXME: Create a proper animated value when animations are supported. - auto base_length = SVGLength::create(0, m_y1.value_or(0)); - auto anim_length = SVGLength::create(0, m_y1.value_or(0)); - return SVGAnimatedLength::create(move(base_length), move(anim_length)); + auto base_length = SVGLength::create(window(), 0, m_y1.value_or(0)); + auto anim_length = SVGLength::create(window(), 0, m_y1.value_or(0)); + return SVGAnimatedLength::create(window(), move(base_length), move(anim_length)); } // https://www.w3.org/TR/SVG11/shapes.html#LineElementX2Attribute -NonnullRefPtr SVGLineElement::x2() const +JS::NonnullGCPtr SVGLineElement::x2() const { // FIXME: Populate the unit type when it is parsed (0 here is "unknown"). // FIXME: Create a proper animated value when animations are supported. - auto base_length = SVGLength::create(0, m_x2.value_or(0)); - auto anim_length = SVGLength::create(0, m_x2.value_or(0)); - return SVGAnimatedLength::create(move(base_length), move(anim_length)); + auto base_length = SVGLength::create(window(), 0, m_x2.value_or(0)); + auto anim_length = SVGLength::create(window(), 0, m_x2.value_or(0)); + return SVGAnimatedLength::create(window(), move(base_length), move(anim_length)); } // https://www.w3.org/TR/SVG11/shapes.html#LineElementY2Attribute -NonnullRefPtr SVGLineElement::y2() const +JS::NonnullGCPtr SVGLineElement::y2() const { // FIXME: Populate the unit type when it is parsed (0 here is "unknown"). // FIXME: Create a proper animated value when animations are supported. - auto base_length = SVGLength::create(0, m_y2.value_or(0)); - auto anim_length = SVGLength::create(0, m_y2.value_or(0)); - return SVGAnimatedLength::create(move(base_length), move(anim_length)); + auto base_length = SVGLength::create(window(), 0, m_y2.value_or(0)); + auto anim_length = SVGLength::create(window(), 0, m_y2.value_or(0)); + return SVGAnimatedLength::create(window(), move(base_length), move(anim_length)); } } diff --git a/Userland/Libraries/LibWeb/SVG/SVGLineElement.h b/Userland/Libraries/LibWeb/SVG/SVGLineElement.h index cf87b85c05..f4ebe20e6b 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGLineElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGLineElement.h @@ -21,10 +21,10 @@ public: virtual Gfx::Path& get_path() override; - NonnullRefPtr x1() const; - NonnullRefPtr y1() const; - NonnullRefPtr x2() const; - NonnullRefPtr y2() const; + JS::NonnullGCPtr x1() const; + JS::NonnullGCPtr y1() const; + JS::NonnullGCPtr x2() const; + JS::NonnullGCPtr y2() const; private: SVGLineElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/SVG/SVGRectElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGRectElement.cpp index 7dfe0757aa..357dd57809 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGRectElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGRectElement.cpp @@ -156,63 +156,63 @@ Gfx::FloatPoint SVGRectElement::calculate_used_corner_radius_values() } // https://www.w3.org/TR/SVG11/shapes.html#RectElementXAttribute -NonnullRefPtr SVGRectElement::x() const +JS::NonnullGCPtr SVGRectElement::x() const { // FIXME: Populate the unit type when it is parsed (0 here is "unknown"). // FIXME: Create a proper animated value when animations are supported. - auto base_length = SVGLength::create(0, m_x.value_or(0)); - auto anim_length = SVGLength::create(0, m_x.value_or(0)); - return SVGAnimatedLength::create(move(base_length), move(anim_length)); + auto base_length = SVGLength::create(window(), 0, m_x.value_or(0)); + auto anim_length = SVGLength::create(window(), 0, m_x.value_or(0)); + return SVGAnimatedLength::create(window(), move(base_length), move(anim_length)); } // https://www.w3.org/TR/SVG11/shapes.html#RectElementYAttribute -NonnullRefPtr SVGRectElement::y() const +JS::NonnullGCPtr SVGRectElement::y() const { // FIXME: Populate the unit type when it is parsed (0 here is "unknown"). // FIXME: Create a proper animated value when animations are supported. - auto base_length = SVGLength::create(0, m_y.value_or(0)); - auto anim_length = SVGLength::create(0, m_y.value_or(0)); - return SVGAnimatedLength::create(move(base_length), move(anim_length)); + auto base_length = SVGLength::create(window(), 0, m_y.value_or(0)); + auto anim_length = SVGLength::create(window(), 0, m_y.value_or(0)); + return SVGAnimatedLength::create(window(), move(base_length), move(anim_length)); } // https://www.w3.org/TR/SVG11/shapes.html#RectElementWidthAttribute -NonnullRefPtr SVGRectElement::width() const +JS::NonnullGCPtr SVGRectElement::width() const { // FIXME: Populate the unit type when it is parsed (0 here is "unknown"). // FIXME: Create a proper animated value when animations are supported. - auto base_length = SVGLength::create(0, m_width.value_or(0)); - auto anim_length = SVGLength::create(0, m_width.value_or(0)); - return SVGAnimatedLength::create(move(base_length), move(anim_length)); + auto base_length = SVGLength::create(window(), 0, m_width.value_or(0)); + auto anim_length = SVGLength::create(window(), 0, m_width.value_or(0)); + return SVGAnimatedLength::create(window(), move(base_length), move(anim_length)); } // https://www.w3.org/TR/SVG11/shapes.html#RectElementHeightAttribute -NonnullRefPtr SVGRectElement::height() const +JS::NonnullGCPtr SVGRectElement::height() const { // FIXME: Populate the unit type when it is parsed (0 here is "unknown"). // FIXME: Create a proper animated value when animations are supported. - auto base_length = SVGLength::create(0, m_height.value_or(0)); - auto anim_length = SVGLength::create(0, m_height.value_or(0)); - return SVGAnimatedLength::create(move(base_length), move(anim_length)); + auto base_length = SVGLength::create(window(), 0, m_height.value_or(0)); + auto anim_length = SVGLength::create(window(), 0, m_height.value_or(0)); + return SVGAnimatedLength::create(window(), move(base_length), move(anim_length)); } // https://www.w3.org/TR/SVG11/shapes.html#RectElementRXAttribute -NonnullRefPtr SVGRectElement::rx() const +JS::NonnullGCPtr SVGRectElement::rx() const { // FIXME: Populate the unit type when it is parsed (0 here is "unknown"). // FIXME: Create a proper animated value when animations are supported. - auto base_length = SVGLength::create(0, m_radius_x.value_or(0)); - auto anim_length = SVGLength::create(0, m_radius_x.value_or(0)); - return SVGAnimatedLength::create(move(base_length), move(anim_length)); + auto base_length = SVGLength::create(window(), 0, m_radius_x.value_or(0)); + auto anim_length = SVGLength::create(window(), 0, m_radius_x.value_or(0)); + return SVGAnimatedLength::create(window(), move(base_length), move(anim_length)); } // https://www.w3.org/TR/SVG11/shapes.html#RectElementRYAttribute -NonnullRefPtr SVGRectElement::ry() const +JS::NonnullGCPtr SVGRectElement::ry() const { // FIXME: Populate the unit type when it is parsed (0 here is "unknown"). // FIXME: Create a proper animated value when animations are supported. - auto base_length = SVGLength::create(0, m_radius_y.value_or(0)); - auto anim_length = SVGLength::create(0, m_radius_y.value_or(0)); - return SVGAnimatedLength::create(move(base_length), move(anim_length)); + auto base_length = SVGLength::create(window(), 0, m_radius_y.value_or(0)); + auto anim_length = SVGLength::create(window(), 0, m_radius_y.value_or(0)); + return SVGAnimatedLength::create(window(), move(base_length), move(anim_length)); } } diff --git a/Userland/Libraries/LibWeb/SVG/SVGRectElement.h b/Userland/Libraries/LibWeb/SVG/SVGRectElement.h index 9e647accf7..b80e539db4 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGRectElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGRectElement.h @@ -21,12 +21,12 @@ public: virtual Gfx::Path& get_path() override; - NonnullRefPtr x() const; - NonnullRefPtr y() const; - NonnullRefPtr width() const; - NonnullRefPtr height() const; - NonnullRefPtr rx() const; - NonnullRefPtr ry() const; + JS::NonnullGCPtr x() const; + JS::NonnullGCPtr y() const; + JS::NonnullGCPtr width() const; + JS::NonnullGCPtr height() const; + JS::NonnullGCPtr rx() const; + JS::NonnullGCPtr ry() const; private: SVGRectElement(DOM::Document&, DOM::QualifiedName); diff --git a/Userland/Libraries/LibWeb/idl_files.cmake b/Userland/Libraries/LibWeb/idl_files.cmake index b7472ef6ec..b740482ded 100644 --- a/Userland/Libraries/LibWeb/idl_files.cmake +++ b/Userland/Libraries/LibWeb/idl_files.cmake @@ -159,7 +159,7 @@ libweb_js_wrapper(IntersectionObserver/IntersectionObserver) libweb_js_wrapper(NavigationTiming/PerformanceTiming NO_INSTANCE) libweb_js_wrapper(RequestIdleCallback/IdleDeadline) libweb_js_wrapper(ResizeObserver/ResizeObserver) -libweb_js_wrapper(SVG/SVGAnimatedLength) +libweb_js_wrapper(SVG/SVGAnimatedLength NO_INSTANCE) libweb_js_wrapper(SVG/SVGClipPathElement NO_INSTANCE) libweb_js_wrapper(SVG/SVGDefsElement NO_INSTANCE) libweb_js_wrapper(SVG/SVGElement NO_INSTANCE) @@ -167,7 +167,7 @@ libweb_js_wrapper(SVG/SVGGeometryElement NO_INSTANCE) libweb_js_wrapper(SVG/SVGGraphicsElement NO_INSTANCE) libweb_js_wrapper(SVG/SVGCircleElement NO_INSTANCE) libweb_js_wrapper(SVG/SVGEllipseElement NO_INSTANCE) -libweb_js_wrapper(SVG/SVGLength) +libweb_js_wrapper(SVG/SVGLength NO_INSTANCE) libweb_js_wrapper(SVG/SVGLineElement NO_INSTANCE) libweb_js_wrapper(SVG/SVGPathElement NO_INSTANCE) libweb_js_wrapper(SVG/SVGPolygonElement NO_INSTANCE)