AnimationPlaybackEvent.cpp 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (c) 2023, Matthew Olsson <mattco@serenityos.org>.
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <LibWeb/Animations/AnimationPlaybackEvent.h>
  7. #include <LibWeb/Bindings/AnimationPlaybackEventPrototype.h>
  8. #include <LibWeb/Bindings/Intrinsics.h>
  9. namespace Web::Animations {
  10. JS_DEFINE_ALLOCATOR(AnimationPlaybackEvent);
  11. JS::NonnullGCPtr<AnimationPlaybackEvent> AnimationPlaybackEvent::create(JS::Realm& realm, FlyString const& type, AnimationPlaybackEventInit const& event_init)
  12. {
  13. return realm.create<AnimationPlaybackEvent>(realm, type, event_init);
  14. }
  15. // https://www.w3.org/TR/web-animations-1/#dom-animationplaybackevent-animationplaybackevent
  16. WebIDL::ExceptionOr<JS::NonnullGCPtr<AnimationPlaybackEvent>> AnimationPlaybackEvent::construct_impl(JS::Realm& realm, FlyString const& type, AnimationPlaybackEventInit const& event_init)
  17. {
  18. return create(realm, type, event_init);
  19. }
  20. AnimationPlaybackEvent::AnimationPlaybackEvent(JS::Realm& realm, FlyString const& type, AnimationPlaybackEventInit const& event_init)
  21. : DOM::Event(realm, type, event_init)
  22. , m_current_time(event_init.current_time)
  23. , m_timeline_time(event_init.timeline_time)
  24. {
  25. }
  26. void AnimationPlaybackEvent::initialize(JS::Realm& realm)
  27. {
  28. Base::initialize(realm);
  29. WEB_SET_PROTOTYPE_FOR_INTERFACE(AnimationPlaybackEvent);
  30. }
  31. }