mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:07:34 +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
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue