OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/LayoutTableSection.h" | 5 #include "core/layout/LayoutTableSection.h" |
6 | 6 |
7 #include "core/layout/LayoutTableCell.h" | 7 #include "core/layout/LayoutTableCell.h" |
8 #include "core/layout/LayoutTestHelper.h" | 8 #include "core/layout/LayoutTestHelper.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 class LayoutTableSectionTest : public RenderingTest { | 14 class LayoutTableSectionTest : public RenderingTest { |
15 protected: | 15 protected: |
16 LayoutTableSection* GetSectionByElementId(const char* id) { | 16 LayoutTableSection* GetSectionByElementId(const char* id) { |
17 return ToLayoutTableSection(GetLayoutObjectByElementId(id)); | 17 return ToLayoutTableSection(GetLayoutObjectByElementId(id)); |
18 } | 18 } |
19 | 19 |
20 LayoutTableSection* CreateSection(unsigned rows, unsigned cols) { | 20 LayoutTableSection* CreateSection(unsigned rows, unsigned columns) { |
21 auto* table = GetDocument().createElement("table"); | 21 auto* table = GetDocument().createElement("table"); |
22 GetDocument().body()->appendChild(table); | 22 GetDocument().body()->appendChild(table); |
23 auto* section = GetDocument().createElement("tbody"); | 23 auto* section = GetDocument().createElement("tbody"); |
24 table->appendChild(section); | 24 table->appendChild(section); |
25 for (unsigned i = 0; i < rows; ++i) { | 25 for (unsigned i = 0; i < rows; ++i) { |
26 auto* row = GetDocument().createElement("tr"); | 26 auto* row = GetDocument().createElement("tr"); |
27 section->appendChild(row); | 27 section->appendChild(row); |
28 for (unsigned i = 0; i < cols; ++i) | 28 for (unsigned i = 0; i < columns; ++i) |
29 row->appendChild(GetDocument().createElement("td")); | 29 row->appendChild(GetDocument().createElement("td")); |
30 } | 30 } |
31 GetDocument().View()->UpdateAllLifecyclePhases(); | 31 GetDocument().View()->UpdateAllLifecyclePhases(); |
32 return ToLayoutTableSection(section->GetLayoutObject()); | 32 return ToLayoutTableSection(section->GetLayoutObject()); |
33 } | 33 } |
34 }; | 34 }; |
35 | 35 |
36 TEST_F(LayoutTableSectionTest, | 36 TEST_F(LayoutTableSectionTest, |
37 BackgroundIsKnownToBeOpaqueWithLayerAndCollapsedBorder) { | 37 BackgroundIsKnownToBeOpaqueWithLayerAndCollapsedBorder) { |
38 SetBodyInnerHTML( | 38 SetBodyInnerHTML( |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 " <tr><td>Cell</td><td>Cell</td></tr>" | 71 " <tr><td>Cell</td><td>Cell</td></tr>" |
72 " </thead>" | 72 " </thead>" |
73 "</table>"); | 73 "</table>"); |
74 | 74 |
75 auto* section = GetSectionByElementId("section"); | 75 auto* section = GetSectionByElementId("section"); |
76 EXPECT_TRUE(section); | 76 EXPECT_TRUE(section); |
77 EXPECT_FALSE( | 77 EXPECT_FALSE( |
78 section->BackgroundIsKnownToBeOpaqueInRect(LayoutRect(0, 0, 1, 1))); | 78 section->BackgroundIsKnownToBeOpaqueInRect(LayoutRect(0, 0, 1, 1))); |
79 } | 79 } |
80 | 80 |
81 TEST_F(LayoutTableSectionTest, EmptySectionDirtiedRows) { | 81 TEST_F(LayoutTableSectionTest, EmptySectionDirtiedRowsAndEffeciveColumns) { |
82 SetBodyInnerHTML( | 82 SetBodyInnerHTML( |
83 "<table style='border: 100px solid red'>" | 83 "<table style='border: 100px solid red'>" |
84 " <thead id='section'></thead>" | 84 " <thead id='section'></thead>" |
85 "</table>"); | 85 "</table>"); |
86 | 86 |
87 auto* section = GetSectionByElementId("section"); | 87 auto* section = GetSectionByElementId("section"); |
88 EXPECT_TRUE(section); | 88 EXPECT_TRUE(section); |
89 CellSpan cell_span = section->DirtiedRows(LayoutRect(50, 50, 100, 100)); | 89 CellSpan rows; |
90 EXPECT_EQ(0u, cell_span.Start()); | 90 CellSpan columns; |
91 EXPECT_EQ(0u, cell_span.end()); | 91 section->DirtiedRowsAndEffectiveColumns(LayoutRect(50, 50, 100, 100), rows, |
92 } | 92 columns); |
93 | 93 EXPECT_EQ(0u, rows.Start()); |
94 TEST_F(LayoutTableSectionTest, EmptySectionDirtiedEffectiveColumns) { | 94 EXPECT_EQ(0u, rows.End()); |
95 SetBodyInnerHTML( | |
96 "<table style='border: 100px solid red'>" | |
97 " <thead id='section'></thead>" | |
98 "</table>"); | |
99 | |
100 auto* section = GetSectionByElementId("section"); | |
101 EXPECT_TRUE(section); | |
102 CellSpan cell_span = | |
103 section->DirtiedEffectiveColumns(LayoutRect(50, 50, 100, 100)); | |
104 // The table has at least 1 column even if there is no cell. | 95 // The table has at least 1 column even if there is no cell. |
105 EXPECT_EQ(1u, section->Table()->NumEffectiveColumns()); | 96 EXPECT_EQ(1u, section->Table()->NumEffectiveColumns()); |
106 EXPECT_EQ(1u, cell_span.Start()); | 97 EXPECT_EQ(1u, columns.Start()); |
107 EXPECT_EQ(1u, cell_span.end()); | 98 EXPECT_EQ(1u, columns.End()); |
108 } | 99 } |
109 | 100 |
110 TEST_F(LayoutTableSectionTest, PrimaryCellAtAndOriginatingCellAt) { | 101 TEST_F(LayoutTableSectionTest, PrimaryCellAtAndOriginatingCellAt) { |
111 SetBodyInnerHTML( | 102 SetBodyInnerHTML( |
112 "<table>" | 103 "<table>" |
113 " <tbody id='section'>" | 104 " <tbody id='section'>" |
114 " <tr>" | 105 " <tr>" |
115 " <td id='cell00'></td>" | 106 " <td id='cell00'></td>" |
116 " <td id='cell01' rowspan='2'></td>" | 107 " <td id='cell01' rowspan='2'></td>" |
117 " </tr>" | 108 " </tr>" |
(...skipping 16 matching lines...) Expand all Loading... |
134 EXPECT_EQ(cell00, section->PrimaryCellAt(0, 0)); | 125 EXPECT_EQ(cell00, section->PrimaryCellAt(0, 0)); |
135 EXPECT_EQ(cell01, section->PrimaryCellAt(0, 1)); | 126 EXPECT_EQ(cell01, section->PrimaryCellAt(0, 1)); |
136 EXPECT_EQ(cell10, section->PrimaryCellAt(1, 0)); | 127 EXPECT_EQ(cell10, section->PrimaryCellAt(1, 0)); |
137 EXPECT_EQ(cell10, section->PrimaryCellAt(1, 1)); | 128 EXPECT_EQ(cell10, section->PrimaryCellAt(1, 1)); |
138 EXPECT_EQ(cell00, section->OriginatingCellAt(0, 0)); | 129 EXPECT_EQ(cell00, section->OriginatingCellAt(0, 0)); |
139 EXPECT_EQ(cell01, section->OriginatingCellAt(0, 1)); | 130 EXPECT_EQ(cell01, section->OriginatingCellAt(0, 1)); |
140 EXPECT_EQ(cell10, section->OriginatingCellAt(1, 0)); | 131 EXPECT_EQ(cell10, section->OriginatingCellAt(1, 0)); |
141 EXPECT_EQ(nullptr, section->OriginatingCellAt(1, 1)); | 132 EXPECT_EQ(nullptr, section->OriginatingCellAt(1, 1)); |
142 } | 133 } |
143 | 134 |
144 TEST_F(LayoutTableSectionTest, DirtiedRowsAndDirtiedEffectiveColumnsWithSpans) { | 135 TEST_F(LayoutTableSectionTest, DirtiedRowsAndEffectiveColumnsWithSpans) { |
145 SetBodyInnerHTML( | 136 SetBodyInnerHTML( |
146 "<style>" | 137 "<style>" |
147 " td { width: 100px; height: 100px; padding: 0 }" | 138 " td { width: 100px; height: 100px; padding: 0 }" |
148 " table { border-spacing: 0 }" | 139 " table { border-spacing: 0 }" |
149 "</style>" | 140 "</style>" |
150 "<table>" | 141 "<table>" |
151 " <tbody id='section'>" | 142 " <tbody id='section'>" |
152 " <tr>" | 143 " <tr>" |
153 " <td></td>" | 144 " <td></td>" |
154 " <td rowspan='2'></td>" | 145 " <td rowspan='2'></td>" |
(...skipping 10 matching lines...) Expand all Loading... |
165 | 156 |
166 // x,yO: A cell originates from this grid slot. | 157 // x,yO: A cell originates from this grid slot. |
167 // x,yS: A cell originating from x,y spans into this slot. | 158 // x,yS: A cell originating from x,y spans into this slot. |
168 // 0 1 2 | 159 // 0 1 2 |
169 // 0 0,0(O) 0,1(O) 0,2(O) | 160 // 0 0,0(O) 0,1(O) 0,2(O) |
170 // 1 1,0(O) 1,0/0,1(S) 0,2(S) | 161 // 1 1,0(O) 1,0/0,1(S) 0,2(S) |
171 // 2 2,0(O) 2,0(S) 2,0(S) | 162 // 2 2,0(O) 2,0(S) 2,0(S) |
172 auto* section = GetSectionByElementId("section"); | 163 auto* section = GetSectionByElementId("section"); |
173 | 164 |
174 // Cell 0,0 only. | 165 // Cell 0,0 only. |
175 auto span = section->DirtiedRows(LayoutRect(5, 5, 90, 90)); | 166 CellSpan rows; |
176 EXPECT_EQ(0u, span.Start()); | 167 CellSpan columns; |
177 EXPECT_EQ(1u, span.end()); | 168 section->DirtiedRowsAndEffectiveColumns(LayoutRect(5, 5, 90, 90), rows, |
178 span = section->DirtiedEffectiveColumns(LayoutRect(5, 5, 90, 90)); | 169 columns); |
179 EXPECT_EQ(0u, span.Start()); | 170 EXPECT_EQ(0u, rows.Start()); |
180 EXPECT_EQ(1u, span.end()); | 171 EXPECT_EQ(1u, rows.End()); |
| 172 EXPECT_EQ(0u, columns.Start()); |
| 173 EXPECT_EQ(1u, columns.End()); |
181 | 174 |
182 // Rect intersects the first row and all originating primary cells. | 175 // Rect intersects the first row and all originating primary cells. |
183 span = section->DirtiedRows(LayoutRect(5, 5, 290, 90)); | 176 section->DirtiedRowsAndEffectiveColumns(LayoutRect(5, 5, 290, 90), rows, |
184 EXPECT_EQ(0u, span.Start()); | 177 columns); |
185 EXPECT_EQ(1u, span.end()); | 178 EXPECT_EQ(0u, rows.Start()); |
186 span = section->DirtiedEffectiveColumns(LayoutRect(5, 5, 290, 90)); | 179 EXPECT_EQ(1u, rows.End()); |
187 EXPECT_EQ(0u, span.Start()); | 180 EXPECT_EQ(0u, columns.Start()); |
188 EXPECT_EQ(3u, span.end()); | 181 EXPECT_EQ(3u, columns.End()); |
189 | 182 |
190 // Rect intersects (1,2). Dirtied rows also cover the first row to cover the | 183 // Rect intersects (1,2). Dirtied rows also cover the first row to cover the |
191 // primary cell's originating slot. | 184 // primary cell's originating slot. |
192 span = section->DirtiedRows(LayoutRect(205, 105, 90, 90)); | 185 section->DirtiedRowsAndEffectiveColumns(LayoutRect(205, 105, 90, 90), rows, |
193 EXPECT_EQ(0u, span.Start()); | 186 columns); |
194 EXPECT_EQ(2u, span.end()); | 187 EXPECT_EQ(0u, rows.Start()); |
195 span = section->DirtiedEffectiveColumns(LayoutRect(205, 105, 90, 90)); | 188 EXPECT_EQ(2u, rows.End()); |
196 EXPECT_EQ(2u, span.Start()); | 189 EXPECT_EQ(2u, columns.Start()); |
197 EXPECT_EQ(3u, span.end()); | 190 EXPECT_EQ(3u, columns.End()); |
198 | 191 |
199 // Rect intersects (1,1) which has multiple levels of cells (originating from | 192 // Rect intersects (1,1) which has multiple levels of cells (originating from |
200 // (1,0) and (0,1), in which (1,0) is the primary cell). | 193 // (1,0) and (0,1)). Dirtied columns also cover the first column. Dirtied rows |
201 // Dirtied columns also cover the first column to cover the primary cell's | 194 // also cover the first row. |
202 // originating grid slot. | 195 section->DirtiedRowsAndEffectiveColumns(LayoutRect(105, 105, 90, 90), rows, |
203 span = section->DirtiedRows(LayoutRect(105, 105, 90, 90)); | 196 columns); |
204 EXPECT_EQ(1u, span.Start()); | 197 EXPECT_EQ(0u, rows.Start()); |
205 EXPECT_EQ(2u, span.end()); | 198 EXPECT_EQ(2u, rows.End()); |
206 span = section->DirtiedEffectiveColumns(LayoutRect(105, 105, 90, 90)); | 199 EXPECT_EQ(0u, columns.Start()); |
207 EXPECT_EQ(0u, span.Start()); | 200 EXPECT_EQ(2u, columns.End()); |
208 EXPECT_EQ(2u, span.end()); | |
209 | 201 |
210 // Rect intersects (1,1) and (1,2). Dirtied rows also cover the first row. | 202 // Rect intersects (1,1) and (1,2). Dirtied rows also cover the first row. |
211 // Dirtied columns also cover the first column. | 203 // Dirtied columns also cover the first column. |
212 span = section->DirtiedRows(LayoutRect(105, 105, 190, 90)); | 204 section->DirtiedRowsAndEffectiveColumns(LayoutRect(105, 105, 190, 90), rows, |
213 EXPECT_EQ(0u, span.Start()); | 205 columns); |
214 EXPECT_EQ(2u, span.end()); | 206 EXPECT_EQ(0u, rows.Start()); |
215 span = section->DirtiedEffectiveColumns(LayoutRect(105, 105, 190, 90)); | 207 EXPECT_EQ(2u, rows.End()); |
216 EXPECT_EQ(0u, span.Start()); | 208 EXPECT_EQ(0u, columns.Start()); |
217 EXPECT_EQ(3u, span.end()); | 209 EXPECT_EQ(3u, columns.End()); |
218 | 210 |
219 // Rect intersects (1,2) and (2,2). Dirtied rows and dirtied columns cover all | 211 // Rect intersects (1,2) and (2,2). Dirtied rows and dirtied columns cover all |
220 // rows and columns. | 212 // rows and columns. |
221 span = section->DirtiedRows(LayoutRect(205, 105, 90, 190)); | 213 section->DirtiedRowsAndEffectiveColumns(LayoutRect(205, 105, 90, 190), rows, |
222 EXPECT_EQ(0u, span.Start()); | 214 columns); |
223 EXPECT_EQ(3u, span.end()); | 215 EXPECT_EQ(0u, rows.Start()); |
224 span = section->DirtiedEffectiveColumns(LayoutRect(205, 105, 90, 190)); | 216 EXPECT_EQ(3u, rows.End()); |
225 EXPECT_EQ(0u, span.Start()); | 217 EXPECT_EQ(0u, columns.Start()); |
226 EXPECT_EQ(3u, span.end()); | 218 EXPECT_EQ(3u, columns.End()); |
| 219 } |
| 220 |
| 221 TEST_F(LayoutTableSectionTest, |
| 222 DirtiedRowsAndEffectiveColumnsWithCollapsedBorders) { |
| 223 SetBodyInnerHTML( |
| 224 "<style>" |
| 225 " td { width: 100px; height: 100px; padding: 0; border: 2px solid; }" |
| 226 " table { border-collapse: collapse }" |
| 227 "</style>" |
| 228 "<table>" |
| 229 " <tbody id='section'>" |
| 230 " <tr><td></td><td></td><td></td><td></td></tr>" |
| 231 " <tr><td></td><td></td><td></td><td></td></tr>" |
| 232 " <tr><td></td><td></td><td></td><td></td></tr>" |
| 233 " <tr><td></td><td></td><td></td><td></td></tr>" |
| 234 " </tbody>" |
| 235 "</table>"); |
| 236 |
| 237 // Dirtied rows and columns are expanded by 1 cell in each side to ensure |
| 238 // collapsed borders are covered. |
| 239 auto* section = GetSectionByElementId("section"); |
| 240 CellSpan rows; |
| 241 CellSpan columns; |
| 242 |
| 243 // Rect intersects cells (0,0 1x1), expanded to (0,0 2x2) |
| 244 section->DirtiedRowsAndEffectiveColumns(LayoutRect(50, 50, 10, 10), rows, |
| 245 columns); |
| 246 EXPECT_EQ(0u, rows.Start()); |
| 247 EXPECT_EQ(2u, rows.End()); |
| 248 EXPECT_EQ(0u, columns.Start()); |
| 249 EXPECT_EQ(2u, columns.End()); |
| 250 |
| 251 // Rect intersects cells (2,1 1x1), expanded to (1,0 3x3) |
| 252 section->DirtiedRowsAndEffectiveColumns(LayoutRect(250, 150, 10, 10), rows, |
| 253 columns); |
| 254 EXPECT_EQ(0u, rows.Start()); |
| 255 EXPECT_EQ(3u, rows.End()); |
| 256 EXPECT_EQ(1u, columns.Start()); |
| 257 EXPECT_EQ(4u, columns.End()); |
| 258 |
| 259 // Rect intersects cells (3,2 1x2), expanded to (2,1 2x3) |
| 260 section->DirtiedRowsAndEffectiveColumns(LayoutRect(350, 220, 110, 110), rows, |
| 261 columns); |
| 262 EXPECT_EQ(1u, rows.Start()); |
| 263 EXPECT_EQ(4u, rows.End()); |
| 264 EXPECT_EQ(2u, columns.Start()); |
| 265 EXPECT_EQ(4u, columns.End()); |
| 266 |
| 267 // All cells. |
| 268 section->DirtiedRowsAndEffectiveColumns(LayoutRect(0, 0, 400, 400), rows, |
| 269 columns); |
| 270 EXPECT_EQ(0u, rows.Start()); |
| 271 EXPECT_EQ(4u, rows.End()); |
| 272 EXPECT_EQ(0u, columns.Start()); |
| 273 EXPECT_EQ(4u, columns.End()); |
227 } | 274 } |
228 | 275 |
229 TEST_F(LayoutTableSectionTest, VisualOverflowWithCollapsedBorders) { | 276 TEST_F(LayoutTableSectionTest, VisualOverflowWithCollapsedBorders) { |
230 SetBodyInnerHTML( | 277 SetBodyInnerHTML( |
231 "<style>" | 278 "<style>" |
232 " table { border-collapse: collapse }" | 279 " table { border-collapse: collapse }" |
233 " td { border: 0px solid blue; padding: 0 }" | 280 " td { border: 0px solid blue; padding: 0 }" |
234 " div { width: 100px; height: 100px }" | 281 " div { width: 100px; height: 100px }" |
235 "</style>" | 282 "</style>" |
236 "<table>" | 283 "<table>" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 TEST_F(LayoutTableSectionTest, OverflowingCells) { | 315 TEST_F(LayoutTableSectionTest, OverflowingCells) { |
269 SetBodyInnerHTML( | 316 SetBodyInnerHTML( |
270 "<style>" | 317 "<style>" |
271 " td { width: 10px; height: 10px }" | 318 " td { width: 10px; height: 10px }" |
272 " td.overflow { outline: 10px solid blue }" | 319 " td.overflow { outline: 10px solid blue }" |
273 "</style>"); | 320 "</style>"); |
274 | 321 |
275 LayoutRect paint_rect(50, 50, 50, 50); | 322 LayoutRect paint_rect(50, 50, 50, 50); |
276 auto* small_section = CreateSection(20, 20); | 323 auto* small_section = CreateSection(20, 20); |
277 EXPECT_FALSE(small_section->HasOverflowingCell()); | 324 EXPECT_FALSE(small_section->HasOverflowingCell()); |
278 EXPECT_NE(small_section->FullTableEffectiveColumnSpan(), | 325 CellSpan rows; |
279 small_section->DirtiedEffectiveColumns(paint_rect)); | 326 CellSpan columns; |
280 EXPECT_NE(small_section->FullSectionRowSpan(), | 327 small_section->DirtiedRowsAndEffectiveColumns(paint_rect, rows, columns); |
281 small_section->DirtiedRows(paint_rect)); | 328 EXPECT_NE(small_section->FullSectionRowSpan(), rows); |
| 329 EXPECT_NE(small_section->FullTableEffectiveColumnSpan(), columns); |
282 | 330 |
283 auto* big_section = CreateSection(80, 80); | 331 auto* big_section = CreateSection(80, 80); |
284 EXPECT_FALSE(big_section->HasOverflowingCell()); | 332 EXPECT_FALSE(big_section->HasOverflowingCell()); |
285 EXPECT_NE(big_section->FullTableEffectiveColumnSpan(), | 333 big_section->DirtiedRowsAndEffectiveColumns(paint_rect, rows, columns); |
286 big_section->DirtiedEffectiveColumns(paint_rect)); | 334 EXPECT_NE(big_section->FullSectionRowSpan(), rows); |
287 EXPECT_NE(big_section->FullSectionRowSpan(), | 335 EXPECT_NE(big_section->FullTableEffectiveColumnSpan(), columns); |
288 big_section->DirtiedRows(paint_rect)); | |
289 | 336 |
290 SetCellsOverflowInRow(small_section->FirstRow()); | 337 SetCellsOverflowInRow(small_section->FirstRow()); |
291 SetCellsOverflowInRow(big_section->FirstRow()); | 338 SetCellsOverflowInRow(big_section->FirstRow()); |
292 GetDocument().View()->UpdateAllLifecyclePhases(); | 339 GetDocument().View()->UpdateAllLifecyclePhases(); |
293 | 340 |
294 // Small sections with overflowing cells always use the slow path. | 341 // Small sections with overflowing cells always use the full paint path. |
295 EXPECT_TRUE(small_section->HasOverflowingCell()); | 342 EXPECT_TRUE(small_section->HasOverflowingCell()); |
296 EXPECT_EQ(0u, small_section->OverflowingCells().size()); | 343 EXPECT_EQ(0u, small_section->OverflowingCells().size()); |
297 EXPECT_EQ(small_section->FullTableEffectiveColumnSpan(), | 344 small_section->DirtiedRowsAndEffectiveColumns(paint_rect, rows, columns); |
298 small_section->DirtiedEffectiveColumns(paint_rect)); | 345 EXPECT_EQ(small_section->FullSectionRowSpan(), rows); |
299 EXPECT_EQ(small_section->FullSectionRowSpan(), | 346 EXPECT_EQ(small_section->FullTableEffectiveColumnSpan(), columns); |
300 small_section->DirtiedRows(paint_rect)); | |
301 | 347 |
302 // Big sections with small number of overflowing cells use the fast path. | 348 // Big sections with small number of overflowing cells use partial paint path. |
303 EXPECT_TRUE(big_section->HasOverflowingCell()); | 349 EXPECT_TRUE(big_section->HasOverflowingCell()); |
304 EXPECT_EQ(80u, big_section->OverflowingCells().size()); | 350 EXPECT_EQ(80u, big_section->OverflowingCells().size()); |
305 EXPECT_NE(big_section->FullTableEffectiveColumnSpan(), | 351 big_section->DirtiedRowsAndEffectiveColumns(paint_rect, rows, columns); |
306 big_section->DirtiedEffectiveColumns(paint_rect)); | 352 EXPECT_NE(big_section->FullSectionRowSpan(), rows); |
307 EXPECT_NE(big_section->FullSectionRowSpan(), | 353 EXPECT_NE(big_section->FullTableEffectiveColumnSpan(), columns); |
308 big_section->DirtiedRows(paint_rect)); | |
309 | 354 |
310 for (auto* row = small_section->FirstRow(); row; row = row->NextRow()) | 355 for (auto* row = small_section->FirstRow(); row; row = row->NextRow()) |
311 SetCellsOverflowInRow(row); | 356 SetCellsOverflowInRow(row); |
312 for (auto* row = big_section->FirstRow(); row; row = row->NextRow()) | 357 for (auto* row = big_section->FirstRow(); row; row = row->NextRow()) |
313 SetCellsOverflowInRow(row); | 358 SetCellsOverflowInRow(row); |
314 GetDocument().View()->UpdateAllLifecyclePhases(); | 359 GetDocument().View()->UpdateAllLifecyclePhases(); |
315 | 360 |
316 // Small sections with overflowing cells always use the slow path. | 361 // Small sections with overflowing cells always use the full paint path. |
317 EXPECT_TRUE(small_section->HasOverflowingCell()); | 362 EXPECT_TRUE(small_section->HasOverflowingCell()); |
318 EXPECT_EQ(0u, small_section->OverflowingCells().size()); | 363 EXPECT_EQ(0u, small_section->OverflowingCells().size()); |
319 EXPECT_EQ(small_section->FullTableEffectiveColumnSpan(), | 364 small_section->DirtiedRowsAndEffectiveColumns(paint_rect, rows, columns); |
320 small_section->DirtiedEffectiveColumns(paint_rect)); | 365 EXPECT_EQ(small_section->FullSectionRowSpan(), rows); |
321 EXPECT_EQ(small_section->FullSectionRowSpan(), | 366 EXPECT_EQ(small_section->FullTableEffectiveColumnSpan(), columns); |
322 small_section->DirtiedRows(paint_rect)); | |
323 | 367 |
324 // Big sections with too many overflowing cells are forced to use the slow | 368 // Big sections with too many overflowing cells are forced to use the full |
325 // path. | 369 // paint path. |
326 EXPECT_TRUE(big_section->HasOverflowingCell()); | 370 EXPECT_TRUE(big_section->HasOverflowingCell()); |
327 EXPECT_EQ(0u, big_section->OverflowingCells().size()); | 371 EXPECT_EQ(0u, big_section->OverflowingCells().size()); |
328 EXPECT_EQ(big_section->FullTableEffectiveColumnSpan(), | 372 big_section->DirtiedRowsAndEffectiveColumns(paint_rect, rows, columns); |
329 big_section->DirtiedEffectiveColumns(paint_rect)); | 373 EXPECT_EQ(big_section->FullSectionRowSpan(), rows); |
330 EXPECT_EQ(big_section->FullSectionRowSpan(), | 374 EXPECT_EQ(big_section->FullTableEffectiveColumnSpan(), columns); |
331 big_section->DirtiedRows(paint_rect)); | |
332 } | 375 } |
333 | 376 |
334 } // anonymous namespace | 377 } // anonymous namespace |
335 | 378 |
336 } // namespace blink | 379 } // namespace blink |
OLD | NEW |