Chromium Code Reviews| 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 3ff56a1a50d338d786a12badc5b414b429f3e855..550a2acdcc0078764b4fb78d7f63cc66ba7c5b0a 100644 |
| --- a/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp |
| +++ b/third_party/WebKit/Source/core/paint/PaintLayerPainterTest.cpp |
| @@ -420,4 +420,56 @@ TEST_P(PaintLayerPainterTest, PaintPhasesUpdateOnLayerAddition) |
| EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds()); |
| } |
| +TEST_P(PaintLayerPainterTest, PaintPhasesUpdateOnBecomingSelfPainting) |
| +{ |
| + setBodyInnerHTML( |
| + "<div id='will-be-self-painting' style='width: 100px; height: 100px; overflow: hidden'>" |
| + " <div>" |
|
pdr.
2016/04/20 23:13:39
Why is this inner div required?
Xianzhu
2016/04/21 00:42:35
Haven't looked into the root cause, but without th
Xianzhu
2016/04/21 01:03:41
Without the div, the div at line 428 will be marke
pdr.
2016/04/21 18:20:57
This doesn't seem obviously wrong to me, but I thi
|
| + " <div style='outline: 1px solid red; background-color: green'>outline and background</div>" |
| + " </div>" |
| + "</div>"); |
| + |
| + LayoutBlock& layerDiv = *toLayoutBlock(document().getElementById("will-be-self-painting")->layoutObject()); |
| + ASSERT_TRUE(layerDiv.hasLayer()); |
| + EXPECT_FALSE(layerDiv.layer()->isSelfPaintingLayer()); |
| + |
| + PaintLayer& htmlLayer = *toLayoutBlock(document().documentElement()->layoutObject())->layer(); |
| + EXPECT_TRUE(htmlLayer.needsPaintPhaseDescendantOutlines()); |
| + EXPECT_TRUE(htmlLayer.needsPaintPhaseDescendantBlockBackgrounds()); |
| + |
| + toHTMLElement(layerDiv.node())->setAttribute(HTMLNames::styleAttr, "width: 100px; height: 100px; overflow: hidden; position: relative"); |
| + document().view()->updateAllLifecyclePhases(); |
| + PaintLayer& layer = *layerDiv.layer(); |
| + ASSERT_TRUE(layer.isSelfPaintingLayer()); |
| + EXPECT_TRUE(layer.needsPaintPhaseDescendantOutlines()); |
| + EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds()); |
| +} |
| + |
| +TEST_P(PaintLayerPainterTest, PaintPhasesUpdateOnBecomingNonSelfPainting) |
| +{ |
| + setBodyInnerHTML( |
| + "<div id='will-be-non-self-painting' style='width: 100px; height: 100px; overflow: hidden; position: relative'>" |
| + " <div>" |
| + " <div style='outline: 1px solid red; background-color: green'>outline and background</div>" |
| + " </div>" |
| + "</div>"); |
| + |
| + LayoutBlock& layerDiv = *toLayoutBlock(document().getElementById("will-be-non-self-painting")->layoutObject()); |
| + ASSERT_TRUE(layerDiv.hasLayer()); |
| + PaintLayer& layer = *layerDiv.layer(); |
| + EXPECT_TRUE(layer.isSelfPaintingLayer()); |
| + EXPECT_TRUE(layer.needsPaintPhaseDescendantOutlines()); |
| + EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds()); |
| + |
| + PaintLayer& htmlLayer = *toLayoutBlock(document().documentElement()->layoutObject())->layer(); |
| + EXPECT_FALSE(htmlLayer.needsPaintPhaseDescendantOutlines()); |
| + EXPECT_FALSE(htmlLayer.needsPaintPhaseDescendantBlockBackgrounds()); |
| + |
| + toHTMLElement(layerDiv.node())->setAttribute(HTMLNames::styleAttr, "width: 100px; height: 100px; overflow: hidden"); |
| + document().view()->updateAllLifecyclePhases(); |
| + EXPECT_FALSE(layer.isSelfPaintingLayer()); |
| + EXPECT_TRUE(htmlLayer.needsPaintPhaseDescendantOutlines()); |
| + EXPECT_TRUE(htmlLayer.needsPaintPhaseDescendantBlockBackgrounds()); |
| +} |
| + |
| } // namespace blink |