Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cafb7b2f4caf0214ac2536f458478b636188456e
      
https://github.com/WebKit/WebKit/commit/cafb7b2f4caf0214ac2536f458478b636188456e
  Author: Antoine Quint <[email protected]>
  Date:   2025-12-11 (Thu, 11 Dec 2025)

  Changed paths:
    M Source/WebCore/Headers.cmake
    M Source/WebCore/Sources.txt
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/animation/AcceleratedEffectStackUpdater.cpp
    M Source/WebCore/animation/AcceleratedEffectStackUpdater.h
    A Source/WebCore/animation/AcceleratedTimelinesUpdater.cpp
    A Source/WebCore/animation/AcceleratedTimelinesUpdater.h
    M Source/WebCore/animation/ScrollTimeline.cpp
    M Source/WebCore/dom/Document.cpp
    M Source/WebCore/page/Page.cpp
    M Source/WebCore/page/Page.h
    M Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm

  Log Message:
  -----------
  [threaded-animations] `animations/resume-after-page-cache.html` crashes with 
"Threaded Time-based Animations" enabled
https://bugs.webkit.org/show_bug.cgi?id=303980

Reviewed by Simon Fraser.

The test `animations/resume-after-page-cache.html` puts a page with animations
in the back/forward cache and then navigates back to it and checks that 
animations
are resumed.

If this test was ran twice in a row, it would crash the test runner in debug 
builds
due to a failed assertion in 
`RemoteLayerTreeNode::setAcceleratedEffectsAndBaseValues()`
indicating a failed timeline lookup.

As the animated page enters the cache, its animations are suspended, and as a 
result
accelerated animations are canceled. This leads to a remote a layer tree 
transaction
destroying layers with animations, and thus destroying associated 
`AcceleratedTimeline`
which are owned by layer tree animations (see 304042@main). Typically, the list 
of known
timelines held by `AcceleratedEffectStackUpdater` will catch the deletion of 
those timelines
and provide the `TimelinesUpdate` for the transaction with those removals. 
However, since
`AcceleratedEffectStackUpdater` is held by the `Document` (via its 
`AnimationTimelinesController`),
when we compile the timelines update in `WebPage::willCommitLayerTree()`, after 
the page
has entered the cache, the document with the expected timelines update is no 
longer iterated
upon by `Page::forEachDocument()` and we don't correctly remove the affected 
timelines from
the list of known timelines.

To address this, we move the list of known timelines to a per-`Page` object, 
the new class
`AcceleratedTimelinesUpdater`. Now the remote layer tree transaction, as a page 
enters the cache,
will contain timelines associated with documents now in the cache and the 
currently-active documents.

Note that there is no test change in this patch since the flag is not yet 
enabled on bots. This
was caught in preparation of that running animation tests locally using
`--experimental-feature ThreadedTimeBasedAnimationsEnabled=true`.

* Source/WebCore/Headers.cmake:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/animation/AcceleratedEffectStackUpdater.cpp:
(WebCore::AcceleratedEffectStackUpdater::update):
(WebCore::AcceleratedEffectStackUpdater::scrollTimelineDidChange): Deleted.
(WebCore::AcceleratedEffectStackUpdater::takeTimelinesUpdate): Deleted.
* Source/WebCore/animation/AcceleratedEffectStackUpdater.h:
(WebCore::AcceleratedEffectStackUpdater::hasTargetsPendingUpdate const):
* Source/WebCore/animation/AcceleratedTimelinesUpdater.cpp: Added.
(WebCore::AcceleratedTimelinesUpdater::scrollTimelineDidChange):
(WebCore::AcceleratedTimelinesUpdater::processTimelinesSeenDuringEffectStacksUpdate):
(WebCore::AcceleratedTimelinesUpdater::takeTimelinesUpdate):
* Source/WebCore/animation/AcceleratedTimelinesUpdater.h: Added.
* Source/WebCore/animation/ScrollTimeline.cpp:
(WebCore::ScrollTimeline::scheduleAcceleratedRepresentationUpdate):
* Source/WebCore/dom/Document.cpp:
* Source/WebCore/page/Page.cpp:
(WebCore::Page::ensureAcceleratedTimelinesUpdater):
* Source/WebCore/page/Page.h:
(WebCore::Page::acceleratedTimelinesUpdater const):
* Source/WebKit/WebProcess/WebPage/Cocoa/WebPageCocoa.mm:
(WebKit::WebPage::willCommitLayerTree):

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



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

Reply via email to