mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 20:52:45 +00:00 
			
		
		
		
	LibWeb: Make SVGLength and SVGAnimatedLength GC-allocated
This commit is contained in:
		
							parent
							
								
									16fbb91aa1
								
							
						
					
					
						commit
						3905d54a9c
					
				
					 14 changed files with 139 additions and 126 deletions
				
			
		|  | @ -473,8 +473,6 @@ class ResizeObserverWrapper; | |||
| class SelectionWrapper; | ||||
| class StorageWrapper; | ||||
| class SubtleCryptoWrapper; | ||||
| class SVGAnimatedLengthWrapper; | ||||
| class SVGLengthWrapper; | ||||
| class TextDecoderWrapper; | ||||
| class TextEncoderWrapper; | ||||
| class TextMetricsWrapper; | ||||
|  |  | |||
|  | @ -4,21 +4,35 @@ | |||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
| 
 | ||||
| #include <LibWeb/Bindings/SVGAnimatedLengthPrototype.h> | ||||
| #include <LibWeb/HTML/Window.h> | ||||
| #include <LibWeb/SVG/SVGAnimatedLength.h> | ||||
| 
 | ||||
| namespace Web::SVG { | ||||
| 
 | ||||
| NonnullRefPtr<SVGAnimatedLength> SVGAnimatedLength::create(NonnullRefPtr<SVGLength> base_val, NonnullRefPtr<SVGLength> anim_val) | ||||
| JS::NonnullGCPtr<SVGAnimatedLength> SVGAnimatedLength::create(HTML::Window& window, JS::NonnullGCPtr<SVGLength> base_val, JS::NonnullGCPtr<SVGLength> anim_val) | ||||
| { | ||||
|     return adopt_ref(*new SVGAnimatedLength(move(base_val), move(anim_val))); | ||||
|     return *window.heap().allocate<SVGAnimatedLength>(window.realm(), window, move(base_val), move(anim_val)); | ||||
| } | ||||
| 
 | ||||
| SVGAnimatedLength::SVGAnimatedLength(NonnullRefPtr<SVGLength> base_val, NonnullRefPtr<SVGLength> anim_val) | ||||
|     : m_base_val(move(base_val)) | ||||
| SVGAnimatedLength::SVGAnimatedLength(HTML::Window& window, JS::NonnullGCPtr<SVGLength> base_val, JS::NonnullGCPtr<SVGLength> anim_val) | ||||
|     : PlatformObject(window.realm()) | ||||
|     , m_base_val(move(base_val)) | ||||
|     , m_anim_val(move(anim_val)) | ||||
| { | ||||
|     set_prototype(&window.ensure_web_prototype<Bindings::SVGAnimatedLengthPrototype>("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()); | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -6,32 +6,31 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <AK/RefCounted.h> | ||||
| #include <AK/Weakable.h> | ||||
| #include <LibWeb/Bindings/Wrappable.h> | ||||
| #include <LibWeb/Bindings/PlatformObject.h> | ||||
| #include <LibWeb/SVG/SVGLength.h> | ||||
| 
 | ||||
| namespace Web::SVG { | ||||
| 
 | ||||
| // https://www.w3.org/TR/SVG11/types.html#InterfaceSVGAnimatedLength
 | ||||
| class SVGAnimatedLength | ||||
|     : public RefCounted<SVGAnimatedLength> | ||||
|     , public Bindings::Wrappable | ||||
|     , public Weakable<SVGAnimatedLength> { | ||||
| class SVGAnimatedLength final : public Bindings::PlatformObject { | ||||
|     WEB_PLATFORM_OBJECT(SVGAnimatedLength, Bindings::PlatformObject); | ||||
| 
 | ||||
| public: | ||||
|     using WrapperType = Bindings::SVGAnimatedLengthWrapper; | ||||
|     static JS::NonnullGCPtr<SVGAnimatedLength> create(HTML::Window&, JS::NonnullGCPtr<SVGLength> base_val, JS::NonnullGCPtr<SVGLength> anim_val); | ||||
|     virtual ~SVGAnimatedLength() override; | ||||
| 
 | ||||
|     static NonnullRefPtr<SVGAnimatedLength> create(NonnullRefPtr<SVGLength> base_val, NonnullRefPtr<SVGLength> anim_val); | ||||
|     virtual ~SVGAnimatedLength() = default; | ||||
| 
 | ||||
|     NonnullRefPtr<SVGLength> const& base_val() const { return m_base_val; } | ||||
|     NonnullRefPtr<SVGLength> const& anim_val() const { return m_anim_val; } | ||||
|     JS::NonnullGCPtr<SVGLength> base_val() const { return m_base_val; } | ||||
|     JS::NonnullGCPtr<SVGLength> anim_val() const { return m_anim_val; } | ||||
| 
 | ||||
| private: | ||||
|     SVGAnimatedLength(NonnullRefPtr<SVGLength> base_val, NonnullRefPtr<SVGLength> anim_val); | ||||
|     SVGAnimatedLength(HTML::Window&, JS::NonnullGCPtr<SVGLength> base_val, JS::NonnullGCPtr<SVGLength> anim_val); | ||||
| 
 | ||||
|     NonnullRefPtr<SVGLength> m_base_val; | ||||
|     NonnullRefPtr<SVGLength> m_anim_val; | ||||
|     virtual void visit_edges(Cell::Visitor&) override; | ||||
| 
 | ||||
|     JS::NonnullGCPtr<SVGLength> m_base_val; | ||||
|     JS::NonnullGCPtr<SVGLength> m_anim_val; | ||||
| }; | ||||
| 
 | ||||
| } | ||||
| 
 | ||||
| WRAPPER_HACK(SVGAnimatedLength, Web::SVG) | ||||
|  |  | |||
|  | @ -74,33 +74,33 @@ Gfx::Path& SVGCircleElement::get_path() | |||
| } | ||||
| 
 | ||||
| // https://www.w3.org/TR/SVG11/shapes.html#CircleElementCXAttribute
 | ||||
| NonnullRefPtr<SVGAnimatedLength> SVGCircleElement::cx() const | ||||
| JS::NonnullGCPtr<SVGAnimatedLength> 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<SVGAnimatedLength> SVGCircleElement::cy() const | ||||
| JS::NonnullGCPtr<SVGAnimatedLength> 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<SVGAnimatedLength> SVGCircleElement::r() const | ||||
| JS::NonnullGCPtr<SVGAnimatedLength> 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)); | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -21,9 +21,9 @@ public: | |||
| 
 | ||||
|     virtual Gfx::Path& get_path() override; | ||||
| 
 | ||||
|     NonnullRefPtr<SVGAnimatedLength> cx() const; | ||||
|     NonnullRefPtr<SVGAnimatedLength> cy() const; | ||||
|     NonnullRefPtr<SVGAnimatedLength> r() const; | ||||
|     JS::NonnullGCPtr<SVGAnimatedLength> cx() const; | ||||
|     JS::NonnullGCPtr<SVGAnimatedLength> cy() const; | ||||
|     JS::NonnullGCPtr<SVGAnimatedLength> r() const; | ||||
| 
 | ||||
| private: | ||||
|     SVGCircleElement(DOM::Document&, DOM::QualifiedName); | ||||
|  |  | |||
|  | @ -79,43 +79,43 @@ Gfx::Path& SVGEllipseElement::get_path() | |||
| } | ||||
| 
 | ||||
| // https://www.w3.org/TR/SVG11/shapes.html#EllipseElementCXAttribute
 | ||||
| NonnullRefPtr<SVGAnimatedLength> SVGEllipseElement::cx() const | ||||
| JS::NonnullGCPtr<SVGAnimatedLength> 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<SVGAnimatedLength> SVGEllipseElement::cy() const | ||||
| JS::NonnullGCPtr<SVGAnimatedLength> 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<SVGAnimatedLength> SVGEllipseElement::rx() const | ||||
| JS::NonnullGCPtr<SVGAnimatedLength> 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<SVGAnimatedLength> SVGEllipseElement::ry() const | ||||
| JS::NonnullGCPtr<SVGAnimatedLength> 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)); | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -21,10 +21,10 @@ public: | |||
| 
 | ||||
