Chromium Code Reviews| Index: third_party/WebKit/Source/core/layout/LayoutTable.cpp |
| diff --git a/third_party/WebKit/Source/core/layout/LayoutTable.cpp b/third_party/WebKit/Source/core/layout/LayoutTable.cpp |
| index a541b242260e9fc510be933094d0f12474574e54..d459b3903bdb3e619256699690a2843cc381c83d 100644 |
| --- a/third_party/WebKit/Source/core/layout/LayoutTable.cpp |
| +++ b/third_party/WebKit/Source/core/layout/LayoutTable.cpp |
| @@ -1445,7 +1445,9 @@ LayoutTableCell* LayoutTable::cellAbove(const LayoutTableCell* cell) const { |
| if (section) { |
| unsigned effCol = |
| absoluteColumnToEffectiveColumn(cell->absoluteColumnIndex()); |
| - return section->primaryCellAt(rAbove, effCol); |
| + return effCol < section->numCols(rAbove) |
| + ? section->primaryCellAt(rAbove, effCol) |
| + : nullptr; |
| } |
| return nullptr; |
| } |
| @@ -1471,7 +1473,9 @@ LayoutTableCell* LayoutTable::cellBelow(const LayoutTableCell* cell) const { |
| if (section) { |
| unsigned effCol = |
| absoluteColumnToEffectiveColumn(cell->absoluteColumnIndex()); |
| - return section->primaryCellAt(rBelow, effCol); |
| + return effCol < section->numCols(rBelow) |
| + ? section->primaryCellAt(rBelow, effCol) |
| + : nullptr; |
| } |
| return nullptr; |
| } |
| @@ -1486,9 +1490,7 @@ LayoutTableCell* LayoutTable::cellBefore(const LayoutTableCell* cell) const { |
| return nullptr; |
| // If we hit a colspan back up to a real cell. |
| - LayoutTableSection::CellStruct& prevCell = |
| - section->cellAt(cell->rowIndex(), effCol - 1); |
| - return prevCell.primaryCell(); |
| + return section->primaryCellAt(cell->rowIndex(), effCol - 1); |
|
mstensho (USE GERRIT)
2017/01/20 10:02:04
This is just clean-up, right?
a.suchit
2017/01/23 06:35:32
yes
|
| } |
| LayoutTableCell* LayoutTable::cellAfter(const LayoutTableCell* cell) const { |
| @@ -1496,7 +1498,10 @@ LayoutTableCell* LayoutTable::cellAfter(const LayoutTableCell* cell) const { |
| unsigned effCol = absoluteColumnToEffectiveColumn( |
| cell->absoluteColumnIndex() + cell->colSpan()); |
| - return cell->section()->primaryCellAt(cell->rowIndex(), effCol); |
| + unsigned row = cell->rowIndex(); |
| + LayoutTableSection* section = cell->section(); |
| + return effCol < section->numCols(row) ? section->primaryCellAt(row, effCol) |
| + : nullptr; |
| } |
| int LayoutTable::baselinePosition(FontBaseline baselineType, |