| Index: third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
|
| diff --git a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
|
| index 1f42815aa7b3bca21ac7bc365202cb84c7242579..b2e771c1f5d37eb6a41a72749ff1f63b12d5d905 100644
|
| --- a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
|
| @@ -131,8 +131,9 @@ void LayoutTableSection::StyleDidChange(StyleDifference diff,
|
| if (!table)
|
| return;
|
|
|
| - LayoutTableBoxComponent::InvalidateCollapsedBordersOnStyleChange(
|
| - *this, *table, diff, *old_style);
|
| + if (LayoutTableBoxComponent::NeedsInvalidateCollapsedBordersOnStyleChange(
|
| + *this, *table, diff, *old_style))
|
| + InvalidateCollapsedBordersOfAffectedCells();
|
|
|
| if (LayoutTableBoxComponent::DoCellsHaveDirtyWidth(*this, *table, diff,
|
| *old_style))
|
| @@ -2172,4 +2173,77 @@ bool LayoutTableSection::PaintedOutputOfObjectHasNoEffectRegardlessOfSize()
|
| PaintedOutputOfObjectHasNoEffectRegardlessOfSize();
|
| }
|
|
|
| +void LayoutTableSection::InvalidateCellCollapsedBordersIntersectingRow(
|
| + unsigned row_index) {
|
| + auto& row_struct = grid_[row_index].row;
|
| + for (auto& cell_struct : row_struct) {
|
| + if (cell_struct.in_col_span)
|
| + continue;
|
| + if (auto* cell = cell_struct.PrimaryCell())
|
| + cell->InvalidateCollapsedBorderValues();
|
| + }
|
| +}
|
| +
|
| +void LayoutTableSection::InvalidateCollapsedBordersOfAffectedCells() {
|
| + auto* table = this->Table();
|
| + DCHECK(table->CollapseBorders());
|
| + if (table->NeedsInvalidateCollapsedBordersForAllCells())
|
| + return;
|
| +
|
| + table->RecalcSectionsIfNeeded();
|
| + table->InvalidateCollapsedBorders();
|
| +
|
| + if (NumRows()) {
|
| + // Invalidate cells intersecting the top row.
|
| + InvalidateCellCollapsedBordersIntersectingRow(0);
|
| + // Invalidate cells intersecting the bottom row.
|
| + if (NumRows() > 1)
|
| + InvalidateCellCollapsedBordersIntersectingRow(NumRows() - 1);
|
| +
|
| + // Invalidate cell in start and end columns.
|
| + auto num_effective_columns = this->NumEffectiveColumns();
|
| + for (unsigned r = 0; r < NumRows(); ++r) {
|
| + if (auto* cell = PrimaryCellAt(r, 0))
|
| + cell->InvalidateCollapsedBorderValues();
|
| + if (auto* cell = PrimaryCellAt(r, num_effective_columns - 1))
|
| + cell->InvalidateCollapsedBorderValues();
|
| + }
|
| + }
|
| +
|
| + // Invalidate cells in the row above the top row.
|
| + if (auto* section = table->SectionAbove(this, kSkipEmptySections)) {
|
| + section->InvalidateCellCollapsedBordersIntersectingRow(section->NumRows() -
|
| + 1);
|
| + }
|
| + // Invalidate cells in the row below the bottom row.
|
| + if (auto* section = table->SectionBelow(this, kSkipEmptySections)) {
|
| + section->InvalidateCellCollapsedBordersIntersectingRow(0);
|
| + }
|
| +}
|
| +
|
| +LayoutTableCell* LayoutTableSection::PrimaryCellAboveInTable(
|
| + unsigned row,
|
| + unsigned effective_column) {
|
| + DCHECK(PrimaryCellAt(row, effective_column)->RowIndex() == row);
|
| + if (row)
|
| + return PrimaryCellAt(row - 1, effective_column);
|
| + if (auto* section_above = Table()->SectionAbove(this, kSkipEmptySections)) {
|
| + return section_above->PrimaryCellAt(section_above->NumRows() - 1,
|
| + effective_column);
|
| + }
|
| + return nullptr;
|
| +}
|
| +
|
| +LayoutTableCell* LayoutTableSection::PrimaryCellBelowInTable(
|
| + unsigned row,
|
| + unsigned effective_column) {
|
| + DCHECK(PrimaryCellAt(row, effective_column)->RowIndex() == row);
|
| + unsigned row_below = row + PrimaryCellAt(row, effective_column)->RowSpan();
|
| + if (row_below < NumRows())
|
| + return PrimaryCellAt(row_below, effective_column);
|
| + if (auto* section_below = Table()->SectionBelow(this, kSkipEmptySections))
|
| + return section_below->PrimaryCellAt(0, effective_column);
|
| + return nullptr;
|
| +}
|
| +
|
| } // namespace blink
|
|
|