AnimationEvent.cpp 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (c) 2024, Matthew Olsson <mattco@serenityos.org>.
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/Bindings/AnimationEventPrototype.h>
  7. #include <LibWeb/Bindings/Intrinsics.h>
  8. #include <LibWeb/CSS/AnimationEvent.h>
  9. namespace Web::CSS {
  10. JS_DEFINE_ALLOCATOR(AnimationEvent);
  11. JS::NonnullGCPtr<AnimationEvent> AnimationEvent::create(JS::Realm& realm, FlyString const& type, AnimationEventInit const& event_init)
  12. {
  13. return realm.heap().allocate<AnimationEvent>(realm, realm, type, event_init);
  14. }
  15. WebIDL::ExceptionOr<JS::NonnullGCPtr<AnimationEvent>> AnimationEvent::construct_impl(JS::Realm& realm, FlyString const& type, AnimationEventInit const& event_init)
  16. {
  17. return create(realm, type, event_init);
  18. }
  19. AnimationEvent::AnimationEvent(JS::Realm& realm, FlyString const& type, AnimationEventInit const& event_init)
  20. : DOM::Event(realm, type, event_init)
  21. , m_animation_name(event_init.animation_name)
  22. , m_elapsed_time(event_init.elapsed_time)
  23. , m_pseudo_element(event_init.pseudo_element)
  24. {
  25. }
  26. void AnimationEvent::initialize(JS::Realm& realm)
  27. {
  28. Base::initialize(realm);
  29. WEB_SET_PROTOTYPE_FOR_INTERFACE(AnimationEvent);
  30. }
  31. }