Skip to content

Commit 1b73f63

Browse files
hiikezoemoz-wptsync-bot
authored andcommitted
Clear mAutoAlignStartTime when transitioning away from a finite timeline.
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
1 parent d9153b6 commit 1b73f63

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<style>
2+
@keyframes anim {}
3+
</style>
4+
<script>
5+
document.addEventListener("DOMContentLoaded", () => {
6+
const a = document.createElement("style")
7+
const b = document.createTextNode("* { animation-play-state: paused; animation-timeline: scroll(), none, --")
8+
a.appendChild(b)
9+
document.documentElement.appendChild(a)
10+
const c = document.createElementNS("http://www.w3.org/2000/svg", "font-face")
11+
document.documentElement.appendChild(c)
12+
c.style.animationName = '"anim", none, none'
13+
self.scroll({"left": 4096})
14+
b.data = ""
15+
})
16+
</script>

0 commit comments

Comments
 (0)