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/RenderMultiColumnSpannerPlaceholder.h" | 10 #include "core/rendering/RenderMultiColumnSpannerPlaceholder.h" |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 RenderMultiColumnSet* thirdRow = secondRow->nextSiblingMultiColumnSet(); | 338 RenderMultiColumnSet* thirdRow = secondRow->nextSiblingMultiColumnSet(); |
339 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(800)), thirdRow); | 339 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(800)), thirdRow); |
340 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(899)), thirdRow); //
bottom of last row | 340 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(899)), thirdRow); //
bottom of last row |
341 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000)), thirdRow);
// overflow | 341 EXPECT_EQ(flowThread->columnSetAtBlockOffset(LayoutUnit(10000)), thirdRow);
// overflow |
342 } | 342 } |
343 | 343 |
344 class MultiColumnTreeModifyingTest : public MultiColumnRenderingTest { | 344 class MultiColumnTreeModifyingTest : public MultiColumnRenderingTest { |
345 public: | 345 public: |
346 void setMulticolHTML(const char*); | 346 void setMulticolHTML(const char*); |
347 void reparentRenderer(const char* newParentId, const char* childId, const ch
ar* insertBeforeId = 0); | 347 void reparentRenderer(const char* newParentId, const char* childId, const ch
ar* insertBeforeId = 0); |
348 void destroyRenderer(RenderObject* child); | 348 void destroyRenderer(LayoutObject* child); |
349 void destroyRenderer(const char* childId); | 349 void destroyRenderer(const char* childId); |
350 }; | 350 }; |
351 | 351 |
352 void MultiColumnTreeModifyingTest::setMulticolHTML(const char* html) | 352 void MultiColumnTreeModifyingTest::setMulticolHTML(const char* html) |
353 { | 353 { |
354 MultiColumnRenderingTest::setMulticolHTML(html); | 354 MultiColumnRenderingTest::setMulticolHTML(html); |
355 // Allow modifications to the render tree structure, because that's what we
want to test. | 355 // Allow modifications to the render tree structure, because that's what we
want to test. |
356 document().lifecycle().advanceTo(DocumentLifecycle::InStyleRecalc); | 356 document().lifecycle().advanceTo(DocumentLifecycle::InStyleRecalc); |
357 } | 357 } |
358 | 358 |
359 void MultiColumnTreeModifyingTest::reparentRenderer(const char* newParentId, con
st char* childId, const char* insertBeforeId) | 359 void MultiColumnTreeModifyingTest::reparentRenderer(const char* newParentId, con
st char* childId, const char* insertBeforeId) |
360 { | 360 { |
361 RenderObject* newParent = document().getElementById(newParentId)->renderer()
; | 361 LayoutObject* newParent = document().getElementById(newParentId)->renderer()
; |
362 RenderObject* child = document().getElementById(childId)->renderer(); | 362 LayoutObject* child = document().getElementById(childId)->renderer(); |
363 RenderObject* insertBefore = insertBeforeId ? document().getElementById(inse
rtBeforeId)->renderer() : 0; | 363 LayoutObject* insertBefore = insertBeforeId ? document().getElementById(inse
rtBeforeId)->renderer() : 0; |
364 child->remove(); | 364 child->remove(); |
365 newParent->addChild(child, insertBefore); | 365 newParent->addChild(child, insertBefore); |
366 } | 366 } |
367 | 367 |
368 void MultiColumnTreeModifyingTest::destroyRenderer(RenderObject* child) | 368 void MultiColumnTreeModifyingTest::destroyRenderer(LayoutObject* child) |
369 { | 369 { |
370 // Remove and destroy in separate steps, so that we get to test removal of s
ubtrees. | 370 // Remove and destroy in separate steps, so that we get to test removal of s
ubtrees. |
371 child->remove(); | 371 child->remove(); |
372 child->node()->detach(); | 372 child->node()->detach(); |
373 } | 373 } |
374 | 374 |
375 void MultiColumnTreeModifyingTest::destroyRenderer(const char* childId) | 375 void MultiColumnTreeModifyingTest::destroyRenderer(const char* childId) |
376 { | 376 { |
377 destroyRenderer(document().getElementById(childId)->renderer()); | 377 destroyRenderer(document().getElementById(childId)->renderer()); |
378 } | 378 } |
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
797 { | 797 { |
798 setMulticolHTML("<div id='mc'>text<div id='spanner'><div class='s'></div></d
iv>text</div>"); | 798 setMulticolHTML("<div id='mc'>text<div id='spanner'><div class='s'></div></d
iv>text</div>"); |
799 EXPECT_EQ(columnSetSignature("mc"), "csc"); | 799 EXPECT_EQ(columnSetSignature("mc"), "csc"); |
800 destroyRenderer("spanner"); | 800 destroyRenderer("spanner"); |
801 EXPECT_EQ(columnSetSignature("mc"), "c"); | 801 EXPECT_EQ(columnSetSignature("mc"), "c"); |
802 } | 802 } |
803 | 803 |
804 } // anonymous namespace | 804 } // anonymous namespace |
805 | 805 |
806 } // namespace blink | 806 } // namespace blink |
OLD | NEW |