ladybird/Libraries/LibWeb/Internals/InternalAnimationTimeline.h
Callum Law 5e3028013c LibWeb: Store AnimationTimeline associated document as Ref
We always had an associated document for the spec defined timelines
(i.e. `DocumentTimeline` and `ScrollTimeline`) but not for the ad-hoc
`InternalAnimationTimeline` so lets store one for that as well and use a
`Ref` instead of a `Ptr`.

This requires `convert_a_timeline_time_to_an_origin_relative_time` to be
implemented for `InternalAnimationTimeline` since it can now be called
where it previously wasn't due to the absence of a document - we just
return an empty optional since it's not used anywhere.
2026-05-08 22:59:16 +02:00

33 lines
970 B
C++

/*
* Copyright (c) 2024, Matthew Olsson <mattco@serenityos.org>
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibWeb/Animations/AnimationTimeline.h>
namespace Web::Internals {
class InternalAnimationTimeline : public Web::Animations::AnimationTimeline {
public:
WEB_PLATFORM_OBJECT(InternalAnimationTimeline, Web::Animations::AnimationTimeline);
GC_DECLARE_ALLOCATOR(InternalAnimationTimeline);
virtual Optional<Animations::TimeValue> duration() const override { return {}; }
virtual Optional<double> convert_a_timeline_time_to_an_origin_relative_time(Optional<Animations::TimeValue>) override { return {}; }
virtual void update_current_time(double timestamp) override;
void set_time(Optional<double> time);
private:
explicit InternalAnimationTimeline(JS::Realm&, GC::Ref<DOM::Document>);
virtual ~InternalAnimationTimeline() override = default;
virtual void initialize(JS::Realm&) override;
};
}