/src/serenity/Userland/Libraries/LibWeb/SVG/SVGAnimatedLength.cpp
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2022, Tim Flynn <trflynn89@serenityos.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #include <LibWeb/Bindings/Intrinsics.h> |
8 | | #include <LibWeb/Bindings/SVGAnimatedLengthPrototype.h> |
9 | | #include <LibWeb/SVG/SVGAnimatedLength.h> |
10 | | |
11 | | namespace Web::SVG { |
12 | | |
13 | | JS_DEFINE_ALLOCATOR(SVGAnimatedLength); |
14 | | |
15 | | JS::NonnullGCPtr<SVGAnimatedLength> SVGAnimatedLength::create(JS::Realm& realm, JS::NonnullGCPtr<SVGLength> base_val, JS::NonnullGCPtr<SVGLength> anim_val) |
16 | 0 | { |
17 | 0 | return realm.heap().allocate<SVGAnimatedLength>(realm, realm, move(base_val), move(anim_val)); |
18 | 0 | } |
19 | | |
20 | | SVGAnimatedLength::SVGAnimatedLength(JS::Realm& realm, JS::NonnullGCPtr<SVGLength> base_val, JS::NonnullGCPtr<SVGLength> anim_val) |
21 | 0 | : PlatformObject(realm) |
22 | 0 | , m_base_val(move(base_val)) |
23 | 0 | , m_anim_val(move(anim_val)) |
24 | 0 | { |
25 | | // The object referenced by animVal will always be distinct from the one referenced by baseVal, even when the attribute is not animated. |
26 | 0 | VERIFY(m_base_val.ptr() != m_anim_val.ptr()); |
27 | 0 | } |
28 | | |
29 | 0 | SVGAnimatedLength::~SVGAnimatedLength() = default; |
30 | | |
31 | | void SVGAnimatedLength::initialize(JS::Realm& realm) |
32 | 0 | { |
33 | 0 | Base::initialize(realm); |
34 | 0 | WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGAnimatedLength); |
35 | 0 | } |
36 | | |
37 | | void SVGAnimatedLength::visit_edges(Cell::Visitor& visitor) |
38 | 0 | { |
39 | 0 | Base::visit_edges(visitor); |
40 | 0 | visitor.visit(m_base_val); |
41 | 0 | visitor.visit(m_anim_val); |
42 | 0 | } |
43 | | |
44 | | } |