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

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

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/LayoutTableCellTest.cpp
diff --git a/third_party/WebKit/Source/core/layout/LayoutTableCellTest.cpp b/third_party/WebKit/Source/core/layout/LayoutTableCellTest.cpp
index 8ae6c8cdd6f6fb8cd4d74e6daa11b5b003d5fcdd..054b13fe255fcd5df459d944f43178059dfa3ee3 100644
--- a/third_party/WebKit/Source/core/layout/LayoutTableCellTest.cpp
+++ b/third_party/WebKit/Source/core/layout/LayoutTableCellTest.cpp
@@ -245,6 +245,80 @@ TEST_F(LayoutTableCellTest, HasBorderAdjoiningTableRTL) {
EXPECT_FALSE(HasEndBorderAdjoiningTable(cell32));
}
+TEST_F(LayoutTableCellTest, EffectiveColumnIndex) {
+ SetBodyInnerHTML(
+ "<table id='table'>"
+ " <tr>"
+ " <td id='cell11' colspan='2000'></td>"
+ " <td id='cell12'></td>"
+ " <td id='cell13'></td>"
+ " </tr>"
+ " <tr>"
+ " <td id='cell21' rowspan='2'></td>"
+ " <td id='cell22'></td>"
+ " <td id='cell23' colspan='2000'></td>"
+ " </tr>"
+ " <tr>"
+ " <td id='cell31'></td>"
+ " <td id='cell32'></td>"
+ " </tr>"
+ "</table>");
+
+ // Effective column spans of absolute columns:
+ // 1 1 1 1997 1 1
+ // +-------------------+---+---+
+ // | 4 (2000) | 1 | 1 |
+ // |-------+-----------+---+---+
+ // | | 1 | 4 (2000) |
+ // | 1 |---+---+---------------|
+ // | | 1 | 1 |
+ // +---+---+---+
+ // Each number not in () is the span of effective columns of the cell.
+ // Each number in () is the span of absolute columns of the cell if it's
+ // different from the span of effective columns.
+
+ const auto* cell11 = GetCellByElementId("cell11");
+ EXPECT_EQ(6u, cell11->Table()->NumEffectiveColumns());
+ EXPECT_EQ(0u, cell11->EffectiveColumnIndex());
+ EXPECT_EQ(0u, cell11->AbsoluteColumnIndex());
+ EXPECT_EQ(4u, cell11->EffectiveColumnIndexOfCellAfter());
+
+ const auto* cell12 = GetCellByElementId("cell12");
+ EXPECT_EQ(4u, cell12->EffectiveColumnIndex());
+ EXPECT_EQ(2000u, cell12->AbsoluteColumnIndex());
+ EXPECT_EQ(5u, cell12->EffectiveColumnIndexOfCellAfter());
+
+ const auto* cell13 = GetCellByElementId("cell13");
+ EXPECT_EQ(5u, cell13->EffectiveColumnIndex());
+ EXPECT_EQ(2001u, cell13->AbsoluteColumnIndex());
+ EXPECT_EQ(6u, cell13->EffectiveColumnIndexOfCellAfter());
+
+ const auto* cell21 = GetCellByElementId("cell21");
+ EXPECT_EQ(0u, cell21->EffectiveColumnIndex());
+ EXPECT_EQ(0u, cell21->AbsoluteColumnIndex());
+ EXPECT_EQ(1u, cell21->EffectiveColumnIndexOfCellAfter());
+
+ const auto* cell22 = GetCellByElementId("cell22");
+ EXPECT_EQ(1u, cell22->EffectiveColumnIndex());
+ EXPECT_EQ(1u, cell22->AbsoluteColumnIndex());
+ EXPECT_EQ(2u, cell22->EffectiveColumnIndexOfCellAfter());
+
+ const auto* cell23 = GetCellByElementId("cell23");
+ EXPECT_EQ(2u, cell23->EffectiveColumnIndex());
+ EXPECT_EQ(2u, cell23->AbsoluteColumnIndex());
+ EXPECT_EQ(6u, cell23->EffectiveColumnIndexOfCellAfter());
+
+ const auto* cell31 = GetCellByElementId("cell31");
+ EXPECT_EQ(1u, cell31->EffectiveColumnIndex());
+ EXPECT_EQ(1u, cell31->AbsoluteColumnIndex());
+ EXPECT_EQ(2u, cell31->EffectiveColumnIndexOfCellAfter());
+
+ const auto* cell32 = GetCellByElementId("cell32");
+ EXPECT_EQ(2u, cell32->EffectiveColumnIndex());
+ EXPECT_EQ(2u, cell32->AbsoluteColumnIndex());
+ EXPECT_EQ(3u, cell32->EffectiveColumnIndexOfCellAfter());
+}
+
TEST_F(LayoutTableCellTest, LocalVisualRectWithCollapsedBorders) {
SetBodyInnerHTML(
"<style>"
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutTableCell.cpp ('k') | third_party/WebKit/Source/core/layout/LayoutTableCol.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698