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

Unified Diff: Source/core/rendering/RenderMultiColumnFlowThreadTest.cpp

Issue 712553003: [New Multicolumn] Actual support for layout of column-span:all. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Code review. Camelize. Created 6 years 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
« no previous file with comments | « Source/core/rendering/RenderMultiColumnFlowThread.cpp ('k') | Source/core/rendering/RenderMultiColumnSet.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/rendering/RenderMultiColumnFlowThreadTest.cpp
diff --git a/Source/core/rendering/RenderMultiColumnFlowThreadTest.cpp b/Source/core/rendering/RenderMultiColumnFlowThreadTest.cpp
index 719607c5ca475f7d9268619f57a29b3fdf2d1841..f458366a299d3146b2951c0a1c3733335bb8bd99 100644
--- a/Source/core/rendering/RenderMultiColumnFlowThreadTest.cpp
+++ b/Source/core/rendering/RenderMultiColumnFlowThreadTest.cpp
@@ -237,6 +237,81 @@ TEST_F(MultiColumnRenderingTest, SubtreeWithSpannerBeforeSpanner)
EXPECT_EQ(flowThread->containingColumnSpannerSet(document().getElementById("outer")->renderer()), nullptr);
}
+TEST_F(MultiColumnRenderingTest, columnSetAtBlockOffset)
+{
+ setMulticolHTML("<div id='mc' style='line-height:100px;'>text<br>text<br>text<br>text<br>text<div id='spanner1'>spanner</div>text<br>text<div id='spanner2'>text<br>text</div>text</div>");
+ RenderMultiColumnFlowThread* flowThread = findFlowThread("mc");
+ EXPECT_EQ(columnSetSignature(flowThread), "cscsc");
+ RenderMultiColumnSet* firstRow = flowThread->firstMultiColumnSet();
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000)), firstRow); // negative overflow
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit()), firstRow);
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(499)), firstRow); // bottom of last line in first row.
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(599)), firstRow); // empty content in last column in first row
+ RenderMultiColumnSet* firstSpanner = firstRow->nextSiblingMultiColumnSet();
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(600)), firstSpanner);
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(699)), firstSpanner);
+ RenderMultiColumnSet* secondRow = firstSpanner->nextSiblingMultiColumnSet();
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(700)), secondRow);
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(899)), secondRow);
+ RenderMultiColumnSet* secondSpanner = secondRow->nextSiblingMultiColumnSet();
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(900)), secondSpanner);
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(1099)), secondSpanner);
+ RenderMultiColumnSet* thirdRow = secondSpanner->nextSiblingMultiColumnSet();
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(1100)), thirdRow);
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(1199)), thirdRow); // bottom of last row
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000)), thirdRow); // overflow
+}
+
+TEST_F(MultiColumnRenderingTest, columnSetAtBlockOffsetVerticalRl)
+{
+ setMulticolHTML("<div id='mc' style='line-height:100px; -webkit-writing-mode:vertical-rl;'>text<br>text<br>text<br>text<br>text<div id='spanner1'>spanner</div>text<br>text<div id='spanner2'>text<br>text</div>text</div>");
+ RenderMultiColumnFlowThread* flowThread = findFlowThread("mc");
+ EXPECT_EQ(columnSetSignature(flowThread), "cscsc");
+ RenderMultiColumnSet* firstRow = flowThread->firstMultiColumnSet();
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000)), firstRow); // negative overflow
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit()), firstRow);
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(499)), firstRow); // bottom of last line in first row.
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(599)), firstRow); // empty content in last column in first row
+ RenderMultiColumnSet* firstSpanner = firstRow->nextSiblingMultiColumnSet();
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(600)), firstSpanner);
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(699)), firstSpanner);
+ RenderMultiColumnSet* secondRow = firstSpanner->nextSiblingMultiColumnSet();
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(700)), secondRow);
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(899)), secondRow);
+ RenderMultiColumnSet* secondSpanner = secondRow->nextSiblingMultiColumnSet();
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(900)), secondSpanner);
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(1099)), secondSpanner);
+ RenderMultiColumnSet* thirdRow = secondSpanner->nextSiblingMultiColumnSet();
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(1100)), thirdRow);
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(1199)), thirdRow); // bottom of last row
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000)), thirdRow); // overflow
+}
+
+TEST_F(MultiColumnRenderingTest, columnSetAtBlockOffsetVerticalLr)
+{
+ setMulticolHTML("<div id='mc' style='line-height:100px; -webkit-writing-mode:vertical-lr;'>text<br>text<br>text<br>text<br>text<div id='spanner1'>spanner</div>text<br>text<div id='spanner2'>text<br>text</div>text</div>");
+ RenderMultiColumnFlowThread* flowThread = findFlowThread("mc");
+ EXPECT_EQ(columnSetSignature(flowThread), "cscsc");
+ RenderMultiColumnSet* firstRow = flowThread->firstMultiColumnSet();
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000)), firstRow); // negative overflow
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit()), firstRow);
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(499)), firstRow); // bottom of last line in first row.
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(599)), firstRow); // empty content in last column in first row
+ RenderMultiColumnSet* firstSpanner = firstRow->nextSiblingMultiColumnSet();
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(600)), firstSpanner);
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(699)), firstSpanner);
+ RenderMultiColumnSet* secondRow = firstSpanner->nextSiblingMultiColumnSet();
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(700)), secondRow);
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(899)), secondRow);
+ RenderMultiColumnSet* secondSpanner = secondRow->nextSiblingMultiColumnSet();
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(900)), secondSpanner);
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(1099)), secondSpanner);
+ RenderMultiColumnSet* thirdRow = secondSpanner->nextSiblingMultiColumnSet();
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(1100)), thirdRow);
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(1199)), thirdRow); // bottom of last row
+ EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000)), thirdRow); // overflow
+}
+
} // anonymous namespace
} // namespace blink
« no previous file with comments | « Source/core/rendering/RenderMultiColumnFlowThread.cpp ('k') | Source/core/rendering/RenderMultiColumnSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698