Bug 1409446 - Work around the dual-ancestor case that WR doesn't handle yet. r=mstange
authorKartikaya Gupta <kgupta@mozilla.com>
Tue, 24 Oct 2017 15:45:59 -0400
changeset 685814 4a1434cdcae32760d8fef0236fa92545a5c4cc65
parent 685813 40c84480b4d4ce3d806d4d27d705b5fae02eb876
child 685815 debf2683f01fca3c0ec3f1881280752d9676d766
push id86016
push userkgupta@mozilla.com
push dateWed, 25 Oct 2017 01:53:44 +0000
reviewersmstange
bugs1409446, 1409442
milestone58.0a1
Bug 1409446 - Work around the dual-ancestor case that WR doesn't handle yet. r=mstange Bug 1409442 is tracking a change that will allow scroll layers to have multiple ancestors. Without that, there are cases we cannot properly handle, and so we need to ignore a clip in those scenarios. This patch makes sure we do that instead of crashing. MozReview-Commit-ID: 7AU4uyzT6if
gfx/layers/wr/ScrollingLayersHelper.cpp
--- a/gfx/layers/wr/ScrollingLayersHelper.cpp
+++ b/gfx/layers/wr/ScrollingLayersHelper.cpp
@@ -236,18 +236,29 @@ ScrollingLayersHelper::RecurseAndDefineA
           // to be a performance cliff, so we should figure out a better way to
           // deal with this.
           for (it = aCache.begin(); it != aCache.end(); it++) {
             if (DisplayItemClipChain::Equal(aChain, it->first)) {
               break;
             }
           }
         }
-        MOZ_ASSERT(it != aCache.end());
-        ids.second = Some(it->second);
+        // If |it == aCache.end()| here then we have run into a case where the
+        // scroll layer was previously defined a specific parent clip, and
+        // now here it has a different parent clip. Gecko can create display
+        // lists like this because it treats the ASR chain and clipping chain
+        // more independently, but we can't yet represent this in WR. This is
+        // tracked by bug 1409442. For now we'll just leave ids.second as
+        // Nothing() which will effectively ignore the clip |aChain|. Once WR
+        // supports multiple ancestors on a scroll layer we can deal with this
+        // better. The layout/reftests/text/wordwrap-08.html has a Text display
+        // item that exercises this case.
+        if (it != aCache.end()) {
+          ids.second = Some(it->second);
+        }
       }
     }
     return ids;
   }
 
   // If not, recurse to ensure all the ancestors are defined
   auto ancestorIds = DefineClipChain(
       aItem, aAsr->mParent, aChain, aAppUnitsPerDevPixel, aSc,