| 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/LayoutBlock.h" | 5 #include "core/layout/LayoutBlock.h" |
| 6 #include "core/layout/LayoutInline.h" | 6 #include "core/layout/LayoutInline.h" |
| 7 #include "core/layout/compositing/CompositedLayerMapping.h" | 7 #include "core/layout/compositing/CompositedLayerMapping.h" |
| 8 #include "core/paint/PaintControllerPaintTest.h" | 8 #include "core/paint/PaintControllerPaintTest.h" |
| 9 #include "platform/graphics/GraphicsContext.h" | 9 #include "platform/graphics/GraphicsContext.h" |
| 10 | 10 |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 483 | 483 |
| 484 toHTMLElement(layerDiv.node())->setAttribute(HTMLNames::styleAttr, "width: 1
00px; height: 100px; overflow: hidden"); | 484 toHTMLElement(layerDiv.node())->setAttribute(HTMLNames::styleAttr, "width: 1
00px; height: 100px; overflow: hidden"); |
| 485 document().view()->updateAllLifecyclePhases(); | 485 document().view()->updateAllLifecyclePhases(); |
| 486 EXPECT_FALSE(layer.isSelfPaintingLayer()); | 486 EXPECT_FALSE(layer.isSelfPaintingLayer()); |
| 487 EXPECT_TRUE(htmlLayer.needsPaintPhaseDescendantOutlines()); | 487 EXPECT_TRUE(htmlLayer.needsPaintPhaseDescendantOutlines()); |
| 488 EXPECT_TRUE(htmlLayer.needsPaintPhaseDescendantBlockBackgrounds()); | 488 EXPECT_TRUE(htmlLayer.needsPaintPhaseDescendantBlockBackgrounds()); |
| 489 } | 489 } |
| 490 | 490 |
| 491 TEST_P(PaintLayerPainterTest, TableCollapsedBorderNeedsPaintPhaseDescendantBlock
Backgrounds) | 491 TEST_P(PaintLayerPainterTest, TableCollapsedBorderNeedsPaintPhaseDescendantBlock
Backgrounds) |
| 492 { | 492 { |
| 493 // TODO(wangxianzhu): Enable this test slimmingPaintInvalidation when its fu
lly functional. |
| 494 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) |
| 495 return; |
| 496 |
| 493 // "position: relative" makes the table and td self-painting layers. | 497 // "position: relative" makes the table and td self-painting layers. |
| 494 // The table's layer should be marked needsPaintPhaseDescendantBlockBackgrou
nd because it | 498 // The table's layer should be marked needsPaintPhaseDescendantBlockBackgrou
nd because it |
| 495 // will paint collapsed borders in the phase. | 499 // will paint collapsed borders in the phase. |
| 496 setBodyInnerHTML( | 500 setBodyInnerHTML( |
| 497 "<table id='table' style='position: relative; border-collapse: collapse'
>" | 501 "<table id='table' style='position: relative; border-collapse: collapse'
>" |
| 498 " <tr><td style='position: relative; border: 1px solid green'>Cell</td>
</tr>" | 502 " <tr><td style='position: relative; border: 1px solid green'>Cell</td>
</tr>" |
| 499 "</table>"); | 503 "</table>"); |
| 500 | 504 |
| 501 LayoutBlock& table = *toLayoutBlock(getLayoutObjectByElementId("table")); | 505 LayoutBlock& table = *toLayoutBlock(getLayoutObjectByElementId("table")); |
| 502 ASSERT_TRUE(table.hasLayer()); | 506 ASSERT_TRUE(table.hasLayer()); |
| 503 PaintLayer& layer = *table.layer(); | 507 PaintLayer& layer = *table.layer(); |
| 504 EXPECT_TRUE(layer.isSelfPaintingLayer()); | 508 EXPECT_TRUE(layer.isSelfPaintingLayer()); |
| 505 EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds()); | 509 EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds()); |
| 506 } | 510 } |
| 507 | 511 |
| 508 TEST_P(PaintLayerPainterTest, TableCollapsedBorderNeedsPaintPhaseDescendantBlock
BackgroundsDynamic) | 512 TEST_P(PaintLayerPainterTest, TableCollapsedBorderNeedsPaintPhaseDescendantBlock
BackgroundsDynamic) |
| 509 { | 513 { |
| 514 // TODO(wangxianzhu): Enable this test slimmingPaintInvalidation when its fu
lly functional. |
| 515 if (RuntimeEnabledFeatures::slimmingPaintInvalidationEnabled()) |
| 516 return; |
| 517 |
| 510 setBodyInnerHTML( | 518 setBodyInnerHTML( |
| 511 "<table id='table' style='position: relative'>" | 519 "<table id='table' style='position: relative'>" |
| 512 " <tr><td style='position: relative; border: 1px solid green'>Cell</td>
</tr>" | 520 " <tr><td style='position: relative; border: 1px solid green'>Cell</td>
</tr>" |
| 513 "</table>"); | 521 "</table>"); |
| 514 | 522 |
| 515 LayoutBlock& table = *toLayoutBlock(getLayoutObjectByElementId("table")); | 523 LayoutBlock& table = *toLayoutBlock(getLayoutObjectByElementId("table")); |
| 516 ASSERT_TRUE(table.hasLayer()); | 524 ASSERT_TRUE(table.hasLayer()); |
| 517 PaintLayer& layer = *table.layer(); | 525 PaintLayer& layer = *table.layer(); |
| 518 EXPECT_TRUE(layer.isSelfPaintingLayer()); | 526 EXPECT_TRUE(layer.isSelfPaintingLayer()); |
| 519 EXPECT_FALSE(layer.needsPaintPhaseDescendantBlockBackgrounds()); | 527 EXPECT_FALSE(layer.needsPaintPhaseDescendantBlockBackgrounds()); |
| 520 | 528 |
| 521 toHTMLElement(table.node())->setAttribute(HTMLNames::styleAttr, "position: r
elative; border-collapse: collapse"); | 529 toHTMLElement(table.node())->setAttribute(HTMLNames::styleAttr, "position: r
elative; border-collapse: collapse"); |
| 522 document().view()->updateAllLifecyclePhases(); | 530 document().view()->updateAllLifecyclePhases(); |
| 523 EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds()); | 531 EXPECT_TRUE(layer.needsPaintPhaseDescendantBlockBackgrounds()); |
| 524 } | 532 } |
| 525 | 533 |
| 526 } // namespace blink | 534 } // namespace blink |
| OLD | NEW |