2023-11-04 16:20:39 -03:00
|
|
|
/*
|
2026-02-16 11:23:14 -03:00
|
|
|
* Copyright (c) 2023, Matthew Olsson <mattco@serenityos.org>
|
|
|
|
|
* Copyright (c) 2026, Sam Atkins <sam@ladybird.org>
|
2023-11-04 16:20:39 -03:00
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include <LibWeb/Animations/AnimationPlaybackEvent.h>
|
2026-04-18 05:54:06 -03:00
|
|
|
#include <LibWeb/Bindings/AnimationPlaybackEvent.h>
|
2023-11-04 16:20:39 -03:00
|
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
2026-02-16 11:23:14 -03:00
|
|
|
#include <LibWeb/CSS/CSSNumericValue.h>
|
2023-11-04 16:20:39 -03:00
|
|
|
|
|
|
|
|
namespace Web::Animations {
|
|
|
|
|
|
2024-11-14 12:01:23 -03:00
|
|
|
GC_DEFINE_ALLOCATOR(AnimationPlaybackEvent);
|
2023-11-19 15:47:52 -03:00
|
|
|
|
2026-05-01 14:01:23 -03:00
|
|
|
GC::Ref<AnimationPlaybackEvent> AnimationPlaybackEvent::create(JS::Realm& realm, FlyString const& type, Bindings::AnimationPlaybackEventInit const& event_init)
|
2023-11-04 16:20:39 -03:00
|
|
|
{
|
2024-11-13 13:50:17 -03:00
|
|
|
return realm.create<AnimationPlaybackEvent>(realm, type, event_init);
|
2023-11-04 16:20:39 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// https://www.w3.org/TR/web-animations-1/#dom-animationplaybackevent-animationplaybackevent
|
2026-05-01 14:01:23 -03:00
|
|
|
WebIDL::ExceptionOr<GC::Ref<AnimationPlaybackEvent>> AnimationPlaybackEvent::construct_impl(JS::Realm& realm, FlyString const& type, Bindings::AnimationPlaybackEventInit const& event_init)
|
2023-11-04 16:20:39 -03:00
|
|
|
{
|
2024-02-03 22:23:14 -03:00
|
|
|
return create(realm, type, event_init);
|
2023-11-04 16:20:39 -03:00
|
|
|
}
|
|
|
|
|
|
2026-05-01 14:01:23 -03:00
|
|
|
AnimationPlaybackEvent::AnimationPlaybackEvent(JS::Realm& realm, FlyString const& type, Bindings::AnimationPlaybackEventInit const& event_init)
|
2024-02-03 22:23:14 -03:00
|
|
|
: DOM::Event(realm, type, event_init)
|
2026-05-20 15:58:46 -03:00
|
|
|
, m_current_time(event_init.current_time)
|
|
|
|
|
, m_timeline_time(event_init.timeline_time)
|
2023-11-04 16:20:39 -03:00
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AnimationPlaybackEvent::initialize(JS::Realm& realm)
|
|
|
|
|
{
|
2024-03-16 09:13:08 -03:00
|
|
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(AnimationPlaybackEvent);
|
2025-04-20 11:22:57 -03:00
|
|
|
Base::initialize(realm);
|
2023-11-04 16:20:39 -03:00
|
|
|
}
|
|
|
|
|
|
2026-02-16 11:23:14 -03:00
|
|
|
void AnimationPlaybackEvent::visit_edges(Visitor& visitor)
|
|
|
|
|
{
|
|
|
|
|
Base::visit_edges(visitor);
|
2026-04-14 14:03:06 -03:00
|
|
|
visitor.visit(m_current_time);
|
|
|
|
|
visitor.visit(m_timeline_time);
|
2026-02-16 11:23:14 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NullableCSSNumberish AnimationPlaybackEvent::current_time() const
|
|
|
|
|
{
|
2026-05-20 15:58:46 -03:00
|
|
|
return m_current_time;
|
2026-02-16 11:23:14 -03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
NullableCSSNumberish AnimationPlaybackEvent::timeline_time() const
|
|
|
|
|
{
|
2026-05-20 15:58:46 -03:00
|
|
|
return m_timeline_time;
|
2026-02-16 11:23:14 -03:00
|
|
|
}
|
|
|
|
|
|
2023-11-04 16:20:39 -03:00
|
|
|
}
|