APZ makes parallax effect look more choppy

RESOLVED FIXED in Firefox 40

Status

()

RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: botond, Assigned: botond)

Tracking

(Blocks: 1 bug)

Trunk
mozilla40
x86_64
Linux
Points:
---

Firefox Tracking Flags

(firefox40 fixed)

Details

(Whiteboard: gfx-noted)

MozReview Requests

()

Submitter Diff Changes Open Issues Last Updated
Loading...
Error loading review requests:

Attachments

(1 attachment, 1 obsolete attachment)

In the testcase for bug 1013412 [1], a parallax effect is implemented by registering a "scroll" event listener which applies a transform to a content element to make it appear like it's scrolling more slowly than the page.

Without APZ, this effect looks smooth - every composite corresponds to a fresh paint, so the scroll listener gets a chance to make its adjustment between every composite.

With APZ, the effect looks choppy - we have brief periods of async scrolling where the content element in question scrolls at the same rate as the page, and then once in a while the scroll event listener runs and adjusts its position, making it jump a bit.

Technically this is expected behaviour, but it's still unfortunate that enabling APZ makes the page behave worse. Is there something we can do to mitigate this?

[1] https://bug1013412.bugzilla.mozilla.org/attachment.cgi?id=8425744
Two things:
 1. On this page, there really is no reason that updating the page in response to a scroll event should take longer than 16ms. We should find out what's taking so long, or what else we're doing wrong if it's not taking long.
 2. I thought bug 1126090 had made us wait for scroll event listeners, too, but I might have misunderstood what was done in that bug.
(In reply to Markus Stange [:mstange] from comment #1)
> Two things:
>  1. On this page, there really is no reason that updating the page in
> response to a scroll event should take longer than 16ms. We should find out
> what's taking so long, or what else we're doing wrong if it's not taking
> long.

We don't trigger repaints every 16 ms [1]. Maybe we should (I see we do on OS X, maybe we just haven't gotten around to setting that pref on Windows and Linux too).

>  2. I thought bug 1126090 had made us wait for scroll event listeners, too,
> but I might have misunderstood what was done in that bug.

Not sure about this, I need to study the wheel event handling code a bit more.

[1] https://dxr.mozilla.org/mozilla-central/source/modules/libpref/init/all.js?from=all.js#558
(In reply to Markus Stange [:mstange] from comment #1)
>  2. I thought bug 1126090 had made us wait for scroll event listeners, too,
> but I might have misunderstood what was done in that bug.

Looking through the bug again, it seems I was misremembering. 

There's some discussion about the general topic on https://groups.google.com/forum/#!topic/mozilla.dev.platform/UMXQw6YEIZ8 .
We should just change that pref to trigger repaints every 16ms by default, for both pan and fling.
Whiteboard: gfx-noted
Sounds good. If that causes too much painting, we could also try to decouple scroll position updates from display port updates, and do them at different rates. But the fact that we snap the display port to tile boundaries should keep our painting frequency down anyways.
Keep in mind tiling isn't used on Windows yet.
Oh, right!
Created attachment 8588804 [details]
MozReview Request: bz://1150282/botond

/r/6675 - Bug 1150282 - Apply APZ prefs meant for desktop to all desktop platforms, not just OS X. r=kats

Pull down this commit:

hg pull -r 87226c6e307652a4eced2e7486488708c251e053 https://reviewboard-hg.mozilla.org/gecko/
Attachment #8588804 - Flags: review?(bugmail.mozilla)
Comment on attachment 8588804 [details]
MozReview Request: bz://1150282/botond

/r/6675 - Bug 1150282 - Apply APZ prefs meant for desktop to all desktop platforms, not just OS X. r=kats

Pull down this commit:

hg pull -r 87226c6e307652a4eced2e7486488708c251e053 https://reviewboard-hg.mozilla.org/gecko/
Behaves much better with 16 ms repaints.

Try push: https://treeherder.mozilla.org/#/jobs?repo=try&revision=fa8ef0df5289
Assignee: nobody → botond
Comment on attachment 8588804 [details]
MozReview Request: bz://1150282/botond

https://reviewboard.mozilla.org/r/6673/#review5561

Ship It!
Attachment #8588804 - Flags: review?(bugmail.mozilla) → review+
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/17f7421d7b53
Status: NEW → RESOLVED
Last Resolved: 3 years ago
status-firefox40: affected → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
Comment on attachment 8588804 [details]
MozReview Request: bz://1150282/botond
Attachment #8588804 - Attachment is obsolete: true
Attachment #8619951 - Flags: review+
Created attachment 8619951 [details]
MozReview Request: Bug 1150282 - Apply APZ prefs meant for desktop to all desktop platforms, not just OS X. r=kats
You need to log in before you can comment on or make changes to this bug.