Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 87befbbe824b580abd8dca0f8efade4da4c02cf4
https://github.com/WebKit/WebKit/commit/87befbbe824b580abd8dca0f8efade4da4c02cf4
Author: Antoine Quint <[email protected]>
Date: 2025-11-26 (Wed, 26 Nov 2025)
Changed paths:
M
LayoutTests/webanimations/threaded-animations/resources/scroll-timeline-in-iframe-content.html
M
LayoutTests/webanimations/threaded-animations/scroll-timeline-in-iframe.html
A
LayoutTests/webanimations/threaded-animations/threaded-and-non-threaded-animations-scroll-source-composition-change-expected.txt
A
LayoutTests/webanimations/threaded-animations/threaded-and-non-threaded-animations-scroll-source-composition-change.html
M LayoutTests/webanimations/threaded-animations/threaded-animations-utils.js
M Source/WebCore/animation/AnimationTimeline.cpp
M Source/WebCore/animation/AnimationTimeline.h
M Source/WebCore/animation/AnimationTimelinesController.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/animation/ScrollTimeline.h
Log Message:
-----------
[threaded-animations] scroll-driven animations should only be accelerated if
their source is composited
https://bugs.webkit.org/show_bug.cgi?id=303136
rdar://165441462
Reviewed by Anne van Kesteren.
Scroll-driven animations make the assumption that their timeline's source is
composited,
exemplified in code with `ASSERT(sourceScrollableArea->scrollingNodeID())` in
the
`ScrollTimeline::createAcceleratedRepresentation()` function. This assumption
and that
assertion fail in a number of demos where `overflow: hidden` is set and the
source is
not composited.
To address this, we add a new `canBeAccelerated()` function for timelines
allowing
acceleration to be opt-in. In the case of document timelines, this is always
true.
For progress-based timelines, we ensure their source is composited. Then, in the
`KeyframeEffect::canBeAccelerated()` function we add a check that the animation
timeline can indeed be accelerated.
This acceleration ability is controlled by a cached boolean flag for
progress-based
timelines that is updated under
`Document::runPostRenderingUpdateAnimationTasks()`.
To do so, we introduce a new `AnimationTimeline::runPostRenderingUpdateTasks()`
which,
on top of resetting the accelerated representation as was previously done,
updates
that boolean flag, and if it changed, notifies all associated animation effects
such
that they may update their accelerated representation.
We test this behavior with a new test that checks that we can make an animation
become
accelerated by virtue of toggling the `overflow` property on its timeline's
source.
This uncovered a small issue in
`webanimations/threaded-animations/scroll-timeline-in-iframe.html`
where if no content was rendered, the iframe's document scroller wouldn't be
composited
and the test would fail. We work around this for the moment bug filed bug
303137 to address this.
Test:
webanimations/threaded-animations/threaded-and-non-threaded-animations-scroll-source-composition-change.html
*
LayoutTests/webanimations/threaded-animations/resources/scroll-timeline-in-iframe-content.html:
* LayoutTests/webanimations/threaded-animations/scroll-timeline-in-iframe.html:
*
LayoutTests/webanimations/threaded-animations/threaded-and-non-threaded-animations-scroll-source-composition-change-expected.txt:
Added.
*
LayoutTests/webanimations/threaded-animations/threaded-and-non-threaded-animations-scroll-source-composition-change.html:
Added.
* LayoutTests/webanimations/threaded-animations/threaded-animations-utils.js:
* Source/WebCore/animation/AnimationTimeline.cpp:
(WebCore::AnimationTimeline::runPostRenderingUpdateTasks):
* Source/WebCore/animation/AnimationTimeline.h:
(WebCore::AnimationTimeline::canBeAccelerated const):
(WebCore::AnimationTimeline::computeCanBeAccelerated const):
(WebCore::AnimationTimeline::clearAcceleratedRepresentation): Deleted.
* Source/WebCore/animation/AnimationTimelinesController.cpp:
(WebCore::AnimationTimelinesController::runPostRenderingUpdateTasks):
* Source/WebCore/animation/DocumentTimeline.h:
* Source/WebCore/animation/KeyframeEffect.cpp:
(WebCore::KeyframeEffect::canBeAccelerated const):
(WebCore::KeyframeEffect::timelineAccelerationAbilityDidChange):
* Source/WebCore/animation/KeyframeEffect.h:
* Source/WebCore/animation/ScrollTimeline.cpp:
(WebCore::ScrollTimeline::computeCanBeAccelerated const):
* Source/WebCore/animation/ScrollTimeline.h:
Canonical link: https://commits.webkit.org/303589@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications