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/paint/PaintControllerPaintTest.h" | 5 #include "core/paint/PaintControllerPaintTest.h" |
6 #include "core/paint/PaintLayerPainter.h" | 6 #include "core/paint/PaintLayerPainter.h" |
7 | 7 |
8 // This file contains tests testing TablePainter, TableSectionPainter, | 8 // This file contains tests testing TablePainter, TableSectionPainter, |
9 // TableRowPainter and TableCellPainter. It's difficult to separate the tests | 9 // TableRowPainter and TableCellPainter. It's difficult to separate the tests |
10 // into individual files because of dependencies among the painter classes. | 10 // into individual files because of dependencies among the painter classes. |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 "separate; }" | 115 "separate; }" |
116 "</style>" | 116 "</style>" |
117 "<table>" | 117 "<table>" |
118 " <tr id='row'><td id='cell1'><td id='cell2'></td></tr>" | 118 " <tr id='row'><td id='cell1'><td id='cell2'></td></tr>" |
119 "</table>"); | 119 "</table>"); |
120 | 120 |
121 LayoutView& layoutView = *document().layoutView(); | 121 LayoutView& layoutView = *document().layoutView(); |
122 LayoutObject& cell1 = *getLayoutObjectByElementId("cell1"); | 122 LayoutObject& cell1 = *getLayoutObjectByElementId("cell1"); |
123 LayoutObject& cell2 = *getLayoutObjectByElementId("cell2"); | 123 LayoutObject& cell2 = *getLayoutObjectByElementId("cell2"); |
124 LayoutObject& row = *getLayoutObjectByElementId("row"); | 124 LayoutObject& row = *getLayoutObjectByElementId("row"); |
| 125 PaintLayer& htmlLayer = |
| 126 *toLayoutBoxModelObject(document().documentElement()->layoutObject()) |
| 127 ->layer(); |
125 | 128 |
126 rootPaintController().invalidateAll(); | 129 rootPaintController().invalidateAll(); |
127 document().view()->updateAllLifecyclePhasesExceptPaint(); | 130 document().view()->updateAllLifecyclePhasesExceptPaint(); |
128 // Intersects cell1 and the spacing between cell1 and cell2. | 131 // Intersects cell1 and the spacing between cell1 and cell2. |
129 IntRect interestRect(200, 0, 200, 200); | 132 IntRect interestRect(200, 0, 200, 200); |
130 paint(&interestRect); | 133 paint(&interestRect); |
131 | 134 |
132 EXPECT_DISPLAY_LIST( | 135 EXPECT_DISPLAY_LIST( |
133 rootPaintController().getDisplayItemList(), 5, | 136 rootPaintController().getDisplayItemList(), 7, |
134 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground), | 137 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground), |
| 138 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence), |
135 TestDisplayItem(row, DisplayItem::kBeginCompositing), | 139 TestDisplayItem(row, DisplayItem::kBeginCompositing), |
136 TestDisplayItem(row, DisplayItem::kBoxDecorationBackground), | 140 TestDisplayItem(row, DisplayItem::kBoxDecorationBackground), |
137 TestDisplayItem(cell1, DisplayItem::kBoxDecorationBackground), | 141 TestDisplayItem(cell1, DisplayItem::kBoxDecorationBackground), |
138 TestDisplayItem(row, DisplayItem::kEndCompositing)); | 142 TestDisplayItem(row, DisplayItem::kEndCompositing), |
| 143 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence)); |
139 | 144 |
140 document().view()->updateAllLifecyclePhasesExceptPaint(); | 145 document().view()->updateAllLifecyclePhasesExceptPaint(); |
141 // Intersects the spacing only. | 146 // Intersects the spacing only. |
142 interestRect = IntRect(300, 0, 100, 100); | 147 interestRect = IntRect(300, 0, 100, 100); |
143 paint(&interestRect); | 148 paint(&interestRect); |
144 | 149 |
145 EXPECT_DISPLAY_LIST( | 150 EXPECT_DISPLAY_LIST( |
146 rootPaintController().getDisplayItemList(), 1, | 151 rootPaintController().getDisplayItemList(), 3, |
147 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground)); | 152 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground), |
| 153 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence), |
| 154 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence)); |
148 | 155 |
149 document().view()->updateAllLifecyclePhasesExceptPaint(); | 156 document().view()->updateAllLifecyclePhasesExceptPaint(); |
150 // Intersects cell2 only. | 157 // Intersects cell2 only. |
151 interestRect = IntRect(450, 0, 200, 200); | 158 interestRect = IntRect(450, 0, 200, 200); |
152 paint(&interestRect); | 159 paint(&interestRect); |
153 | 160 |
154 EXPECT_DISPLAY_LIST( | 161 EXPECT_DISPLAY_LIST( |
155 rootPaintController().getDisplayItemList(), 5, | 162 rootPaintController().getDisplayItemList(), 7, |
156 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground), | 163 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground), |
| 164 TestDisplayItem(htmlLayer, DisplayItem::kSubsequence), |
157 TestDisplayItem(row, DisplayItem::kBeginCompositing), | 165 TestDisplayItem(row, DisplayItem::kBeginCompositing), |
158 TestDisplayItem(row, DisplayItem::kBoxDecorationBackground), | 166 TestDisplayItem(row, DisplayItem::kBoxDecorationBackground), |
159 TestDisplayItem(cell2, DisplayItem::kBoxDecorationBackground), | 167 TestDisplayItem(cell2, DisplayItem::kBoxDecorationBackground), |
160 TestDisplayItem(row, DisplayItem::kEndCompositing)); | 168 TestDisplayItem(row, DisplayItem::kEndCompositing), |
| 169 TestDisplayItem(htmlLayer, DisplayItem::kEndSubsequence)); |
161 } | 170 } |
162 | 171 |
163 TEST_F(TablePainterTest, CollapsedBorderAndOverflow) { | 172 TEST_F(TablePainterTest, CollapsedBorderAndOverflow) { |
164 setBodyInnerHTML( | 173 setBodyInnerHTML( |
165 "<style>" | 174 "<style>" |
166 " body { margin: 0 }" | 175 " body { margin: 0 }" |
167 " td { width: 100px; height: 100px; border: 100px solid blue; outline: " | 176 " td { width: 100px; height: 100px; border: 100px solid blue; outline: " |
168 "100px solid yellow; background: green; }" | 177 "100px solid yellow; background: green; }" |
169 " table { margin: 100px; border-collapse: collapse; }" | 178 " table { margin: 100px; border-collapse: collapse; }" |
170 "</style>" | 179 "</style>" |
(...skipping 14 matching lines...) Expand all Loading... |
185 EXPECT_DISPLAY_LIST( | 194 EXPECT_DISPLAY_LIST( |
186 rootPaintController().getDisplayItemList(), 4, | 195 rootPaintController().getDisplayItemList(), 4, |
187 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground), | 196 TestDisplayItem(layoutView, DisplayItem::kDocumentBackground), |
188 TestDisplayItem(cell, DisplayItem::kBoxDecorationBackground), | 197 TestDisplayItem(cell, DisplayItem::kBoxDecorationBackground), |
189 TestDisplayItem(cell, DisplayItem::kTableCollapsedBorderLast), | 198 TestDisplayItem(cell, DisplayItem::kTableCollapsedBorderLast), |
190 TestDisplayItem(cell, DisplayItem::paintPhaseToDrawingType( | 199 TestDisplayItem(cell, DisplayItem::paintPhaseToDrawingType( |
191 PaintPhaseSelfOutlineOnly))); | 200 PaintPhaseSelfOutlineOnly))); |
192 } | 201 } |
193 | 202 |
194 } // namespace blink | 203 } // namespace blink |
OLD | NEW |