Bug 1192910 - When modifying display port margins, don't schedule paints if the actual display port hasn't changed. r?mattwoodrow
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -1105,16 +1105,19 @@ nsLayoutUtils::SetDisplayPortMargins(nsI
if (currentData && currentData->mPriority > aPriority) {
return false;
}
if (currentData && currentData->mMargins == aMargins) {
return true;
}
+ nsRect oldDisplayPort;
+ GetDisplayPort(aContent, &oldDisplayPort);
+
aContent->SetProperty(nsGkAtoms::DisplayPortMargins,
new DisplayPortMarginsPropertyData(
aMargins, aPriority),
nsINode::DeleteProperty<DisplayPortMarginsPropertyData>);
if (gfxPrefs::LayoutUseContainersForRootFrames()) {
nsIFrame* rootScrollFrame = aPresShell->GetRootScrollFrame();
if (rootScrollFrame &&
@@ -1123,26 +1126,31 @@ nsLayoutUtils::SetDisplayPortMargins(nsI
{
// We are setting a root displayport for a document.
// If we have APZ, then set a special flag on the pres shell so
// that we don't get scrollbars drawn.
aPresShell->SetIgnoreViewportScrolling(true);
}
}
- if (aRepaintMode == RepaintMode::Repaint) {
- nsIFrame* frame = aContent->GetPrimaryFrame();
- if (frame) {
- frame->SchedulePaint();
- }
- }
-
- // Display port margins changing means that the set of visible images may
- // have drastically changed. Schedule an update.
- aPresShell->ScheduleImageVisibilityUpdate();
+ nsRect newDisplayPort;
+ GetDisplayPort(aContent, &newDisplayPort);
+
+ if (!newDisplayPort.IsEqualEdges(oldDisplayPort)) {
+ if (aRepaintMode == RepaintMode::Repaint) {
+ nsIFrame* frame = aContent->GetPrimaryFrame();
+ if (frame) {
+ frame->SchedulePaint();
+ }
+ }
+
+ // Display port margins changing means that the set of visible images may
+ // have drastically changed. Schedule an update.
+ aPresShell->ScheduleImageVisibilityUpdate();
+ }
return true;
}
void
nsLayoutUtils::SetDisplayPortBase(nsIContent* aContent, const nsRect& aBase)
{
aContent->SetProperty(nsGkAtoms::DisplayPortBase, new nsRect(aBase),