Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c152324493769faa042332fd62826b37258d67bc
      
https://github.com/WebKit/WebKit/commit/c152324493769faa042332fd62826b37258d67bc
  Author: Antoine Quint <grao...@webkit.org>
  Date:   2025-05-14 (Wed, 14 May 2025)

  Changed paths:
    A 
LayoutTests/animations/no-cancelation-when-entering-page-cache-expected.txt
    A LayoutTests/animations/no-cancelation-when-entering-page-cache.html
    M Source/WebCore/animation/StyleOriginatedAnimation.cpp
    M Source/WebCore/style/Styleable.cpp

  Log Message:
  -----------
  [scroll-animations] 
https://scroll-driven-animations.style/demos/3d-shoe-explorer/css/ animations 
break after navigating away then back to page
https://bugs.webkit.org/show_bug.cgi?id=284732
rdar://141528296

Reviewed by Antti Koivisto.

The demo at https://scroll-driven-animations.style/demos/3d-shoe-explorer/css/ 
shows a 3d model of sorts that is rendered via <canvas>.
To perform the rotation of the model, the demo uses a `requestAnimationFrame` 
loop to query the current time of scroll-driven CSS
animations in the document. The animation object itself is cached upon page 
load. As the page enters the back-forward cache, the
wrapper object itself is preserved, but the `CSSAnimation` is canceled during 
page teardown under `BackForwardCache::trySuspendPage()`.
As the page is restored from the page cache, the wrapper object will no longer 
provide a valid current time since its associated
animation has been canceled.

To address this we no longer cancel style-originated animations when entering 
the page cache.

Running the new test with multiple iterations uncovered an unsafe comparison in 
`StyleOriginatedAnimation::phaseWithoutEffect()`
between a `WebAnimationTime` and a `Seconds` value, so we also address this.

* LayoutTests/animations/no-cancelation-when-entering-page-cache-expected.txt: 
Added.
* LayoutTests/animations/no-cancelation-when-entering-page-cache.html: Added.
* Source/WebCore/animation/StyleOriginatedAnimation.cpp:
(WebCore::StyleOriginatedAnimation::phaseWithoutEffect const):
* Source/WebCore/style/Styleable.cpp:
(WebCore::Styleable::cancelStyleOriginatedAnimations const):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to