| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "config.h" |
| 6 |
| 7 #include "core/paint/DeprecatedPaintLayerPainter.h" |
| 8 #include "core/paint/DisplayItemListPaintTest.h" |
| 9 #include "platform/graphics/GraphicsContext.h" |
| 10 |
| 11 namespace blink { |
| 12 |
| 13 using TableCellPainterTest = DisplayItemListPaintTest; |
| 14 |
| 15 // TODO(wangxianzhu): Create a version for slimming paint v2 when it supports in
terest rect |
| 16 TEST_F(TableCellPainterTest, TableCellBackgroundInterestRect) |
| 17 { |
| 18 setBodyInnerHTML( |
| 19 "<style>" |
| 20 " td { width: 200px; height: 200px; border: none; }" |
| 21 " tr { background-color: blue; }" |
| 22 " table { border: none; border-spacing: 0; border-collapse: collapse; }
" |
| 23 "</style>" |
| 24 "<table>" |
| 25 " <tr><td id='cell1'></td></tr>" |
| 26 " <tr><td id='cell2'></td></tr>" |
| 27 "</table>"); |
| 28 |
| 29 LayoutView& layoutView = *document().layoutView(); |
| 30 DeprecatedPaintLayer& rootLayer = *layoutView.layer(); |
| 31 LayoutObject& cell1 = *document().getElementById("cell1")->layoutObject(); |
| 32 LayoutObject& cell2 = *document().getElementById("cell2")->layoutObject(); |
| 33 |
| 34 GraphicsContext context(&rootDisplayItemList()); |
| 35 DeprecatedPaintLayerPaintingInfo paintingInfo(&rootLayer, LayoutRect(0, 0, 2
00, 200), GlobalPaintNormalPhase, LayoutSize()); |
| 36 DeprecatedPaintLayerPainter(rootLayer).paintLayerContents(&context, painting
Info, PaintLayerPaintingCompositingAllPhases); |
| 37 rootDisplayItemList().commitNewDisplayItems(); |
| 38 |
| 39 EXPECT_DISPLAY_LIST_BASE(rootDisplayItemList().displayItems(), 2, |
| 40 TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground), |
| 41 TestDisplayItem(cell1, DisplayItem::TableCellBackgroundFromContainers)); |
| 42 |
| 43 DeprecatedPaintLayerPaintingInfo paintingInfo1(&rootLayer, LayoutRect(0, 300
, 200, 200), GlobalPaintNormalPhase, LayoutSize()); |
| 44 DeprecatedPaintLayerPainter(rootLayer).paintLayerContents(&context, painting
Info1, PaintLayerPaintingCompositingAllPhases); |
| 45 rootDisplayItemList().commitNewDisplayItems(); |
| 46 |
| 47 EXPECT_DISPLAY_LIST_BASE(rootDisplayItemList().displayItems(), 2, |
| 48 TestDisplayItem(layoutView, DisplayItem::BoxDecorationBackground), |
| 49 TestDisplayItem(cell2, DisplayItem::TableCellBackgroundFromContainers)); |
| 50 } |
| 51 |
| 52 } // namespace blink |
| OLD | NEW |