|     virtual Gfx::Path& get_path() override; | ||||
| 
 | ||||
|     NonnullRefPtr<SVGAnimatedLength> cx() const; | ||||
|     NonnullRefPtr<SVGAnimatedLength> cy() const; | ||||
|     NonnullRefPtr<SVGAnimatedLength> rx() const; | ||||
|     NonnullRefPtr<SVGAnimatedLength> ry() const; | ||||
|     JS::NonnullGCPtr<SVGAnimatedLength> cx() const; | ||||
|     JS::NonnullGCPtr<SVGAnimatedLength> cy() const; | ||||
|     JS::NonnullGCPtr<SVGAnimatedLength> rx() const; | ||||
|     JS::NonnullGCPtr<SVGAnimatedLength> ry() const; | ||||
| 
 | ||||
| private: | ||||
|     SVGEllipseElement(DOM::Document&, DOM::QualifiedName); | ||||
|  |  | |||
|  | @ -4,21 +4,27 @@ | |||
|  * SPDX-License-Identifier: BSD-2-Clause | ||||
|  */ | ||||
| 
 | ||||
| #include <LibWeb/Bindings/SVGLengthPrototype.h> | ||||
| #include <LibWeb/HTML/Window.h> | ||||
| #include <LibWeb/SVG/SVGLength.h> | ||||
| 
 | ||||
