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

Side by Side Diff: third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThreadTest.cpp

Issue 2340213003: Add PageBoundaryRule parameter to columnSetAtBlockOffset(). (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "core/layout/LayoutMultiColumnFlowThread.h" 5 #include "core/layout/LayoutMultiColumnFlowThread.h"
6 6
7 #include "core/layout/LayoutMultiColumnSet.h" 7 #include "core/layout/LayoutMultiColumnSet.h"
8 #include "core/layout/LayoutMultiColumnSpannerPlaceholder.h" 8 #include "core/layout/LayoutMultiColumnSpannerPlaceholder.h"
9 #include "core/layout/LayoutTestHelper.h" 9 #include "core/layout/LayoutTestHelper.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->layoutObjectInFl owThread(), getLayoutObjectByElementId("spanner2")); 274 EXPECT_EQ(toLayoutMultiColumnSpannerPlaceholder(columnBox)->layoutObjectInFl owThread(), getLayoutObjectByElementId("spanner2"));
275 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(getLayoutObjectByEl ementId("outer")), nullptr); 275 EXPECT_EQ(flowThread->containingColumnSpannerPlaceholder(getLayoutObjectByEl ementId("outer")), nullptr);
276 } 276 }
277 277
278 TEST_F(MultiColumnRenderingTest, columnSetAtBlockOffset) 278 TEST_F(MultiColumnRenderingTest, columnSetAtBlockOffset)
279 { 279 {
280 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>"); 280 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>");
281 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); 281 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc");
282 EXPECT_EQ(columnSetSignature(flowThread), "cscsc"); 282 EXPECT_EQ(columnSetSignature(flowThread), "cscsc");
283 LayoutMultiColumnSet* firstRow = flowThread->firstMultiColumnSet(); 283 LayoutMultiColumnSet* firstRow = flowThread->firstMultiColumnSet();
284 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000)), firstRow); // negative overflow 284 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000), LayoutBox:: AssociateWithFormerPage), firstRow); // negative overflow
285 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit()), firstRow); 285 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000), LayoutBox:: AssociateWithLatterPage), firstRow); // negative overflow
286 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(499)), firstRow); // bottom of last line in first row. 286 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(), LayoutBox::Associ ateWithFormerPage), firstRow);
287 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(), LayoutBox::Associ ateWithLatterPage), firstRow);
288 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(499), LayoutBox::Ass ociateWithFormerPage), firstRow); // bottom of last line in first row.
289 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(499), LayoutBox::Ass ociateWithLatterPage), firstRow); // bottom of last line in first row.
287 LayoutMultiColumnSet* secondRow = firstRow->nextSiblingMultiColumnSet(); 290 LayoutMultiColumnSet* secondRow = firstRow->nextSiblingMultiColumnSet();
288 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(500)), secondRow); 291 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(500), LayoutBox::Ass ociateWithFormerPage), firstRow);
289 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(699)), secondRow); 292 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(500), LayoutBox::Ass ociateWithLatterPage), secondRow);
293 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(699), LayoutBox::Ass ociateWithFormerPage), secondRow);
294 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(699), LayoutBox::Ass ociateWithLatterPage), secondRow);
290 LayoutMultiColumnSet* thirdRow = secondRow->nextSiblingMultiColumnSet(); 295 LayoutMultiColumnSet* thirdRow = secondRow->nextSiblingMultiColumnSet();
291 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(700)), thirdRow); 296 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(700), LayoutBox::Ass ociateWithFormerPage), secondRow);
292 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(799)), thirdRow); // bottom of last row 297 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(700), LayoutBox::Ass ociateWithLatterPage), thirdRow);
293 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000)), thirdRow); // overflow 298 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(799), LayoutBox::Ass ociateWithLatterPage), thirdRow); // bottom of last row
299 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000), LayoutBox::A ssociateWithFormerPage), thirdRow); // overflow
300 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000), LayoutBox::A ssociateWithLatterPage), thirdRow); // overflow
294 } 301 }
295 302
296 TEST_F(MultiColumnRenderingTest, columnSetAtBlockOffsetVerticalRl) 303 TEST_F(MultiColumnRenderingTest, columnSetAtBlockOffsetVerticalRl)
297 { 304 {
298 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>"); 305 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>");
299 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); 306 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc");
300 EXPECT_EQ(columnSetSignature(flowThread), "cscsc"); 307 EXPECT_EQ(columnSetSignature(flowThread), "cscsc");
301 LayoutMultiColumnSet* firstRow = flowThread->firstMultiColumnSet(); 308 LayoutMultiColumnSet* firstRow = flowThread->firstMultiColumnSet();
302 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000)), firstRow); // negative overflow 309 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000), LayoutBox:: AssociateWithFormerPage), firstRow); // negative overflow
303 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit()), firstRow); 310 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000), LayoutBox:: AssociateWithLatterPage), firstRow); // negative overflow
304 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(499)), firstRow); // bottom of last line in first row. 311 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(), LayoutBox::Associ ateWithFormerPage), firstRow);
312 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(), LayoutBox::Associ ateWithLatterPage), firstRow);
313 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(499), LayoutBox::Ass ociateWithFormerPage), firstRow); // bottom of last line in first row.
314 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(499), LayoutBox::Ass ociateWithLatterPage), firstRow); // bottom of last line in first row.
305 LayoutMultiColumnSet* secondRow = firstRow->nextSiblingMultiColumnSet(); 315 LayoutMultiColumnSet* secondRow = firstRow->nextSiblingMultiColumnSet();
306 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(500)), secondRow); 316 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(500), LayoutBox::Ass ociateWithFormerPage), firstRow);
307 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(699)), secondRow); 317 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(500), LayoutBox::Ass ociateWithLatterPage), secondRow);
318 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(699), LayoutBox::Ass ociateWithFormerPage), secondRow);
319 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(699), LayoutBox::Ass ociateWithLatterPage), secondRow);
308 LayoutMultiColumnSet* thirdRow = secondRow->nextSiblingMultiColumnSet(); 320 LayoutMultiColumnSet* thirdRow = secondRow->nextSiblingMultiColumnSet();
309 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(700)), thirdRow); 321 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(700), LayoutBox::Ass ociateWithFormerPage), secondRow);
310 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(799)), thirdRow); // bottom of last row 322 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(700), LayoutBox::Ass ociateWithLatterPage), thirdRow);
311 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000)), thirdRow); // overflow 323 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(799), LayoutBox::Ass ociateWithLatterPage), thirdRow); // bottom of last row
324 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000), LayoutBox::A ssociateWithFormerPage), thirdRow); // overflow
325 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000), LayoutBox::A ssociateWithLatterPage), thirdRow); // overflow
312 } 326 }
313 327
314 TEST_F(MultiColumnRenderingTest, columnSetAtBlockOffsetVerticalLr) 328 TEST_F(MultiColumnRenderingTest, columnSetAtBlockOffsetVerticalLr)
315 { 329 {
316 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>"); 330 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>");
317 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc"); 331 LayoutMultiColumnFlowThread* flowThread = findFlowThread("mc");
318 EXPECT_EQ(columnSetSignature(flowThread), "cscsc"); 332 EXPECT_EQ(columnSetSignature(flowThread), "cscsc");
319 LayoutMultiColumnSet* firstRow = flowThread->firstMultiColumnSet(); 333 LayoutMultiColumnSet* firstRow = flowThread->firstMultiColumnSet();
320 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000)), firstRow); // negative overflow 334 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000), LayoutBox:: AssociateWithFormerPage), firstRow); // negative overflow
321 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit()), firstRow); 335 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(-10000), LayoutBox:: AssociateWithLatterPage), firstRow); // negative overflow
322 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(499)), firstRow); // bottom of last line in first row. 336 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(), LayoutBox::Associ ateWithFormerPage), firstRow);
337 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(), LayoutBox::Associ ateWithLatterPage), firstRow);
338 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(499), LayoutBox::Ass ociateWithFormerPage), firstRow); // bottom of last line in first row.
339 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(499), LayoutBox::Ass ociateWithLatterPage), firstRow); // bottom of last line in first row.
323 LayoutMultiColumnSet* secondRow = firstRow->nextSiblingMultiColumnSet(); 340 LayoutMultiColumnSet* secondRow = firstRow->nextSiblingMultiColumnSet();
324 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(500)), secondRow); 341 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(500), LayoutBox::Ass ociateWithFormerPage), firstRow);
325 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(699)), secondRow); 342 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(500), LayoutBox::Ass ociateWithLatterPage), secondRow);
343 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(699), LayoutBox::Ass ociateWithFormerPage), secondRow);
344 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(699), LayoutBox::Ass ociateWithLatterPage), secondRow);
326 LayoutMultiColumnSet* thirdRow = secondRow->nextSiblingMultiColumnSet(); 345 LayoutMultiColumnSet* thirdRow = secondRow->nextSiblingMultiColumnSet();
327 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(700)), thirdRow); 346 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(700), LayoutBox::Ass ociateWithFormerPage), secondRow);
328 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(799)), thirdRow); // bottom of last row 347 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(700), LayoutBox::Ass ociateWithLatterPage), thirdRow);
329 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000)), thirdRow); // overflow 348 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(799), LayoutBox::Ass ociateWithLatterPage), thirdRow); // bottom of last row
349 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000), LayoutBox::A ssociateWithFormerPage), thirdRow); // overflow
350 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000), LayoutBox::A ssociateWithLatterPage), thirdRow); // overflow
330 } 351 }
331 352
332 class MultiColumnTreeModifyingTest : public MultiColumnRenderingTest { 353 class MultiColumnTreeModifyingTest : public MultiColumnRenderingTest {
333 public: 354 public:
334 void setMulticolHTML(const char*); 355 void setMulticolHTML(const char*);
335 void reparentLayoutObject(const char* newParentId, const char* childId, cons t char* insertBeforeId = nullptr); 356 void reparentLayoutObject(const char* newParentId, const char* childId, cons t char* insertBeforeId = nullptr);
336 void destroyLayoutObject(LayoutObject* child); 357 void destroyLayoutObject(LayoutObject* child);
337 void destroyLayoutObject(const char* childId); 358 void destroyLayoutObject(const char* childId);
338 }; 359 };
339 360
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 { 806 {
786 setMulticolHTML("<div id='mc'>text<div id='spanner'><div class='s'></div></d iv>text</div>"); 807 setMulticolHTML("<div id='mc'>text<div id='spanner'><div class='s'></div></d iv>text</div>");
787 EXPECT_EQ(columnSetSignature("mc"), "csc"); 808 EXPECT_EQ(columnSetSignature("mc"), "csc");
788 destroyLayoutObject("spanner"); 809 destroyLayoutObject("spanner");
789 EXPECT_EQ(columnSetSignature("mc"), "c"); 810 EXPECT_EQ(columnSetSignature("mc"), "c");
790 } 811 }
791 812
792 } // anonymous namespace 813 } // anonymous namespace
793 814
794 } // namespace blink 815 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/layout/LayoutMultiColumnFlowThread.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698