haikuwebkit/LayoutTests/webanimations
Antoine Quint 3af29ce313 [Web Animations] setKeyframes does not preserve animation's current offset
https://bugs.webkit.org/show_bug.cgi?id=222939
<rdar://problem/75207793>

Reviewed by Dean Jackson.

Source/WebCore:

Test: webanimations/set-keyframes-after-animation-completion.html

When setKeyframes() is called on a KeyframeEffect, it clears the existing blending keyframes
created for the style system which will be re-populated on the next style update.

When an animation completes, it becomes eligible for being removed unless its effect is the
top-most effect in the target element's effect stack affecting one of the CSS properties
animated by effects in the stack. To determine what properties an effect animates, the method
KeyframeEffect::animatedProperties() is used.

Until now, KeyframeEffect::animatedProperties() simply returned the properties from the
blending keyframes. As such, if blending keyframes are empty, that method returns an empty
set of properties.

Since blending keyframes are cleared by a call to setKeyframes(), calling this method on
the effect of an animation that just finished will remove that animation and the effect
will no longer be applied when updating styles.

To fix this, we add a new instance variable on KeyframeEffect to store the list of properties
affected by the effect from the keyframes parsed by setKeyframes() until we generate the
blending keyframes during the next style update.

As soon as we generate the blending keyframes and setBlendingKeyframes() is called, we clear
that new property. This guarantees that no matter how keyframes are specified – CSS Transitions,
CSS Animations or Web Animations JS API – the animatedProperties() method returns the set
of affected properties.

* animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::animatedProperties):
(WebCore::KeyframeEffect::setBlendingKeyframes):
* animation/KeyframeEffect.h:
(WebCore::KeyframeEffect::animatedProperties const): Deleted.

LayoutTests:

Add a new test that checks that updating keyframes after an animation has completed
correctly updates styles accounting for the new keyframes.

* webanimations/set-keyframes-after-animation-completion-expected.html: Added.
* webanimations/set-keyframes-after-animation-completion.html: Added.


