Closed Bug 1395670 Opened 7 years ago Closed 7 years ago

Scrollbar runs away when APZ-scrolling in layers-free WR mode

Categories

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

Other Branch
defect

Tracking

()

RESOLVED FIXED
mozilla57
Tracking Status
firefox57 --- fixed

People

(Reporter: kats, Assigned: kats)

References

Details

(Whiteboard: [gfx-noted])

Attachments

(2 files)

Scrolling on many pages (e.g. https://news.ycombinator.com/news for a concrete example) will result in the scrollbar outpacing the actual scroll distance. This can also be reproduced in the layout/reftests/async-scrolling/position-fixed-transformed-1.html reftest, if it is run with layers-free WR enabled.

I believe the same root cause is also responsible for the event regions running away from where they should be, which results in bad hit-testing and scrolling not working when it should.

I tracked down the problem, it's a regression from bug 1394011. The code in GetRootMetadata has a bit that checks if the scrollmetadata is already in layer tree, and sets ensureMetricsForRootId to false in that case. This code isn't running in layers-free WR mode because we don't have a layer tree. However it is still needed. Without it we end up with the root scroll id's metadata in two (maybe more) places in the APZ tree, and that results in this weird behaviour.

I have patches that I'm testing.
Comment on attachment 8903273 [details]
Bug 1395670 - Update HitTestingTreeNode logging to indicate scrollbar and scrollthumb nodes.

https://reviewboard.mozilla.org/r/175066/#review180134
Attachment #8903273 - Flags: review?(botond) → review+
This time without capturing a raw pointer to a refcounted object in a lambda:
https://treeherder.mozilla.org/#/jobs?repo=try&revision=4cb870867b4f476637cd98ea08818f8da5e47e5b
And now passing a const-ref of std::function instead of the std::function. Some compilers are so picky.
https://treeherder.mozilla.org/#/jobs?repo=try&revision=dd4c6e0352ba97cce90028c1a1320c552d56d3aa
(In reply to Kartikaya Gupta (Away Sep02-Sep10) (email:kats@mozilla.com) from comment #8)
> And now passing a const-ref of std::function instead of the std::function.
> Some compilers are so picky.

That's actually our own static analysis [1] :)

[1] http://searchfox.org/mozilla-central/source/build/clang-plugin/NonParamInsideFunctionDeclChecker.cpp#100
(In reply to Botond Ballo [:botond] from comment #9)
> That's actually our own static analysis [1] :)

Huh, I'm surprised that showed on the OS X build but not the linux64 static analysis build, then.
(In reply to Kartikaya Gupta (Away Sep02-Sep10) (email:kats@mozilla.com) from comment #12)
> (In reply to Botond Ballo [:botond] from comment #9)
> > That's actually our own static analysis [1] :)
> 
> Huh, I'm surprised that showed on the OS X build but not the linux64 static
> analysis build, then.

It looks like the Linux64 static analysis build uses libstdc++ as the standard library, while the OS X build uses libc++.

The two libraries have different std::function implementations, and one of them triggers our checker and the other doesn't.
Comment on attachment 8903274 [details]
Bug 1395670 - In webrender layers-free mode, don't add a root scroll metadata if we already have it elsewhere in the tree.

https://reviewboard.mozilla.org/r/175068/#review180540
Attachment #8903274 - Flags: review?(mstange) → review+
It would be nice to teach our static analysis the difference between a callback function that is only passed to something in order to be invoked synchronously during that call, and a callback function that is stored away somewhere.
Pushed by kgupta@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/2c70beb7528f
Update HitTestingTreeNode logging to indicate scrollbar and scrollthumb nodes. r=botond
https://hg.mozilla.org/integration/autoland/rev/1027120d021b
In webrender layers-free mode, don't add a root scroll metadata if we already have it elsewhere in the tree. r=mstange
https://hg.mozilla.org/mozilla-central/rev/2c70beb7528f
https://hg.mozilla.org/mozilla-central/rev/1027120d021b
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla57
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: