Closed Bug 1669982 Opened 4 years ago Closed 4 years ago

Blank page is displayed on a pinch zoomed page after hitting the back button

Categories

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

Firefox 83
defect

Tracking

()

VERIFIED FIXED
83 Branch
Tracking Status
firefox81 --- disabled
firefox82 --- disabled
firefox83 --- verified

People

(Reporter: hyacoub, Assigned: kats)

References

Details

Attachments

(4 files, 1 obsolete file)

Affected versions

Firefox Nightly 83.0a1

Affected platforms

Windows 10 x64
MacOS x 10.15

Preconditions

fx.webrender.all = true OR fx.webrender.all = false
apz.allow_zooming = true
apz.windows.use_direct_manipulation = true

Steps to reproduce

  1. Open Firefox
  2. Go to ebay.com
  3. Pinch zoom on any link/button
  4. Click on it
  5. Click the back button

Expected result

The content of the page should be correctly displayed on a pinch zoomed page after hitting the back button

Actual Result

  • Blank page is displayed on a pinch zoomed page after hitting the back button
  • The page is correctly displayed only after clicking or pinch zoom the page

Suggested severity

S2

Severity: -- → S2
Priority: -- → P2

This seems like more similar to bug 1670877. It looks like the displayport is correct initially, but then some time around page load it gets clobbered. Initially the DisplayPortMargins struct has sane margins, layout, and visual offsets. But then the new one that comes in is either empty or just has the margins, and so loses the layout vs relative delta. So then the painted displayport ends up relative to the layout offset instead of the visual offset.

Sadly I couldn't repro on my Linux machine and use rr so I need to use more painful debugging methods on macOS.

Assignee: nobody → kats
See Also: 16699521670877

https://searchfox.org/mozilla-central/rev/803b368879fa332e8e2c1840bf1ec164f7ed2c32/layout/base/GeckoMVMContext.cpp#190-191 is the culprit it seems. At least the main one; there might be other codepaths that trigger the same thing.

Attached file firefox-2020-10-13.zip

Logs of repro case. Was able to repro this on desktop with mousewheel.with_control.action= 5 and ctrl zoom on button on the left side of the screen

Blocks: 1670877
See Also: 1670877

The code in CalculateAndSetDisplayPortMargins computes metrics for the content,
which may be the RCD and therefore have separate visual and layout scroll offsets.
The code then uses CalculatePendingDisplayPort to compute displayport margins,
but that function computes the margins based on the visual scroll offset. The
code then uses that as the final margins, when in fact those margins might
need adjusting so that they can be applied to the base rect (which is based
on the layout scroll offset).

This function is invoked by MobileViewportManager after load complete, at
which point the displayport may already be set and the layout and visual offsets
may have diverged. This can happen if, for example, the user manipulates the
visual viewport early during page load, or if a visual viewport is restored
after navigating backwards. In these scenarios the existing "with adjustment"
displayport margins are clobbered by the new, incorrect "with no adjustment"
margins. This patch corrects this by specifying the necessary adjustment.

All the other call sites of this function only call it to initialize the
displayport for the first time, so they cannot run into this problem of
"clobbering" an existing margins. However, I kept this patch general enough
so that if any of those call sites were to change in the future, it wouldn't
run into the same problem.

Depends on D93493

The warning log statement from two patches up was also triggered by this
codepath early during page load while I was doing manual testing. It's
not clear to me if this has user-observable effects, but from a code inspection
it seems like the margins here should also be subject to the same adjustment.
The recentering code simply normalizes the margin around the same "base rect"
which in this case is the visual offset, since the margins are coming from APZ.
So for the margins to then be applied to main-thread base rect, it needs an
adjustment from the visual space to the layout space.

Depends on D93494

Attachment #9181538 - Attachment is obsolete: true

Tried the above build and can no longer reproduce this issue and 1670877.

(In reply to Kris Taeleman (:ktaeleman) from comment #8)

Tried the above build and can no longer reproduce this issue and 1670877.

Thanks for confirming!

I wrote a test that fails without the patch, seems to pass with the patch: https://treeherder.mozilla.org/#/jobs?repo=try&group_state=expanded&revision=e7ec6f64551b9d2a9abd8337e713cea6816d9e6f

Pushed by kgupta@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/e469c93effb1 Add a log to catch suspicious calls to SetDisplayPortMargins. r=botond https://hg.mozilla.org/integration/autoland/rev/e6611beb37d6 Keep the margin adjustment when calculating margins on the main thread. r=botond https://hg.mozilla.org/integration/autoland/rev/73df8ab9e6e5 Add a test. r=botond

Verified as fixed on Firefox Nightly 83.0a1 (2020-10-18) on Windows 10 x64 and on MacOS x 10.15 using touchpad and a touchscreen.

Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: