OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/TableSectionPainter.h" | 5 #include "core/paint/TableSectionPainter.h" |
6 | 6 |
7 #include "core/layout/LayoutTableCell.h" | 7 #include "core/layout/LayoutTableCell.h" |
8 #include "core/layout/LayoutTableCol.h" | 8 #include "core/layout/LayoutTableCol.h" |
9 #include "core/layout/LayoutTableRow.h" | 9 #include "core/layout/LayoutTableRow.h" |
10 #include "core/paint/BoxClipper.h" | 10 #include "core/paint/BoxClipper.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 CellSpan dirtiedColumns = | 182 CellSpan dirtiedColumns = |
183 m_layoutTableSection.dirtiedEffectiveColumns(tableAlignedRect); | 183 m_layoutTableSection.dirtiedEffectiveColumns(tableAlignedRect); |
184 | 184 |
185 if (dirtiedColumns.start() >= dirtiedColumns.end()) | 185 if (dirtiedColumns.start() >= dirtiedColumns.end()) |
186 return; | 186 return; |
187 | 187 |
188 // Collapsed borders are painted from the bottom right to the top left so that | 188 // Collapsed borders are painted from the bottom right to the top left so that |
189 // precedence due to cell position is respected. | 189 // precedence due to cell position is respected. |
190 for (unsigned r = dirtiedRows.end(); r > dirtiedRows.start(); r--) { | 190 for (unsigned r = dirtiedRows.end(); r > dirtiedRows.start(); r--) { |
191 unsigned row = r - 1; | 191 unsigned row = r - 1; |
192 for (unsigned c = dirtiedColumns.end(); c > dirtiedColumns.start(); c--) { | 192 unsigned nCols = m_layoutTableSection.numCols(row); |
| 193 for (unsigned c = std::min(dirtiedColumns.end(), nCols); |
| 194 c > dirtiedColumns.start(); c--) { |
193 unsigned col = c - 1; | 195 unsigned col = c - 1; |
194 const LayoutTableCell* cell = | 196 const LayoutTableCell* cell = |
195 m_layoutTableSection.primaryCellAt(row, col); | 197 m_layoutTableSection.primaryCellAt(row, col); |
196 if (!cell || (row > dirtiedRows.start() && | 198 if (!cell || (row > dirtiedRows.start() && |
197 m_layoutTableSection.primaryCellAt(row - 1, col) == cell) || | 199 m_layoutTableSection.primaryCellAt(row - 1, col) == cell) || |
198 (col > dirtiedColumns.start() && | 200 (col > dirtiedColumns.start() && |
199 m_layoutTableSection.primaryCellAt(row, col - 1) == cell)) | 201 m_layoutTableSection.primaryCellAt(row, col - 1) == cell)) |
200 continue; | 202 continue; |
201 LayoutPoint cellPoint = m_layoutTableSection.flipForWritingModeForChild( | 203 LayoutPoint cellPoint = m_layoutTableSection.flipForWritingModeForChild( |
202 cell, adjustedPaintOffset); | 204 cell, adjustedPaintOffset); |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 | 297 |
296 HashSet<LayoutTableCell*> spanningCells; | 298 HashSet<LayoutTableCell*> spanningCells; |
297 for (unsigned r = dirtiedRows.start(); r < dirtiedRows.end(); r++) { | 299 for (unsigned r = dirtiedRows.start(); r < dirtiedRows.end(); r++) { |
298 const LayoutTableRow* row = m_layoutTableSection.rowLayoutObjectAt(r); | 300 const LayoutTableRow* row = m_layoutTableSection.rowLayoutObjectAt(r); |
299 // TODO(crbug.com/577282): This painting order is inconsistent with other | 301 // TODO(crbug.com/577282): This painting order is inconsistent with other |
300 // outlines. | 302 // outlines. |
301 if (row && !row->hasSelfPaintingLayer() && | 303 if (row && !row->hasSelfPaintingLayer() && |
302 shouldPaintSelfOutline(paintInfoForDescendants.phase)) | 304 shouldPaintSelfOutline(paintInfoForDescendants.phase)) |
303 TableRowPainter(*row).paintOutline(paintInfoForDescendants, | 305 TableRowPainter(*row).paintOutline(paintInfoForDescendants, |
304 paintOffset); | 306 paintOffset); |
305 for (unsigned c = dirtiedColumns.start(); c < dirtiedColumns.end(); c++) { | 307 unsigned nCols = m_layoutTableSection.numCols(r); |
306 if (c >= m_layoutTableSection.numCols(r)) | 308 for (unsigned c = dirtiedColumns.start(); |
307 break; | 309 c < nCols && c < dirtiedColumns.end(); c++) { |
308 const LayoutTableSection::CellStruct& current = | 310 const LayoutTableSection::CellStruct& current = |
309 m_layoutTableSection.cellAt(r, c); | 311 m_layoutTableSection.cellAt(r, c); |
310 for (LayoutTableCell* cell : current.cells) { | 312 for (LayoutTableCell* cell : current.cells) { |
311 if (overflowingCells.contains(cell)) | 313 if (overflowingCells.contains(cell)) |
312 continue; | 314 continue; |
313 if (cell->rowSpan() > 1 || cell->colSpan() > 1) { | 315 if (cell->rowSpan() > 1 || cell->colSpan() > 1) { |
314 if (!spanningCells.add(cell).isNewEntry) | 316 if (!spanningCells.add(cell).isNewEntry) |
315 continue; | 317 continue; |
316 } | 318 } |
317 cells.push_back(cell); | 319 cells.push_back(cell); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 m_layoutTableSection.styleRef()); | 407 m_layoutTableSection.styleRef()); |
406 } else { | 408 } else { |
407 // TODO(wangxianzhu): Calculate the inset shadow bounds by insetting | 409 // TODO(wangxianzhu): Calculate the inset shadow bounds by insetting |
408 // paintRect by half widths of collapsed borders. | 410 // paintRect by half widths of collapsed borders. |
409 BoxPainter::paintInsetBoxShadow(paintInfo, paintRect, | 411 BoxPainter::paintInsetBoxShadow(paintInfo, paintRect, |
410 m_layoutTableSection.styleRef()); | 412 m_layoutTableSection.styleRef()); |
411 } | 413 } |
412 } | 414 } |
413 | 415 |
414 } // namespace blink | 416 } // namespace blink |
OLD | NEW |