Open Bug 2006258 Opened 5 months ago Updated 1 day ago

Process stale timelines in HTML event loop

Categories

(Core :: CSS Transitions and Animations, enhancement)

enhancement

Tracking

()

ASSIGNED

People

(Reporter: boris, Assigned: hiro)

References

(Blocks 2 open bugs, )

Details

Attachments

(2 files, 1 obsolete file)

Split the stale timelines part from Bug 1817051 because we may need to check more things in the patch.

Per spec, we need an extra steps in HTML event loop to update the stale
timelines after we update the animation frame callbacks and resize
observer callbacks.

The wpt for stale timelines rely on the DOM APIs which we don't support
now, so this patch doesn't update any wpt expectation. For now we just
follow the spec to try to update the stale timelines.

Assignee: nobody → boris.chiou
Status: NEW → ASSIGNED
Assignee: boris.chiou → nobody
Status: ASSIGNED → NEW
Whiteboard: [scrollanimation:mvp]
Whiteboard: [scrollanimation:mvp]

The implementation of WebKit:

  1. Use m_updatedScrollTimelines to hold a list of scroll timelines which just updated during updateAnimationsAndSendEvents()
  2. Then call runPostRenderingUpdateAnimationTasks() after layoutIfNeeded() and updateResizeObservations().
  3. This function checks m_updatedScrollTimelines and try to update them if they are staled, which means the offset or the range is changed.
  4. May do style update if any of the associated animations have KeyframeEffect.
Blocks: 2039745

I've rebased D269665 and revised it. I am going to upload it now.

This lets callers detect staleness without having to snapshot fields
around the call, and makes the comparison subclass-aware (ViewTimeline
now compares its full CurrentTimeData via operator==).

Assignee: nobody → hikezoe.birchill
Status: NEW → ASSIGNED

This lets callers detect staleness without having to snapshot fields
around the call, and makes the comparison subclass-aware (ViewTimeline
now compares its full CurrentTimeData via operator==).

Attachment #9533263 - Attachment description: Bug 2006258 - Update stale timelines. → Bug 2006258 - Update stale timelines. r?#layout-scroll-driven-animation-reviewers
Attachment #9586573 - Attachment is obsolete: true
Duplicate of this bug: 1831220

So Chromium melds this into snapshot post-layout state steps, where a lot of different things are handled as "snapshot clients," including scroll timelines. The snapshot clients are added at the scroll timeline creation time.
WebKit seemingly collects every timeline (While the set says "updated timelines," any timeline with a valid source will get added) that has non-null source every refreshdriver tick, to be updated later if stale.

OTOH, the current spec seems more involved... I think it says to collect into stale timelines:

  • Any newly-created timelines during the RO cycle (i.e. layout flush then gather & send RO events)
  • Any existing timelines whose named timeline range changed as a result of the RO cycle

... But computing this set basically requires iterating through all existing scroll timelines anyway?

(In reply to David Shin[:dshin] from comment #7)

So Chromium melds this into snapshot post-layout state steps, where a lot of different things are handled as "snapshot clients," including scroll timelines. The snapshot clients are added at the scroll timeline creation time.
WebKit seemingly collects every timeline (While the set says "updated timelines," any timeline with a valid source will get added) that has non-null source every refreshdriver tick, to be updated later if stale.

OTOH, the current spec seems more involved... I think it says to collect into stale timelines:

  • Any newly-created timelines during the RO cycle (i.e. layout flush then gather & send RO events)
  • Any existing timelines whose named timeline range changed as a result of the RO cycle

... But computing this set basically requires iterating through all existing scroll timelines anyway?

For now, yes. Or, we probably need to set something like a dirty flag for the timelines changed ONLY In RO cycle, or a more elegant way like Chromium does. This sounds a lot of work. I'm fine with checking all existing scroll timelines for now. Fortunately we do some early returns in UpdateCachedCurrentTime() to make this pass slightly quicker, and it is unlikely to return true in the common case. If any performance issues happen, we could revisit it.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: