Bug 1236040 - When updating the scroll position, only schedule image visibility checks if the display port has changed. r?tn draft
authorMarkus Stange <mstange@themasta.com>
Thu, 31 Dec 2015 00:04:18 +0100
changeset 318193 42d920e9651d8942ed6e64f1f508a3cf61c1f843
parent 318192 208cae926bae1f22c5ab533db02b85cb93a27ff9
child 512437 f9afaf5e61b6ffa1c93df9f4ab1f835d0eb0e79e
push id8850
push usermstange@themasta.com
push dateThu, 31 Dec 2015 15:37:15 +0000
reviewerstn
bugs1236040
milestone46.0a1
Bug 1236040 - When updating the scroll position, only schedule image visibility checks if the display port has changed. r?tn
layout/generic/nsGfxScrollFrame.cpp
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -2525,20 +2525,16 @@ ScrollFrameHelper::ScrollToImpl(nsPoint 
   nscoord horzAllowance = std::max(scrollPortSize.width / std::max(sHorzScrollFraction, 1),
                                    nsPresContext::AppUnitsPerCSSPixel());
   nscoord vertAllowance = std::max(scrollPortSize.height / std::max(sVertScrollFraction, 1),
                                    nsPresContext::AppUnitsPerCSSPixel());
   if (dist.x >= horzAllowance || dist.y >= vertAllowance) {
     needImageVisibilityUpdate = true;
   }
 
-  if (needImageVisibilityUpdate) {
-    presContext->PresShell()->ScheduleImageVisibilityUpdate();
-  }
-
   // notify the listeners.
   for (uint32_t i = 0; i < mListeners.Length(); i++) {
     mListeners[i]->ScrollPositionWillChange(pt.x, pt.y);
   }
 
   nsRect oldDisplayPort;
   nsLayoutUtils::GetDisplayPort(mOuter->GetContent(), &oldDisplayPort);
   oldDisplayPort.MoveBy(-mScrolledFrame->GetPosition());
@@ -2562,19 +2558,27 @@ ScrollFrameHelper::ScrollToImpl(nsPoint 
     DebugOnly<bool> usingDisplayPort =
       nsLayoutUtils::GetDisplayPort(mOuter->GetContent(), &displayPort);
     NS_ASSERTION(usingDisplayPort, "Must have a displayport for apz scrolls!");
 
     displayPort.MoveBy(-mScrolledFrame->GetPosition());
 
     if (!displayPort.IsEqualEdges(oldDisplayPort)) {
       mOuter->SchedulePaint();
+
+      if (needImageVisibilityUpdate) {
+        presContext->PresShell()->ScheduleImageVisibilityUpdate();
+      }
     }
   } else {
     mOuter->SchedulePaint();
+
+    if (needImageVisibilityUpdate) {
+      presContext->PresShell()->ScheduleImageVisibilityUpdate();
+    }
   }
 
   if (mOuter->ChildrenHavePerspective()) {
     // The overflow areas of descendants may depend on the scroll position,
     // so ensure they get updated.
     mOuter->RecomputePerspectiveChildrenOverflow(mOuter, nullptr);
   }