Created attachment 413425 [details] Test Consider this example: div { width: 100px; height: 100px; margin-left: 100px; margin-top: 100px; background-color: black; animation: scale 2s forwards, rotate 500ms 1s reverse; } @keyframes scale { 50% { scale: 2 } } @keyframes rotate { 100% { rotate: 90deg } } In Safari, the rotate animation won't be performed because it's reversed and we disable accelerated animations when the playback rate is not 1 (see bug 211839). We should ensure that we only run accelerated transform animations if all of the accelerated transform animations can be accelerated.
<rdar://problem/71116284>
We should also test we switch to software mode if already accelerated and a non-accelerated animation is added.
I have the case where we try to add an animation that we think should be accelerated but fails to run accelerated due to the internals of GraphicsLayerCA working fine. I also need to handle the case where we determine the animation cannot be run accelerated before even involving GraphicsLayerCA, such as a steps() timing function.
Created attachment 417627 [details] Patch
Comment on attachment 417627 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=417627&action=review > Source/WebCore/animation/DocumentTimeline.cpp:443 > + m_isApplyingPendingAcceleratedAnimations = true; SetForScope<> > Source/WebCore/animation/DocumentTimeline.cpp:466 > + if (keyframeEffect.failedToRunAcceleratedTransformRelatedAnimation()) { It's a bit weird to have the very specific failedToRunAcceleratedTransformRelatedAnimation() function. Could applyPendingAcceleratedActions() instead return an OptionSet<> of what it did? > Source/WebCore/animation/KeyframeEffect.cpp:1773 > + if (downcast<DocumentTimeline>(animation()->timeline())->isApplyingPendingAcceleratedAnimations()) { Not a fan of code like this that needs to know what's on its call stack.
(In reply to Simon Fraser (smfr) from comment #5) > Comment on attachment 417627 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=417627&action=review > > > Source/WebCore/animation/DocumentTimeline.cpp:466 > > + if (keyframeEffect.failedToRunAcceleratedTransformRelatedAnimation()) { > > It's a bit weird to have the very specific > failedToRunAcceleratedTransformRelatedAnimation() function. Could > applyPendingAcceleratedActions() instead return an OptionSet<> of what it > did? Yes, I'll do this. > > Source/WebCore/animation/KeyframeEffect.cpp:1773 > > + if (downcast<DocumentTimeline>(animation()->timeline())->isApplyingPendingAcceleratedAnimations()) { > > Not a fan of code like this that needs to know what's on its call stack. Me neither actually, but was a bit lazy there I confess. I'll make it so that a parameter is passed down to effectFailedToRunAcceleratedTransformRelatedAnimation() to indicate whether the change should be made synchronously or as part of an accelerated action.
Created attachment 417682 [details] Patch
Created attachment 417690 [details] Patch
Committed r271524: <https://trac.webkit.org/changeset/271524> All reviewed patches have been landed. Closing bug and clearing flags on attachment 417690 [details].