From 9bd8db2016e5585af624d56624ed17bccd9ce25e Mon Sep 17 00:00:00 2001 From: Botond Ballo Date: Fri, 2 Aug 2019 20:31:57 +0000 Subject: [PATCH] Bug 1568826 - Restrict the fix for bug 1549625 to cases where we have a zoomable viewport. r=tnikkel The fix for bug 1549625 is only necessary in cases where the layout and visual viewports can diverge (currently mobile, and later desktop zooming), but it has caused regressions in desktop scenarios that don't involve zooming. While we can get a proper fix in place (tracked in bug 1543485), restricting the existing fix to zoomable configurations mitigates the regressions. Differential Revision: https://phabricator.services.mozilla.com/D40473 --HG-- extra : moz-landing-system : lando --- layout/generic/nsGfxScrollFrame.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index ac560b7f13f1..4b670e43c07f 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -2752,8 +2752,11 @@ void ScrollFrameHelper::ScrollToImpl(nsPoint aPt, const nsRect& aRange, // clamped target position can be different from the current position, so // we don't take the early exit, but conceptually we still want to avoid // updating |mLastScrollOrigin| and clobbering the visual scroll offset. + // We only do this if the visual and layout scroll offsets can diverge + // in the first place, because it causes various regressions (bug 1543485 + // tracks a proper fix). bool suppressScrollOriginChange = false; - if (aPt == curPos) { + if (presContext->PresShell()->GetIsViewportOverridden() && aPt == curPos) { suppressScrollOriginChange = true; }