Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cherry-pick 262875@main (d566d00). https://bugs.webkit.org/show_bug.c…
…gi?id=255338 REGRESSION (260399@main): animations flicker on https://payto.com.au https://bugs.webkit.org/show_bug.cgi?id=255338 rdar://107532064 Reviewed by Dean Jackson. When creating a new animation of any type (CSS Transition, CSS Animation, Web Animations API) that is accelerated, we add it to the list of animations on GraphicsLayerCA regardless of its composite order relative to other effects for the given target. In the case of https://payto.com.au, a CSS Animation is applied to an element for the "transform" property, and that property also yields a CSS Transition that is canceled and recreated on each frame (whether this is the right behavior is discussed in w3c/csswg-drafts#8701 as Firefox, Chrome and Safari all have different behavior). That perpetually-recreated CSS Transition is lower in the composite order, but since it's created after the CSS Animation, due to how we create accelerated animations it would override the CSS Animation. In this patch we change the behavior of DocumentTimeline::applyPendingAcceleratedAnimations() to update the entire effect stack with which an effect pending application of an accelerated action is associated. This guarantees the effect stack's order to be preserved. We also ensure we remove any similarly-named animation before adding new animations in GraphicsLayerCA. * LayoutTests/webanimations/accelerated-animation-addition-lower-in-effect-stack-expected.html: Added. * LayoutTests/webanimations/accelerated-animation-addition-lower-in-effect-stack.html: Added. * Source/WebCore/animation/DocumentTimeline.cpp: (WebCore::DocumentTimeline::applyPendingAcceleratedAnimations): * Source/WebCore/animation/KeyframeEffect.cpp: (WebCore::KeyframeEffect::applyPendingAcceleratedActionsOrUpdateTimingProperties): * Source/WebCore/animation/KeyframeEffect.h: * Source/WebCore/animation/KeyframeEffectStack.cpp: (WebCore::KeyframeEffectStack::applyPendingAcceleratedActions const): * Source/WebCore/animation/KeyframeEffectStack.h: * Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp: (WebCore::GraphicsLayerCA::createTransformAnimationsFromKeyframes): (WebCore::GraphicsLayerCA::createFilterAnimationsFromKeyframes): Canonical link: https://commits.webkit.org/262875@main
- Loading branch information
Showing
8 changed files
with
111 additions
and
1 deletion.
There are no files selected for viewing
14 changes: 14 additions & 0 deletions
14
LayoutTests/webanimations/accelerated-animation-addition-lower-in-effect-stack-expected.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<style> | ||
|
||
div { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100px; | ||
height: 100px; | ||
background-color: black; | ||
translate: 100px; | ||
} | ||
|
||
</style> | ||
<div></div> |
50 changes: 50 additions & 0 deletions
50
LayoutTests/webanimations/accelerated-animation-addition-lower-in-effect-stack.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<style> | ||
|
||
div { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100px; | ||
height: 100px; | ||
background-color: black; | ||
} | ||
|
||
div.animated { | ||
animation: translate 1000s linear forwards; | ||
} | ||
|
||
@keyframes translate { | ||
from { translate: 0px } | ||
to { translate: 0px } | ||
} | ||
|
||
</style> | ||
<div></div> | ||
<script> | ||
|
||
window.testRunner?.waitUntilDone(); | ||
|
||
(async function () { | ||
const target = document.querySelector("div"); | ||
|
||
// Start an animation which will remain the highest in composite order. | ||
const animation = target.animate({ "translate": ["100px", "100px"] }, { duration: 1000 * 1000, fill: "forwards" }) | ||
|
||
// Wait until the animation is committed. | ||
await animation.ready; | ||
await new Promise(requestAnimationFrame); | ||
await new Promise(requestAnimationFrame); | ||
await new Promise(requestAnimationFrame); | ||
|
||
// Start a CSS Animation which will be completely replaced by the script-originated animation. | ||
target.classList.add("animated"); | ||
|
||
// Wait until the animation is committed. | ||
await new Promise(requestAnimationFrame); | ||
await new Promise(requestAnimationFrame); | ||
await new Promise(requestAnimationFrame); | ||
|
||
window.testRunner?.notifyDone(); | ||
})(); | ||
|
||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters