Closed Bug 1738135 Opened 3 years ago Closed 2 years ago

Don't create ScrollTimeline object for each CSS Animation

Categories

(Core :: DOM: Animation, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
99 Branch
Tracking Status
firefox99 --- fixed

People

(Reporter: boris, Assigned: boris)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

In Bug 1676791, we cerate ScrollTimeline when building animations, for simplicity. It's not a good idea because we may create many identical ScrollTimeline objects, and these ScrollTimeline objects increase the overhead of scrollable frames. In this bug, we have to introduce a way to look up the existing ScrollTimeline when building CSS animations. If it doesn't exist, we create one and let the element owns it. (Note: This may change the lifetime of ScrollTimeline and may need to do cycle-collection for it.)

Yeah, that matches my understanding of what the spec says, i.e. it seems to suggest a maximum of one ScrollTimeline objects per @scroll-timeline declaration. Hopefully there are already WPT for this 🤞

Some ideas from the comment: https://phabricator.services.mozilla.com/D126452#4274075, and EffectSet is a good reference because their structures are similar.

Assignee: nobody → boris.chiou
Blocks: 1746146
Status: NEW → ASSIGNED

We use a HashMap to keep the ScrollTimeline, and use scroll-direction as
the key, so an Element and a scroll direction map to a specific
ScrollTimeline. This means a maximum of one ScrollTimeline objects per
@scroll-timeline declaration.

Note: We may have to update this once we support more descriptors in
@scroll-timeline. For now, this should be enough.

Pushed by bchiou@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/397e6f2fda20
Don't create ScrollTimeline for each Animation. r=hiro
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 99 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: