Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Unified Diff: third_party/WebKit/Source/core/layout/LayoutTableCell.h

Issue 2884573002: Replace LayoutTableCell::AbsoluteColumnIndex() with EffectiveColumnIndex()
Patch Set: - Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/layout/LayoutTableCell.h
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableCell.h b/third_party/WebKit/Source/core/layout/LayoutTableCell.h
index 1380b1907c857889972587d5570bdbe86d23067f..d0c01db5a52703135f5308f9244ad09ad433bafb 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableCell.h
+++ b/third_party/WebKit/Source/core/layout/LayoutTableCell.h
@@ -109,13 +109,19 @@ class CORE_EXPORT LayoutTableCell final : public LayoutBlockFlow {
absolute_column_index_ = column;
}
- bool HasSetAbsoluteColumnIndex() const {
- return absolute_column_index_ != kUnsetColumnIndex;
+ // See LayoutTable.h for definition of absolute and effective columns.
+ // In most cases we should use EffectiveColumnIndex() instead of
+ // AbsolutColumnIndex().
+ unsigned AbsoluteColumnIndex() const { return absolute_column_index_; }
+ unsigned EffectiveColumnIndex() const {
+ DCHECK_NE(absolute_column_index_, kUnsetColumnIndex);
+ return Table()->AbsoluteColumnToEffectiveColumn(absolute_column_index_);
}
-
- unsigned AbsoluteColumnIndex() const {
- DCHECK(HasSetAbsoluteColumnIndex());
- return absolute_column_index_;
+ // Returns effective column index, of the cell after this cell, or of the
+ // imaginary cell after this cell if there is no cell after this cell.
+ unsigned EffectiveColumnIndexOfCellAfter() const {
+ return Table()->AbsoluteColumnToEffectiveColumn(absolute_column_index_ +
+ ColSpan());
}
LayoutTableRow* Row() const { return ToLayoutTableRow(Parent()); }
@@ -125,6 +131,9 @@ class CORE_EXPORT LayoutTableCell final : public LayoutBlockFlow {
LayoutTable* Table() const {
return ToLayoutTable(Parent()->Parent()->Parent());
}
+ LayoutTable::ColAndColGroup GetColAndColGroup() const {
+ return Table()->ColAndColGroupAtEffectiveColumn(EffectiveColumnIndex());
+ }
LayoutTableCell* PreviousCell() const;
LayoutTableCell* NextCell() const;
@@ -140,9 +149,7 @@ class CORE_EXPORT LayoutTableCell final : public LayoutBlockFlow {
if (!style_width.IsAuto())
return style_width;
if (LayoutTableCol* first_column =
- Table()
- ->ColElementAtAbsoluteColumn(AbsoluteColumnIndex())
- .InnermostColOrColGroup())
+ GetColAndColGroup().InnermostColOrColGroup())
return LogicalWidthFromColumns(first_column, style_width);
return style_width;
}
@@ -368,6 +375,7 @@ class CORE_EXPORT LayoutTableCell final : public LayoutBlockFlow {
const PaintInvalidatorContext&) const override;
private:
+ friend class LayoutTableCellDeathTest;
friend class LayoutTableCellTest;
bool IsOfType(LayoutObjectType type) const override {
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTable.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutTableCell.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698