| Index: third_party/WebKit/Source/core/layout/LayoutTable.h
|
| diff --git a/third_party/WebKit/Source/core/layout/LayoutTable.h b/third_party/WebKit/Source/core/layout/LayoutTable.h
|
| index 335eea31c9ba0c8eaf6dda84c94307acaa77c089..5431633915b68cebe38eb2e77e8039c288e3a3d3 100644
|
| --- a/third_party/WebKit/Source/core/layout/LayoutTable.h
|
| +++ b/third_party/WebKit/Source/core/layout/LayoutTable.h
|
| @@ -127,8 +127,8 @@ enum TableHeightChangingValue { kTableHeightNotChanging, kTableHeightChanging };
|
| // </table>
|
| //
|
| // Columns can be split if we add a row with a different colspan structure.
|
| -// See splitEffectiveColumn() and appendEffectiveColumn() for operations
|
| -// over effectiveColumns() and effectiveColumnPositions().
|
| +// See SplitEffectiveColumn() and AppendEffectiveColumn() for operations
|
| +// over EffectiveColumns() and EffectiveColumnPositions().
|
| //
|
| // See absoluteColumnToEffectiveColumn() for converting an absolute column
|
| // index into an index into effectiveColumns() and effectiveColumnPositions().
|
| @@ -356,6 +356,7 @@ class CORE_EXPORT LayoutTable final : public LayoutBlock {
|
|
|
| // Return the first column or column-group.
|
| LayoutTableCol* FirstColumn() const;
|
| + LayoutTableCol* FirstInnermostColumn() const;
|
|
|
| struct ColAndColGroup {
|
| ColAndColGroup()
|
| @@ -369,15 +370,20 @@ class CORE_EXPORT LayoutTable final : public LayoutBlock {
|
| bool adjoins_end_border_of_col_group;
|
| LayoutTableCol* InnermostColOrColGroup() { return col ? col : colgroup; }
|
| };
|
| - ColAndColGroup ColElementAtAbsoluteColumn(
|
| - unsigned absolute_column_index) const {
|
| - // The common case is to not have col/colgroup elements, make that case
|
| - // fast.
|
| - if (!has_col_elements_)
|
| + ColAndColGroup ColAndColGroupAtEffectiveColumn(
|
| + unsigned effective_column) const {
|
| + if (!cols_at_effective_columns_valid_)
|
| + UpdateColsAtEffectiveColumns();
|
| + if (!cols_at_effective_columns_ ||
|
| + effective_column >= cols_at_effective_columns_->size())
|
| return ColAndColGroup();
|
| - return SlowColElementAtAbsoluteColumn(absolute_column_index);
|
| + return cols_at_effective_columns_->at(effective_column);
|
| + }
|
| + bool HasColOrColGroups() const {
|
| + if (!cols_at_effective_columns_valid_)
|
| + UpdateColsAtEffectiveColumns();
|
| + return !!cols_at_effective_columns_;
|
| }
|
| - bool HasColElements() const { return has_col_elements_; }
|
|
|
| bool NeedsSectionRecalc() const { return needs_section_recalc_; }
|
| void SetNeedsSectionRecalc() {
|
| @@ -501,10 +507,8 @@ class CORE_EXPORT LayoutTable final : public LayoutBlock {
|
| int FirstLineBoxBaseline() const override;
|
| int InlineBlockBaseline(LineDirectionMode) const override;
|
|
|
| - ColAndColGroup SlowColElementAtAbsoluteColumn(unsigned col) const;
|
| -
|
| - void UpdateColumnCache() const;
|
| - void InvalidateCachedColumns();
|
| + void UpdateColsAtEffectiveColumns() const;
|
| + void InvalidateColsAtEffectiveColumns() const;
|
|
|
| void UpdateLogicalWidth() override;
|
|
|
| @@ -557,11 +561,8 @@ class CORE_EXPORT LayoutTable final : public LayoutBlock {
|
| // The captions associated with this object.
|
| mutable Vector<LayoutTableCaption*> captions_;
|
|
|
| - // Holds pointers to LayoutTableCol objects for <col>s and <colgroup>s under
|
| - // this table.
|
| - // There is no direct relationship between the size of and index into this
|
| - // vector and those of m_effectiveColumns because they hold different things.
|
| - mutable Vector<LayoutTableCol*> column_layout_objects_;
|
| + // Stores cached ColAndColGroup structures at effective columns.
|
| + mutable std::unique_ptr<Vector<ColAndColGroup>> cols_at_effective_columns_;
|
|
|
| mutable LayoutTableSection* head_;
|
| mutable LayoutTableSection* foot_;
|
| @@ -590,11 +591,10 @@ class CORE_EXPORT LayoutTable final : public LayoutBlock {
|
| bool collapsed_borders_valid_ : 1;
|
| bool needs_invalidate_collapsed_borders_for_all_cells_ : 1;
|
|
|
| - mutable bool has_col_elements_ : 1;
|
| mutable bool needs_section_recalc_ : 1;
|
|
|
| bool column_logical_width_changed_ : 1;
|
| - mutable bool column_layout_objects_valid_ : 1;
|
| + mutable bool cols_at_effective_columns_valid_ : 1;
|
| mutable unsigned no_cell_colspan_at_least_;
|
| unsigned CalcNoCellColspanAtLeast() const {
|
| for (unsigned c = 0; c < NumEffectiveColumns(); c++) {
|
|
|