1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:48:10 +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

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