Index: Source/core/paint/DisplayItemListPaintTest.cpp |
diff --git a/Source/core/paint/DisplayItemListPaintTest.cpp b/Source/core/paint/DisplayItemListPaintTest.cpp |
index c136e3707dad0d0de0309fc0ba293b14194b91b7..0f6c226ca03b0f2c15891c62343957e3207738fb 100644 |
--- a/Source/core/paint/DisplayItemListPaintTest.cpp |
+++ b/Source/core/paint/DisplayItemListPaintTest.cpp |
@@ -72,7 +72,7 @@ public: |
#define TRACE_DISPLAY_ITEMS(i, expected, actual) |
#endif |
-#define EXPECT_DISPLAY_LIST(actual, expectedSize, ...) \ |
+#define EXPECT_DISPLAY_LIST_BASE(actual, expectedSize, ...) \ |
do { \ |
EXPECT_EQ((size_t)expectedSize, actual.size()); \ |
if (expectedSize != actual.size()) \ |
@@ -85,35 +85,36 @@ public: |
} \ |
} while (false); |
+#ifndef NDEBUG |
+#define EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(actual, expectedSizeWithoutFill, ...) \ |
+ EXPECT_DISPLAY_LIST_BASE( \ |
+ actual, expectedSizeWithoutFill + 1, \ |
+ TestDisplayItem(*document().layoutView()->layer()->graphicsLayerBacking(), DisplayItem::DebugRedFill), \ |
+ __VA_ARGS__) |
+#else |
+#define EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG EXPECT_DISPLAY_LIST_BASE |
+#endif |
+ |
TEST_F(DisplayItemListPaintTest, FullDocumentPaintingWithCaret) |
{ |
setBodyInnerHTML("<div id='div' contentEditable='true' style='outline:none'>XYZ</div>"); |
document().page()->focusController().setActive(true); |
document().page()->focusController().setFocused(true); |
LayoutView& layoutView = *document().layoutView(); |
- DeprecatedPaintLayer& rootLayer = *layoutView.layer(); |
chrishtr
2015/08/14 00:17:20
Please make v1 and v2 versions of appropriate test
pdr.
2015/08/14 17:28:18
Good catch.
This was already made into a spv2-spe
|
Element& div = *toElement(document().body()->firstChild()); |
LayoutObject& divLayoutObject = *document().body()->firstChild()->layoutObject(); |
InlineTextBox& textInlineBox = *toLayoutText(div.firstChild()->layoutObject())->firstTextBox(); |
- GraphicsContext context(&rootDisplayItemList()); |
- DeprecatedPaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(0, 0, 800, 600), GlobalPaintNormalPhase, LayoutSize()); |
- DeprecatedPaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo, PaintLayerPaintingCompositingAllPhases); |
- rootDisplayItemList().commitNewDisplayItems(); |
+ document().view()->updateAllLifecyclePhases(); |
- EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 2, |
+ EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItems(), 2, |
TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground), |
TestDisplayItem(textInlineBox, DisplayItem::paintPhaseToDrawingType(PaintPhaseForeground))); |
div.focus(); |
document().view()->updateAllLifecyclePhases(); |
- EXPECT_TRUE(rootDisplayItemList().clientCacheIsValid(layoutView.displayItemClient())); |
- EXPECT_FALSE(rootDisplayItemList().clientCacheIsValid(divLayoutObject.displayItemClient())); |
- EXPECT_TRUE(rootDisplayItemList().clientCacheIsValid(textInlineBox.displayItemClient())); |
- DeprecatedPaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo, PaintLayerPaintingCompositingAllPhases); |
- rootDisplayItemList().commitNewDisplayItems(); |
- EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 3, |
+ EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItems(), 3, |
TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground), |
TestDisplayItem(textInlineBox, DisplayItem::paintPhaseToDrawingType(PaintPhaseForeground)), |
TestDisplayItem(divLayoutObject, DisplayItem::Caret)); // New! |
@@ -123,35 +124,25 @@ TEST_F(DisplayItemListPaintTest, InlineRelayout) |
{ |
setBodyInnerHTML("<div id='div' style='width:100px; height: 200px'>AAAAAAAAAA BBBBBBBBBB</div>"); |
LayoutView& layoutView = *document().layoutView(); |
- DeprecatedPaintLayer& rootLayer = *layoutView.layer(); |
Element& div = *toElement(document().body()->firstChild()); |
LayoutBlock& divBlock = *toLayoutBlock(document().body()->firstChild()->layoutObject()); |
LayoutText& text = *toLayoutText(divBlock.firstChild()); |
InlineTextBox& firstTextBox = *text.firstTextBox(); |
- DisplayItemClient firstTextBoxDisplayItemClient = firstTextBox.displayItemClient(); |
- GraphicsContext context(&rootDisplayItemList()); |
- DeprecatedPaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(0, 0, 800, 600), GlobalPaintNormalPhase, LayoutSize()); |
- DeprecatedPaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo, PaintLayerPaintingCompositingAllPhases); |
- rootDisplayItemList().commitNewDisplayItems(); |
+ document().view()->updateAllLifecyclePhases(); |
- EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 2, |
+ EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItems(), 2, |
TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground), |
TestDisplayItem(firstTextBox, DisplayItem::paintPhaseToDrawingType(PaintPhaseForeground))); |
div.setAttribute(HTMLNames::styleAttr, "width: 10px; height: 200px"); |
document().view()->updateAllLifecyclePhases(); |
- EXPECT_TRUE(rootDisplayItemList().clientCacheIsValid(layoutView.displayItemClient())); |
- EXPECT_FALSE(rootDisplayItemList().clientCacheIsValid(divBlock.displayItemClient())); |
- EXPECT_FALSE(rootDisplayItemList().clientCacheIsValid(firstTextBoxDisplayItemClient)); |
- DeprecatedPaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo, PaintLayerPaintingCompositingAllPhases); |
- rootDisplayItemList().commitNewDisplayItems(); |
LayoutText& newText = *toLayoutText(divBlock.firstChild()); |
InlineTextBox& newFirstTextBox = *newText.firstTextBox(); |
InlineTextBox& secondTextBox = *newText.firstTextBox()->nextTextBox(); |
- EXPECT_DISPLAY_LIST(rootDisplayItemList().displayItems(), 5, |
+ EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItems(), 5, |
TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground), |
TestDisplayItem(divBlock, DisplayItem::paintPhaseToBeginSubtreeType(PaintPhaseForeground)), |
TestDisplayItem(newFirstTextBox, DisplayItem::paintPhaseToDrawingType(PaintPhaseForeground)), |