Canonical link: https://commits.webkit.org/235086@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274165 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-09 20:09:49 +00:00
..
resources REGRESSION(r268615): images flicker on apple.com/ios/ios-14 2021-01-28 06:54:42 +00:00
accelerated-animation-canceled-before-commit-expected.html
accelerated-animation-canceled-before-commit.html
accelerated-animation-easing-and-direction-update-expected.html
accelerated-animation-easing-and-direction-update.html
accelerated-animation-easing-update-after-pause-expected.html
accelerated-animation-easing-update-after-pause.html
accelerated-animation-easing-update-steps-after-pause-expected.html
accelerated-animation-easing-update-steps-after-pause.html
accelerated-animation-interruption-display-none-expected.txt
accelerated-animation-interruption-display-none.html
accelerated-animation-playback-rate-expected.html
accelerated-animation-playback-rate.html
accelerated-animation-removal-upon-transition-completion-expected.txt
accelerated-animation-removal-upon-transition-completion.html
accelerated-animation-renderer-change-expected.html
accelerated-animation-renderer-change.html
accelerated-animation-single-keyframe-expected.txt
accelerated-animation-single-keyframe.html
accelerated-animation-slot-invalidation-expected.html
accelerated-animation-slot-invalidation.html
accelerated-animation-suspension-expected.txt
accelerated-animation-suspension.html
accelerated-animation-with-delay-and-seek-expected.html
accelerated-animation-with-delay-and-seek.html
accelerated-animation-with-delay-expected.html
accelerated-animation-with-delay.html
accelerated-animation-with-easing-expected.html
accelerated-animation-with-easing.html
accelerated-css-animation-with-easing-expected.html
accelerated-css-animation-with-easing.html
accelerated-css-transition-with-easing-y-axis-above-1-expected.html
accelerated-css-transition-with-easing-y-axis-above-1.html
accelerated-overlapping-transform-animations-expected.html
accelerated-overlapping-transform-animations.html
accelerated-transform-related-animation-property-order-expected.html
accelerated-transform-related-animation-property-order.html
accelerated-transition-by-removing-property-expected.html
accelerated-transition-by-removing-property.html
accelerated-transition-interrupted-on-composited-element-expected.html
accelerated-transition-interrupted-on-composited-element.html
accelerated-translate-animation-additional-animation-added-in-flight-expected.html
accelerated-translate-animation-additional-animation-added-in-flight.html
accelerated-translate-animation-expected.html
accelerated-translate-animation-underlying-transform-changed-in-flight-expected.html
accelerated-translate-animation-underlying-transform-changed-in-flight.html
accelerated-translate-animation-with-transform-expected.html
accelerated-translate-animation-with-transform.html
accelerated-translate-animation.html
accessing-current-time-after-clearing-css-animation-effect-expected.txt
accessing-current-time-after-clearing-css-animation-effect.html
accessing-current-time-after-finished-css-animation-target-removal-expected.txt
accessing-current-time-after-finished-css-animation-target-removal.html
animation-null-effect-expected.txt
animation-null-effect.html
animation-of-accelerated-property-after-non-accelerated-property-expected.html
animation-of-accelerated-property-after-non-accelerated-property.html
animation-opacity-animation-crash-expected.txt
animation-opacity-animation-crash.html
animation-page-cache-expected.txt
animation-page-cache.html
child-layer-position-after-removal-of-animation-triggering-stacking-context-with-fill-forwards-expected.html
child-layer-position-after-removal-of-animation-triggering-stacking-context-with-fill-forwards.html
combining-transform-animations-with-different-acceleration-capabilities-2-expected.txt Reversed transform animation not applied alongside other transform animations 2021-01-15 17:47:18 +00:00
combining-transform-animations-with-different-acceleration-capabilities-2.html Reversed transform animation not applied alongside other transform animations 2021-01-15 17:47:18 +00:00
combining-transform-animations-with-different-acceleration-capabilities-3-expected.txt Reversed transform animation not applied alongside other transform animations 2021-01-15 17:47:18 +00:00
combining-transform-animations-with-different-acceleration-capabilities-3.html Reversed transform animation not applied alongside other transform animations 2021-01-15 17:47:18 +00:00
combining-transform-animations-with-different-acceleration-capabilities-expected.txt Reversed transform animation not applied alongside other transform animations 2021-01-15 17:47:18 +00:00
combining-transform-animations-with-different-acceleration-capabilities.html Reversed transform animation not applied alongside other transform animations 2021-01-15 17:47:18 +00:00
css-animation-dynamic-duration-change-expected.txt
css-animation-dynamic-duration-change.html
css-animation-effect-target-change-and-animation-removal-crash-expected.html
css-animation-effect-target-change-and-animation-removal-crash.html
css-animation-effect-target-change-and-get-keyframes-crash-expected.html
css-animation-effect-target-change-and-get-keyframes-crash.html
css-animations-expected.txt
css-animations.html
css-transition-in-flight-reversal-accelerated-expected.txt
css-transition-in-flight-reversal-accelerated.html
css-transition-retargeting-during-ready-promise-expected.txt
css-transition-retargeting-during-ready-promise.html
css-transition-retargeting-to-same-value-upon-completion-with-timeout-expected.txt
css-transition-retargeting-to-same-value-upon-completion-with-timeout.html
empty-keyframes-crash-expected.txt
empty-keyframes-crash.html
js-wrapper-kept-alive-expected.txt
js-wrapper-kept-alive.html
keyframe-effect-target-kept-alive-expected.txt
keyframe-effect-target-kept-alive.html
leak-css-animation-expected.txt
leak-css-animation.html
leak-document-with-web-animation-expected.txt
leak-document-with-web-animation.html
multiple-transform-properties-and-multiple-transform-properties-animation-with-delay-on-forced-layer-expected.html REGRESSION(r268615): images flicker on apple.com/ios/ios-14 2021-01-28 06:54:42 +00:00
multiple-transform-properties-and-multiple-transform-properties-animation-with-delay-on-forced-layer.html REGRESSION(r268615): images flicker on apple.com/ios/ios-14 2021-01-28 06:54:42 +00:00
no-css-animation-on-noscript-expected.txt
no-css-animation-on-noscript.html
no-scheduling-while-filling-accelerated-expected.txt
no-scheduling-while-filling-accelerated.html
no-scheduling-while-filling-non-accelerated-expected.txt
no-scheduling-while-filling-non-accelerated.html
no-transition-on-after-pseudo-element-upon-creation-expected.html REGRESSION (r267571): black line appears upon navigating back from apple.com shopping bag 2021-01-13 10:11:25 +00:00
no-transition-on-after-pseudo-element-upon-creation.html REGRESSION (r267571): black line appears upon navigating back from apple.com shopping bag 2021-01-13 10:11:25 +00:00
opacity-animation-expected.html
opacity-animation-no-longer-composited-upon-completion-expected.txt
opacity-animation-no-longer-composited-upon-completion.html
opacity-animation-yields-compositing-expected.txt
opacity-animation-yields-compositing-span-expected.txt
opacity-animation-yields-compositing-span.html
opacity-animation-yields-compositing.html
opacity-animation.html
partly-accelerated-transition-by-removing-property-expected.txt
partly-accelerated-transition-by-removing-property.html
relative-ordering-of-translate-and-rotate-properties-accelerated-expected.html Animation of "rotate" or "scale" property does not correctly account for static "translate" property 2021-02-02 10:59:00 +00:00
relative-ordering-of-translate-and-rotate-properties-accelerated.html Animation of "rotate" or "scale" property does not correctly account for static "translate" property 2021-02-02 10:59:00 +00:00
relative-ordering-of-translate-and-scale-properties-accelerated-expected.html Animation of "rotate" or "scale" property does not correctly account for static "translate" property 2021-02-02 10:59:00 +00:00
relative-ordering-of-translate-and-scale-properties-accelerated.html Animation of "rotate" or "scale" property does not correctly account for static "translate" property 2021-02-02 10:59:00 +00:00
rotate-property-and-rotate-animation-with-delay-on-forced-layer-expected.html REGRESSION(r268615): images flicker on apple.com/ios/ios-14 2021-01-28 06:54:42 +00:00
rotate-property-and-rotate-animation-with-delay-on-forced-layer.html REGRESSION(r268615): images flicker on apple.com/ios/ios-14 2021-01-28 06:54:42 +00:00
scale-property-and-scale-animation-with-delay-on-forced-layer-expected.html REGRESSION(r268615): images flicker on apple.com/ios/ios-14 2021-01-28 06:54:42 +00:00
scale-property-and-scale-animation-with-delay-on-forced-layer.html REGRESSION(r268615): images flicker on apple.com/ios/ios-14 2021-01-28 06:54:42 +00:00
scheduling-of-animation-with-steps-timing-function-on-effect-expected.txt
scheduling-of-animation-with-steps-timing-function-on-effect.html
scheduling-of-animation-with-steps-timing-function-on-keyframe-expected.txt
scheduling-of-animation-with-steps-timing-function-on-keyframe.html
scheduling-of-animation-without-keyframes-expected.txt
scheduling-of-animation-without-keyframes.html
scheduling-of-css-animation-with-explicit-steps-timing-function-on-some-keyframes-expected.txt
scheduling-of-css-animation-with-explicit-steps-timing-function-on-some-keyframes.html
scheduling-of-css-animation-with-implicit-steps-timing-function-expected.txt
scheduling-of-css-animation-with-implicit-steps-timing-function.html
seeking-by-changing-delay-accelerated-expected.html
seeking-by-changing-delay-accelerated.html
set-keyframes-after-animation-completion-expected.html [Web Animations] setKeyframes does not preserve animation's current offset 2021-03-09 20:09:49 +00:00
set-keyframes-after-animation-completion.html [Web Animations] setKeyframes does not preserve animation's current offset 2021-03-09 20:09:49 +00:00
setting-css-animation-none-after-clearing-effect-expected.txt
setting-css-animation-none-after-clearing-effect.html
setting-css-animation-timing-property-via-style-after-clearing-effect-expected.txt
setting-css-animation-timing-property-via-style-after-clearing-effect.html
transform-accelerated-animation-finishes-before-removal-expected.txt
transform-accelerated-animation-finishes-before-removal.html
transform-accelerated-animation-removed-one-frame-after-finished-promise-expected.txt
transform-accelerated-animation-removed-one-frame-after-finished-promise.html
transform-animation-with-steps-timing-function-not-accelerated-expected.txt
transform-animation-with-steps-timing-function-not-accelerated.html
transform-property-and-transform-animation-with-delay-on-forced-layer-expected.html REGRESSION(r268615): images flicker on apple.com/ios/ios-14 2021-01-28 06:54:42 +00:00
transform-property-and-transform-animation-with-delay-on-forced-layer.html REGRESSION(r268615): images flicker on apple.com/ios/ios-14 2021-01-28 06:54:42 +00:00
transform-transition-with-delay-on-forced-layer-with-transform-expected.html REGRESSION(r272004): transform transition with delay doesn't behave correctly 2021-03-01 18:47:02 +00:00
transform-transition-with-delay-on-forced-layer-with-transform.html REGRESSION(r272004): transform transition with delay doesn't behave correctly 2021-03-01 18:47:02 +00:00
transition-restart-after-style-recalc-during-transitionend-expected.txt
transition-restart-after-style-recalc-during-transitionend.html
translate-property-and-translate-animation-with-delay-on-forced-layer-expected.html REGRESSION(r268615): images flicker on apple.com/ios/ios-14 2021-01-28 06:54:42 +00:00
translate-property-and-translate-animation-with-delay-on-forced-layer.html REGRESSION(r268615): images flicker on apple.com/ios/ios-14 2021-01-28 06:54:42 +00:00
updating-property-targeted-by-css-transition-during-css-animation-expected.txt
updating-property-targeted-by-css-transition-during-css-animation.html
width-and-opacity-separate-animation-yields-compositing-expected.txt
width-and-opacity-separate-animation-yields-compositing.html