[Gecko Bug 2031862] Clear mAutoAlignStartTime when transitioning away from a finite timeline.#59928
Merged
Conversation
…ine. mAutoAlignStartTime is only meaningful for finite timelines: it is set in the toFiniteTimeline branch of Animation::SetTimelineNoUpdate, and the AutoAlignStartTime procedure asserts that the current timeline is not monotonically increasing. The other branch in SetTimelineNoUpdate only runs SetCurrentTimeNoUpdate (which clears mAutoAlignStartTime as a side effect via SilentlySetCurrentTime) when previous progress is resolved. For a pause-pending scroll-driven animation whose start time was never auto-aligned -- mStartTime null, mHoldTime null, so previousCurrentTime and previousProgress are both null -- that branch is skipped and the animation lands on the new (potentially monotonic) timeline still carrying mAutoAlignStartTime = true. Per spec [1], the fromFiniteTimeline branch only acts when previous progress is resolved and says nothing about the unresolved case. We deviate by unconditionally clearing mAutoAlignStartTime in that branch, because otherwise the flag's invariant (only true while the timeline is finite) is violated and AutoAlignStartTime would later fire on a monotonic timeline. Clear the flag unconditionally in the fromFiniteTimeline branch so the invariant holds regardless of previousProgress, and keep the existing SetCurrentTimeNoUpdate call nested inside the previous-progress check. [1] https://drafts.csswg.org/web-animations-2/#setting-the-timeline Differential Revision: https://phabricator.services.mozilla.com/D300738 bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=2031862 gecko-commit: cf7a1644bfc0a64533b3fc427431a01d55fcc630 gecko-commit-git: a8588405288dd8fa3b173faf25cde9e1c32cfde3 gecko-reviewers: layout-scroll-driven-animation-reviewers, boris
wpt-pr-bot
approved these changes
May 16, 2026
Collaborator
wpt-pr-bot
left a comment
There was a problem hiding this comment.
The review process for this patch is being conducted in the Firefox project.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mAutoAlignStartTime is only meaningful for finite timelines: it is set in
the toFiniteTimeline branch of Animation::SetTimelineNoUpdate, and the
AutoAlignStartTime procedure asserts that the current timeline is not
monotonically increasing.
The other branch in SetTimelineNoUpdate only runs SetCurrentTimeNoUpdate
(which clears mAutoAlignStartTime as a side effect via SilentlySetCurrentTime)
when previous progress is resolved. For a pause-pending scroll-driven
animation whose start time was never auto-aligned -- mStartTime null,
mHoldTime null, so previousCurrentTime and previousProgress are both null --
that branch is skipped and the animation lands on the new (potentially
monotonic) timeline still carrying mAutoAlignStartTime = true.
Per spec [1], the fromFiniteTimeline branch only acts when previous
progress is resolved and says nothing about the unresolved case. We
deviate by unconditionally clearing mAutoAlignStartTime in that branch,
because otherwise the flag's invariant (only true while the timeline is
finite) is violated and AutoAlignStartTime would later fire on a
monotonic timeline.
Clear the flag unconditionally in the fromFiniteTimeline branch so the
invariant holds regardless of previousProgress, and keep the existing
SetCurrentTimeNoUpdate call nested inside the previous-progress check.
[1] https://drafts.csswg.org/web-animations-2/#setting-the-timeline
Differential Revision: https://phabricator.services.mozilla.com/D300738
bugzilla-url: https://bugzilla.mozilla.org/show_bug.cgi?id=2031862
gecko-commit: cf7a1644bfc0a64533b3fc427431a01d55fcc630
gecko-commit-git: a8588405288dd8fa3b173faf25cde9e1c32cfde3
gecko-reviewers: layout-scroll-driven-animation-reviewers, boris