LibWeb: Update style before getting animation play state

Pending style updates can influence this value
This commit is contained in:
Callum Law 2025-10-31 01:14:05 +13:00 committed by Alexander Kalenik
parent a95cde3660
commit fbcef936a9
Notes: github-actions[bot] 2025-11-02 22:55:11 +00:00
7 changed files with 286 additions and 1 deletions

View file

@ -277,6 +277,14 @@ WebIDL::ExceptionOr<void> Animation::set_playback_rate(double new_playback_rate)
}
// https://www.w3.org/TR/web-animations-1/#animation-play-state
Bindings::AnimationPlayState Animation::play_state_for_bindings() const
{
if (m_owning_element)
m_owning_element->document().update_style();
return play_state();
}
Bindings::AnimationPlayState Animation::play_state() const
{
// The play state of animation, animation, at a given moment is the state corresponding to the first matching

View file

@ -48,6 +48,7 @@ public:
double playback_rate() const { return m_playback_rate; }
WebIDL::ExceptionOr<void> set_playback_rate(double value);
Bindings::AnimationPlayState play_state_for_bindings() const;
Bindings::AnimationPlayState play_state() const;
bool is_relevant() const;

View file

@ -14,7 +14,7 @@ interface Animation : EventTarget {
attribute double? startTime;
attribute double? currentTime;
attribute double playbackRate;
readonly attribute AnimationPlayState playState;
[ImplementedAs=play_state_for_bindings] readonly attribute AnimationPlayState playState;
readonly attribute AnimationReplaceState replaceState;
readonly attribute boolean pending;
readonly attribute Promise<Animation> ready;