[tbb-commits] [tor-browser] 143/311: Bug 1744069 - Restore the previous behavior of merging RDL list traversal r=emilio, a=dmeehan

gitolite role git at cupani.torproject.org
Tue Apr 26 15:29:03 UTC 2022


This is an automated email from the git hooks/post-receive script.

pierov pushed a commit to branch geckoview-99.0.1-11.0-1
in repository tor-browser.

commit 981774a41601f39214e89a944a8176b5787009a0
Author: Miko Mynttinen <mikokm at gmail.com>
AuthorDate: Mon Mar 14 15:11:05 2022 +0000

    Bug 1744069 - Restore the previous behavior of merging RDL list traversal r=emilio, a=dmeehan
    
    Differential Revision: https://phabricator.services.mozilla.com/D140920
---
 layout/painting/RetainedDisplayListBuilder.cpp | 10 ++++++++--
 layout/painting/nsDisplayList.h                | 19 +++++++++++++++++++
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/layout/painting/RetainedDisplayListBuilder.cpp b/layout/painting/RetainedDisplayListBuilder.cpp
index ebc88cc59e92d..2af75e88f207c 100644
--- a/layout/painting/RetainedDisplayListBuilder.cpp
+++ b/layout/painting/RetainedDisplayListBuilder.cpp
@@ -203,8 +203,10 @@ bool RetainedDisplayListBuilder::PreProcessDisplayList(
       aList->mDAG.Length() ==
           (initializeOldItems ? aList->Length() : aList->mOldItems.Length()));
 
+  nsDisplayList out(Builder());
+
   size_t i = 0;
-  for (nsDisplayItem* item : aList->TakeItems()) {
+  while (nsDisplayItem* item = aList->RemoveBottom()) {
 #ifdef MOZ_DIAGNOSTIC_ASSERT_ENABLED
     item->SetMergedPreProcessed(false, true);
 #endif
@@ -341,13 +343,17 @@ bool RetainedDisplayListBuilder::PreProcessDisplayList(
       if (item->GetType() == DisplayItemType::TYPE_SUBDOCUMENT) {
         IncrementSubDocPresShellPaintCount(item);
       }
-      aList->AppendToTop(item);
+      out.AppendToTop(item);
     }
     i++;
   }
 
   MOZ_RELEASE_ASSERT(aList->mOldItems.Length() == aList->mDAG.Length());
 
+  if (aKeepLinked) {
+    aList->AppendToTop(&out);
+  }
+
   return true;
 }
 
diff --git a/layout/painting/nsDisplayList.h b/layout/painting/nsDisplayList.h
index 41f61d2e70991..4395412862c08 100644
--- a/layout/painting/nsDisplayList.h
+++ b/layout/painting/nsDisplayList.h
@@ -3244,6 +3244,25 @@ class nsDisplayList {
     return list;
   }
 
+  nsDisplayItem* RemoveBottom() {
+    if (!mBottom) {
+      return nullptr;
+    }
+
+    nsDisplayItem* bottom = mBottom->mValue;
+    mBottom = mBottom->mNext;
+
+    if (!mBottom) {
+      // No bottom item means no items at all.
+      mTop = nullptr;
+    }
+
+    MOZ_ASSERT(mLength > 0);
+    mLength--;
+
+    return bottom;
+  }
+
   /**
    * Paint the list to the rendering context. We assume that (0,0) in aCtx
    * corresponds to the origin of the reference frame. For best results,

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list