Bug 1413073 - Fix rebase issue that caused us to only update the container asr for reused items. a=gchang
authorMatt Woodrow <mwoodrow@mozilla.com>
Sat, 11 Nov 2017 15:46:48 +1300
changeset 445074 409df5c82beae70a7060bceb2e5072ee78d78c52
parent 445073 2796c4cd23e3206f548bc3a83a9c982377d442ca
child 445075 51795bc51debe7bd0426bcd8ab6fa2ca75f8c6af
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgchang
bugs1413073
milestone58.0
Bug 1413073 - Fix rebase issue that caused us to only update the container asr for reused items. a=gchang
layout/painting/RetainedDisplayListBuilder.cpp
--- a/layout/painting/RetainedDisplayListBuilder.cpp
+++ b/layout/painting/RetainedDisplayListBuilder.cpp
@@ -349,30 +349,34 @@ void UpdateASR(nsDisplayItem* aItem,
  */
 void
 RetainedDisplayListBuilder::MergeDisplayLists(nsDisplayList* aNewList,
                                               nsDisplayList* aOldList,
                                               nsDisplayList* aOutList,
                                               Maybe<const ActiveScrolledRoot*>& aOutContainerASR)
 {
   nsDisplayList merged(&mBuilder);
-  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 (!aOutContainerASR) {
       aOutContainerASR = Some(finiteBoundsASR);
     } else {
       aOutContainerASR =
         Some(ActiveScrolledRoot::PickAncestor(aOutContainerASR.value(), 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.
@@ -463,23 +467,23 @@ RetainedDisplayListBuilder::MergeDisplay
             Maybe<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