OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "config.h" | 5 #include "config.h" |
6 | 6 |
7 #include "core/rendering/RenderMultiColumnFlowThread.h" | 7 #include "core/rendering/RenderMultiColumnFlowThread.h" |
8 | 8 |
9 #include "core/rendering/RenderMultiColumnSet.h" | 9 #include "core/rendering/RenderMultiColumnSet.h" |
10 #include "core/rendering/RenderMultiColumnSpannerSet.h" | 10 #include "core/rendering/RenderMultiColumnSpannerSet.h" |
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 EXPECT_EQ(columnSetSignature(flowThread), "cscs"); | 230 EXPECT_EQ(columnSetSignature(flowThread), "cscs"); |
231 RenderMultiColumnSet* columnSet = flowThread->firstMultiColumnSet()->nextSib
lingMultiColumnSet(); | 231 RenderMultiColumnSet* columnSet = flowThread->firstMultiColumnSet()->nextSib
lingMultiColumnSet(); |
232 EXPECT_EQ(flowThread->containingColumnSpannerSet(document().getElementById("
spanner1")->renderer()), columnSet); | 232 EXPECT_EQ(flowThread->containingColumnSpannerSet(document().getElementById("
spanner1")->renderer()), columnSet); |
233 EXPECT_EQ(toRenderMultiColumnSpannerSet(columnSet)->rendererInFlowThread(),
document().getElementById("spanner1")->renderer()); | 233 EXPECT_EQ(toRenderMultiColumnSpannerSet(columnSet)->rendererInFlowThread(),
document().getElementById("spanner1")->renderer()); |
234 columnSet = columnSet->nextSiblingMultiColumnSet()->nextSiblingMultiColumnSe
t(); | 234 columnSet = columnSet->nextSiblingMultiColumnSet()->nextSiblingMultiColumnSe
t(); |
235 EXPECT_EQ(flowThread->containingColumnSpannerSet(document().getElementById("
spanner2")->renderer()), columnSet); | 235 EXPECT_EQ(flowThread->containingColumnSpannerSet(document().getElementById("
spanner2")->renderer()), columnSet); |
236 EXPECT_EQ(toRenderMultiColumnSpannerSet(columnSet)->rendererInFlowThread(),
document().getElementById("spanner2")->renderer()); | 236 EXPECT_EQ(toRenderMultiColumnSpannerSet(columnSet)->rendererInFlowThread(),
document().getElementById("spanner2")->renderer()); |
237 EXPECT_EQ(flowThread->containingColumnSpannerSet(document().getElementById("
outer")->renderer()), nullptr); | 237 EXPECT_EQ(flowThread->containingColumnSpannerSet(document().getElementById("
outer")->renderer()), nullptr); |
238 } | 238 } |
239 | 239 |
| 240 TEST_F(MultiColumnRenderingTest, columnSetAtBlockOffset) |
| 241 { |
| 242 setMulticolHTML("<div id='mc' style='line-height:100px;'>text<br>text<br>tex
t<br>text<br>text<div id='spanner1'>spanner</div>text<br>text<div id='spanner2'>
text<br>text</div>text</div>"); |
| 243 RenderMultiColumnFlowThread* multicolFlowThread = findFlowThread("mc"); |
| 244 RenderFlowThread* flowThread = multicolFlowThread; // FIXME: columnSetAtBloc
kOffset() override is private in RenderMultiColumnFlowThread. :( |
| 245 EXPECT_EQ(columnSetSignature(multicolFlowThread), "cscsc"); |
| 246 RenderMultiColumnSet* columnSet = multicolFlowThread->firstMultiColumnSet(); |
| 247 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000)), columnSet)
; // negative overflow |
| 248 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit()), columnSet); |
| 249 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(499)), columnSet); /
/ bottom of last line in first row. |
| 250 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(599)), columnSet); /
/ empty content in last column in first row |
| 251 columnSet = columnSet->nextSiblingMultiColumnSet(); // first spanner |
| 252 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(600)), columnSet); |
| 253 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(699)), columnSet); |
| 254 columnSet = columnSet->nextSiblingMultiColumnSet(); // second row |
| 255 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(700)), columnSet); |
| 256 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(899)), columnSet); |
| 257 columnSet = columnSet->nextSiblingMultiColumnSet(); // second spanner |
| 258 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(900)), columnSet); |
| 259 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(1099)), columnSet); |
| 260 columnSet = columnSet->nextSiblingMultiColumnSet(); // third row |
| 261 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(1100)), columnSet); |
| 262 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(1199)), columnSet);
// bottom of last row |
| 263 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000)), columnSet);
// overflow |
| 264 } |
| 265 |
240 } // anonymous namespace | 266 } // anonymous namespace |
241 | 267 |
242 } // namespace blink | 268 } // namespace blink |
OLD | NEW |