From b908589a18adb02387c5d804c8ec98b1e75e8603 Mon Sep 17 00:00:00 2001 From: Johannes Odland Date: Thu, 8 Feb 2024 22:36:06 +0100 Subject: [PATCH] Realign start time if finite timeline and auto-rewind is true --- src/proxy-animation.js | 5 ++++- test/expected.txt | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/proxy-animation.js b/src/proxy-animation.js index 0c13bc3..417d9e5 100644 --- a/src/proxy-animation.js +++ b/src/proxy-animation.js @@ -572,10 +572,13 @@ function playInternal(details, autoRewind) { } // Not by spec, but required by tests in play-animation.html: + // – Playing a running animation resets a sticky start time // - Playing a finished animation restarts the animation aligned at the start // - Playing a pause-pending but previously finished animation realigns with the scroll position // - Playing a finished animation clears the start time - if (details.proxy.playState === 'finished' || abortedPause) { + // - Resuming an animation from paused realigns with scroll position. + // These tests suggest that the start time should always be auto aligned when auto-rewind and finite timeline is true + if (autoRewind) { details.holdTime = null details.startTime = null details.autoAlignStartTime = true; diff --git a/test/expected.txt b/test/expected.txt index 2382c52..84d7f50 100644 --- a/test/expected.txt +++ b/test/expected.txt @@ -829,14 +829,14 @@ FAIL /scroll-animations/scroll-timelines/play-animation.html Playing an animatio PASS /scroll-animations/scroll-timelines/play-animation.html Playing an animations with a negative playback rate aligns the start time with the end of the active range PASS /scroll-animations/scroll-timelines/play-animation.html Start time set while play pending is preserved. PASS /scroll-animations/scroll-timelines/play-animation.html Current time set while play pending is preserved. -FAIL /scroll-animations/scroll-timelines/play-animation.html Playing a running animation resets a sticky start time +PASS /scroll-animations/scroll-timelines/play-animation.html Playing a running animation resets a sticky start time PASS /scroll-animations/scroll-timelines/play-animation.html Playing a finished animation restarts the animation aligned at the start PASS /scroll-animations/scroll-timelines/play-animation.html Playing a finished and reversed animation restarts the animation aligned at the end PASS /scroll-animations/scroll-timelines/play-animation.html Playing a pause-pending but previously finished animation realigns with the scroll position PASS /scroll-animations/scroll-timelines/play-animation.html Playing a finished animation clears the start time PASS /scroll-animations/scroll-timelines/play-animation.html The ready promise should be replaced if the animation is not already pending PASS /scroll-animations/scroll-timelines/play-animation.html A pending ready promise should be resolved and not replaced when the animation enters the running state -FAIL /scroll-animations/scroll-timelines/play-animation.html Resuming an animation from paused realigns with scroll position. +PASS /scroll-animations/scroll-timelines/play-animation.html Resuming an animation from paused realigns with scroll position. PASS /scroll-animations/scroll-timelines/play-animation.html If a pause operation is interrupted, the ready promise is reused FAIL /scroll-animations/scroll-timelines/play-animation.html A pending playback rate is used when determining timeline range alignment PASS /scroll-animations/scroll-timelines/play-animation.html Playing a canceled animation sets the start time