ladybird/Libraries/LibWeb/Animations/AnimationPlaybackEvent.h
Shannon Booth 637fd51595 LibWeb: Unify WebIDL C++ type generation
Represent WebIDL C++ types with a single CppType model that tracks
nullability, optional presence, and contained storage.

GC-like values now use GC::Ref/GC::Ptr directly, while containers choose
"plain", "Root", or "Conservative" container types depending on what
they contain. For example, sequence<Element> becomes a RootVector of
GC::Ref values, while sequence<SomeDictionary> becomes a
ConservativeVector only when the dictionary contains GC-like values.
This moves the generated bindings away from wrapping GC values in
GC::Root by default.

This has broad fallout as the types passed to interfaces for GC
objects changes almost fully across the board.
2026-05-23 18:26:12 +02:00

44 lines
1.6 KiB
C++

/*
* Copyright (c) 2023, Matthew Olsson <mattco@serenityos.org>
* Copyright (c) 2026, Sam Atkins <sam@ladybird.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/Animations/TimeValue.h>
#include <LibWeb/Bindings/AnimationPlaybackEvent.h>
#include <LibWeb/Bindings/PlatformObject.h>
#include <LibWeb/DOM/Event.h>
namespace Web::Animations {
// https://www.w3.org/TR/web-animations-1/#animationplaybackevent
class AnimationPlaybackEvent : public DOM::Event {
WEB_PLATFORM_OBJECT(AnimationPlaybackEvent, DOM::Event);
GC_DECLARE_ALLOCATOR(AnimationPlaybackEvent);
public:
[[nodiscard]] static GC::Ref<AnimationPlaybackEvent> create(JS::Realm&, FlyString const& type, Bindings::AnimationPlaybackEventInit const& event_init = {});
static WebIDL::ExceptionOr<GC::Ref<AnimationPlaybackEvent>> construct_impl(JS::Realm&, FlyString const& type, Bindings::AnimationPlaybackEventInit const& event_init);
virtual ~AnimationPlaybackEvent() override = default;
NullableCSSNumberish current_time() const;
NullableCSSNumberish timeline_time() const;
private:
AnimationPlaybackEvent(JS::Realm&, FlyString const& type, Bindings::AnimationPlaybackEventInit const& event_init);
virtual void initialize(JS::Realm&) override;
virtual void visit_edges(Visitor&) override;
// https://drafts.csswg.org/web-animations-2/#dom-animationplaybackevent-currenttime
NullableCSSNumberish m_current_time;
// https://drafts.csswg.org/web-animations-2/#dom-animationplaybackevent-timelinetime
NullableCSSNumberish m_timeline_time;
};
}