mirror of
https://github.com/RGBCube/serenity
synced 2025-05-16 02:34:58 +00:00

With this change, we now have ~1200 CellAllocators across both LibJS and LibWeb in a normal WebContent instance. This gives us a minimum heap size of 4.7 MiB in the scenario where we only have one cell allocated per type. Of course, in practice there will be many more of each type, so the effective overhead is quite a bit smaller than that in practice. I left a few types unconverted to this mechanism because I got tired of doing this. :^)
55 lines
2.1 KiB
C++
55 lines
2.1 KiB
C++
/*
|
|
* Copyright (c) 2023, Matthew Olsson <mattco@serenityos.org>.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <LibWeb/Bindings/PlatformObject.h>
|
|
|
|
namespace Web::Animations {
|
|
|
|
// https://www.w3.org/TR/web-animations-1/#animationtimeline
|
|
class AnimationTimeline : public Bindings::PlatformObject {
|
|
WEB_PLATFORM_OBJECT(AnimationTimeline, Bindings::PlatformObject);
|
|
JS_DECLARE_ALLOCATOR(AnimationTimeline);
|
|
|
|
public:
|
|
Optional<double> current_time() const { return m_current_time; }
|
|
virtual WebIDL::ExceptionOr<void> set_current_time(Optional<double>);
|
|
|
|
JS::GCPtr<DOM::Document> associated_document() const { return m_associated_document; }
|
|
void set_associated_document(JS::GCPtr<DOM::Document>);
|
|
|
|
virtual bool is_inactive() const;
|
|
bool is_monotonically_increasing() const { return m_is_monotonically_increasing; }
|
|
|
|
// https://www.w3.org/TR/web-animations-1/#timeline-time-to-origin-relative-time
|
|
virtual Optional<double> convert_a_timeline_time_to_an_original_relative_time(Optional<double>) { VERIFY_NOT_REACHED(); }
|
|
virtual bool can_convert_a_timeline_time_to_an_original_relative_time() const { return false; }
|
|
|
|
void associate_with_animation(JS::NonnullGCPtr<Animation> value) { m_associated_animations.set(value); }
|
|
void disassociate_with_animation(JS::NonnullGCPtr<Animation> value) { m_associated_animations.remove(value); }
|
|
HashTable<JS::NonnullGCPtr<Animation>> const& associated_animations() const;
|
|
|
|
protected:
|
|
AnimationTimeline(JS::Realm&);
|
|
virtual ~AnimationTimeline() override;
|
|
|
|
virtual void initialize(JS::Realm&) override;
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
|
|
|
// https://www.w3.org/TR/web-animations-1/#dom-animationtimeline-currenttime
|
|
Optional<double> m_current_time {};
|
|
|
|
// https://www.w3.org/TR/web-animations-1/#monotonically-increasing-timeline
|
|
bool m_is_monotonically_increasing { true };
|
|
|
|
// https://www.w3.org/TR/web-animations-1/#timeline-associated-with-a-document
|
|
JS::GCPtr<DOM::Document> m_associated_document {};
|
|
|
|
HashTable<JS::NonnullGCPtr<Animation>> m_associated_animations {};
|
|
};
|
|
|
|
}
|