Closed Bug 1528180 Opened 11 months ago Closed 6 months ago

above-the-fold animations in scrollport (of e.g. 'height') can cause visible elements to jitter if WebRender is enabled

Categories

(Core :: Graphics: WebRender, defect, P3)

defect

Tracking

()

VERIFIED FIXED
mozilla70
Tracking Status
firefox-esr60 --- unaffected
firefox-esr68 --- disabled
firefox65 --- disabled
firefox66 --- disabled
firefox67 --- wontfix
firefox68 --- wontfix
firefox69 --- verified
firefox70 --- verified

People

(Reporter: alice0775, Assigned: emilio)

References

(Depends on 1 open bug, Blocks 2 open bugs, )

Details

(Keywords: regression, reproducible)

Attachments

(2 files)

+++ This bug was initially created as a clone of Bug #1527899 +++

Build ID 20190215045130
User Agent Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:67.0) Gecko/20100101 Firefox/67.0

STR:
0. WebRender turn on and restart

  1. Launch Firefox.
  2. Navigate to testcase of Bug 1519553 attachment 9036063 [details]
  3. Scroll up by 20-30px with drag scrollbar thumb
    or Scroll up or down with mouse wheel one notch
  4. Observe

(optionally if not reproduced)
5. Repeat step3

ER: Solid scroll position
AR: The contents jitter.

Attached file about:support
Summary: above-the-fold animations in scrollport (of e.g. 'height') can cause visible elements to jitter if WebRender isenabled → above-the-fold animations in scrollport (of e.g. 'height') can cause visible elements to jitter if WebRender is enabled
Priority: -- → P4
Priority: P4 → P3
See Also: → 1541072
Keywords: reproducible
See Also: → 1554861
Duplicate of this bug: 1565547
Has STR: --- → yes
OS: Windows 10 → All
Hardware: x86_64 → All

Taking since I'm looking at this for the moment. Andrew was also looking at more general snapping, so this may also be interesting to him.

Assignee: nobody → emilio

So I did a bit of debugging. What's going on is:

  • Scroll anchoring adjusts to the offset of the frame.
  • APC requests a fractionally different offset:
(rr) p geckoScrollPosition
$7 = {<mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::CSSPixel, float>, mozilla::gfx::CoordTyped<mozilla::CSSPixel, float> >> = {{{x = 0, y = 290.683319}, components = {0, 
        290.683319}}}, <mozilla::CSSPixel> = {<No data fields>}, <No data fields>}
(rr) p targetScrollPosition
$8 = {<mozilla::gfx::BasePoint<float, mozilla::gfx::PointTyped<mozilla::CSSPixel, float>, mozilla::gfx::CoordTyped<mozilla::CSSPixel, float> >> = {{{x = 0, y = 290.68335}, components = {0, 
        290.68335}}}, <mozilla::CSSPixel> = {<No data fields>}, <No data fields>}
  • The APC scrolling ends up in ScrollToImpl, where we change the offset, invalidate the anchor, and start again.

This position is only invalidated from FrameLayerBuilder, that's not a very good
signal.

This would get out of sync when using WebRender, and APZ messages will send
sub-pixel scroll positions that will get wrongly adjusted, causing small scroll
offsets which scroll anchoring would incorrectly try to correct, which is the
ultimate cause of the jittering.

Mentioned this on IRC but: I'm only mildly confident in https://phabricator.services.mozilla.com/D37875 being the 100% correct fix, but I'm pretty sure that what we're doing right now is completely wrong. I'm unsure what the WebRender equivalent to the two calls of https://searchfox.org/mozilla-central/rev/15be167a5b436b57fef944b84eef061d24c1af8c/layout/painting/FrameLayerBuilder.cpp#2550 are, but an alternative that probably also works is calling that from the WebRender equivalents.

(It is unclear there is a WebRender equivalent at all to the point where we create a layer for a scrollable frame. :))

Pushed by ealvarez@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a37238f046d5
Don't align scroll offsets to layer pixels when using WebRender. r=tnikkel
Blocks: 1541072
Status: NEW → RESOLVED
Closed: 6 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla70

Bugbug thinks this bug is a regression, but please revert this change in case of error.

Keywords: regression

Comment on attachment 9077691 [details]
Bug 1528180 - Don't align scroll offsets to layer pixels when using WebRender. r=kats,jrmuizel

Beta/Release Uplift Approval Request

  • User impact if declined: Bug 1554861 + jittering in some pages.
  • Is this code covered by automated tests?: No
  • Has the fix been verified in Nightly?: Yes
  • Needs manual test from QE?: Yes
  • If yes, steps to reproduce: comment 0
  • List of other uplifts needed: None
  • Risk to taking this patch: Low
  • Why is the change risky/not risky? (and alternatives if risky): Very low effort patch that fixes a WR correctness bug. The risk of this change having fallout is pretty low I'd say.
  • String changes made/needed: none
Attachment #9077691 - Flags: approval-mozilla-beta?
Flags: qe-verify+
Duplicate of this bug: 1554861
QA Whiteboard: [qa-triaged]
Blocks: 1566517

Comment on attachment 9077691 [details]
Bug 1528180 - Don't align scroll offsets to layer pixels when using WebRender. r=kats,jrmuizel

Fixes a scroll anchoring bug with WebRender. Approved for 69.0b6.

Attachment #9077691 - Flags: approval-mozilla-beta? → approval-mozilla-beta+

Verified as fixed on Firefox 70.0a1 (2019-07-17) on Windows 10 x 64, Windows 7 x32, Mac OS X 10.14 and on Ubuntu 18.04 x64.

Verified as fixed on Firefox 69.0b6 on Windows 10 x 64, Mac OS X 10.14 and on Ubuntu 18.04 x64.

Status: RESOLVED → VERIFIED
QA Whiteboard: [qa-triaged]
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.