Bug 1264949 - Ensure that the display list does not contain any background-image/background-color display item;
MozReview-Commit-ID: LikPnuMxeMc
--- 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();