| 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 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 413 toHTMLElement(layerDiv.node())->setAttribute(HTMLNames::styleAttr, "position
: relative"); | 413 toHTMLElement(layerDiv.node())->setAttribute(HTMLNames::styleAttr, "position
: relative"); |
| 414 document().view()->updateAllLifecyclePhases(); | 414 document().view()->updateAllLifecyclePhases(); |
| 415 ASSERT_TRUE(layerDiv.hasLayer()); | 415 ASSERT_TRUE(layerDiv.hasLayer()); |
| 416 PaintLayer& layer = *layerDiv.layer(); | 416 PaintLayer& layer = *layerDiv.layer(); |
| 417 ASSERT_TRUE(layer.isSelfPaintingLayer()); | 417 ASSERT_TRUE(layer.isSelfPaintingLayer()); |
| 418 EXPECT_TRUE(layer.needsPaintPhaseDescendantOutlines()); | 418 EXPECT_TRUE(layer.needsPaintPhaseDescendantOutlines()); |
| 419 EXPECT_TRUE(layer.needsPaintPhaseFloat()); | 419 EXPECT_TRUE(layer.needsPaintPhaseFloat()); |
| 420 EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds()); | 420 EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds()); |
| 421 } | 421 } |
| 422 | 422 |
| 423 TEST_P(PaintLayerPainterTest, PaintPhasesUpdateOnBecomingSelfPainting) |
| 424 { |
| 425 setBodyInnerHTML( |
| 426 "<div id='will-be-self-painting' style='height: 100px; overflow: hidden'
>" |
| 427 " <div style='height: 200px; outline: 1px solid red; background-color:
green'>outline and background</div>" |
| 428 " <div style='float: left; height: 80px; width: 50px'>float</div>" |
| 429 "</div>"); |
| 430 |
| 431 LayoutBlock& layerDiv = *toLayoutBlock(document().getElementById("will-be-se
lf-painting")->layoutObject()); |
| 432 ASSERT_TRUE(layerDiv.hasLayer()); |
| 433 EXPECT_FALSE(layerDiv.layer()->isSelfPaintingLayer()); |
| 434 |
| 435 PaintLayer& htmlLayer = *toLayoutBlock(document().documentElement()->layoutO
bject())->layer(); |
| 436 EXPECT_TRUE(htmlLayer.needsPaintPhaseDescendantOutlines()); |
| 437 EXPECT_TRUE(htmlLayer.needsPaintPhaseFloat()); |
| 438 EXPECT_TRUE(htmlLayer.needsPaintPhaseDescendantBlockBackgrounds()); |
| 439 |
| 440 toHTMLElement(layerDiv.node())->setAttribute(HTMLNames::styleAttr, "height:
100px; overflow: hidden; position: relative"); |
| 441 document().view()->updateAllLifecyclePhases(); |
| 442 PaintLayer& layer = *layerDiv.layer(); |
| 443 ASSERT_TRUE(layer.isSelfPaintingLayer()); |
| 444 EXPECT_TRUE(layer.needsPaintPhaseDescendantOutlines()); |
| 445 EXPECT_TRUE(layer.needsPaintPhaseFloat()); |
| 446 EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds()); |
| 447 } |
| 448 |
| 449 TEST_P(PaintLayerPainterTest, PaintPhasesUpdateOnBecomingNonSelfPainting) |
| 450 { |
| 451 setBodyInnerHTML( |
| 452 "<div id='will-be-non-self-painting' style='height: 100px; overflow: hid
den; position: relative'>" |
| 453 " <div style='height: 200px; outline: 1px solid red; background-color:
green'>outline and background</div>" |
| 454 " <div style='float: left; height: 80px; width: 50px'>float</div>" |
| 455 "</div>"); |
| 456 |
| 457 LayoutBlock& layerDiv = *toLayoutBlock(document().getElementById("will-be-no
n-self-painting")->layoutObject()); |
| 458 ASSERT_TRUE(layerDiv.hasLayer()); |
| 459 PaintLayer& layer = *layerDiv.layer(); |
| 460 EXPECT_TRUE(layer.isSelfPaintingLayer()); |
| 461 EXPECT_TRUE(layer.needsPaintPhaseDescendantOutlines()); |
| 462 EXPECT_TRUE(layer.needsPaintPhaseFloat()); |
| 463 EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds()); |
| 464 |
| 465 PaintLayer& htmlLayer = *toLayoutBlock(document().documentElement()->layoutO
bject())->layer(); |
| 466 EXPECT_FALSE(htmlLayer.needsPaintPhaseDescendantOutlines()); |
| 467 EXPECT_FALSE(htmlLayer.needsPaintPhaseFloat()); |
| 468 EXPECT_FALSE(htmlLayer.needsPaintPhaseDescendantBlockBackgrounds()); |
| 469 |
| 470 toHTMLElement(layerDiv.node())->setAttribute(HTMLNames::styleAttr, "height:
100px; overflow: hidden"); |
| 471 document().view()->updateAllLifecyclePhases(); |
| 472 EXPECT_FALSE(layer.isSelfPaintingLayer()); |
| 473 EXPECT_TRUE(htmlLayer.needsPaintPhaseDescendantOutlines()); |
| 474 EXPECT_TRUE(htmlLayer.needsPaintPhaseFloat()); |
| 475 EXPECT_TRUE(htmlLayer.needsPaintPhaseDescendantBlockBackgrounds()); |
| 476 } |
| 477 |
| 423 } // namespace blink | 478 } // namespace blink |
| OLD | NEW |