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 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='width: 100px; height: 100px; ove rflow: hidden'>" | |
| 427 " <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
| |
| 428 " <div style='outline: 1px solid red; background-color: green'>outlin e and background</div>" | |
| 429 " </div>" | |
| 430 "</div>"); | |
| 431 | |
| 432 LayoutBlock& layerDiv = *toLayoutBlock(document().getElementById("will-be-se lf-painting")->layoutObject()); | |
| 433 ASSERT_TRUE(layerDiv.hasLayer()); | |
| 434 EXPECT_FALSE(layerDiv.layer()->isSelfPaintingLayer()); | |
| 435 | |
| 436 PaintLayer& htmlLayer = *toLayoutBlock(document().documentElement()->layoutO bject())->layer(); | |
| 437 EXPECT_TRUE(htmlLayer.needsPaintPhaseDescendantOutlines()); | |
| 438 EXPECT_TRUE(htmlLayer.needsPaintPhaseDescendantBlockBackgrounds()); | |
| 439 | |
| 440 toHTMLElement(layerDiv.node())->setAttribute(HTMLNames::styleAttr, "width: 1 00px; 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.needsPaintPhaseDescendantBlockBackgrounds()); | |
| 446 } | |
| 447 | |
| 448 TEST_P(PaintLayerPainterTest, PaintPhasesUpdateOnBecomingNonSelfPainting) | |
| 449 { | |
| 450 setBodyInnerHTML( | |
| 451 "<div id='will-be-non-self-painting' style='width: 100px; height: 100px; overflow: hidden; position: relative'>" | |
| 452 " <div>" | |
| 453 " <div style='outline: 1px solid red; background-color: green'>outlin e and background</div>" | |
| 454 " </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.needsPaintPhaseDescendantBlockBackgrounds()); | |
| 463 | |
| 464 PaintLayer& htmlLayer = *toLayoutBlock(document().documentElement()->layoutO bject())->layer(); | |
| 465 EXPECT_FALSE(htmlLayer.needsPaintPhaseDescendantOutlines()); | |
| 466 EXPECT_FALSE(htmlLayer.needsPaintPhaseDescendantBlockBackgrounds()); | |
| 467 | |
| 468 toHTMLElement(layerDiv.node())->setAttribute(HTMLNames::styleAttr, "width: 1 00px; height: 100px; overflow: hidden"); | |
| 469 document().view()->updateAllLifecyclePhases(); | |
| 470 EXPECT_FALSE(layer.isSelfPaintingLayer()); | |
| 471 EXPECT_TRUE(htmlLayer.needsPaintPhaseDescendantOutlines()); | |
| 472 EXPECT_TRUE(htmlLayer.needsPaintPhaseDescendantBlockBackgrounds()); | |
| 473 } | |
| 474 | |
| 423 } // namespace blink | 475 } // namespace blink |
| OLD | NEW |