Bug 873926 - Don't store a scroll state if we never have been scrolled or restored a previous scroll state. r=roc
authorMats Palmgren <matspal@gmail.com>
Wed, 22 May 2013 12:49:49 +0000
changeset 132617 2133f018b1c3182e8a95c3aa54ce7950a2caf471
parent 132616 0a801c3516c06c4581d83a5a73a389fa8811d576
child 132618 dc987f828c72e403cba4cdbc4f84c2f15c59cf27
push id28365
push usermpalmgren@mozilla.com
push dateWed, 22 May 2013 10:49:56 +0000
treeherdermozilla-inbound@2133f018b1c3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs873926
milestone24.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 873926 - Don't store a scroll state if we never have been scrolled or restored a previous scroll state. r=roc
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) {