Janky scrolling on itest.5ch.net due to add network dynamically changing the viewport element
Categories
(Core :: Panning and Zooming, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox72 | --- | fixed |
People
(Reporter: emilio, Assigned: botond)
References
Details
Attachments
(6 files)
See the test-case. This is the cause of https://github.com/webcompat/web-bugs/issues/36826.
Reporter | ||
Comment 1•6 years ago
|
||
Seems like we maybe should be able to restore the APZ scroll offset when reconstructing the viewport, somehow...
Reporter | ||
Comment 2•6 years ago
|
||
Or avoid reconstructing the viewport in the first place I guess.
Reporter | ||
Comment 3•6 years ago
|
||
Ah, interesting, this works on WebRender... so probably an apz issue of sorts?
Assignee | ||
Comment 4•6 years ago
|
||
Hmm. I see comparably janky scrolling both with and without WebRender.
Assignee | ||
Comment 5•6 years ago
|
||
The behaviour is much worse on Android (it initially seems like you can't scroll at all, though you eventually can), but again, I see the same thing with and without WebRender.
Assignee | ||
Comment 6•6 years ago
|
||
From the testcase:
function messWithScrolling() {
let iframe = document.querySelector("iframe");
let oldOverflow = document.documentElement.style.overflow;
document.documentElement.style.overflow = 'hidden';
let someSize = iframe.contentWindow.innerWidth;
document.documentElement.style.overflow = "";
setTimeout(messWithScrolling, 200);
};
It looks like the declaration of someSize
is important to trigger the problem, even though it's never used. Do you understand why?
Assignee | ||
Comment 7•6 years ago
|
||
The underlying issue here is closely related to the one in bug 1592435, and an extension to the approach taken there improves the behaviour by keeping scrolling responsive, although the scroll offset still jumps back and forth.
Assignee | ||
Comment 8•6 years ago
|
||
(In reply to Botond Ballo [:botond] from comment #6)
It looks like the declaration of
someSize
is important to trigger the problem, even though it's never used. Do you understand why?
This is answered in the Github issue:
innerWidth requires updating layout on the parent document, for obvious reasons, and the overflow-x: hidden on the body means that when overflow on the root is visible, overflow is propagated from the body to the viewport, and not otherwise. So the body needs to become a scrolling box, and thus Firefox rebuilds the layout tree, and it seems some scrolling state gets messed up while doing this.
Assignee | ||
Comment 9•6 years ago
|
||
Assignee | ||
Comment 10•6 years ago
|
||
Depends on D51445
Assignee | ||
Comment 11•6 years ago
|
||
Depends on D51446
Assignee | ||
Comment 12•6 years ago
|
||
Otherwise, a main-thread update can interrupt a touch drag near its very
start, when we're still in the TOUCHING state while we're overcoming the
touch start tolerance threshold.
Depends on D51447
Assignee | ||
Comment 13•6 years ago
|
||
Depends on D51448
Assignee | ||
Updated•6 years ago
|
Assignee | ||
Comment 14•6 years ago
|
||
So, the patches I posted help, in that they prevent the scroll updates coming from layout from interrupting the user's touch gestures. However, those updates still cause the scroll offset to jump, at least on the test page.
I'm not sure what the impact on the original page is, as I can't actually repro any scrolling misbehaviour on that page myself. I would suggest filing a new bug if there are still issues on the original page (such as the mentioned jump occuring and being noticeable), and we can explore a separate fix for that.
Comment 15•6 years ago
|
||
(In reply to Botond Ballo [:botond] from comment #6)
It looks like the declaration of
someSize
is important to trigger the problem, even though it's never used. Do you understand why?
Probably because that would force flushing of layout to get that size.
Comment 16•6 years ago
|
||
Comment 17•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/a407a5cf22c5
https://hg.mozilla.org/mozilla-central/rev/701479e9ecf7
https://hg.mozilla.org/mozilla-central/rev/fba08c688f41
https://hg.mozilla.org/mozilla-central/rev/17e20df1d092
https://hg.mozilla.org/mozilla-central/rev/d9da7dd620fa
Updated•3 years ago
|
Description
•