SVGAnimatedLength.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. // The object referenced by animVal will always be distinct from the one referenced by baseVal, even when the attribute is not animated.
  19. VERIFY(m_base_val.ptr() != m_anim_val.ptr());
  20. }
  21. SVGAnimatedLength::~SVGAnimatedLength() = default;
  22. void SVGAnimatedLength::initialize(JS::Realm& realm)
  23. {
  24. Base::initialize(realm);
  25. set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGAnimatedLengthPrototype>(realm, "SVGAnimatedLength"));
  26. }
  27. void SVGAnimatedLength::visit_edges(Cell::Visitor& visitor)
  28. {
  29. Base::visit_edges(visitor);
  30. visitor.visit(m_base_val.ptr());
  31. visitor.visit(m_anim_val.ptr());
  32. }
  33. }