Bug 873926 - Don't store a scroll state if we never have been scrolled or restored a previous scroll state. r=roc a=lsblakk
authorMats Palmgren <matspal@gmail.com>
Tue, 28 May 2013 17:49:34 +0000
changeset 142743 f326e14be7d52362770c8c54d83b41f4e3373ebe
parent 142742 9b072d87665ac1ea2500389e1d8371e966908a6a
child 142744 08a29ed728b9aab9a50578aa90a1374da23280aa
push id2579
push userakeybl@mozilla.com
push dateMon, 24 Jun 2013 18:52:47 +0000
treeherdermozilla-beta@b69b7de8a05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc, lsblakk
bugs873926
milestone23.0a2
Bug 873926 - Don't store a scroll state if we never have been scrolled or restored a previous scroll state. r=roc a=lsblakk
layout/generic/nsGfxScrollFrame.cpp
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -3939,16 +3939,22 @@ nsPresState*
 nsGfxScrollFrameInner::SaveState()
 {
   nsIScrollbarMediator* mediator = do_QueryFrame(GetScrolledFrame());
   if (mediator) {
     // child handles its own scroll state, so don't bother saving state here
     return nullptr;
   }
 
+  // Don't store a scroll state if we never have been scrolled or restored
+  // a previous scroll state.
+  if (!mHasBeenScrolled && !mDidHistoryRestore) {
+    return nullptr;
+  }
+
   nsPresState* state = new nsPresState();
   // Save mRestorePos instead of our actual current scroll position, if it's
   // valid and we haven't moved since the last update of mLastPos (same check
   // that ScrollToRestoredPosition uses). This ensures if a reframe occurs
   // while we're in the process of loading content to scroll to a restored
   // position, we'll keep trying after the reframe.
   nsPoint pt = GetLogicalScrollPosition();
   if (mRestorePos.y != -1 && pt == mLastPos) {