mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 22:37:36 +00:00
LibWeb: Implement Document::remove_replaced_animations()
This commit is contained in:
parent
fe848487db
commit
10fddb99fc
6 changed files with 105 additions and 1 deletions
|
@ -345,6 +345,20 @@ bool Animation::is_replaceable() const
|
|||
return true;
|
||||
}
|
||||
|
||||
void Animation::set_replace_state(Bindings::AnimationReplaceState value)
|
||||
{
|
||||
m_replace_state = value;
|
||||
|
||||
if (value == Bindings::AnimationReplaceState::Removed) {
|
||||
// Remove the associated effect from its target, if applicable
|
||||
if (m_effect && m_effect->target())
|
||||
m_effect->target()->disassociate_with_effect(*m_effect);
|
||||
|
||||
// Remove this animation from its timeline
|
||||
m_timeline->disassociate_with_animation(*this);
|
||||
}
|
||||
}
|
||||
|
||||
// https://www.w3.org/TR/web-animations-1/#dom-animation-play
|
||||
WebIDL::ExceptionOr<void> Animation::play()
|
||||
{
|
||||
|
|
|
@ -54,6 +54,7 @@ public:
|
|||
|
||||
bool is_replaceable() const;
|
||||
Bindings::AnimationReplaceState replace_state() const { return m_replace_state; }
|
||||
void set_replace_state(Bindings::AnimationReplaceState value);
|
||||
|
||||
// https://www.w3.org/TR/web-animations-1/#dom-animation-pending
|
||||
bool pending() const { return m_pending_play_task == TaskState::Scheduled || m_pending_pause_task == TaskState::Scheduled; }
|
||||
|
|
|
@ -142,6 +142,7 @@ public:
|
|||
Optional<double> transformed_progress() const;
|
||||
|
||||
virtual DOM::Element* target() const { return {}; }
|
||||
virtual bool is_keyframe_effect() const { return false; }
|
||||
|
||||
protected:
|
||||
AnimationEffect(JS::Realm&);
|
||||
|
|
|
@ -96,6 +96,8 @@ public:
|
|||
KeyFrameSet const* key_frame_set() { return m_key_frame_set; }
|
||||
void set_key_frame_set(RefPtr<KeyFrameSet const> key_frame_set) { m_key_frame_set = key_frame_set; }
|
||||
|
||||
virtual bool is_keyframe_effect() const override { return true; }
|
||||
|
||||
private:
|
||||
KeyframeEffect(JS::Realm&);
|
||||
virtual ~KeyframeEffect() override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue