SVGAnimatedLength.cpp 1.3 KB

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