@@ -202,7 +202,7 @@ spec: cssom-view-1; type: dfn;
202202 <dt> <dfn>self</dfn>
203203 <dd>
204204 Specifies to use the element’s own [=principal box=] as the [=scroll container=] .
205- If the [=principal box=] is not a [=scroll container=] ,
205+ If the [=principal box=] is not a [=scroll container=] ,
206206 then the [=scroll progress timeline=] is [=inactive timeline|inactive=] .
207207 </dl>
208208
@@ -788,40 +788,44 @@ spec: cssom-view-1; type: dfn;
788788
789789# Frame Calculation Details # {#frames}
790790
791- ## Avoiding cycles with layout ## {#avoiding-cycles}
791+ ## HTML Processing Model: Event loop
792792
793793 The ability for scrolling to drive the progress of an animation,
794794 gives rise to the possibility of <dfn>layout cycles</dfn> ,
795795 where a change to a scroll offset causes an animation's effect to update,
796796 which in turn causes a new change to the scroll offset.
797797
798798 To avoid such [=layout cycles=] ,
799- animations with a [=scroll progress timeline=] are sampled once per frame,
800- after scrolling in response to input events has taken place,
801- but before {{requestAnimationFrame()}} callbacks are run.
802- If the sampling of such an animation causes a change to a scroll offset,
803- the animation will not be re-sampled to reflect the new offset
804- until the next frame.
805-
806- The implication of this is that in some situations, in a given frame,
807- the rendered scroll offset of a scroll container might not be consistent
808- with the state of an animation driven by scrolling that scroll container.
809- However, this will only occur in situations where the animation's effect
810- changes the scroll offset of that same scroll container
811- (in other words, in situations where the animation's author is asking for trouble).
812- In normal situations, including—importantly--
813- when scrolling happens in response to input events,
814- the rendered scroll offset and the state of scroll-driven animations
815- will be consistent in each frame.
816-
817- User agents that composite frames asynchronously
818- with respect to layout and/or script
819- may, at their discretion, sample scroll-driven animations
820- once per <em> composited</em> frame,
821- rather than (or in addition to) once per full layout cycle.
822- Again, if sampling such an animation causes a change to a scroll offset,
823- the animation will not be re-sampled to reflect the new offset
824- until the next frame.
799+ animations with a [=scroll progress timeline=] update their current time once
800+ during step 7.10 of the [HTML Processing Model] (https://html.spec.whatwg.org/multipage/webappapis.html#processing-model-8) event loop,
801+ as step 1 of [=update animations and send events=] .
802+
803+ During step 7.14.1 of the [HTML Processing Model] (https://html.spec.whatwg.org/multipage/webappapis.html#processing-model-8),
804+ any created [=scroll progress timelines=] or [=view progress timelines=] are collected into an <dfn export>initially stale</dfn> set.
805+ After step 7.14.1 if there are any [=initially stale=] timelines, they update their current time,
806+ the set of [=initially stale=] timelines is cleared and
807+ we run and we run an additional step to recalculate styles and update layout.
808+ As we only gather stale timelines during the first style and layout calculation,
809+ this can only directly cause one additional style recalculation.
810+
811+ Note: Without this additional round of style and layout,
812+ [=initially stale=] timelines would remain stale
813+ (i.e. they would not have a current time)
814+ for the remainder of the frame where the timeline was created.
815+ This means that animations linked to such a timeline
816+ would not produce any [=effect value=] for that frame,
817+ which could lead to an undesirable initial "flash"
818+ in the rendered output.
819+
820+ Note: This section has no effect on forced style and layout
821+ calculations triggered by {{Window/getComputedStyle()|getComputedStyle()}} or similar.
822+ In other words, [=initially stale=] timelines are visible as such
823+ through those APIs.
824+
825+ If the step 7.14 of the [HTML Processing Model] (https://html.spec.whatwg.org/multipage/webappapis.html#processing-model-8)
826+ would result in a change of time for any [=scroll progress timelines=] or
827+ [=view progress timelines=] , they will not be re-sampled to reflect the
828+ new offset until the next update of the rendering.
825829
826830 Nothing in this section is intended to require
827831 that scrolling block on layout or script.
@@ -1040,7 +1044,7 @@ spec: cssom-view-1; type: dfn;
10401044
10411045 2. Otherwise, return null.
10421046
1043- 2. Let |current time|
1047+ 2. Let |current time|
10441048 be the value of [=this's=] {{AnimationTimeline/currentTime}} internal slot.
10451049
10461050 If [=this=] is a {{ScrollTimeline}} ,
0 commit comments