1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 16:07:47 +00:00

LibWeb: Make SVGLength and SVGAnimatedLength GC-allocated

This commit is contained in:
Andreas Kling 2022-09-02 14:04:59 +02:00
parent 16fbb91aa1
commit 3905d54a9c
14 changed files with 139 additions and 126 deletions

View file

@ -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)