/* * Copyright (c) 2024, Matthew Olsson . * * SPDX-License-Identifier: BSD-2-Clause */ #pragma once #include #include namespace Web::Animations { // https://www.w3.org/TR/web-animations-1/#dictdef-keyframeanimationoptions struct KeyframeAnimationOptions : public KeyframeEffectOptions { FlyString id { ""_fly_string }; Optional> timeline; }; // https://www.w3.org/TR/web-animations-1/#dictdef-getanimationsoptions struct GetAnimationsOptions { bool subtree { false }; }; // https://www.w3.org/TR/web-animations-1/#animatable class Animatable { public: virtual ~Animatable() = default; WebIDL::ExceptionOr> animate(Optional> keyframes, Variant options = {}); Vector> get_animations(GetAnimationsOptions options = {}); void associate_with_animation(JS::NonnullGCPtr); void disassociate_with_animation(JS::NonnullGCPtr); JS::GCPtr cached_animation_name_source(Optional) const; void set_cached_animation_name_source(JS::GCPtr value, Optional); JS::GCPtr cached_animation_name_animation(Optional) const; void set_cached_animation_name_animation(JS::GCPtr value, Optional); protected: void visit_edges(JS::Cell::Visitor&); private: Vector> m_associated_animations; bool m_is_sorted_by_composite_order { true }; Array, to_underlying(CSS::Selector::PseudoElement::Type::KnownPseudoElementCount) + 1> m_cached_animation_name_source; Array, to_underlying(CSS::Selector::PseudoElement::Type::KnownPseudoElementCount) + 1> m_cached_animation_name_animation; }; }