Bug 1517895 - Scroll the visual viewport in ScrollToRestoredPosition(). r=tnikkel
authorBotond Ballo <botond@mozilla.com>
Wed, 13 Mar 2019 22:42:48 +0000
changeset 521793 ee808a9cfb1b66b02241216a674ef9dd9a8dd14c
parent 521792 ca8a2a294a18aa1bc5b0f764527ab6c9cd518b7d
child 521794 02e879149e47419f08e03e73fe61a7d7abe58a24
push id10867
push userdvarga@mozilla.com
push dateThu, 14 Mar 2019 15:20:45 +0000
treeherdermozilla-beta@abad13547875 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstnikkel
bugs1517895, 1516056
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1517895 - Scroll the visual viewport in ScrollToRestoredPosition(). r=tnikkel We scroll the visual viewport in addition to the layout viewport to make sure that the layout viewport also ends up at the desired position; note that the layout viewport's desired position will change in bug 1516056 as we start clamping the layout viewport offset to the layout scroll range. Differential Revision: https://phabricator.services.mozilla.com/D19873
layout/generic/nsGfxScrollFrame.cpp
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -4465,16 +4465,20 @@ void ScrollFrameHelper::ScrollToRestored
       AutoWeakFrame weakFrame(mOuter);
       // It's very important to pass nsGkAtoms::restore here, so
       // ScrollToWithOrigin won't clear out mRestorePos.
       ScrollToWithOrigin(scrollToPos, nsIScrollableFrame::INSTANT,
                          nsGkAtoms::restore, nullptr);
       if (!weakFrame.IsAlive()) {
         return;
       }
+      if (mIsRoot && mOuter->PresContext()->IsRootContentDocument()) {
+        mOuter->PresShell()->SetPendingVisualScrollUpdate(
+            scrollToPos, FrameMetrics::eRestore);
+      }
       if (state == LoadingState::Loading || NS_SUBTREE_DIRTY(mOuter)) {
         // If we're trying to do a history scroll restore, then we want to
         // keep trying this until we succeed, because the page can be loading
         // incrementally. So re-get the scroll position for the next iteration,
         // it might not be exactly equal to mRestorePos due to rounding and
         // clamping.
         mLastPos = GetLogicalVisualViewportOffset();
         return;