Closed Bug 1592902 Opened 6 years ago Closed 6 years ago

Janky scrolling on itest.5ch.net due to add network dynamically changing the viewport element

Categories

(Core :: Panning and Zooming, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla72
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.

Seems like we maybe should be able to restore the APZ scroll offset when reconstructing the viewport, somehow...

Or avoid reconstructing the viewport in the first place I guess.

Ah, interesting, this works on WebRender... so probably an apz issue of sorts?

Component: Layout: Scrolling and Overflow → Panning and Zooming

Hmm. I see comparably janky scrolling both with and without WebRender.

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.

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?

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.

Depends on: 1592435

(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.

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: nobody → botond
Priority: -- → P2

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.

(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.

Pushed by bballo@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/a407a5cf22c5 Add some logging. r=tnikkel https://hg.mozilla.org/integration/autoland/rev/701479e9ecf7 Factor out a ShouldCancelAnimationForScrollUpdate() helper. r=tnikkel https://hg.mozilla.org/integration/autoland/rev/fba08c688f41 Use ShouldCancelAnimationForScrollUpdate() for visual scroll updates as well. r=tnikkel[C https://hg.mozilla.org/integration/autoland/rev/17e20df1d092 Include the TOUCHING state in CanHandleScrollOffsetUpdate(). r=tnikkel https://hg.mozilla.org/integration/autoland/rev/d9da7dd620fa Extend gtest to cover this scenario. r=tnikkel
See Also: → 1593752
No longer blocks: fixed-by-webrender
Depends on: fixed-by-webrender
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: