Bug 1413073 - Fix rebase issue that caused us to only update the container asr for reused items.
authorMatt Woodrow <mwoodrow@mozilla.com>
Sat, 11 Nov 2017 15:46:48 +1300
changeset 435972 559f4487dc65fa76687447282d40b0eee60f20bf
parent 435967 7fb001f811d183095e9cfdd958c9215484377396
child 435973 2ec68ec7ff01827c8b12e9b0c1817920de967b9a
push id117
push userfmarier@mozilla.com
push dateTue, 28 Nov 2017 20:17:16 +0000
bugs1413073
milestone58.0a1
Bug 1413073 - Fix rebase issue that caused us to only update the container asr for reused items.
layout/painting/RetainedDisplayListBuilder.cpp
--- a/layout/painting/RetainedDisplayListBuilder.cpp
+++ b/layout/painting/RetainedDisplayListBuilder.cpp
@@ -347,30 +347,34 @@ void
 RetainedDisplayListBuilder::MergeDisplayLists(nsDisplayList* aNewList,
                                               nsDisplayList* aOldList,
                                               nsDisplayList* aOutList,
                                               const ActiveScrolledRoot** aOutContainerASR)
 {
   nsDisplayList merged(&mBuilder);
   const ActiveScrolledRoot* containerASR = nullptr;
 
-  const auto ReuseItem = [&](nsDisplayItem* aItem) {
+  const auto UseItem = [&](nsDisplayItem* aItem) {
     const ActiveScrolledRoot* itemClipASR =
       aItem->GetClipChain() ? aItem->GetClipChain()->mASR : nullptr;
 
     const ActiveScrolledRoot* finiteBoundsASR = ActiveScrolledRoot::PickDescendant(
       itemClipASR, aItem->GetActiveScrolledRoot());
     if (merged.IsEmpty()) {
       containerASR = finiteBoundsASR;
     } else {
       containerASR =
         ActiveScrolledRoot::PickAncestor(containerASR, finiteBoundsASR);
     }
 
     merged.AppendToTop(aItem);
+  };
+
+  const auto ReuseItem = [&](nsDisplayItem* aItem) {
+    UseItem(aItem);
     aItem->SetReused(true);
 
     if (aItem->GetType() == DisplayItemType::TYPE_SUBDOCUMENT) {
       IncrementSubDocPresShellPaintCount(aItem);
     }
   };
 
   // Build a hashtable of items in the old list so we can look for them quickly.
@@ -461,23 +465,23 @@ RetainedDisplayListBuilder::MergeDisplay
             const ActiveScrolledRoot* containerASRForChildren;
             MergeDisplayLists(newItem->GetChildren(), old->GetChildren(),
                               newItem->GetChildren(), &containerASRForChildren);
             UpdateASR(newItem, containerASRForChildren);
             newItem->UpdateBounds(&mBuilder);
           }
 
           old->Destroy(&mBuilder);
-          merged.AppendToTop(newItem);
+          UseItem(newItem);
         }
       }
     } else {
       // If there was no matching item in the old list, then we only need to
       // add the new item to the merged list.
-      merged.AppendToTop(newItem);
+      UseItem(newItem);
     }
   }
 
   // Reuse the remaining valid items from the old display list.
   while (nsDisplayItem* old = aOldList->RemoveBottom()) {
     if (!IsAnyAncestorModified(old->FrameForInvalidation())) {
       if (old->GetChildren()) {
         // We are calling MergeDisplayLists() to ensure that the display items