SVGAnimatedLength.cpp 1.3 KB

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