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

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: stripped localPaintingInfo cleanup and fixed-pos workarounds 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 14f703545c70d09f3646a33ea991c5559a6b3f8c..bc390d587ad7db590986f656f9b4a5959986dd81 100644
--- a/Source/core/paint/DisplayItemListPaintTest.cpp
+++ b/Source/core/paint/DisplayItemListPaintTest.cpp
@@ -156,4 +156,124 @@ TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, InlineRelayout)
TestDisplayItem(rootLayer, DisplayItem::EndSubsequence));
}
+TEST_F(DisplayItemListPaintTestForSlimmingPaintV2, OverflowClipHierarchy)
Xianzhu 2015/09/15 23:40:13 Can this be moved into DeprecatedPaintLayerPainter
trchen 2015/09/17 01:56:04 Acknowledged.
+{
+ 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();
+ DeprecatedPaintLayer& rootLayer = *layoutView.layer();
+ 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(rootDisplayItemList().displayItems(), 33,
+ TestDisplayItem(rootLayer, DisplayItem::BeginSubsequence),
+ 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),
+ TestDisplayItem(rootLayer, 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();
+ DeprecatedPaintLayer& rootLayer = *layoutView.layer();
+ 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(rootDisplayItemList().displayItems(), 24,
+ TestDisplayItem(rootLayer, DisplayItem::BeginSubsequence),
+ 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),
+ TestDisplayItem(rootLayer, DisplayItem::EndSubsequence));
+}
+
} // namespace blink

Powered by Google App Engine
This is Rietveld 408576698