Skip to content

Commit

Permalink
Commit the pending playback rate when auto aligning the start time
Browse files Browse the repository at this point in the history
  • Loading branch information
johannesodland committed Feb 10, 2024
1 parent ab6f21a commit 2ce10d1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/proxy-animation.js
Original file line number Diff line number Diff line change
Expand Up @@ -921,7 +921,9 @@ function autoAlignStartTime(details) {
// TODO: Clarify how range duration should be resolved
details.rangeDuration = endOffset.value - startOffset.value;
// 7. Set start time to start offset if effective playback rate ≥ 0, and end offset otherwise.
const playbackRate = effectivePlaybackRate(details);
// Not by spec: Applying the pending playback rate. If not, the start time will be re-aligned in `commitPendingPlay()`
applyPendingPlaybackRate(details);
const playbackRate = details.animation.playbackRate;
details.startTime = fromCssNumberish(details,playbackRate >= 0 ? startOffset : endOffset);

// 8. Clear hold time.
Expand Down
4 changes: 2 additions & 2 deletions test/expected.txt
Original file line number Diff line number Diff line change
Expand Up @@ -838,12 +838,12 @@ PASS /scroll-animations/scroll-timelines/play-animation.html The ready promise s
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
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 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
PASS /scroll-animations/scroll-timelines/play-animation.html Playing a canceled animation backwards sets the start time
PASS /scroll-animations/scroll-timelines/reverse-animation.html Setting current time while reverse-pending preserves currentTime
PASS /scroll-animations/scroll-timelines/reverse-animation.html Reversing an animation inverts the playback rate
FAIL /scroll-animations/scroll-timelines/reverse-animation.html Reversing an animation resets a sticky start time.
PASS /scroll-animations/scroll-timelines/reverse-animation.html Reversing an animation resets a sticky start time.
PASS /scroll-animations/scroll-timelines/reverse-animation.html Reversing an animation does not cause it to leave the pending state
PASS /scroll-animations/scroll-timelines/reverse-animation.html Reversing an animation does not cause it to resolve the ready promise
PASS /scroll-animations/scroll-timelines/reverse-animation.html Reversing an animation with a negative playback rate should cause the animation to play in a forward direction
Expand Down

0 comments on commit 2ce10d1

Please sign in to comment.