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

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

Issue 2842123003: Refactor LayoutTableCell::Has(Start|End)BorderAdjoinjingTable() and add test (Closed)
Patch Set: - Created 3 years, 8 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.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp b/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp
index 14dc86695534739603ece0f62b1be09ef692d49e..5c6f73698211c508f3a4329a9cce5f2fe3f05536 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTableCell.cpp
@@ -572,32 +572,28 @@ static CollapsedBorderValue ChooseBorder(const CollapsedBorderValue& border1,
return CompareBorders(border1, border2) ? border2 : border1;
}
-bool LayoutTableCell::HasStartBorderAdjoiningTable() const {
- bool is_start_column = !AbsoluteColumnIndex();
- bool is_end_column = Table()->AbsoluteColumnToEffectiveColumn(
- AbsoluteColumnIndex() + ColSpan() - 1) ==
- Table()->NumEffectiveColumns() - 1;
- bool has_same_direction_as_table = HasSameDirectionAs(Table());
+bool LayoutTableCell::IsInStartColumn() const {
+ return !AbsoluteColumnIndex();
+}
+
+bool LayoutTableCell::IsInEndColumn() const {
+ return Table()->AbsoluteColumnToEffectiveColumn(AbsoluteColumnIndex() +
+ ColSpan() - 1) ==
+ Table()->NumEffectiveColumns() - 1;
+}
+bool LayoutTableCell::HasStartBorderAdjoiningTable() const {
// The table direction determines the row direction. In mixed directionality,
// we cannot guarantee that we have a common border with the table (think a
// ltr table with rtl start cell).
- return (is_start_column && has_same_direction_as_table) ||
- (is_end_column && !has_same_direction_as_table);
+ return HasSameDirectionAs(Table()) ? IsInStartColumn() : IsInEndColumn();
}
bool LayoutTableCell::HasEndBorderAdjoiningTable() const {
- bool is_start_column = !AbsoluteColumnIndex();
- bool is_end_column = Table()->AbsoluteColumnToEffectiveColumn(
- AbsoluteColumnIndex() + ColSpan() - 1) ==
- Table()->NumEffectiveColumns() - 1;
- bool has_same_direction_as_table = HasSameDirectionAs(Table());
-
// The table direction determines the row direction. In mixed directionality,
// we cannot guarantee that we have a common border with the table (think a
// ltr table with ltr end cell).
- return (is_start_column && !has_same_direction_as_table) ||
- (is_end_column && has_same_direction_as_table);
+ return HasSameDirectionAs(Table()) ? IsInEndColumn() : IsInStartColumn();
}
CollapsedBorderValue LayoutTableCell::ComputeCollapsedStartBorder(
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTableCell.h ('k') | third_party/WebKit/Source/core/layout/LayoutTableCellTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698