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

Side by Side Diff: Source/core/rendering/RenderMultiColumnFlowThreadTest.cpp

Issue 792803002: [New Multicolumn] Layout support for column-span:all. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@347325-placeholder
Patch Set: Code review. If there are no sets, return early. Created 5 years, 11 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 unified diff | Download patch
OLDNEW
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/RenderMultiColumnSpannerPlaceholder.h" 10 #include "core/rendering/RenderMultiColumnSpannerPlaceholder.h"
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("spanner1")->renderer()), columnBox); 250 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("spanner1")->renderer()), columnBox);
251 EXPECT_EQ(document().getElementById("spanner1")->renderer()->spannerPlacehol der(), columnBox); 251 EXPECT_EQ(document().getElementById("spanner1")->renderer()->spannerPlacehol der(), columnBox);
252 EXPECT_EQ(toRenderMultiColumnSpannerPlaceholder(columnBox)->rendererInFlowTh read(), document().getElementById("spanner1")->renderer()); 252 EXPECT_EQ(toRenderMultiColumnSpannerPlaceholder(columnBox)->rendererInFlowTh read(), document().getElementById("spanner1")->renderer());
253 columnBox = columnBox->nextSiblingMultiColumnBox()->nextSiblingMultiColumnBo x(); 253 columnBox = columnBox->nextSiblingMultiColumnBox()->nextSiblingMultiColumnBo x();
254 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("spanner2")->renderer()), columnBox); 254 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("spanner2")->renderer()), columnBox);
255 EXPECT_EQ(document().getElementById("spanner2")->renderer()->spannerPlacehol der(), columnBox); 255 EXPECT_EQ(document().getElementById("spanner2")->renderer()->spannerPlacehol der(), columnBox);
256 EXPECT_EQ(toRenderMultiColumnSpannerPlaceholder(columnBox)->rendererInFlowTh read(), document().getElementById("spanner2")->renderer()); 256 EXPECT_EQ(toRenderMultiColumnSpannerPlaceholder(columnBox)->rendererInFlowTh read(), document().getElementById("spanner2")->renderer());
257 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("outer")->renderer()), nullptr); 257 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(document().getEleme ntById("outer")->renderer()), nullptr);
258 } 258 }
259 259
260 TEST_F(MultiColumnRenderingTest, columnSetAtBlockOffset)
261 {
262 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>");
263 RenderMultiColumnFlowThread* flowThread = findFlowThread("mc");
264 EXPECT_EQ(columnSetSignature(flowThread), "cscsc");
265 RenderMultiColumnSet* firstRow = flowThread->firstMultiColumnSet();
266 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000)), firstRow); // negative overflow
267 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit()), firstRow);
268 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(499)), firstRow); // bottom of last line in first row.
269 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(599)), firstRow); // empty content in last column in first row
270 RenderMultiColumnSet* secondRow = firstRow->nextSiblingMultiColumnSet();
271 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(600)), secondRow);
272 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(799)), secondRow);
273 RenderMultiColumnSet* thirdRow = secondRow->nextSiblingMultiColumnSet();
274 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(800)), thirdRow);
275 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(899)), thirdRow); // bottom of last row
276 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000)), thirdRow); // overflow
277 }
278
279 TEST_F(MultiColumnRenderingTest, columnSetAtBlockOffsetVerticalRl)
280 {
281 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</d iv>text<br>text<div id='spanner2'>text<br>text</div>text</div>");
282 RenderMultiColumnFlowThread* flowThread = findFlowThread("mc");
283 EXPECT_EQ(columnSetSignature(flowThread), "cscsc");
284 RenderMultiColumnSet* firstRow = flowThread->firstMultiColumnSet();
285 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000)), firstRow); // negative overflow
286 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit()), firstRow);
287 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(499)), firstRow); // bottom of last line in first row.
288 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(599)), firstRow); // empty content in last column in first row
289 RenderMultiColumnSet* secondRow = firstRow->nextSiblingMultiColumnSet();
290 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(600)), secondRow);
291 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(799)), secondRow);
292 RenderMultiColumnSet* thirdRow = secondRow->nextSiblingMultiColumnSet();
293 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(800)), thirdRow);
294 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(899)), thirdRow); // bottom of last row
295 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000)), thirdRow); // overflow
296 }
297
298 TEST_F(MultiColumnRenderingTest, columnSetAtBlockOffsetVerticalLr)
299 {
300 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</d iv>text<br>text<div id='spanner2'>text<br>text</div>text</div>");
301 RenderMultiColumnFlowThread* flowThread = findFlowThread("mc");
302 EXPECT_EQ(columnSetSignature(flowThread), "cscsc");
303 RenderMultiColumnSet* firstRow = flowThread->firstMultiColumnSet();
304 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000)), firstRow); // negative overflow
305 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit()), firstRow);
306 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(499)), firstRow); // bottom of last line in first row.
307 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(599)), firstRow); // empty content in last column in first row
308 RenderMultiColumnSet* secondRow = firstRow->nextSiblingMultiColumnSet();
309 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(600)), secondRow);
310 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(799)), secondRow);
311 RenderMultiColumnSet* thirdRow = secondRow->nextSiblingMultiColumnSet();
312 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(800)), thirdRow);
313 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(899)), thirdRow); // bottom of last row
314 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000)), thirdRow); // overflow
315 }
316
260 } // anonymous namespace 317 } // anonymous namespace
261 318
262 } // namespace blink 319 } // namespace blink
OLDNEW
« 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