From e6aef49ef38d6c72e446b461778b2f96ea689292 Mon Sep 17 00:00:00 2001 From: Matthew Olsson Date: Tue, 5 Mar 2024 19:04:14 -0700 Subject: [PATCH] LibWeb: Consider fill state before calling Animation::play() Animation::play_state() does not consider the fill state, and thus will not return "Playing" for a fill-forward animation in the after phase. It is still valid for paused, as pausing is not affected by the fill mode. --- .../Ref/css-keyframe-fill-forwards.html | 21 +++++++++++++++++++ .../css-keyframe-fill-forwards-ref.html | 9 ++++++++ .../Libraries/LibWeb/CSS/StyleComputer.cpp | 2 +- 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 Tests/LibWeb/Ref/css-keyframe-fill-forwards.html create mode 100644 Tests/LibWeb/Ref/reference/css-keyframe-fill-forwards-ref.html diff --git a/Tests/LibWeb/Ref/css-keyframe-fill-forwards.html b/Tests/LibWeb/Ref/css-keyframe-fill-forwards.html new file mode 100644 index 0000000000..4619a109b8 --- /dev/null +++ b/Tests/LibWeb/Ref/css-keyframe-fill-forwards.html @@ -0,0 +1,21 @@ + + + +
+ diff --git a/Tests/LibWeb/Ref/reference/css-keyframe-fill-forwards-ref.html b/Tests/LibWeb/Ref/reference/css-keyframe-fill-forwards-ref.html new file mode 100644 index 0000000000..364e674185 --- /dev/null +++ b/Tests/LibWeb/Ref/reference/css-keyframe-fill-forwards-ref.html @@ -0,0 +1,9 @@ + + +
diff --git a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp index aa4789c85a..ab6af448fc 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleComputer.cpp @@ -1400,7 +1400,7 @@ static void apply_animation_properties(DOM::Document& document, StyleProperties& effect.set_playback_direction(Animations::css_animation_direction_to_bindings_playback_direction(direction)); HTML::TemporaryExecutionContext context(document.relevant_settings_object()); - if (play_state == CSS::AnimationPlayState::Running && animation.play_state() != Bindings::AnimationPlayState::Running) { + if (play_state == CSS::AnimationPlayState::Running && !animation.is_relevant()) { animation.play().release_value_but_fixme_should_propagate_errors(); } else if (play_state == CSS::AnimationPlayState::Paused && animation.play_state() != Bindings::AnimationPlayState::Paused) { animation.pause().release_value_but_fixme_should_propagate_errors();