| Index: third_party/WebKit/Source/core/layout/LayoutTableCell.cpp
|
| diff --git a/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp b/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp
|
| index 56a40e0dd4045021b7e61e0940053a720889eac1..4c13b8910e741fbae97beb9ef0702ae142e232cf 100644
|
| --- a/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp
|
| +++ b/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp
|
| @@ -165,9 +165,7 @@ Length LayoutTableCell::LogicalWidthFromColumns(
|
| Length width_from_style) const {
|
| DCHECK(first_col_for_this_cell);
|
| DCHECK_EQ(first_col_for_this_cell,
|
| - Table()
|
| - ->ColElementAtAbsoluteColumn(AbsoluteColumnIndex())
|
| - .InnermostColOrColGroup());
|
| + GetColAndColGroup().InnermostColOrColGroup());
|
| LayoutTableCol* table_col = first_col_for_this_cell;
|
|
|
| unsigned col_span_count = ColSpan();
|
| @@ -594,13 +592,11 @@ static CollapsedBorderValue ChooseBorder(const CollapsedBorderValue& border1,
|
| }
|
|
|
| bool LayoutTableCell::IsInStartColumn() const {
|
| - return !AbsoluteColumnIndex();
|
| + return !EffectiveColumnIndex();
|
| }
|
|
|
| bool LayoutTableCell::IsInEndColumn() const {
|
| - return Table()->AbsoluteColumnToEffectiveColumn(AbsoluteColumnIndex() +
|
| - ColSpan() - 1) ==
|
| - Table()->NumEffectiveColumns() - 1;
|
| + return EffectiveColumnIndexOfCellAfter() >= Table()->NumEffectiveColumns();
|
| }
|
|
|
| bool LayoutTableCell::HasStartBorderAdjoiningTable() const {
|
| @@ -679,29 +675,26 @@ CollapsedBorderValue LayoutTableCell::ComputeCollapsedStartBorder() const {
|
| }
|
|
|
| // (5) Our column and column group's start borders.
|
| - LayoutTable::ColAndColGroup col_and_col_group =
|
| - table->ColElementAtAbsoluteColumn(AbsoluteColumnIndex());
|
| - if (col_and_col_group.colgroup &&
|
| - col_and_col_group.adjoins_start_border_of_col_group) {
|
| + auto start_col = GetColAndColGroup();
|
| + if (start_col.colgroup && start_col.adjoins_start_border_of_col_group) {
|
| // Only apply the colgroup's border if this cell touches the colgroup edge.
|
| result = ChooseBorder(
|
| - result,
|
| - CollapsedBorderValue(
|
| - col_and_col_group.colgroup->BorderAdjoiningCellStartBorder(this),
|
| - col_and_col_group.colgroup->ResolveColor(start_color_property),
|
| - kBorderPrecedenceColumnGroup));
|
| + result, CollapsedBorderValue(
|
| + start_col.colgroup->BorderAdjoiningCellStartBorder(this),
|
| + start_col.colgroup->ResolveColor(start_color_property),
|
| + kBorderPrecedenceColumnGroup));
|
| if (!result.Exists())
|
| return result;
|
| }
|
| - if (col_and_col_group.col) {
|
| + if (start_col.col) {
|
| // Always apply the col's border irrespective of whether this cell touches
|
| // it. This is per HTML5: "For the purposes of the CSS table model, the col
|
| // element is expected to be treated as if it "was present as many times as
|
| // its span attribute specifies".
|
| result = ChooseBorder(
|
| result, CollapsedBorderValue(
|
| - col_and_col_group.col->BorderAdjoiningCellStartBorder(this),
|
| - col_and_col_group.col->ResolveColor(start_color_property),
|
| + start_col.col->BorderAdjoiningCellStartBorder(this),
|
| + start_col.col->ResolveColor(start_color_property),
|
| kBorderPrecedenceColumn));
|
| if (!result.Exists())
|
| return result;
|
| @@ -709,15 +702,14 @@ CollapsedBorderValue LayoutTableCell::ComputeCollapsedStartBorder() const {
|
|
|
| // (6) The end border of the preceding column.
|
| if (cell_before) {
|
| - LayoutTable::ColAndColGroup col_and_col_group =
|
| - table->ColElementAtAbsoluteColumn(AbsoluteColumnIndex() - 1);
|
| + auto col_before =
|
| + table->ColAndColGroupAtEffectiveColumn(EffectiveColumnIndex() - 1);
|
| // Only apply the colgroup's border if this cell touches the colgroup edge.
|
| - if (col_and_col_group.colgroup &&
|
| - col_and_col_group.adjoins_end_border_of_col_group) {
|
| + if (col_before.colgroup && col_before.adjoins_end_border_of_col_group) {
|
| result = ChooseBorder(
|
| CollapsedBorderValue(
|
| - col_and_col_group.colgroup->BorderAdjoiningCellEndBorder(this),
|
| - col_and_col_group.colgroup->ResolveColor(end_color_property),
|
| + col_before.colgroup->BorderAdjoiningCellEndBorder(this),
|
| + col_before.colgroup->ResolveColor(end_color_property),
|
| kBorderPrecedenceColumnGroup),
|
| result);
|
| if (!result.Exists())
|
| @@ -727,12 +719,11 @@ CollapsedBorderValue LayoutTableCell::ComputeCollapsedStartBorder() const {
|
| // it. This is per HTML5: "For the purposes of the CSS table model, the col
|
| // element is expected to be treated as if it "was present as many times as
|
| // its span attribute specifies".
|
| - if (col_and_col_group.col) {
|
| + if (col_before.col) {
|
| result = ChooseBorder(
|
| - CollapsedBorderValue(
|
| - col_and_col_group.col->BorderAdjoiningCellAfter(this),
|
| - col_and_col_group.col->ResolveColor(end_color_property),
|
| - kBorderPrecedenceColumn),
|
| + CollapsedBorderValue(col_before.col->BorderAdjoiningCellAfter(this),
|
| + col_before.col->ResolveColor(end_color_property),
|
| + kBorderPrecedenceColumn),
|
| result);
|
| if (!result.Exists())
|
| return result;
|
| @@ -809,60 +800,56 @@ CollapsedBorderValue LayoutTableCell::ComputeCollapsedEndBorder() const {
|
| }
|
|
|
| // (5) Our column and column group's end borders.
|
| - LayoutTable::ColAndColGroup col_and_col_group =
|
| - table->ColElementAtAbsoluteColumn(AbsoluteColumnIndex() + ColSpan() - 1);
|
| - if (col_and_col_group.colgroup &&
|
| - col_and_col_group.adjoins_end_border_of_col_group) {
|
| + auto end_col = table->ColAndColGroupAtEffectiveColumn(
|
| + EffectiveColumnIndexOfCellAfter() - 1);
|
| + if (end_col.colgroup && end_col.adjoins_end_border_of_col_group) {
|
| // Only apply the colgroup's border if this cell touches the colgroup edge.
|
| result = ChooseBorder(
|
| - result,
|
| - CollapsedBorderValue(
|
| - col_and_col_group.colgroup->BorderAdjoiningCellEndBorder(this),
|
| - col_and_col_group.colgroup->ResolveColor(end_color_property),
|
| - kBorderPrecedenceColumnGroup));
|
| + result, CollapsedBorderValue(
|
| + end_col.colgroup->BorderAdjoiningCellEndBorder(this),
|
| + end_col.colgroup->ResolveColor(end_color_property),
|
| + kBorderPrecedenceColumnGroup));
|
| if (!result.Exists())
|
| return result;
|
| }
|
| - if (col_and_col_group.col) {
|
| + if (end_col.col) {
|
| // Always apply the col's border irrespective of whether this cell touches
|
| // it. This is per HTML5: "For the purposes of the CSS table model, the col
|
| // element is expected to be treated as if it "was present as many times as
|
| // its span attribute specifies".
|
| result = ChooseBorder(
|
| - result, CollapsedBorderValue(
|
| - col_and_col_group.col->BorderAdjoiningCellEndBorder(this),
|
| - col_and_col_group.col->ResolveColor(end_color_property),
|
| - kBorderPrecedenceColumn));
|
| + result,
|
| + CollapsedBorderValue(end_col.col->BorderAdjoiningCellEndBorder(this),
|
| + end_col.col->ResolveColor(end_color_property),
|
| + kBorderPrecedenceColumn));
|
| if (!result.Exists())
|
| return result;
|
| }
|
|
|
| // (6) The start border of the next column.
|
| if (!is_end_column) {
|
| - LayoutTable::ColAndColGroup col_and_col_group =
|
| - table->ColElementAtAbsoluteColumn(AbsoluteColumnIndex() + ColSpan());
|
| - if (col_and_col_group.colgroup &&
|
| - col_and_col_group.adjoins_start_border_of_col_group) {
|
| + auto col_after = table->ColAndColGroupAtEffectiveColumn(
|
| + EffectiveColumnIndexOfCellAfter());
|
| + if (col_after.colgroup && col_after.adjoins_start_border_of_col_group) {
|
| // Only apply the colgroup's border if this cell touches the colgroup
|
| // edge.
|
| result = ChooseBorder(
|
| - result,
|
| - CollapsedBorderValue(
|
| - col_and_col_group.colgroup->BorderAdjoiningCellStartBorder(this),
|
| - col_and_col_group.colgroup->ResolveColor(start_color_property),
|
| - kBorderPrecedenceColumnGroup));
|
| + result, CollapsedBorderValue(
|
| + col_after.colgroup->BorderAdjoiningCellStartBorder(this),
|
| + col_after.colgroup->ResolveColor(start_color_property),
|
| + kBorderPrecedenceColumnGroup));
|
| if (!result.Exists())
|
| return result;
|
| }
|
| - if (col_and_col_group.col) {
|
| + if (col_after.col) {
|
| // Always apply the col's border irrespective of whether this cell touches
|
| // it. This is per HTML5: "For the purposes of the CSS table model, the
|
| // col element is expected to be treated as if it "was present as many
|
| // times as its span attribute specifies".
|
| result = ChooseBorder(
|
| result, CollapsedBorderValue(
|
| - col_and_col_group.col->BorderAdjoiningCellBefore(this),
|
| - col_and_col_group.col->ResolveColor(start_color_property),
|
| + col_after.col->BorderAdjoiningCellBefore(this),
|
| + col_after.col->ResolveColor(start_color_property),
|
| kBorderPrecedenceColumn));
|
| if (!result.Exists())
|
| return result;
|
| @@ -887,7 +874,7 @@ CollapsedBorderValue LayoutTableCell::ComputeCollapsedBeforeBorder() const {
|
| LayoutTableCell* prev_cell = table->CellAbove(this);
|
| // We can use the border shared with |prev_cell| if it is valid.
|
| if (prev_cell && prev_cell->collapsed_border_values_valid_ &&
|
| - prev_cell->AbsoluteColumnIndex() == AbsoluteColumnIndex()) {
|
| + prev_cell->EffectiveColumnIndex() == EffectiveColumnIndex()) {
|
| return prev_cell->GetCollapsedBorderValues()
|
| ? prev_cell->GetCollapsedBorderValues()->AfterBorder()
|
| : CollapsedBorderValue();
|
| @@ -969,9 +956,7 @@ CollapsedBorderValue LayoutTableCell::ComputeCollapsedBeforeBorder() const {
|
|
|
| if (!curr_section) {
|
| // (8) Our column and column group's before borders.
|
| - LayoutTableCol* col_elt =
|
| - table->ColElementAtAbsoluteColumn(AbsoluteColumnIndex())
|
| - .InnermostColOrColGroup();
|
| + LayoutTableCol* col_elt = GetColAndColGroup().InnermostColOrColGroup();
|
| if (col_elt) {
|
| result = ChooseBorder(
|
| result,
|
| @@ -1010,7 +995,7 @@ CollapsedBorderValue LayoutTableCell::ComputeCollapsedAfterBorder() const {
|
| LayoutTableCell* next_cell = table->CellBelow(this);
|
| // We can use the border shared with |next_cell| if it is valid.
|
| if (next_cell && next_cell->collapsed_border_values_valid_ &&
|
| - next_cell->AbsoluteColumnIndex() == AbsoluteColumnIndex()) {
|
| + next_cell->EffectiveColumnIndex() == EffectiveColumnIndex()) {
|
| return next_cell->GetCollapsedBorderValues()
|
| ? next_cell->GetCollapsedBorderValues()->BeforeBorder()
|
| : CollapsedBorderValue();
|
| @@ -1083,9 +1068,7 @@ CollapsedBorderValue LayoutTableCell::ComputeCollapsedAfterBorder() const {
|
|
|
| if (!curr_section) {
|
| // (8) Our column and column group's after borders.
|
| - LayoutTableCol* col_elt =
|
| - table->ColElementAtAbsoluteColumn(AbsoluteColumnIndex())
|
| - .InnermostColOrColGroup();
|
| + LayoutTableCol* col_elt = GetColAndColGroup().InnermostColOrColGroup();
|
| if (col_elt) {
|
| result = ChooseBorder(
|
| result,
|
|
|