Bug 1302470 Part 4: Change nsDisplayList::GetOpaqueRegion non-opaque lists to build up a region from its children. draft
authorBrad Werth <bwerth@mozilla.com>
Thu, 20 Apr 2017 10:50:41 -0700
changeset 677026 2506b95388c47b8f073cd46a07952cfa2225724f
parent 677025 db7f478ca5ca16fdb667b57e0100484a0af9c99a
child 677027 853435a09b27ec8f750fbcc9bc621ca02406a9ed
push id83666
push userbwerth@mozilla.com
push dateMon, 09 Oct 2017 21:51:27 +0000
bugs1302470
milestone58.0a1
Bug 1302470 Part 4: Change nsDisplayList::GetOpaqueRegion non-opaque lists to build up a region from its children. MozReview-Commit-ID: LEuvazbz1X
layout/painting/nsDisplayList.cpp
--- a/layout/painting/nsDisplayList.cpp
+++ b/layout/painting/nsDisplayList.cpp
@@ -5817,17 +5817,26 @@ nsRegion
 nsDisplayWrapList::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
                                    bool* aSnap) const
 {
   *aSnap = false;
   nsRegion result;
   if (mListPtr->IsOpaque()) {
     // Everything within GetBounds that's visible is opaque.
     result = GetBounds(aBuilder, aSnap);
-  }
+  } else if (aBuilder->HitTestShouldStopAtFirstOpaque()) {
+    // If we care about an accurate opaque region, iterate the display list
+    // and build up a region of opaque bounds.
+    nsDisplayItem* item = mList.GetBottom();
+    while (item) {
+      result.OrWith(item->GetOpaqueRegion(aBuilder, aSnap));
+      item = item->GetAbove();
+    }
+  }
+  *aSnap = false;
   return result;
 }
 
 Maybe<nscolor>
 nsDisplayWrapList::IsUniform(nsDisplayListBuilder* aBuilder) const
 {
   // We could try to do something but let's conservatively just return Nothing.
   return Nothing();