SVGAnimatedLength.cpp 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  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::NonnullGCPtr<SVGAnimatedLength> SVGAnimatedLength::create(JS::Realm& realm, JS::NonnullGCPtr<SVGLength> base_val, JS::NonnullGCPtr<SVGLength> anim_val)
  10. {
  11. return *realm.heap().allocate<SVGAnimatedLength>(realm, realm, move(base_val), move(anim_val));
  12. }
  13. SVGAnimatedLength::SVGAnimatedLength(JS::Realm& realm, JS::NonnullGCPtr<SVGLength> base_val, JS::NonnullGCPtr<SVGLength> anim_val)
  14. : PlatformObject(realm)
  15. , m_base_val(move(base_val))
  16. , m_anim_val(move(anim_val))
  17. {
  18. set_prototype(&Bindings::cached_web_prototype(realm, "SVGAnimatedLength"));
  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::visit_edges(Cell::Visitor& visitor)
  24. {
  25. Base::visit_edges(visitor);
  26. visitor.visit(m_base_val.ptr());
  27. visitor.visit(m_anim_val.ptr());
  28. }
  29. }