Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(935)

Unified Diff: Source/core/paint/DisplayItemListPaintTest.cpp

Issue 1284203004: Generate scroll/clip display item hierarchy for SPv2 (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fix assertion failure Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/paint/DisplayItemListPaintTest.cpp
diff --git a/Source/core/paint/DisplayItemListPaintTest.cpp b/Source/core/paint/DisplayItemListPaintTest.cpp
index f9fed44c8dc0e8f30525dcc4d6b8d718d643e2db..d54c254d5596c01227327969453e81e1180cc4a2 100644
--- a/Source/core/paint/DisplayItemListPaintTest.cpp
+++ b/Source/core/paint/DisplayItemListPaintTest.cpp
@@ -228,7 +228,8 @@ TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, FullDocumentPaintingWithCaret
document().view()->updateAllLifecyclePhases();
- EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItems(), 4,
+ EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItems(), 5,
+ TestDisplayItem(layoutView, DisplayItem::FixedPositionContainer),
TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground),
TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence),
TestDisplayItem(textInlineBox, DisplayItem::paintPhaseToDrawingType(PaintPhaseForeground)),
@@ -237,7 +238,8 @@ TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, FullDocumentPaintingWithCaret
div.focus();
document().view()->updateAllLifecyclePhases();
- EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItems(), 5,
+ EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItems(), 6,
+ TestDisplayItem(layoutView, DisplayItem::FixedPositionContainer),
TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground),
TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence),
TestDisplayItem(textInlineBox, DisplayItem::paintPhaseToDrawingType(PaintPhaseForeground)),
@@ -257,7 +259,8 @@ TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, InlineRelayout)
document().view()->updateAllLifecyclePhases();
- EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItems(), 4,
+ EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItems(), 5,
+ TestDisplayItem(layoutView, DisplayItem::FixedPositionContainer),
TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground),
TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence),
TestDisplayItem(firstTextBox, DisplayItem::paintPhaseToDrawingType(PaintPhaseForeground)),
@@ -270,7 +273,8 @@ TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, InlineRelayout)
InlineTextBox& newFirstTextBox = *newText.firstTextBox();
InlineTextBox& secondTextBox = *newText.firstTextBox()->nextTextBox();
- EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItems(), 5,
+ EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItems(), 6,
+ TestDisplayItem(layoutView, DisplayItem::FixedPositionContainer),
TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground),
TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence),
TestDisplayItem(newFirstTextBox, DisplayItem::paintPhaseToDrawingType(PaintPhaseForeground)),
@@ -298,7 +302,8 @@ TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, CachedSubsequence)
DeprecatedPaintLayer& container2Layer = *toLayoutBoxModelObject(container2).layer();
LayoutObject& content2 = *document().getElementById("content2")->layoutObject();
- EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItems(), 11,
+ EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItems(), 12,
+ TestDisplayItem(layoutView, DisplayItem::FixedPositionContainer),
TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground),
TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence),
TestDisplayItem(container1Layer, DisplayItem::BeginSubsequence),
@@ -314,7 +319,8 @@ TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, CachedSubsequence)
toHTMLElement(content1.node())->setAttribute(HTMLNames::styleAttr, "width: 100px; height: 100px; background-color: green");
updateLifecyclePhasesToPaintForSlimmingPaintV2Clean();
- EXPECT_DISPLAY_LIST_WITH_CACHED_RED_FILL_IN_DEBUG(newDisplayItemsBeforeUpdate(), 8,
+ EXPECT_DISPLAY_LIST_WITH_CACHED_RED_FILL_IN_DEBUG(newDisplayItemsBeforeUpdate(), 9,
+ TestDisplayItem(layoutView, DisplayItem::FixedPositionContainer),
TestDisplayItem(layoutView, DisplayItem::drawingTypeToCachedDrawingType(DisplayItem::BoxDecorationBackground)),
TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence),
TestDisplayItem(container1Layer, DisplayItem::BeginSubsequence),
@@ -326,7 +332,8 @@ TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, CachedSubsequence)
compositeForSlimmingPaintV2();
- EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItems(), 11,
+ EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItems(), 12,
+ TestDisplayItem(layoutView, DisplayItem::FixedPositionContainer),
TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground),
TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence),
TestDisplayItem(container1Layer, DisplayItem::BeginSubsequence),
@@ -340,4 +347,120 @@ TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, CachedSubsequence)
TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence));
}
+TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, OverflowClipHierarchy)
pdr. 2015/09/08 04:23:54 If you'd like to keep the fixed position code in t
+{
+ setBodyInnerHTML(
+ "<div id='scroller1' style='overflow: hidden; width: 100px; height: 100px;'>"
+ " <div id='scroller2' style='overflow: hidden; width: 200px; height: 200px;'>"
+ " normal flow"
+ " <div id='positioned' style='position:relative; width: 300px; height: 300px; border: 1px dotted black;'></div>"
+ " </div>"
+ "</div>");
+
+ LayoutView& layoutView = *document().layoutView();
+ LayoutObject& html = *document().documentElement()->layoutObject();
+ DeprecatedPaintLayer& htmlLayer = *static_cast<LayoutBoxModelObject&>(html).layer();
+ LayoutObject& scroller1 = *document().getElementById("scroller1")->layoutObject();
+ DeprecatedPaintLayer& scroller1Layer = *static_cast<LayoutBoxModelObject&>(scroller1).layer();
+ LayoutObject& scroller2 = *document().getElementById("scroller2")->layoutObject();
+ DeprecatedPaintLayer& scroller2Layer = *static_cast<LayoutBoxModelObject&>(scroller2).layer();
+ InlineTextBox& normalFlow = *static_cast<LayoutText*>(scroller2.slowFirstChild()->slowFirstChild())->firstTextBox();
+ LayoutObject& positioned = *document().getElementById("positioned")->layoutObject();
+ DeprecatedPaintLayer& positionedLayer = *static_cast<LayoutBoxModelObject&>(positioned).layer();
+
+ static_cast<LayoutBox&>(scroller1).scrollToOffset(DoubleSize(12, 34));
+ static_cast<LayoutBox&>(scroller2).scrollToOffset(DoubleSize(56, 78));
+ document().view()->updateAllLifecyclePhases();
+
+ EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItems(), 32,
+ TestDisplayItem(layoutView, DisplayItem::FixedPositionContainer),
+ TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground),
+ TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence),
+
+ TestDisplayItem(scroller1, DisplayItem::paintPhaseToClipBoxType(PaintPhaseForeground)),
+ TestDisplayItem(scroller1, DisplayItem::paintPhaseToScrollType(PaintPhaseForeground)),
+ TestDisplayItem(scroller2, DisplayItem::paintPhaseToClipBoxType(PaintPhaseForeground)),
+ TestDisplayItem(scroller2, DisplayItem::paintPhaseToScrollType(PaintPhaseForeground)),
+ TestDisplayItem(normalFlow, DisplayItem::paintPhaseToDrawingType(PaintPhaseForeground)),
+ TestDisplayItem(scroller2, DisplayItem::scrollTypeToEndScrollType(DisplayItem::paintPhaseToScrollType(PaintPhaseForeground))),
+ TestDisplayItem(scroller2, DisplayItem::clipTypeToEndClipType(DisplayItem::paintPhaseToClipBoxType(PaintPhaseForeground))),
+ TestDisplayItem(scroller1, DisplayItem::scrollTypeToEndScrollType(DisplayItem::paintPhaseToScrollType(PaintPhaseForeground))),
+ TestDisplayItem(scroller1, DisplayItem::clipTypeToEndClipType(DisplayItem::paintPhaseToClipBoxType(PaintPhaseForeground))),
+
+ TestDisplayItem(scroller1Layer, DisplayItem::BeginSubsequence),
+ TestDisplayItem(scroller1, DisplayItem::ClipDescendantStackingContext),
+ TestDisplayItem(scroller1, DisplayItem::paintPhaseToScrollType(PaintPhaseBlockBackground)),
+ TestDisplayItem(scroller2Layer, DisplayItem::BeginSubsequence),
+ TestDisplayItem(scroller2Layer, DisplayItem::EndSubsequence),
+ TestDisplayItem(scroller1, DisplayItem::scrollTypeToEndScrollType(DisplayItem::paintPhaseToScrollType(PaintPhaseBlockBackground))),
+ TestDisplayItem(scroller1, DisplayItem::clipTypeToEndClipType(DisplayItem::ClipDescendantStackingContext)),
+ TestDisplayItem(scroller1Layer, DisplayItem::EndSubsequence),
+
+ TestDisplayItem(scroller1, DisplayItem::ClipDescendantStackingContext),
+ TestDisplayItem(scroller1, DisplayItem::paintPhaseToScrollType(PaintPhaseBlockBackground)),
+ TestDisplayItem(scroller2, DisplayItem::ClipDescendantStackingContext),
+ TestDisplayItem(scroller2, DisplayItem::paintPhaseToScrollType(PaintPhaseBlockBackground)),
+ TestDisplayItem(positionedLayer, DisplayItem::BeginSubsequence),
+ TestDisplayItem(positioned, DisplayItem::BoxDecorationBackground),
+ TestDisplayItem(positionedLayer, DisplayItem::EndSubsequence),
+ TestDisplayItem(scroller2, DisplayItem::scrollTypeToEndScrollType(DisplayItem::paintPhaseToScrollType(PaintPhaseBlockBackground))),
+ TestDisplayItem(scroller2, DisplayItem::clipTypeToEndClipType(DisplayItem::ClipDescendantStackingContext)),
+ TestDisplayItem(scroller1, DisplayItem::scrollTypeToEndScrollType(DisplayItem::paintPhaseToScrollType(PaintPhaseBlockBackground))),
+ TestDisplayItem(scroller1, DisplayItem::clipTypeToEndClipType(DisplayItem::ClipDescendantStackingContext)),
+
+ TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence));
+}
+
+TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, OverflowClipHierarchyPhaseInterleave)
+{
+ setBodyInnerHTML(
+ "<div id='scroller1' style='overflow: hidden; width: 100px; height: 100px;'>"
+ " <div id='scroller2' style='overflow: hidden; width: 200px; height: 200px;'>"
+ " <div id='multi-phase' style='width: 300px; height: 300px; background: green; outline: 1px dotted black;'></div>"
+ " </div>"
+ "</div>"
+ "<div id='interleave' style='float: right; width: 300px; height: 300px; background-color: blue;'></div>");
+
+ LayoutView& layoutView = *document().layoutView();
+ LayoutObject& html = *document().documentElement()->layoutObject();
+ DeprecatedPaintLayer& htmlLayer = *static_cast<LayoutBoxModelObject&>(html).layer();
+ LayoutObject& scroller1 = *document().getElementById("scroller1")->layoutObject();
+ LayoutObject& scroller2 = *document().getElementById("scroller2")->layoutObject();
+ LayoutObject& multiPhase = *document().getElementById("multi-phase")->layoutObject();
+ LayoutObject& interleave = *document().getElementById("interleave")->layoutObject();
+
+ static_cast<LayoutBox&>(scroller1).scrollToOffset(DoubleSize(12, 34));
+ static_cast<LayoutBox&>(scroller2).scrollToOffset(DoubleSize(56, 78));
+ document().view()->updateAllLifecyclePhases();
+
+ EXPECT_DISPLAY_LIST_WITH_RED_FILL_IN_DEBUG(rootDisplayItemList().displayItems(), 23,
+ TestDisplayItem(layoutView, DisplayItem::FixedPositionContainer),
+ TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground),
+ TestDisplayItem(htmlLayer, DisplayItem::BeginSubsequence),
+
+ TestDisplayItem(scroller1, DisplayItem::paintPhaseToClipBoxType(PaintPhaseChildBlockBackgrounds)),
+ TestDisplayItem(scroller1, DisplayItem::paintPhaseToScrollType(PaintPhaseChildBlockBackgrounds)),
+ TestDisplayItem(scroller2, DisplayItem::paintPhaseToClipBoxType(PaintPhaseChildBlockBackgrounds)),
+ TestDisplayItem(scroller2, DisplayItem::paintPhaseToScrollType(PaintPhaseChildBlockBackgrounds)),
+ TestDisplayItem(multiPhase, DisplayItem::BoxDecorationBackground),
+ TestDisplayItem(scroller2, DisplayItem::scrollTypeToEndScrollType(DisplayItem::paintPhaseToScrollType(PaintPhaseChildBlockBackgrounds))),
+ TestDisplayItem(scroller2, DisplayItem::clipTypeToEndClipType(DisplayItem::paintPhaseToClipBoxType(PaintPhaseChildBlockBackgrounds))),
+ TestDisplayItem(scroller1, DisplayItem::scrollTypeToEndScrollType(DisplayItem::paintPhaseToScrollType(PaintPhaseChildBlockBackgrounds))),
+ TestDisplayItem(scroller1, DisplayItem::clipTypeToEndClipType(DisplayItem::paintPhaseToClipBoxType(PaintPhaseChildBlockBackgrounds))),
+
+ TestDisplayItem(interleave, DisplayItem::BoxDecorationBackground),
+
+ TestDisplayItem(scroller1, DisplayItem::paintPhaseToClipBoxType(PaintPhaseChildOutlines)),
+ TestDisplayItem(scroller1, DisplayItem::paintPhaseToScrollType(PaintPhaseChildOutlines)),
+ TestDisplayItem(scroller2, DisplayItem::paintPhaseToClipBoxType(PaintPhaseChildOutlines)),
+ TestDisplayItem(scroller2, DisplayItem::paintPhaseToScrollType(PaintPhaseChildOutlines)),
+ TestDisplayItem(multiPhase, DisplayItem::paintPhaseToDrawingType(PaintPhaseSelfOutline)),
+ TestDisplayItem(scroller2, DisplayItem::scrollTypeToEndScrollType(DisplayItem::paintPhaseToScrollType(PaintPhaseChildOutlines))),
+ TestDisplayItem(scroller2, DisplayItem::clipTypeToEndClipType(DisplayItem::paintPhaseToClipBoxType(PaintPhaseChildOutlines))),
+ TestDisplayItem(scroller1, DisplayItem::scrollTypeToEndScrollType(DisplayItem::paintPhaseToScrollType(PaintPhaseChildOutlines))),
+ TestDisplayItem(scroller1, DisplayItem::clipTypeToEndClipType(DisplayItem::paintPhaseToClipBoxType(PaintPhaseChildOutlines))),
+
+ TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence));
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698