| namespace Web::SVG { | ||||
| 
 | ||||
| NonnullRefPtr<SVGLength> SVGLength::create(u8 unit_type, float value) | ||||
| JS::NonnullGCPtr<SVGLength> SVGLength::create(HTML::Window& window, u8 unit_type, float value) | ||||
| { | ||||
|     return adopt_ref(*new SVGLength(unit_type, value)); | ||||
|     return *window.heap().allocate<SVGLength>(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<Bindings::SVGLengthPrototype>("SVGLength")); | ||||
| } | ||||
| 
 | ||||
| SVGLength::~SVGLength() = default; | ||||
| 
 | ||||
| // https://www.w3.org/TR/SVG11/types.html#__svg__SVGLength__value
 | ||||
| DOM::ExceptionOr<void> SVGLength::set_value(float value) | ||||
| { | ||||
|  |  | |||
|  | @ -6,24 +6,18 @@ | |||
| 
 | ||||
| #pragma once | ||||
| 
 | ||||
| #include <AK/RefCounted.h> | ||||
| #include <AK/Types.h> | ||||
| #include <AK/Weakable.h> | ||||
| #include <LibWeb/Bindings/Wrappable.h> | ||||
| #include <LibWeb/Bindings/PlatformObject.h> | ||||
| #include <LibWeb/DOM/ExceptionOr.h> | ||||
| 
 | ||||
| namespace Web::SVG { | ||||
| 
 | ||||
| // https://www.w3.org/TR/SVG11/types.html#InterfaceSVGLength
 | ||||
| class SVGLength | ||||
|     : public RefCounted<SVGLength> | ||||
|     , public Bindings::Wrappable | ||||
|     , public Weakable<SVGLength> { | ||||
| public: | ||||
|     using WrapperType = Bindings::SVGLengthWrapper; | ||||
| class SVGLength : public Bindings::PlatformObject { | ||||
|     WEB_PLATFORM_OBJECT(SVGLength, Bindings::PlatformObject); | ||||
| 
 | ||||
|     static NonnullRefPtr<SVGLength> create(u8 unit_type, float value); | ||||
|     virtual ~SVGLength() = default; | ||||
| public: | ||||
|     static JS::NonnullGCPtr<SVGLength> 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<void> 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) | ||||
|  |  | |||
|  | @ -59,43 +59,43 @@ Gfx::Path& SVGLineElement::get_path() | |||
| } | ||||
| 
 | ||||
| // https://www.w3.org/TR/SVG11/shapes.html#LineElementX1Attribute
 | ||||
| NonnullRefPtr<SVGAnimatedLength> SVGLineElement::x1() const | ||||
| JS::NonnullGCPtr<SVGAnimatedLength> 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<SVGAnimatedLength> SVGLineElement::y1() const | ||||
| JS::NonnullGCPtr<SVGAnimatedLength> 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<SVGAnimatedLength> SVGLineElement::x2() const | ||||
| JS::NonnullGCPtr<SVGAnimatedLength> 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<SVGAnimatedLength> SVGLineElement::y2() const | ||||
| JS::NonnullGCPtr<SVGAnimatedLength> 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)); | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -21,10 +21,10 @@ public: | |||
| 
 | ||||
|     virtual Gfx::Path& get_path() override; | ||||
| 
 | ||||
|     NonnullRefPtr<SVGAnimatedLength> x1() const; | ||||
|     NonnullRefPtr<SVGAnimatedLength> y1() const; | ||||
|     NonnullRefPtr<SVGAnimatedLength> x2() const; | ||||
|     NonnullRefPtr<SVGAnimatedLength> y2() const; | ||||
|     JS::NonnullGCPtr<SVGAnimatedLength> x1() const; | ||||
|     JS::NonnullGCPtr<SVGAnimatedLength> y1() const; | ||||
|     JS::NonnullGCPtr<SVGAnimatedLength> x2() const; | ||||
|     JS::NonnullGCPtr<SVGAnimatedLength> y2() const; | ||||
| 
 | ||||
| private: | ||||
|     SVGLineElement(DOM::Document&, DOM::QualifiedName); | ||||
|  |  | |||
|  | @ -156,63 +156,63 @@ Gfx::FloatPoint SVGRectElement::calculate_used_corner_radius_values() | |||
| } | ||||
| 
 | ||||
