| 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 b19b119bebfc0c8062ef6542251a37c0b24191f8..d911ff7eeac1f90a218bc1ba85446318c794dc53 100644
|
| --- a/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp
|
| +++ b/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp
|
| @@ -242,4 +242,53 @@ TEST_P(PaintLayerPainterTest, CachedSubsequenceOnStyleChangeWithInterestRectClip
|
| TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence));
|
| }
|
|
|
| +TEST_P(PaintLayerPainterTest, PaintPhaseOutline)
|
| +{
|
| + AtomicString styleWithoutOutline = "width: 50px; height: 50px; background-color: green";
|
| + AtomicString styleWithOutline = "outline: 1px solid blue; " + styleWithoutOutline;
|
| + setBodyInnerHTML(
|
| + "<div id='self-painting-layer' style='position: absolute'>"
|
| + " <div id='non-self-painting-layer' style='overflow: hidden'>"
|
| + " <div>"
|
| + " <div id='outline'></div>"
|
| + " </div>"
|
| + " </div>"
|
| + "</div>");
|
| + LayoutObject& outlineDiv = *document().getElementById("outline")->layoutObject();
|
| + toHTMLElement(outlineDiv.node())->setAttribute(HTMLNames::styleAttr, styleWithoutOutline);
|
| + 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 == outlineDiv.enclosingLayer());
|
| + ASSERT_TRUE(&selfPaintingLayer == outlineDiv.enclosingLayer()->enclosingSelfPaintingLayer());
|
| +
|
| + EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseChildOutlines());
|
| + EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseChildOutlines());
|
| +
|
| + // needsPaintPhaseChildOutlines should be set when any descendant on the same layer has outline.
|
| + toHTMLElement(outlineDiv.node())->setAttribute(HTMLNames::styleAttr, styleWithOutline);
|
| + updateLifecyclePhasesBeforePaint();
|
| + EXPECT_TRUE(selfPaintingLayer.needsPaintPhaseChildOutlines());
|
| + EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseChildOutlines());
|
| + paint();
|
| + EXPECT_TRUE(displayItemListContains(rootPaintController().displayItemList(), outlineDiv, DisplayItem::paintPhaseToDrawingType(PaintPhaseSelfOutline)));
|
| +
|
| + // needsPaintPhaseChildOutlines shold be reset after an empty painting of the phase.
|
| + toHTMLElement(outlineDiv.node())->setAttribute(HTMLNames::styleAttr, styleWithoutOutline);
|
| + document().view()->updateAllLifecyclePhases();
|
| + EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseChildOutlines());
|
| + EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseChildOutlines());
|
| +
|
| + // Outline on the self-painting-layer node itself doesn't affect PaintPhaseChildOutlines.
|
| + toHTMLElement(selfPaintingLayerObject.node())->setAttribute(HTMLNames::styleAttr, "position: absolute; outline: 1px solid green");
|
| + document().view()->updateAllLifecyclePhases();
|
| + EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseChildOutlines());
|
| + EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseChildOutlines());
|
| + EXPECT_TRUE(displayItemListContains(rootPaintController().displayItemList(), selfPaintingLayerObject, DisplayItem::paintPhaseToDrawingType(PaintPhaseSelfOutline)));
|
| +}
|
| +
|
| } // namespace blink
|
|
|