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 unsigned nCols = m_layoutTableSection.numCols(row); | |
192 for (unsigned c = dirtiedColumns.end(); c > dirtiedColumns.start(); c--) { | 193 for (unsigned c = dirtiedColumns.end(); c > dirtiedColumns.start(); c--) { |
mstensho (USE GERRIT)
2017/01/23 09:24:57
unsigned c = std::min(dirtiedColumns.end(), nCols)
a.suchit
2017/01/23 11:19:01
Done.
| |
193 unsigned col = c - 1; | 194 unsigned col = c - 1; |
195 if (col >= nCols) | |
196 continue; | |
194 const LayoutTableCell* cell = | 197 const LayoutTableCell* cell = |
195 m_layoutTableSection.primaryCellAt(row, col); | 198 m_layoutTableSection.primaryCellAt(row, col); |
196 if (!cell || (row > dirtiedRows.start() && | 199 if (!cell || (row > dirtiedRows.start() && |
197 m_layoutTableSection.primaryCellAt(row - 1, col) == cell) || | 200 m_layoutTableSection.primaryCellAt(row - 1, col) == cell) || |
198 (col > dirtiedColumns.start() && | 201 (col > dirtiedColumns.start() && |
199 m_layoutTableSection.primaryCellAt(row, col - 1) == cell)) | 202 m_layoutTableSection.primaryCellAt(row, col - 1) == cell)) |
200 continue; | 203 continue; |
201 LayoutPoint cellPoint = m_layoutTableSection.flipForWritingModeForChild( | 204 LayoutPoint cellPoint = m_layoutTableSection.flipForWritingModeForChild( |
202 cell, adjustedPaintOffset); | 205 cell, adjustedPaintOffset); |
203 TableCellPainter(*cell).paintCollapsedBorders(paintInfo, cellPoint, | 206 TableCellPainter(*cell).paintCollapsedBorders(paintInfo, cellPoint, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
295 | 298 |
296 HashSet<LayoutTableCell*> spanningCells; | 299 HashSet<LayoutTableCell*> spanningCells; |
297 for (unsigned r = dirtiedRows.start(); r < dirtiedRows.end(); r++) { | 300 for (unsigned r = dirtiedRows.start(); r < dirtiedRows.end(); r++) { |
298 const LayoutTableRow* row = m_layoutTableSection.rowLayoutObjectAt(r); | 301 const LayoutTableRow* row = m_layoutTableSection.rowLayoutObjectAt(r); |
299 // TODO(crbug.com/577282): This painting order is inconsistent with other | 302 // TODO(crbug.com/577282): This painting order is inconsistent with other |
300 // outlines. | 303 // outlines. |
301 if (row && !row->hasSelfPaintingLayer() && | 304 if (row && !row->hasSelfPaintingLayer() && |
302 shouldPaintSelfOutline(paintInfoForDescendants.phase)) | 305 shouldPaintSelfOutline(paintInfoForDescendants.phase)) |
303 TableRowPainter(*row).paintOutline(paintInfoForDescendants, | 306 TableRowPainter(*row).paintOutline(paintInfoForDescendants, |
304 paintOffset); | 307 paintOffset); |
305 for (unsigned c = dirtiedColumns.start(); c < dirtiedColumns.end(); c++) { | 308 unsigned nCols = m_layoutTableSection.numCols(r); |
306 if (c >= m_layoutTableSection.numCols(r)) | 309 for (unsigned c = dirtiedColumns.start(); |
307 break; | 310 c < nCols && c < dirtiedColumns.end(); c++) { |
308 const LayoutTableSection::CellStruct& current = | 311 const LayoutTableSection::CellStruct& current = |
309 m_layoutTableSection.cellAt(r, c); | 312 m_layoutTableSection.cellAt(r, c); |
310 for (LayoutTableCell* cell : current.cells) { | 313 for (LayoutTableCell* cell : current.cells) { |
311 if (overflowingCells.contains(cell)) | 314 if (overflowingCells.contains(cell)) |
312 continue; | 315 continue; |
313 if (cell->rowSpan() > 1 || cell->colSpan() > 1) { | 316 if (cell->rowSpan() > 1 || cell->colSpan() > 1) { |
314 if (!spanningCells.add(cell).isNewEntry) | 317 if (!spanningCells.add(cell).isNewEntry) |
315 continue; | 318 continue; |
316 } | 319 } |
317 cells.push_back(cell); | 320 cells.push_back(cell); |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
405 m_layoutTableSection.styleRef()); | 408 m_layoutTableSection.styleRef()); |
406 } else { | 409 } else { |
407 // TODO(wangxianzhu): Calculate the inset shadow bounds by insetting | 410 // TODO(wangxianzhu): Calculate the inset shadow bounds by insetting |
408 // paintRect by half widths of collapsed borders. | 411 // paintRect by half widths of collapsed borders. |
409 BoxPainter::paintInsetBoxShadow(paintInfo, paintRect, | 412 BoxPainter::paintInsetBoxShadow(paintInfo, paintRect, |
410 m_layoutTableSection.styleRef()); | 413 m_layoutTableSection.styleRef()); |
411 } | 414 } |
412 } | 415 } |
413 | 416 |
414 } // namespace blink | 417 } // namespace blink |
OLD | NEW |