AnimationPlaybackEvent.cpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  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/Intrinsics.h>
  8. namespace Web::Animations {
  9. JS_DEFINE_ALLOCATOR(AnimationPlaybackEvent);
  10. JS::NonnullGCPtr<AnimationPlaybackEvent> AnimationPlaybackEvent::create(JS::Realm& realm, FlyString const& type, AnimationPlaybackEventInit const& event_init)
  11. {
  12. return realm.heap().allocate<AnimationPlaybackEvent>(realm, realm, type, event_init);
  13. }
  14. // https://www.w3.org/TR/web-animations-1/#dom-animationplaybackevent-animationplaybackevent
  15. WebIDL::ExceptionOr<JS::NonnullGCPtr<AnimationPlaybackEvent>> AnimationPlaybackEvent::construct_impl(JS::Realm& realm, FlyString const& type, AnimationPlaybackEventInit const& event_init)
  16. {
  17. return create(realm, type, event_init);
  18. }
  19. AnimationPlaybackEvent::AnimationPlaybackEvent(JS::Realm& realm, FlyString const& type, AnimationPlaybackEventInit const& event_init)
  20. : DOM::Event(realm, type, event_init)
  21. , m_current_time(event_init.current_time)
  22. , m_timeline_time(event_init.timeline_time)
  23. {
  24. }
  25. void AnimationPlaybackEvent::initialize(JS::Realm& realm)
  26. {
  27. Base::initialize(realm);
  28. WEB_SET_PROTOTYPE_FOR_INTERFACE(AnimationPlaybackEvent);
  29. }
  30. }