mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:58:12 +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
|
@ -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());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue