Closed Bug 1289915 Opened 3 years ago Closed 3 years ago

Allow scroll-driven animations to run without being paused

Categories

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

defect

Tracking

()

RESOLVED DUPLICATE of bug 1321428
Tracking Status
firefox50 --- affected

People

(Reporter: botond, Unassigned)

References

Details

Attachments

(7 files, 4 obsolete files)

58 bytes, text/x-review-board-request
Details
58 bytes, text/x-review-board-request
Details
58 bytes, text/x-review-board-request
Details
58 bytes, text/x-review-board-request
Details
58 bytes, text/x-review-board-request
Details
58 bytes, text/x-review-board-request
Details
58 bytes, text/x-review-board-request
Details
In the initial scroll-driven animations prototype by Mantaroh, the animation had to be paused to be driven by scrolling, because if it was playing it would also be driven by time.

I have some patches that fix this. They are a requirement for prototyping OMTA support for scroll-driven animations (bug 1289909), because the OMTA codepath will not pick up an animation that's paused.

The patches are a bit rough around the edges; they currently cause a crash during shutdown, and they cause the refresh driver to tick while a scroll-driven animation is in the Playing state even if the page isn't currently being scrolled. However, they accomplish the main goal of the scroll position being propagated through the scroll timeline's current time.

With these patches, the demo page here [1] (which is a modified version of Mantaroh's original demo [2]) can be scrolled to drive the animation of a transform.

The last patch explicitly disables OMTA for scroll-driven animations until that's implemented properly; otherwise, the current OMTA code would cause it to be driven by time on the compositor thread.

[1] https://people.mozilla.org/~bballo/scroll-driven-animations/test.html
[2] https://people.mozilla.org/~mantaroh/scroll-animation/test.html
(In reply to Botond Ballo [:botond] from comment #0)
> they currently cause a crash during shutdown

More precisely, a crash when the current document is unloaded.

The reason for this is that no one calls ScrollTimeline::NotifyRefreshDriverDestroying(). I'm not exactly sure who's supposed to be calling it; Mantaroh, perhaps you might have an idea.
(In reply to Botond Ballo [:botond] from comment #0)
> they cause the refresh driver to tick while a
> scroll-driven animation is in the Playing state even if the page isn't
> currently being scrolled.

This could be avoided if, instead of registering itself as a refresh observer, the scroll timeline just called Animation::Tick() from the scroll observer. That would also solve the above problem of needing to call NotifyRefreshDriverDestroying().

I also discovered that there is an existing interface, nsIScrollPositionListener, which could be reused instead of ScrollHandler/ScrollObserver.
Review commit: https://reviewboard.mozilla.org/r/68100/diff/#index_header
See other reviews: https://reviewboard.mozilla.org/r/68100/
Attachment #8775326 - Attachment description: Keep track of a scroll timeline's scroll range, calculated as the maximum of its animations' effect end times → Derive a scroll timeline's current time from the scroll progress
Comment on attachment 8775323 [details]
Initial prototype by Mantaroh

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/67492/diff/1-2/
Comment on attachment 8775324 [details]
Support vertical scrolling

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/67494/diff/1-2/
Comment on attachment 8775325 [details]
Add Max() and Min() methods to TimeDuration

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/67496/diff/1-2/
Comment on attachment 8775326 [details]
Derive a scroll timeline's current time from the scroll progress

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/67498/diff/1-2/
Comment on attachment 8775331 [details]
Disable OMTA for animations with a ScrollTimeline until it's implemented properly

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/67508/diff/1-2/
Attachment #8775327 - Attachment is obsolete: true
Attachment #8775328 - Attachment is obsolete: true
Attachment #8775329 - Attachment is obsolete: true
Attachment #8775330 - Attachment is obsolete: true
Implemented the suggestions described in comment 11. Now it no longer crashes on shutdown, and it doesn't tick the refresh driver unnecessarily.
Priority: -- → P3
The changes in these patches will land as part of bug 1321428.
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1321428
You need to log in before you can comment on or make changes to this bug.