SVGAnimatedLength.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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/Bindings/SVGAnimatedLengthPrototype.h>
  8. #include <LibWeb/SVG/SVGAnimatedLength.h>
  9. namespace Web::SVG {
  10. GC_DEFINE_ALLOCATOR(SVGAnimatedLength);
  11. GC::Ref<SVGAnimatedLength> SVGAnimatedLength::create(JS::Realm& realm, GC::Ref<SVGLength> base_val, GC::Ref<SVGLength> anim_val)
  12. {
  13. return realm.create<SVGAnimatedLength>(realm, move(base_val), move(anim_val));
  14. }
  15. SVGAnimatedLength::SVGAnimatedLength(JS::Realm& realm, GC::Ref<SVGLength> base_val, GC::Ref<SVGLength> anim_val)
  16. : PlatformObject(realm)
  17. , m_base_val(move(base_val))
  18. , m_anim_val(move(anim_val))
  19. {
  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::initialize(JS::Realm& realm)
  25. {
  26. Base::initialize(realm);
  27. WEB_SET_PROTOTYPE_FOR_INTERFACE(SVGAnimatedLength);
  28. }
  29. void SVGAnimatedLength::visit_edges(Cell::Visitor& visitor)
  30. {
  31. Base::visit_edges(visitor);
  32. visitor.visit(m_base_val);
  33. visitor.visit(m_anim_val);
  34. }
  35. }