| 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 43fff52a63b93dc5e06f2071b587ca7f74a90c3b..563e000ae63a6b2ef4db56af8d25e56e3f75e585 100644
|
| --- a/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/LayoutTableSection.cpp
|
| @@ -252,7 +252,7 @@ void LayoutTableSection::AddCell(LayoutTableCell* cell, LayoutTableRow* row) {
|
| // <TR><TD>1 <TD rowspan="2">2 <TD>3 <TD>4
|
| // <TR><TD colspan="2">5
|
| // </TABLE>
|
| - unsigned n_cols = NumCols(insertion_row);
|
| + unsigned n_cols = NumEffectiveColumns(insertion_row);
|
| while (c_col_ < n_cols && (GridCellAt(insertion_row, c_col_).HasCells() ||
|
| GridCellAt(insertion_row, c_col_).InColSpan()))
|
| c_col_++;
|
| @@ -1141,7 +1141,7 @@ void LayoutTableSection::LayoutRows() {
|
| for (unsigned r = 0; r < total_rows; r++) {
|
| LayoutTableRow* row = grid_[r].row;
|
|
|
| - unsigned n_cols = NumCols(r);
|
| + unsigned n_cols = NumEffectiveColumns(r);
|
| for (unsigned c = 0; c < n_cols; c++) {
|
| LayoutTableCell* cell = OriginatingCellAt(r, c);
|
| if (!cell)
|
| @@ -1315,7 +1315,7 @@ bool LayoutTableSection::RecalcChildOverflowAfterStyleChange() {
|
| continue;
|
| row_layouter->ClearChildNeedsOverflowRecalcAfterStyleChange();
|
| bool row_children_overflow_changed = false;
|
| - unsigned n_cols = NumCols(r);
|
| + unsigned n_cols = NumEffectiveColumns(r);
|
| for (unsigned c = 0; c < n_cols; c++) {
|
| auto* cell = OriginatingCellAt(r, c);
|
| if (!cell || !cell->NeedsOverflowRecalcAfterStyleChange())
|
| @@ -1345,6 +1345,13 @@ void LayoutTableSection::MarkAllCellsWidthsDirtyAndOrNeedsLayout(
|
|
|
| int LayoutTableSection::CalcBlockDirectionOuterBorder(
|
| BlockBorderSide side) const {
|
| + // TODO(wangxianzhu): There are several issues in this function:
|
| + // 1. Row borders are not respected;
|
| + // 2. Column borders should be ignored if this section is not at the top or
|
| + // the bottom.
|
| + // 3. It's unnecessarily complex.
|
| + // I think we should just use cell's calculated collapsed border values to
|
| + // avoid all of the problems.
|
| if (!grid_.size() || !Table()->NumEffectiveColumns())
|
| return 0;
|
|
|
| @@ -1367,7 +1374,7 @@ int LayoutTableSection::CalcBlockDirectionOuterBorder(
|
|
|
| bool all_hidden = true;
|
| unsigned r = side == kBorderBefore ? 0 : grid_.size() - 1;
|
| - unsigned n_cols = NumCols(r);
|
| + unsigned n_cols = NumEffectiveColumns(r);
|
| for (unsigned c = 0; c < n_cols; c++) {
|
| const auto& grid_cell = GridCellAt(r, c);
|
| if (grid_cell.InColSpan() || !grid_cell.HasCells())
|
| @@ -1380,7 +1387,7 @@ int LayoutTableSection::CalcBlockDirectionOuterBorder(
|
| : primary_cell_style.BorderAfter();
|
| // FIXME: Don't repeat for the same col group
|
| LayoutTableCol* col =
|
| - Table()->ColElementAtAbsoluteColumn(c).InnermostColOrColGroup();
|
| + Table()->ColAndColGroupAtEffectiveColumn(c).InnermostColOrColGroup();
|
| if (col) {
|
| const BorderValue& gb = side == kBorderBefore
|
| ? col->Style()->BorderBefore()
|
| @@ -1426,7 +1433,7 @@ int LayoutTableSection::CalcInlineDirectionOuterBorder(
|
| border_width = sb.Width();
|
|
|
| if (LayoutTableCol* col = Table()
|
| - ->ColElementAtAbsoluteColumn(col_index)
|
| + ->ColAndColGroupAtEffectiveColumn(col_index)
|
| .InnermostColOrColGroup()) {
|
| const BorderValue& gb = side == kBorderStart ? col->Style()->BorderStart()
|
| : col->Style()->BorderEnd();
|
| @@ -1438,7 +1445,7 @@ int LayoutTableSection::CalcInlineDirectionOuterBorder(
|
|
|
| bool all_hidden = true;
|
| for (unsigned r = 0; r < grid_.size(); r++) {
|
| - if (col_index >= NumCols(r))
|
| + if (col_index >= NumEffectiveColumns(r))
|
| continue;
|
| const auto& grid_cell = GridCellAt(r, col_index);
|
| if (!grid_cell.HasCells())
|
| @@ -1563,7 +1570,7 @@ void LayoutTableSection::DirtiedRowsAndEffectiveColumns(
|
| if (rows.Start() > 0 && rows.Start() < grid_.size()) {
|
| // If there are any cells spanning into the first row, expand |rows| to
|
| // cover the cells.
|
| - unsigned n_cols = NumCols(rows.Start());
|
| + unsigned n_cols = NumEffectiveColumns(rows.Start());
|
| unsigned smallest_row = rows.Start();
|
| for (unsigned c = columns.Start(); c < std::min(columns.End(), n_cols);
|
| ++c) {
|
| @@ -1706,11 +1713,11 @@ void LayoutTableSection::SetNeedsCellRecalc() {
|
| t->SetNeedsSectionRecalc();
|
| }
|
|
|
| -unsigned LayoutTableSection::NumEffectiveColumns() const {
|
| +unsigned LayoutTableSection::MaxNumEffectiveColumnsOfRows() const {
|
| unsigned result = 0;
|
|
|
| for (unsigned r = 0; r < grid_.size(); ++r) {
|
| - unsigned n_cols = NumCols(r);
|
| + unsigned n_cols = NumEffectiveColumns(r);
|
| for (unsigned c = result; c < n_cols; ++c) {
|
| const auto& grid_cell = GridCellAt(r, c);
|
| if (grid_cell.HasCells() || grid_cell.InColSpan())
|
| @@ -1756,7 +1763,7 @@ const LayoutTableCell* LayoutTableSection::FirstRowCellAdjoiningTableEnd()
|
| LayoutTableCell* LayoutTableSection::OriginatingCellAt(
|
| unsigned row,
|
| unsigned effective_column) {
|
| - if (effective_column >= NumCols(row))
|
| + if (effective_column >= NumEffectiveColumns(row))
|
| return nullptr;
|
| auto& grid_cell = GridCellAt(row, effective_column);
|
| if (grid_cell.InColSpan())
|
| @@ -1852,7 +1859,7 @@ bool LayoutTableSection::NodeAtPoint(
|
| // Now iterate over the spanned rows and columns.
|
| for (unsigned hit_row = row_span.Start(); hit_row < row_span.End();
|
| ++hit_row) {
|
| - unsigned n_cols = NumCols(hit_row);
|
| + unsigned n_cols = NumEffectiveColumns(hit_row);
|
| for (unsigned hit_column = column_span.Start();
|
| hit_column < n_cols && hit_column < column_span.End(); ++hit_column) {
|
| auto& grid_cell = GridCellAt(hit_row, hit_column);
|
| @@ -1906,8 +1913,7 @@ void LayoutTableSection::SetLogicalPositionForCell(
|
| cell_location.SetX(LayoutUnit(
|
| Table()->EffectiveColumnPositions()[Table()->NumEffectiveColumns()] -
|
| Table()->EffectiveColumnPositions()
|
| - [Table()->AbsoluteColumnToEffectiveColumn(
|
| - cell->AbsoluteColumnIndex() + cell->ColSpan())] +
|
| + [cell->EffectiveColumnIndexOfCellAfter()] +
|
| horizontal_border_spacing));
|
| else
|
| cell_location.SetX(
|
| @@ -2127,7 +2133,7 @@ bool LayoutTableSection::MapToVisualRectInAncestorSpaceInternal(
|
| bool LayoutTableSection::PaintedOutputOfObjectHasNoEffectRegardlessOfSize()
|
| const {
|
| // LayoutTableSection paints background from columns.
|
| - if (Table()->HasColElements())
|
| + if (Table()->HasColOrColGroups())
|
| return false;
|
| return LayoutTableBoxComponent::
|
| PaintedOutputOfObjectHasNoEffectRegardlessOfSize();
|
|
|