SVGAnimatedNumber.cpp 944 B

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright (c) 2023, MacDue <macdue@dueutil.tech>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/Bindings/Intrinsics.h>
  7. #include <LibWeb/SVG/SVGAnimatedNumber.h>
  8. namespace Web::SVG {
  9. WebIDL::ExceptionOr<JS::NonnullGCPtr<SVGAnimatedNumber>> SVGAnimatedNumber::create(JS::Realm& realm, float base_val, float anim_val)
  10. {
  11. return MUST_OR_THROW_OOM(realm.heap().allocate<SVGAnimatedNumber>(realm, realm, base_val, anim_val));
  12. }
  13. SVGAnimatedNumber::SVGAnimatedNumber(JS::Realm& realm, float base_val, float anim_val)
  14. : PlatformObject(realm)
  15. , m_base_val(base_val)
  16. , m_anim_val(anim_val)
  17. {
  18. }
  19. SVGAnimatedNumber::~SVGAnimatedNumber() = default;
  20. JS::ThrowCompletionOr<void> SVGAnimatedNumber::initialize(JS::Realm& realm)
  21. {
  22. MUST_OR_THROW_OOM(Base::initialize(realm));
  23. set_prototype(&Bindings::ensure_web_prototype<Bindings::SVGAnimatedNumberPrototype>(realm, "SVGAnimatedNumber"));
  24. return {};
  25. }
  26. }