Bug 1419021 - Part 2: Don't do a full display list build when there are no modified frames. r=miko
authorMatt Woodrow <mwoodrow@mozilla.com>
Thu, 14 Dec 2017 17:38:21 -0600
changeset 396425 0b56d4134b331a150ae644a58c581a798671dfb4
parent 396424 5d4f37b2ab23037d29673729855b8bce824bb3a0
child 396426 969f4ef3c4b2eb91000a7cffd094436239f923b9
push id98312
push usermwoodrow@mozilla.com
push dateThu, 14 Dec 2017 23:40:04 +0000
treeherdermozilla-inbound@969f4ef3c4b2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmiko
bugs1419021
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 1419021 - Part 2: Don't do a full display list build when there are no modified frames. r=miko
layout/generic/nsFrame.cpp
layout/painting/RetainedDisplayListBuilder.cpp
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -1046,24 +1046,16 @@ nsIFrame::MarkNeedsDisplayItemRebuild()
     // If the list starts getting too big, then just mark the root frame
     // as needing a rebuild.
     rootFrame->MarkNeedsDisplayItemRebuild();
     return;
   }
 
   modifiedFrames->AppendElement(this);
 
-  // TODO: this is a bit of a hack. We are using ModifiedFrameList property to
-  // decide whether we are trying to reuse the display list.
-  if (displayRoot != rootFrame &&
-      !displayRoot->HasProperty(nsIFrame::ModifiedFrameList())) {
-    displayRoot->SetProperty(nsIFrame::ModifiedFrameList(),
-                             new nsTArray<nsIFrame*>());
-  }
-
   MOZ_ASSERT(PresContext()->LayoutPhaseCount(eLayoutPhase_DisplayListBuilding) == 0);
   SetFrameIsModified(true);
 
   // Hopefully this is cheap, but we could use a frame state bit to note
   // the presence of dependencies to speed it up.
   DisplayItemArray* items = GetProperty(DisplayItems());
   if (items) {
     for (nsDisplayItem* i : *items) {
--- a/layout/painting/RetainedDisplayListBuilder.cpp
+++ b/layout/painting/RetainedDisplayListBuilder.cpp
@@ -785,33 +785,29 @@ RetainedDisplayListBuilder::ClearModifie
     GetModifiedFrames(mBuilder.RootReferenceFrame());
 
   ClearFrameProps(modifiedFrames);
 }
 
 bool
 RetainedDisplayListBuilder::AttemptPartialUpdate(nscolor aBackstop)
 {
-  const bool hasInvalidations =
-    mBuilder.RootReferenceFrame()->HasProperty(nsIFrame::ModifiedFrameList());
-
   mBuilder.RemoveModifiedWindowDraggingRegion();
   if (mBuilder.ShouldSyncDecodeImages()) {
     MarkFramesWithItemsAndImagesModified(&mList);
   }
 
   mBuilder.EnterPresShell(mBuilder.RootReferenceFrame());
 
   nsTArray<nsIFrame*> modifiedFrames =
     GetModifiedFrames(mBuilder.RootReferenceFrame());
 
   // Do not allow partial builds if the retained display list is empty, or if
   // ShouldBuildPartial heuristic fails.
-  const bool shouldBuildPartial =
-    hasInvalidations && !mList.IsEmpty() && ShouldBuildPartial(modifiedFrames);
+  const bool shouldBuildPartial = !mList.IsEmpty() && ShouldBuildPartial(modifiedFrames);
 
   if (mPreviousCaret != mBuilder.GetCaretFrame()) {
     if (mPreviousCaret) {
       if (mBuilder.MarkFrameModifiedDuringBuilding(mPreviousCaret)) {
         modifiedFrames.AppendElement(mPreviousCaret);
       }
     }