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 |