Chromium Code Reviews| 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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 284 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseDescendantOutlines()); | 284 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseDescendantOutlines()); |
| 285 | 285 |
| 286 // Outline on the self-painting-layer node itself doesn't affect PaintPhaseD escendantOutlines. | 286 // Outline on the self-painting-layer node itself doesn't affect PaintPhaseD escendantOutlines. |
| 287 toHTMLElement(selfPaintingLayerObject.node())->setAttribute(HTMLNames::style Attr, "position: absolute; outline: 1px solid green"); | 287 toHTMLElement(selfPaintingLayerObject.node())->setAttribute(HTMLNames::style Attr, "position: absolute; outline: 1px solid green"); |
| 288 document().view()->updateAllLifecyclePhases(); | 288 document().view()->updateAllLifecyclePhases(); |
| 289 EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseDescendantOutlines()); | 289 EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseDescendantOutlines()); |
| 290 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseDescendantOutlines()); | 290 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseDescendantOutlines()); |
| 291 EXPECT_TRUE(displayItemListContains(rootPaintController().displayItemList(), selfPaintingLayerObject, DisplayItem::paintPhaseToDrawingType(PaintPhaseSelfOut lineOnly))); | 291 EXPECT_TRUE(displayItemListContains(rootPaintController().displayItemList(), selfPaintingLayerObject, DisplayItem::paintPhaseToDrawingType(PaintPhaseSelfOut lineOnly))); |
| 292 } | 292 } |
| 293 | 293 |
| 294 TEST_P(PaintLayerPainterTest, PaintPhaseFloat) | |
| 295 { | |
| 296 AtomicString styleWithoutFloat = "width: 50px; height: 50px; background-colo r: green"; | |
| 297 AtomicString styleWithFloat = "float: left; " + styleWithoutFloat; | |
| 298 setBodyInnerHTML( | |
| 299 "<div id='self-painting-layer' style='position: absolute'>" | |
| 300 " <div id='non-self-painting-layer' style='overflow: hidden'>" | |
| 301 " <div>" | |
| 302 " <div id='float'></div>" | |
| 303 " </div>" | |
| 304 " </div>" | |
| 305 "</div>"); | |
| 306 LayoutObject& floatDiv = *document().getElementById("float")->layoutObject() ; | |
| 307 toHTMLElement(floatDiv.node())->setAttribute(HTMLNames::styleAttr, styleWith outFloat); | |
| 308 document().view()->updateAllLifecyclePhases(); | |
| 309 | |
| 310 LayoutBlock& selfPaintingLayerObject = *toLayoutBlock(document().getElementB yId("self-painting-layer")->layoutObject()); | |
| 311 PaintLayer& selfPaintingLayer = *selfPaintingLayerObject.layer(); | |
| 312 ASSERT_TRUE(selfPaintingLayer.isSelfPaintingLayer()); | |
| 313 PaintLayer& nonSelfPaintingLayer = *toLayoutBoxModelObject(document().getEle mentById("non-self-painting-layer")->layoutObject())->layer(); | |
| 314 ASSERT_FALSE(nonSelfPaintingLayer.isSelfPaintingLayer()); | |
| 315 ASSERT_TRUE(&nonSelfPaintingLayer == floatDiv.enclosingLayer()); | |
| 316 ASSERT_TRUE(&selfPaintingLayer == floatDiv.enclosingLayer()->enclosingSelfPa intingLayer()); | |
| 317 | |
| 318 EXPECT_FALSE(selfPaintingLayer.needsPaintPhaseFloat()); | |
| 319 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseFloat()); | |
| 320 | |
| 321 // needsPaintPhaseFloat should be set when any descendant on the same layer has float. | |
| 322 toHTMLElement(floatDiv.node())->setAttribute(HTMLNames::styleAttr, styleWith Float); | |
| 323 updateLifecyclePhasesBeforePaint(); | |
| 324 EXPECT_TRUE(selfPaintingLayer.needsPaintPhaseFloat()); | |
| 325 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseFloat()); | |
| 326 paint(); | |
| 327 | |
| 328 // needsPaintPhaseFloat shold be reset after an empty painting of the phase. | |
| 329 toHTMLElement(floatDiv.node())->setAttribute(HTMLNames::styleAttr, styleWith outFloat); | |
| 330 document().view()->updateAllLifecyclePhases(); | |
| 331 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.
| |
| 332 EXPECT_FALSE(nonSelfPaintingLayer.needsPaintPhaseFloat()); | |
| 333 } | |
| 334 | |
| 294 } // namespace blink | 335 } // namespace blink |
| OLD | NEW |