Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 3da5ec4d32bde7cc2bcd0f51f14c17175722ef75
https://github.com/WebKit/WebKit/commit/3da5ec4d32bde7cc2bcd0f51f14c17175722ef75
Author: Antoine Quint <[email protected]>
Date: 2025-04-25 (Fri, 25 Apr 2025)
Changed paths:
M
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/scroll-timeline-invalidation-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/scroll-timeline-invalidation.html
M Source/WebCore/animation/AnimationTimelinesController.cpp
M Source/WebCore/animation/AnimationTimelinesController.h
M Source/WebCore/animation/ScrollTimeline.cpp
M Source/WebCore/animation/ScrollTimeline.h
M Source/WebCore/dom/Document.cpp
M Source/WebCore/dom/Document.h
M Source/WebCore/page/Page.cpp
Log Message:
-----------
[scroll-animations] WPT test
scroll-animations/scroll-timelines/scroll-timeline-invalidation.html has
failures
https://bugs.webkit.org/show_bug.cgi?id=284546
Reviewed by Antti Koivisto.
The Scroll-driven Animations spec [0] calls for the re-computation of styles if
during a page rendering
update a scroll timeline becomes "stale", ie. if its current time changes
during the update. This
will happen for instance if the bounds of the scroll timeline source changes
during the update as
part of an animation, a requestAnimationFrame callback or a resize observer.
There is a provision
that there can only be a single additional style update caused by this.
Because the spec references the HTML spec by section number and not hyperlinks,
it is not perfectly
clear when exactly potentially-stale timelines should be considered for an
update, but it seems from
informative notes that this happens _after_ resize observers have been
serviced, which also implies
that the style and layout update has also happened. A spec issue was filed to
clarify this.
As such, we call from `Page::updateRendering()` into
`AnimationTimelinesController::updateStaleScrollTimelines()`
to iterate all scroll and view timelines updated during the immediate prior
call to `updateAnimationsAndSendEvents()`
and call the new `ScrollTimeline::updateCurrentTimeIfStale()` method which will
recompute the basic
data used to determine a scroll timeline's current time and, if the source
bounds have changed, will
invalidate the targets of all associated animations and update styles once more.
This process is non-reentrant, ensuring we only update stale timelines once.
The test that was written to test this functionality did not strictly adhere to
what the spec seems
to specify (see [1]) so we update it as well to check that a timeline's current
time is only updated
after much of the page rendering steps have been performed, since it previously
would check it within
a `requestAnimationFrame()` callback.
[0] https://drafts.csswg.org/scroll-animations-1/#event-loop
[1] https://github.com/w3c/csswg-drafts/issues/12120
*
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/scroll-timeline-invalidation-expected.txt:
*
LayoutTests/imported/w3c/web-platform-tests/scroll-animations/scroll-timelines/scroll-timeline-invalidation.html:
* Source/WebCore/animation/AnimationTimelinesController.cpp:
(WebCore::AnimationTimelinesController::updateAnimationsAndSendEvents):
(WebCore::AnimationTimelinesController::updateStaleScrollTimelines):
* Source/WebCore/animation/AnimationTimelinesController.h:
* Source/WebCore/animation/ScrollTimeline.cpp:
(WebCore::ScrollTimeline::updateCurrentTimeIfStale):
* Source/WebCore/animation/ScrollTimeline.h:
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::updateStaleScrollTimelines):
* Source/WebCore/dom/Document.h:
* Source/WebCore/page/Page.cpp:
(WebCore::Page::updateRendering):
Canonical link: https://commits.webkit.org/294121@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes