OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "core/layout/compositing/CompositedLayerMapping.h" | 5 #include "core/layout/compositing/CompositedLayerMapping.h" |
6 #include "core/paint/PaintControllerPaintTest.h" | 6 #include "core/paint/PaintControllerPaintTest.h" |
7 #include "platform/graphics/GraphicsContext.h" | 7 #include "platform/graphics/GraphicsContext.h" |
8 | 8 |
9 namespace blink { | 9 namespace blink { |
10 | 10 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 TestDisplayItem(container1, backgroundType), | 235 TestDisplayItem(container1, backgroundType), |
236 TestDisplayItem(content1, backgroundType), | 236 TestDisplayItem(content1, backgroundType), |
237 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), | 237 TestDisplayItem(container1Layer, DisplayItem::EndSubsequence), |
238 TestDisplayItem(container2Layer, DisplayItem::Subsequence), | 238 TestDisplayItem(container2Layer, DisplayItem::Subsequence), |
239 TestDisplayItem(container2, backgroundType), | 239 TestDisplayItem(container2, backgroundType), |
240 TestDisplayItem(content2, backgroundType), | 240 TestDisplayItem(content2, backgroundType), |
241 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), | 241 TestDisplayItem(container2Layer, DisplayItem::EndSubsequence), |
242 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); | 242 TestDisplayItem(htmlLayer, DisplayItem::EndSubsequence)); |
243 } | 243 } |
244 | 244 |
| 245 TEST_P(PaintLayerPainterTest, PaintPhaseOutline) |
| 246 { |
| 247 AtomicString styleWithoutOutline = "width: 50px; height: 50px; background-co
lor: green"; |
| 248 AtomicString styleWithOutline = "outline: 1px solid blue; " + styleWithoutOu
tline; |
| 249 setBodyInnerHTML( |
| 250 "<div id='self-painting-layer' style='position: absolute'>" |
| 251 " <div id='non-self-painting-layer' style='overflow: hidden'>" |
| 252 " <div>" |
| 253 " <div id='outline'></div>" |
| 254 " </div>" |
| 255 " </div>" |
| 256 "</div>"); |
| 257 LayoutObject& outlineDiv = *document().getElementById("outline")->layoutObje
ct(); |
| 258 toHTMLElement(outlineDiv.node())->setAttribute(HTMLNames::styleAttr, styleWi
thoutOutline); |
| 259 document().view()->updateAllLifecyclePhases(); |
| 260 |
| 261 LayoutBlock& selfPaintingLayerObject = *toLayoutBlock(document().getElementB
yId("self-painting-layer")->layoutObject()); |
| 262 PaintLayer& selfPaintingLayer = *selfPaintingLayerObject.layer(); |
| 263 ASSERT_TRUE(selfPaintingLayer.isSelfPaintingLayer()); |
| 264 PaintLayer& nonSelfPaintingLayer = *toLayoutBoxModelObject(document().getEle
mentById("non-self-painting-layer")->layoutObject())->layer(); |
| 265 ASSERT_FALSE(nonSelfPaintingLayer.isSelfPaintingLayer()); |
| 266 ASSERT_TRUE(&nonSelfPaintingLayer == outlineDiv.enclosingLayer()); |
| 267 |
| 268 EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseDescendantOutlines()); |
| 269 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseDescendantOutlines()); |
| 270 |
| 271 // Outline on the self-painting-layer node itself doesn't affect PaintPhaseD
escendantOutlines. |
| 272 toHTMLElement(selfPaintingLayerObject.node())->setAttribute(HTMLNames::style
Attr, "position: absolute; outline: 1px solid green"); |
| 273 document().view()->updateAllLifecyclePhases(); |
| 274 EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseDescendantOutlines()); |
| 275 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseDescendantOutlines()); |
| 276 EXPECT_TRUE(displayItemListContains(rootPaintController().displayItemList(),
selfPaintingLayerObject, DisplayItem::paintPhaseToDrawingType(PaintPhaseSelfOut
lineOnly))); |
| 277 |
| 278 // needsPaintPhaseDescendantOutlines should be set when any descendant on th
e same layer has outline. |
| 279 toHTMLElement(outlineDiv.node())->setAttribute(HTMLNames::styleAttr, styleWi
thOutline); |
| 280 updateLifecyclePhasesBeforePaint(); |
| 281 EXPECT_TRUE(selfPaintingLayer.needsPaintPhaseDescendantOutlines()); |
| 282 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseDescendantOutlines()); |
| 283 paint(); |
| 284 EXPECT_TRUE(displayItemListContains(rootPaintController().displayItemList(),
outlineDiv, DisplayItem::paintPhaseToDrawingType(PaintPhaseSelfOutlineOnly))); |
| 285 } |
| 286 |
245 } // namespace blink | 287 } // namespace blink |
OLD | NEW |