LibWeb: Store last_css_animation_play_state on anim instead of effect

Since it is the animation rather than the effect which has a play state
it makes more sense to store it here
This commit is contained in:
Callum Law 2025-11-12 22:59:03 +13:00 committed by Sam Atkins
parent 6a95506bb1
commit 1af0364cfc
Notes: github-actions[bot] 2025-12-01 10:19:24 +00:00
4 changed files with 6 additions and 7 deletions

View file

@ -115,6 +115,8 @@ public:
auto release_saved_cancel_time() { return move(m_saved_cancel_time); }
double associated_effect_end() const;
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; }
protected:
Animation(JS::Realm&);
@ -205,6 +207,7 @@ private:
Optional<double> m_saved_play_time;
Optional<double> m_saved_pause_time;
Optional<double> m_saved_cancel_time;
Optional<CSS::AnimationPlayState> m_last_css_animation_play_state;
};
}

View file

@ -109,9 +109,6 @@ public:
virtual void update_computed_properties(AnimationUpdateContext&) 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;
@ -135,8 +132,6 @@ private:
Vector<GC::Ref<JS::Object>> m_keyframe_objects {};
RefPtr<KeyFrameSet const> m_key_frame_set {};
Optional<CSS::AnimationPlayState> m_last_css_animation_play_state;
};
}

View file

@ -1136,7 +1136,7 @@ static void apply_animation_properties(DOM::Document const& document, ComputedPr
effect.set_playback_direction(Animations::css_animation_direction_to_bindings_playback_direction(animation_properties.direction));
effect.set_composite(Animations::css_animation_composition_to_bindings_composite_operation(animation_properties.composition));
if (animation_properties.play_state != effect.last_css_animation_play_state()) {
if (animation_properties.play_state != animation.last_css_animation_play_state()) {
if (animation_properties.play_state == CSS::AnimationPlayState::Running && animation.play_state() != Bindings::AnimationPlayState::Running) {
HTML::TemporaryExecutionContext context(document.realm());
animation.play().release_value_but_fixme_should_propagate_errors();
@ -1145,7 +1145,7 @@ static void apply_animation_properties(DOM::Document const& document, ComputedPr
animation.pause().release_value_but_fixme_should_propagate_errors();
}
effect.set_last_css_animation_play_state(animation_properties.play_state);
animation.set_last_css_animation_play_state(animation_properties.play_state);
}
}

View file

@ -401,6 +401,7 @@ enum class PropertyID : u16;
enum class PaintOrder : u8;
enum class ValueType : u8;
enum class AnimatedPropertyResultOfTransition : u8;
enum class AnimationPlayState : u8;
struct BackgroundLayerData;
struct CalculationContext;