LibWeb: Cache the last CSS play-state value on KeyframeEffect

This way we can just leave it alone if the property hasn't changed.
Notably, if the play-state property has been set to 'paused', and then
the user gets the animation with JS and calls .play() on it, it should
start playing despite the play-state property value.
This commit is contained in:
Matthew Olsson 2024-03-26 17:02:27 -07:00 committed by Andrew Kaster
commit e4dba9d932
Notes: sideshowbarker 2024-07-18 04:46:35 +09:00
2 changed files with 21 additions and 14 deletions

View file

@ -107,6 +107,9 @@ public:
virtual void update_style_properties() override;
Optional<CSS::AnimationPlayState> last_css_animation_play_state() const { return m_last_css_animation_play_state; }
void set_last_css_animation_play_state(CSS::AnimationPlayState state) { m_last_css_animation_play_state = state; }
private:
KeyframeEffect(JS::Realm&);
virtual ~KeyframeEffect() override = default;
@ -130,6 +133,8 @@ private:
Vector<JS::Object*> m_keyframe_objects {};
RefPtr<KeyFrameSet const> m_key_frame_set {};
Optional<CSS::AnimationPlayState> m_last_css_animation_play_state;
};
}