Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: f47e20b766b4c93246329c7b743b11e17cdf9b70
      
https://github.com/WebKit/WebKit/commit/f47e20b766b4c93246329c7b743b11e17cdf9b70
  Author: Antoine Quint <[email protected]>
  Date:   2025-11-19 (Wed, 19 Nov 2025)

  Changed paths:
    M LayoutTests/webanimations/accelerated-animation-suspension.html
    A 
LayoutTests/webanimations/threaded-animations/threaded-and-non-threaded-animations-expected.txt
    A 
LayoutTests/webanimations/threaded-animations/threaded-and-non-threaded-animations.html
    M Source/WebCore/animation/AnimationTimelinesController.cpp
    M Source/WebCore/animation/AnimationTimelinesController.h
    M Source/WebCore/animation/DocumentTimeline.cpp
    M Source/WebCore/animation/DocumentTimeline.h
    M Source/WebCore/animation/KeyframeEffect.cpp
    M Source/WebCore/animation/KeyframeEffect.h
    M Source/WebCore/animation/ScrollTimeline.cpp
    M Source/WebCore/platform/graphics/GraphicsLayer.h
    M Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
    M Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
    M 
Source/WebCore/platform/graphics/texmap/coordinated/GraphicsLayerCoordinated.cpp
    M 
Source/WebCore/platform/graphics/texmap/coordinated/GraphicsLayerCoordinated.h
    M Source/WebCore/rendering/RenderLayerBacking.cpp
    M Source/WebCore/testing/Internals.cpp
    M Source/WebCore/testing/Internals.h
    M Source/WebCore/testing/Internals.idl
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm

  Log Message:
  -----------
  [threaded-animations] turning on the "Threaded Scroll-driven Animations" 
setting should not force monotonic animations to be threaded
https://bugs.webkit.org/show_bug.cgi?id=302812
rdar://165066892

Reviewed by Simon Fraser.

We introduced two different settings to control whether to run accelerated 
animations in the remote
layer tree: "Threaded Scroll-driven Animations" and "Threaded Time-based 
Animations". However, we
don't actually support having one on without the other and thus turning on just 
"Threaded Scroll-driven
Animations" forces even time-based (ie. monotonic) animations to be accelerated 
via the remote layer
tree.

In this patch we correctly handle both settings individually. This starts in 
`KeyframeEffect` where
we introduce a new `canHaveAcceleratedRepresentation()` method which returns 
true if we can indeed
accelerate this animation via the remote layer tree while honoring the two 
aforementioned settings
individually. This essentially replaces the previous 
`threadedAnimationsEnabled()` method which
was the core reason we were in the situation described above.

We also use this new `canHaveAcceleratedRepresentation()` method when 
considering the creation
of an accelerated representation in 
`RenderLayerBacking::updateAcceleratedEffectsAndBaseValues()`,
ensuring that both the threaded and non-threaded animation flavors may be 
supported for a given
animation stack. Note that this does not account for the two flavors trying to 
animate the same
property, which will be handled in a followup patch by turning off acceleration 
altogether in
this situation.

To ensure that we only ever create accelerated timeline representations for 
monotonic and progress-based
timelines, we also add debug assertions in `DocumentTimeline` and 
`ScrollTimeline` to check the
relevant setting is enabled.

On the remote layer tree side, we must also change 
`RemoteLayerTreePropertyApplier::applyPropertiesToLayer()
in order to allow both animation flavors to be specified on a given remote 
layer tree node.

Finally, we add a new `isThreaded` member to the `AcceleratedAnimation` 
dictionary returned by the
`window.internals.acceleratedAnimationsForElement()` method so that we can 
determine the type of
accelerated animations created for a given element. We take this chance to 
update this testing-specific
method to be implemented within `AnimationTimelinesController` rather than 
`DocumentTimeline`
since this method has little to do with the document timeline.

Test: 
webanimations/threaded-animations/threaded-and-non-threaded-animations.html

* LayoutTests/webanimations/accelerated-animation-suspension.html:
* 
LayoutTests/webanimations/threaded-animations/threaded-and-non-threaded-animations-expected.txt:
 Added.
* 
LayoutTests/webanimations/threaded-animations/threaded-and-non-threaded-animations.html:
 Added.
* Source/WebCore/animation/AnimationTimelinesController.cpp:
(WebCore::AnimationTimelinesController::acceleratedAnimationsForElement const):
* Source/WebCore/animation/AnimationTimelinesController.h:
* Source/WebCore/animation/DocumentTimeline.cpp:
(WebCore::DocumentTimeline::createAcceleratedRepresentation):
(WebCore::DocumentTimeline::acceleratedAnimationsForElement const): Deleted.
* Source/WebCore/animation/DocumentTimeline.h:
* Source/WebCore/animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::transformFunctionListPrefix const):
(WebCore::KeyframeEffect::isRunningAccelerated const):
(WebCore::KeyframeEffect::canBeAccelerated const):
(WebCore::KeyframeEffect::preventsAcceleration const):
(WebCore::KeyframeEffect::updateAcceleratedActions):
(WebCore::KeyframeEffect::addPendingAcceleratedAction):
(WebCore::KeyframeEffect::animationBecameReady):
(WebCore::KeyframeEffect::updateAcceleratedAnimationIfNecessary):
(WebCore::KeyframeEffect::animationDidFinish):
(WebCore::KeyframeEffect::animationWasCanceled):
(WebCore::KeyframeEffect::willChangeRenderer):
(WebCore::KeyframeEffect::animationSuspensionStateDidChange):
(WebCore::KeyframeEffect::applyPendingAcceleratedActionsOrUpdateTimingProperties):
(WebCore::KeyframeEffect::applyPendingAcceleratedActions):
(WebCore::KeyframeEffect::ticksContinuouslyWhileActive const):
(WebCore::KeyframeEffect::setComposite):
(WebCore::KeyframeEffect::effectStackNoLongerAllowsAccelerationDuringAcceleratedActionApplication):
(WebCore::KeyframeEffect::abilityToBeAcceleratedDidChange):
(WebCore::KeyframeEffect::lastStyleChangeEventStyleDidChange):
(WebCore::KeyframeEffect::canHaveAcceleratedRepresentation const):
(WebCore::KeyframeEffect::scheduleAssociatedAcceleratedEffectStackUpdate):
(WebCore::KeyframeEffect::threadedAnimationsEnabled const): Deleted.
* Source/WebCore/animation/KeyframeEffect.h:
* Source/WebCore/animation/ScrollTimeline.cpp:
(WebCore::ScrollTimeline::createAcceleratedRepresentation):
* Source/WebCore/platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::acceleratedAnimationsForTesting const):
* Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::ensureStructuralLayer):
* Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h:
* 
Source/WebCore/platform/graphics/texmap/coordinated/GraphicsLayerCoordinated.cpp:
(WebCore::GraphicsLayerCoordinated::acceleratedAnimationsForTesting const):
* 
Source/WebCore/platform/graphics/texmap/coordinated/GraphicsLayerCoordinated.h:
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateAcceleratedEffectsAndBaseValues):
* Source/WebCore/testing/Internals.cpp:
(WebCore::Internals::acceleratedAnimationsForElement):
* Source/WebCore/testing/Internals.h:
* Source/WebCore/testing/Internals.idl:
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreePropertyApplier.mm:
(WebKit::RemoteLayerTreePropertyApplier::applyPropertiesToLayer):

Canonical link: https://commits.webkit.org/303312@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to