2023-11-04 12:20:39 -07:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2023, Matthew Olsson <mattco@serenityos.org>.
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <LibWeb/Bindings/PlatformObject.h>
|
|
|
|
|
#include <LibWeb/DOM/Event.h>
|
|
|
|
|
|
|
|
|
|
namespace Web::Animations {
|
|
|
|
|
|
|
|
|
|
// https://www.w3.org/TR/web-animations-1/#dictdef-animationplaybackeventinit
|
|
|
|
|
struct AnimationPlaybackEventInit : public DOM::EventInit {
|
|
|
|
|
Optional<double> current_time {};
|
|
|
|
|
Optional<double> timeline_time {};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// https://www.w3.org/TR/web-animations-1/#animationplaybackevent
|
|
|
|
|
class AnimationPlaybackEvent : public DOM::Event {
|
|
|
|
|
WEB_PLATFORM_OBJECT(AnimationPlaybackEvent, DOM::Event);
|
2024-11-15 04:01:23 +13:00
|
|
|
GC_DECLARE_ALLOCATOR(AnimationPlaybackEvent);
|
2023-11-04 12:20:39 -07:00
|
|
|
|
|
|
|
|
public:
|
2024-11-15 04:01:23 +13:00
|
|
|
[[nodiscard]] static GC::Ref<AnimationPlaybackEvent> create(JS::Realm&, FlyString const& type, AnimationPlaybackEventInit const& event_init = {});
|
|
|
|
|
static WebIDL::ExceptionOr<GC::Ref<AnimationPlaybackEvent>> construct_impl(JS::Realm&, FlyString const& type, AnimationPlaybackEventInit const& event_init);
|
2023-11-04 12:20:39 -07:00
|
|
|
|
|
|
|
|
virtual ~AnimationPlaybackEvent() override = default;
|
|
|
|
|
|
|
|
|
|
Optional<double> current_time() const { return m_current_time; }
|
|
|
|
|
void set_current_time(Optional<double> current_time) { m_current_time = current_time; }
|
|
|
|
|
|
|
|
|
|
Optional<double> timeline_time() const { return m_timeline_time; }
|
|
|
|
|
void set_timeline_time(Optional<double> timeline_time) { m_timeline_time = timeline_time; }
|
|
|
|
|
|
|
|
|
|
private:
|
2024-02-03 18:23:14 -07:00
|
|
|
AnimationPlaybackEvent(JS::Realm&, FlyString const& type, AnimationPlaybackEventInit const& event_init);
|
2023-11-04 12:20:39 -07:00
|
|
|
|
|
|
|
|
virtual void initialize(JS::Realm&) override;
|
|
|
|
|
|
|
|
|
|
// https://www.w3.org/TR/web-animations-1/#dom-animationplaybackeventinit-currenttime
|
|
|
|
|
Optional<double> m_current_time {};
|
|
|
|
|
|
|
|
|
|
// https://www.w3.org/TR/web-animations-1/#dom-animationplaybackeventinit-timelinetime
|
|
|
|
|
Optional<double> m_timeline_time {};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
}
|