| 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 "config.h" | 5 #include "config.h" |
| 6 | 6 |
| 7 #include "core/paint/PaintControllerPaintTest.h" | 7 #include "core/paint/PaintControllerPaintTest.h" |
| 8 #include "core/paint/PaintLayerPainter.h" | 8 #include "core/paint/PaintLayerPainter.h" |
| 9 #include "platform/graphics/GraphicsContext.h" | |
| 10 | 9 |
| 11 namespace blink { | 10 namespace blink { |
| 12 | 11 |
| 13 using TableCellPainterTest = PaintControllerPaintTest; | 12 using TableCellPainterTest = PaintControllerPaintTest; |
| 14 | 13 |
| 15 // TODO(wangxianzhu): Create a version for slimming paint v2 when it supports in
terest rect | 14 // TODO(wangxianzhu): Create a version for slimming paint v2 when it supports in
terest rect |
| 16 TEST_F(TableCellPainterTest, TableCellBackgroundInterestRect) | 15 TEST_F(TableCellPainterTest, TableCellBackgroundInterestRect) |
| 17 { | 16 { |
| 17 RuntimeEnabledFeatures::setSlimmingPaintSynchronizedPaintingEnabled(true); |
| 18 |
| 18 setBodyInnerHTML( | 19 setBodyInnerHTML( |
| 19 "<style>" | 20 "<style>" |
| 20 " td { width: 200px; height: 200px; border: none; }" | 21 " td { width: 200px; height: 200px; border: none; }" |
| 21 " tr { background-color: blue; }" | 22 " tr { background-color: blue; }" |
| 22 " table { border: none; border-spacing: 0; border-collapse: collapse; }
" | 23 " table { border: none; border-spacing: 0; border-collapse: collapse; }
" |
| 23 "</style>" | 24 "</style>" |
| 24 "<table>" | 25 "<table>" |
| 25 " <tr><td id='cell1'></td></tr>" | 26 " <tr><td id='cell1'></td></tr>" |
| 26 " <tr><td id='cell2'></td></tr>" | 27 " <tr><td id='cell2'></td></tr>" |
| 27 "</table>"); | 28 "</table>"); |
| 28 | 29 |
| 29 LayoutView& layoutView = *document().layoutView(); | 30 LayoutView& layoutView = *document().layoutView(); |
| 30 PaintLayer& rootLayer = *layoutView.layer(); | 31 PaintLayer& rootLayer = *layoutView.layer(); |
| 31 LayoutObject& cell1 = *document().getElementById("cell1")->layoutObject(); | 32 LayoutObject& cell1 = *document().getElementById("cell1")->layoutObject(); |
| 32 LayoutObject& cell2 = *document().getElementById("cell2")->layoutObject(); | 33 LayoutObject& cell2 = *document().getElementById("cell2")->layoutObject(); |
| 33 | 34 |
| 34 GraphicsContext context(rootPaintController()); | 35 rootPaintController().invalidateAll(); |
| 35 PaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(0, 0, 200, 200),
GlobalPaintNormalPhase, LayoutSize()); | 36 IntRect interestRect(0, 0, 200, 200); |
| 36 PaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo, Pain
tLayerPaintingCompositingAllPhases); | 37 document().view()->updateAllLifecyclePhases(&interestRect); |
| 37 rootPaintController().commitNewDisplayItems(); | |
| 38 | 38 |
| 39 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 2, | 39 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 4, |
| 40 TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground), | 40 TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground), |
| 41 TestDisplayItem(cell1, DisplayItem::TableCellBackgroundFromRow)); | 41 TestDisplayItem(rootLayer, subsequenceType), |
| 42 TestDisplayItem(cell1, DisplayItem::TableCellBackgroundFromRow), |
| 43 TestDisplayItem(rootLayer, endSubsequenceType)); |
| 42 | 44 |
| 43 PaintLayerPaintingInfo paintingInfo1(&rootLayer, LayoutRect(0, 300, 200, 200
), GlobalPaintNormalPhase, LayoutSize()); | 45 interestRect = IntRect(0, 300, 200, 1000); |
| 44 PaintLayerPainter(rootLayer).paintLayerContents(&context, paintingInfo1, Pai
ntLayerPaintingCompositingAllPhases); | 46 document().view()->updateAllLifecyclePhases(&interestRect); |
| 45 rootPaintController().commitNewDisplayItems(); | |
| 46 | 47 |
| 47 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 2, | 48 EXPECT_DISPLAY_LIST(rootPaintController().displayItemList(), 4, |
| 48 TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground), | 49 TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground), |
| 49 TestDisplayItem(cell2, DisplayItem::TableCellBackgroundFromRow)); | 50 TestDisplayItem(rootLayer, subsequenceType), |
| 51 TestDisplayItem(cell2, DisplayItem::TableCellBackgroundFromRow), |
| 52 TestDisplayItem(rootLayer, endSubsequenceType)); |
| 50 } | 53 } |
| 51 | 54 |
| 52 } // namespace blink | 55 } // namespace blink |
| OLD | NEW |