Bug 1427476 - Don't try to retain display lists for popups since their display root isn't the root frame of a document. r=miko
authorMatt Woodrow <mwoodrow@mozilla.com>
Wed, 03 Jan 2018 18:31:31 +1300
changeset 452599 c443b2818c66063b96d30fe5104e98fde988e567
parent 452598 90928695e8b17a7b92551bebc11131834f4087db
child 452600 19b69f2ee20bb1a1e53c59e08b63df6714150487
push id1648
push usermtabara@mozilla.com
push dateThu, 01 Mar 2018 12:45:47 +0000
treeherdermozilla-release@cbb9688c2eeb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmiko
bugs1427476
milestone59.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 1427476 - Don't try to retain display lists for popups since their display root isn't the root frame of a document. r=miko
layout/base/nsLayoutUtils.cpp
layout/generic/nsFrame.cpp
layout/painting/RetainedDisplayListBuilder.cpp
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -3631,17 +3631,20 @@ nsLayoutUtils::PaintFrame(gfxContext* aR
   }
 
   TimeStamp startBuildDisplayList = TimeStamp::Now();
 
   const bool buildCaret = !(aFlags & PaintFrameFlags::PAINT_HIDE_CARET);
   const bool isForPainting = (aFlags & PaintFrameFlags::PAINT_WIDGET_LAYERS) &&
     aBuilderMode == nsDisplayListBuilderMode::PAINTING;
 
-  const bool retainingEnabled = isForPainting && AreRetainedDisplayListsEnabled();
+  // Only allow retaining for painting when preffed on, and for root frames (since
+  // the modified frame tracking is per-root-frame).
+  const bool retainingEnabled =
+    isForPainting && AreRetainedDisplayListsEnabled() && !aFrame->GetParent();
 
   RetainedDisplayListBuilder* retainedBuilder =
     GetOrCreateRetainedDisplayListBuilder(aFrame, retainingEnabled, buildCaret);
 
   // Only use the retained display list builder if the retaining is currently
   // enabled. This check is needed because it is possible that the pref has been
   // disabled after creating the retained display list builder.
   const bool useRetainedBuilder = retainedBuilder && retainingEnabled;
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -992,17 +992,19 @@ nsIFrame::RemoveDisplayItemDataForDeleti
       }
     }
   }
 }
 
 void
 nsIFrame::MarkNeedsDisplayItemRebuild()
 {
-  if (!nsLayoutUtils::AreRetainedDisplayListsEnabled() || IsFrameModified()) {
+  if (!nsLayoutUtils::AreRetainedDisplayListsEnabled() ||
+      IsFrameModified() ||
+      HasAnyStateBits(NS_FRAME_IN_POPUP)) {
     // Skip frames that are already marked modified.
     return;
   }
 
   nsIFrame* displayRoot = nsLayoutUtils::GetDisplayRootFrame(this);
   MOZ_ASSERT(displayRoot);
 
   RetainedDisplayListBuilder* retainedBuilder =
--- a/layout/painting/RetainedDisplayListBuilder.cpp
+++ b/layout/painting/RetainedDisplayListBuilder.cpp
@@ -598,16 +598,20 @@ RetainedDisplayListBuilder::ComputeRebui
   CRR_LOG("Computing rebuild regions for %d frames:\n", aModifiedFrames.size());
   for (nsIFrame* f : aModifiedFrames) {
     MOZ_ASSERT(f);
 
     if (f->HasOverrideDirtyRegion()) {
       aOutFramesWithProps->AppendElement(f);
     }
 
+    if (f->HasAnyStateBits(NS_FRAME_IN_POPUP)) {
+      continue;
+    }
+
     // TODO: There is almost certainly a faster way of doing this, probably can be combined with the ancestor
     // walk for TransformFrameRectToAncestor.
     AnimatedGeometryRoot* agr = mBuilder.FindAnimatedGeometryRootFor(f)->GetAsyncAGR();
 
     CRR_LOG("Processing frame %p with agr %p\n", f, agr->mFrame);
 
 
     // Convert the frame's overflow rect into the coordinate space