Skip to content

Commit d8c9df3

Browse files
committed
[scroll-animations-1] Copy over layout cycles section
1 parent 1bd64bc commit d8c9df3

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

scroll-animations-1/rewrite.bs

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,3 +606,49 @@ spec: cssom-view-1; type: dfn;
606606
[=scroll progress timelines=] take precedence over [=view progress timelines=].
607607

608608
ISSUE: Do we want to expand this scope to preceding siblings and/or distant cousins?
609+
610+
# Avoiding cycles with layout # {#avoiding-cycles}
611+
612+
The ability for scrolling to drive the progress of an animation,
613+
gives rise to the possibility of <dfn>layout cycles</dfn>,
614+
where a change to a scroll offset causes an animation's effect to update,
615+
which in turn causes a new change to the scroll offset.
616+
617+
To avoid such [=layout cycles=],
618+
animations with a [=scroll progress timeline=] are sampled once per frame,
619+
after scrolling in response to input events has taken place,
620+
but before {{requestAnimationFrame()}} callbacks are run.
621+
If the sampling of such an animation causes a change to a scroll offset,
622+
the animation will not be re-sampled to reflect the new offset
623+
until the next frame.
624+
625+
The implication of this is that in some situations, in a given frame,
626+
the rendered scroll offset of a scroll container might not be consistent
627+
with the state of an animation driven by scrolling that scroll container.
628+
However, this will only occur in situations where the animation's effect
629+
changes the scroll offset of that same scroll container
630+
(in other words, in situations where the animation's author is asking for trouble).
631+
In normal situations, including&mdash;importantly--
632+
when scrolling happens in response to input events,
633+
the rendered scroll offset and the state of scroll-driven animations
634+
will be consistent in each frame.
635+
636+
User agents that composite frames asynchronously
637+
with respect to layout and/or script
638+
may, at their discretion, sample scroll-driven animations
639+
once per <em>composited</em> frame,
640+
rather than (or in addition to) once per full layout cycle.
641+
Again, if sampling such an animation causes a change to a scroll offset,
642+
the animation will not be re-sampled to reflect the new offset
643+
until the next frame.
644+
645+
Nothing in this section is intended to require
646+
that scrolling block on layout or script.
647+
If a user agent normally composites frames where scrolling has occurred
648+
but the consequences of scrolling have not been fully propagated in layout or script
649+
(for example, `scroll` event listeners have not yet run),
650+
the user agent may likewise choose not to sample scroll-driven animations
651+
for that composited frame.
652+
In such cases, the rendered scroll offset
653+
and the state of a scroll-driven animation
654+
may be inconsistent in the composited frame.

0 commit comments

Comments
 (0)