| // https://www.w3.org/TR/SVG11/shapes.html#RectElementXAttribute
 | ||||
| NonnullRefPtr<SVGAnimatedLength> SVGRectElement::x() const | ||||
| JS::NonnullGCPtr<SVGAnimatedLength> 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<SVGAnimatedLength> SVGRectElement::y() const | ||||
| JS::NonnullGCPtr<SVGAnimatedLength> 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<SVGAnimatedLength> SVGRectElement::width() const | ||||
| JS::NonnullGCPtr<SVGAnimatedLength> 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<SVGAnimatedLength> SVGRectElement::height() const | ||||
| JS::NonnullGCPtr<SVGAnimatedLength> 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<SVGAnimatedLength> SVGRectElement::rx() const | ||||
| JS::NonnullGCPtr<SVGAnimatedLength> 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<SVGAnimatedLength> SVGRectElement::ry() const | ||||
| JS::NonnullGCPtr<SVGAnimatedLength> 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)); | ||||
| } | ||||
| 
 | ||||
| } | ||||
|  |  | |||
|  | @ -21,12 +21,12 @@ public: | |||
| 
 | ||||
|     virtual Gfx::Path& get_path() override; | ||||
| 
 | ||||
|     NonnullRefPtr<SVGAnimatedLength> x() const; | ||||
|     NonnullRefPtr<SVGAnimatedLength> y() const; | ||||
|     NonnullRefPtr<SVGAnimatedLength> width() const; | ||||
|     NonnullRefPtr<SVGAnimatedLength> height() const; | ||||
|     NonnullRefPtr<SVGAnimatedLength> rx() const; | ||||
|     NonnullRefPtr<SVGAnimatedLength> ry() const; | ||||
|     JS::NonnullGCPtr<SVGAnimatedLength> x() const; | ||||
|     JS::NonnullGCPtr<SVGAnimatedLength> y() const; | ||||
|     JS::NonnullGCPtr<SVGAnimatedLength> width() const; | ||||
|     JS::NonnullGCPtr<SVGAnimatedLength> height() const; | ||||
|     JS::NonnullGCPtr<SVGAnimatedLength> rx() const; | ||||
|     JS::NonnullGCPtr<SVGAnimatedLength> ry() const; | ||||
| 
 | ||||
| private: | ||||
|     SVGRectElement(DOM::Document&, DOM::QualifiedName); | ||||
|  |  | |||
|  | @ -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) | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling