Index: third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp |
diff --git a/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp b/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp |
index a1985fac0d2298996c16373e7f982b6eb6d111f7..281f82bd518d21908b5da5e292a0dc0dc11a80a3 100644 |
--- a/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp |
+++ b/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp |
@@ -291,4 +291,45 @@ TEST_P(PaintLayerPainterTest, PaintPhaseOutline) |
EXPECT_TRUE(displayItemListContains(rootPaintController().displayItemList(), selfPaintingLayerObject, DisplayItem::paintPhaseToDrawingType(PaintPhaseSelfOutlineOnly))); |
} |
+TEST_P(PaintLayerPainterTest, PaintPhaseFloat) |
+{ |
+ AtomicString styleWithoutFloat = "width: 50px; height: 50px; background-color: green"; |
+ AtomicString styleWithFloat = "float: left; " + styleWithoutFloat; |
+ setBodyInnerHTML( |
+ "<div id='self-painting-layer' style='position: absolute'>" |
+ " <div id='non-self-painting-layer' style='overflow: hidden'>" |
+ " <div>" |
+ " <div id='float'></div>" |
+ " </div>" |
+ " </div>" |
+ "</div>"); |
+ LayoutObject& floatDiv = *document().getElementById("float")->layoutObject(); |
+ toHTMLElement(floatDiv.node())->setAttribute(HTMLNames::styleAttr, styleWithoutFloat); |
+ document().view()->updateAllLifecyclePhases(); |
+ |
+ LayoutBlock& selfPaintingLayerObject = *toLayoutBlock(document().getElementById("self-painting-layer")->layoutObject()); |
+ PaintLayer& selfPaintingLayer = *selfPaintingLayerObject.layer(); |
+ ASSERT_TRUE(selfPaintingLayer.isSelfPaintingLayer()); |
+ PaintLayer& nonSelfPaintingLayer = *toLayoutBoxModelObject(document().getElementById("non-self-painting-layer")->layoutObject())->layer(); |
+ ASSERT_FALSE(nonSelfPaintingLayer.isSelfPaintingLayer()); |
+ ASSERT_TRUE(&nonSelfPaintingLayer == floatDiv.enclosingLayer()); |
+ ASSERT_TRUE(&selfPaintingLayer == floatDiv.enclosingLayer()->enclosingSelfPaintingLayer()); |
+ |
+ EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseFloat()); |
+ EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseFloat()); |
+ |
+ // needsPaintPhaseFloat should be set when any descendant on the same layer has float. |
+ toHTMLElement(floatDiv.node())->setAttribute(HTMLNames::styleAttr, styleWithFloat); |
+ updateLifecyclePhasesBeforePaint(); |
+ EXPECT_TRUE(selfPaintingLayer.needsPaintPhaseFloat()); |
+ EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseFloat()); |
+ paint(); |
+ |
+ // needsPaintPhaseFloat shold be reset after an empty painting of the phase. |
+ toHTMLElement(floatDiv.node())->setAttribute(HTMLNames::styleAttr, styleWithoutFloat); |
+ document().view()->updateAllLifecyclePhases(); |
+ EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseFloat()); |
chrishtr
2016/01/22 01:51:46
Remove this part of the unittest.
Xianzhu
2016/01/22 17:29:45
Done.
|
+ EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseFloat()); |
+} |
+ |
} // namespace blink |