Bug 1264949 - Ensure that the display list does not contain any background-image/background-color display item; r=jfkthame
authorCJKu <cku@mozilla.com>
Tue, 19 Apr 2016 13:41:03 +0800
changeset 293735 ae1879ede4f002904e32e38c97658dffa6531b53
parent 293734 d7d8092718c989ebb91b88bcdca0fb11bfae5f85
child 293736 aba943f47963c575f5a82b41785c833d5e9d2665
push id75312
push usercku@mozilla.com
push dateTue, 19 Apr 2016 05:48:37 +0000
treeherdermozilla-inbound@aba943f47963 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjfkthame
bugs1264949
milestone48.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1264949 - Ensure that the display list does not contain any background-image/background-color display item; r=jfkthame MozReview-Commit-ID: LikPnuMxeMc
layout/base/nsDisplayList.cpp
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -509,18 +509,24 @@ ClipBackgroundByText(nsIFrame* aFrame, n
   builder.EnterPresShell(aFrame);
   nsDisplayList list;
   aFrame->BuildDisplayListForStackingContext(&builder,
                                       nsRect(nsPoint(0, 0), aFrame->GetSize()),
                                       &list);
   builder.LeavePresShell(aFrame);
 
 #ifdef DEBUG
+  // ClipBackgroundByText is called by nsDisplayBackgroundImage::Paint or
+  // nsDisplayBackgroundColor::Paint.
+  // Assert that we do not generate and put nsDisplayBackgroundImage or
+  // nsDisplayBackgroundColor into the list again, which would lead to
+  // infinite recursion.
   for (nsDisplayItem* i = list.GetBottom(); i; i = i->GetAbove()) {
-    MOZ_ASSERT(nsDisplayItem::TYPE_TEXT == i->GetType());
+    MOZ_ASSERT(nsDisplayItem::TYPE_BACKGROUND != i->GetType() &&
+               nsDisplayItem::TYPE_BACKGROUND_COLOR != i->GetType());
   }
 #endif
 
   gfxContext* ctx = aContext->ThebesContext();
   gfxContextMatrixAutoSaveRestore save(ctx);
   ctx->SetMatrix(ctx->CurrentMatrix().Translate(aFillRect.TopLeft()));
   ctx->NewPath();