mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-07 21:59:54 +00:00
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:
parent
6a95506bb1
commit
1af0364cfc
Notes:
github-actions[bot]
2025-12-01 10:19:24 +00:00
Author: https://github.com/Calme1709
Commit: 1af0364cfc
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6972
Reviewed-by: https://github.com/AtkinsSJ ✅
4 changed files with 6 additions and 7 deletions
|
|
@ -115,6 +115,8 @@ public:
|
||||||
auto release_saved_cancel_time() { return move(m_saved_cancel_time); }
|
auto release_saved_cancel_time() { return move(m_saved_cancel_time); }
|
||||||
|
|
||||||
double associated_effect_end() const;
|
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:
|
protected:
|
||||||
Animation(JS::Realm&);
|
Animation(JS::Realm&);
|
||||||
|
|
@ -205,6 +207,7 @@ private:
|
||||||
Optional<double> m_saved_play_time;
|
Optional<double> m_saved_play_time;
|
||||||
Optional<double> m_saved_pause_time;
|
Optional<double> m_saved_pause_time;
|
||||||
Optional<double> m_saved_cancel_time;
|
Optional<double> m_saved_cancel_time;
|
||||||
|
Optional<CSS::AnimationPlayState> m_last_css_animation_play_state;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -109,9 +109,6 @@ public:
|
||||||
|
|
||||||
virtual void update_computed_properties(AnimationUpdateContext&) override;
|
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:
|
private:
|
||||||
KeyframeEffect(JS::Realm&);
|
KeyframeEffect(JS::Realm&);
|
||||||
virtual ~KeyframeEffect() override = default;
|
virtual ~KeyframeEffect() override = default;
|
||||||
|
|
@ -135,8 +132,6 @@ private:
|
||||||
Vector<GC::Ref<JS::Object>> m_keyframe_objects {};
|
Vector<GC::Ref<JS::Object>> m_keyframe_objects {};
|
||||||
|
|
||||||
RefPtr<KeyFrameSet const> m_key_frame_set {};
|
RefPtr<KeyFrameSet const> m_key_frame_set {};
|
||||||
|
|
||||||
Optional<CSS::AnimationPlayState> m_last_css_animation_play_state;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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_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));
|
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) {
|
if (animation_properties.play_state == CSS::AnimationPlayState::Running && animation.play_state() != Bindings::AnimationPlayState::Running) {
|
||||||
HTML::TemporaryExecutionContext context(document.realm());
|
HTML::TemporaryExecutionContext context(document.realm());
|
||||||
animation.play().release_value_but_fixme_should_propagate_errors();
|
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();
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -401,6 +401,7 @@ enum class PropertyID : u16;
|
||||||
enum class PaintOrder : u8;
|
enum class PaintOrder : u8;
|
||||||
enum class ValueType : u8;
|
enum class ValueType : u8;
|
||||||
enum class AnimatedPropertyResultOfTransition : u8;
|
enum class AnimatedPropertyResultOfTransition : u8;
|
||||||
|
enum class AnimationPlayState : u8;
|
||||||
|
|
||||||
struct BackgroundLayerData;
|
struct BackgroundLayerData;
|
||||||
struct CalculationContext;
|
struct CalculationContext;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue