Bug 1158323 - Make sure we set a base rect on document elements that have margins set. r=tn
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 29 Apr 2015 07:22:27 -0400
changeset 272938 18db17b9f9227899198e111413a062c5e1adc24f
parent 272937 4dca08bb090a22c604e4f9750bf1c3b01ff0861f
child 272939 bf1ed8e07f86298448bd31cdc6fa75dc3e31d657
push id863
push userraliiev@mozilla.com
push dateMon, 03 Aug 2015 13:22:43 +0000
treeherdermozilla-release@f6321b14228d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstn
bugs1158323
milestone40.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 1158323 - Make sure we set a base rect on document elements that have margins set. r=tn
gfx/layers/apz/util/ChromeProcessController.cpp
layout/xul/nsRootBoxFrame.cpp
--- a/gfx/layers/apz/util/ChromeProcessController.cpp
+++ b/gfx/layers/apz/util/ChromeProcessController.cpp
@@ -54,16 +54,18 @@ ChromeProcessController::InitializeRoot(
   nsIContent* content = presShell->GetDocument()->GetDocumentElement();
   if (!content) {
     return;
   }
 
   uint32_t presShellId;
   FrameMetrics::ViewID viewId;
   if (APZCCallbackHelper::GetOrCreateScrollIdentifiers(content, &presShellId, &viewId)) {
+    // Note that the base rect that goes with these margins is set in
+    // nsRootBoxFrame::BuildDisplayList.
     nsLayoutUtils::SetDisplayPortMargins(content, presShell, ScreenMargin(), 0,
         nsLayoutUtils::RepaintMode::DoNotRepaint);
   }
 }
 
 void
 ChromeProcessController::RequestContentRepaint(const FrameMetrics& aFrameMetrics)
 {
--- a/layout/xul/nsRootBoxFrame.cpp
+++ b/layout/xul/nsRootBoxFrame.cpp
@@ -174,16 +174,24 @@ nsRootBoxFrame::Reflow(nsPresContext*   
   return nsBoxFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
 }
 
 void
 nsRootBoxFrame::BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                                  const nsRect&           aDirtyRect,
                                  const nsDisplayListSet& aLists)
 {
+  if (mContent && mContent->GetProperty(nsGkAtoms::DisplayPortMargins)) {
+    // The XUL document's root element may have displayport margins set in
+    // ChromeProcessController::InitializeRoot, and we should to supply the
+    // base rect.
+    nsRect displayPortBase = aDirtyRect.Intersect(nsRect(nsPoint(0, 0), GetSize()));
+    nsLayoutUtils::SetDisplayPortBase(mContent, displayPortBase);
+  }
+
   // root boxes don't need a debug border/outline or a selection overlay...
   // They *may* have a background propagated to them, so force creation
   // of a background display list element.
   DisplayBorderBackgroundOutline(aBuilder, aLists, true);
 
   BuildDisplayListForChildren(aBuilder, aDirtyRect, aLists);
 }