Index: Source/platform/graphics/paint/DisplayItemList.cpp |
diff --git a/Source/platform/graphics/paint/DisplayItemList.cpp b/Source/platform/graphics/paint/DisplayItemList.cpp |
index 654b7f0f91cdd8b22e890f7a4ffc863255fe0217..783e1589c55b89f870bc610c822d9b4de3811b56 100644 |
--- a/Source/platform/graphics/paint/DisplayItemList.cpp |
+++ b/Source/platform/graphics/paint/DisplayItemList.cpp |
@@ -25,6 +25,16 @@ const PaintList& DisplayItemList::paintList() |
void DisplayItemList::add(WTF::PassOwnPtr<DisplayItem> displayItem) |
{ |
ASSERT(RuntimeEnabledFeatures::slimmingPaintEnabled()); |
+ |
+ if (displayItem->isEnd()) { |
+ ASSERT(!m_newPaints.isEmpty()); |
+ if (m_newPaints.last()->isBegin()) { |
+ ASSERT(displayItem->isEndAndPairedWith(*m_newPaints.last())); |
+ // Remove empty pairs. |
+ m_newPaints.removeLast(); |
+ return; |
+ } |
+ } |
m_newPaints.append(displayItem); |
} |