Bug 1547986 - Don't early return in PreProcessDisplayList if we need to re-link the display list on exit. r=miko
authorMatt Woodrow <mwoodrow@mozilla.com>
Wed, 01 May 2019 17:34:45 +0000
changeset 530970 984c175f86f98a22d6a56e40773f5e3f773a004a
parent 530969 6487aeb6617503c3343708613624f72388180046
child 530971 918567a07dbb60dafc2b971afc4ce1610992d069
push id11265
push userffxbld-merge
push dateMon, 13 May 2019 10:53:39 +0000
treeherdermozilla-beta@77e0fe8dbdd3 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmiko
bugs1547986
milestone68.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 1547986 - Don't early return in PreProcessDisplayList if we need to re-link the display list on exit. r=miko This early return is just an optimization to prevent the DAG from becoming too complex, and if we're keeping the list linked, then we know it won't be getting more complex on the current paint. Future paints that actually modify the list will still take this path. Differential Revision: https://phabricator.services.mozilla.com/D29408
layout/painting/RetainedDisplayListBuilder.cpp
--- a/layout/painting/RetainedDisplayListBuilder.cpp
+++ b/layout/painting/RetainedDisplayListBuilder.cpp
@@ -125,17 +125,17 @@ bool RetainedDisplayListBuilder::PreProc
     PartialUpdateResult& aUpdated, uint32_t aCallerKey, uint32_t aNestingDepth,
     bool aKeepLinked) {
   // The DAG merging algorithm does not have strong mechanisms in place to keep
   // the complexity of the resulting DAG under control. In some cases we can
   // build up edges very quickly. Detect those cases and force a full display
   // list build if we hit them.
   static const uint32_t kMaxEdgeRatio = 5;
   const bool initializeDAG = !aList->mDAG.Length();
-  if (!initializeDAG && aList->mDAG.mDirectPredecessorList.Length() >
+  if (!aKeepLinked && !initializeDAG && aList->mDAG.mDirectPredecessorList.Length() >
                             (aList->mDAG.mNodesInfo.Length() * kMaxEdgeRatio)) {
     return false;
   }
 
   // If we had aKeepLinked=true for this list on the previous paint, then
   // mOldItems will already be initialized as it won't have been consumed during
   // a merge.
   const bool initializeOldItems = aList->mOldItems.IsEmpty();
@@ -222,16 +222,17 @@ bool RetainedDisplayListBuilder::PreProc
           !(invalid->GetStateBits() &
             NS_FRAME_FORCE_DISPLAY_LIST_DESCEND_INTO)) {
         keepLinked = true;
       }
 
       if (!PreProcessDisplayList(
               item->GetChildren(), SelectAGRForFrame(f, aAGR), aUpdated,
               item->GetPerFrameKey(), aNestingDepth + 1, keepLinked)) {
+        MOZ_RELEASE_ASSERT(!aKeepLinked, "Can't early return since we need to move the out list back");
         return false;
       }
     }
 
     // TODO: We should be able to check the clipped bounds relative
     // to the common AGR (of both the existing item and the invalidated
     // frame) and determine if they can ever intersect.
     // TODO: We only really need to build the ancestor container item that is a