Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 64e4b813611284f83426e5540758eb80faee07dd
      
https://github.com/WebKit/WebKit/commit/64e4b813611284f83426e5540758eb80faee07dd
  Author: Antoine Quint <[email protected]>
  Date:   2025-07-02 (Wed, 02 Jul 2025)

  Changed paths:
    A 
LayoutTests/webanimations/document-timeline-current-time-updates-without-running-animations-expected.txt
    A 
LayoutTests/webanimations/document-timeline-current-time-updates-without-running-animations.html
    M Source/WebCore/animation/AnimationTimelinesController.cpp
    M Source/WebCore/animation/AnimationTimelinesController.h

  Log Message:
  -----------
  REGRESSION(294049@main): `document.timeline.currentTime` never advances
https://bugs.webkit.org/show_bug.cgi?id=295177
rdar://problem/154607696

Reviewed by Simon Fraser.

Prior to 294049@main, when the current time would be requested from 
`AnimationTimelinesController`,
most likely through `DocumentTimeline::currentTime()`, we would either use the 
cached current time,
if available, or compute a new one. In the case where we would compute a new 
one, we would also
enqueue a task (using `EventLoop::queueTask()`) to clear it after the current 
run loop had completed,
ensuring that any code ran within that loop would use the same current time.

That changed in 294049@main where we made it so that the document timeline's 
current time was cached
throughout the duration of the animation frame, matching the behavior of Chrome 
and Firefox. In effect,
this meant that that current time was updated every 16ms or so (assuming a 
display update cadence of 60Hz).

However, we neglected to preserve the mechanism to clear that cached current 
time, instead relying on
the fact that animations would cause animations to be updated and for that 
current time to be cached
as the page rendering updated at 60Hz.

When we cache the current time, we now clear it after a delay matching the 
page's preferred rendering
update interval.

We also add a test which checks that the document timeline's current time is 
correctly updated
after 20ms even with no page rendering updates scheduled. This test would have 
reliably failed
prior to this patch.

* 
LayoutTests/webanimations/document-timeline-current-time-updates-without-running-animations-expected.txt:
 Added.
* 
LayoutTests/webanimations/document-timeline-current-time-updates-without-running-animations.html:
 Added.
* Source/WebCore/animation/AnimationTimelinesController.cpp:
(WebCore::AnimationTimelinesController::AnimationTimelinesController):
(WebCore::AnimationTimelinesController::suspendAnimations):
(WebCore::AnimationTimelinesController::resumeAnimations):
(WebCore::AnimationTimelinesController::cacheCurrentTime):
(WebCore::AnimationTimelinesController::clearCachedCurrentTime):
* Source/WebCore/animation/AnimationTimelinesController.h:

Canonical link: https://commits.webkit.org/296903@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

Reply via email to