Bug 1236040 - When updating the scroll position, only schedule image visibility checks if the display port has changed. r?tn
--- 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);
}