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

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm_test.cc

Issue 2655783006: Top down version of algorithm to position margins and floats in LayoutNG (Closed)
Patch Set: git rebase-update Created 3 years, 10 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/ng/ng_block_layout_algorithm.h" 5 #include "core/layout/ng/ng_block_layout_algorithm.h"
6 6
7 #include "core/dom/NodeComputedStyle.h" 7 #include "core/dom/NodeComputedStyle.h"
8 #include "core/dom/TagCollection.h" 8 #include "core/dom/TagCollection.h"
9 #include "core/layout/ng/layout_ng_block_flow.h" 9 #include "core/layout/ng/layout_ng_block_flow.h"
10 #include "core/layout/ng/ng_block_node.h" 10 #include "core/layout/ng/ng_block_node.h"
11 #include "core/layout/ng/ng_constraint_space.h" 11 #include "core/layout/ng/ng_constraint_space.h"
12 #include "core/layout/ng/ng_constraint_space_builder.h" 12 #include "core/layout/ng/ng_constraint_space_builder.h"
13 #include "core/layout/ng/ng_floating_object.h" 13 #include "core/layout/ng/ng_floating_object.h"
14 #include "core/layout/ng/ng_length_utils.h" 14 #include "core/layout/ng/ng_length_utils.h"
15 #include "core/layout/LayoutTestHelper.h" 15 #include "core/layout/LayoutTestHelper.h"
16 #include "core/layout/ng/ng_physical_box_fragment.h" 16 #include "core/layout/ng/ng_physical_box_fragment.h"
17 #include "core/layout/ng/ng_physical_fragment.h" 17 #include "core/layout/ng/ng_physical_fragment.h"
18 #include "core/layout/ng/ng_units.h" 18 #include "core/layout/ng/ng_units.h"
19 #include "core/style/ComputedStyle.h"
19 #include "testing/gmock/include/gmock/gmock.h" 20 #include "testing/gmock/include/gmock/gmock.h"
20 #include "core/style/ComputedStyle.h"
21 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
22 22
23 namespace blink { 23 namespace blink {
24 namespace { 24 namespace {
25 25
26 using testing::ElementsAre; 26 using testing::ElementsAre;
27 using testing::Pointee; 27 using testing::Pointee;
28 28
29 NGConstraintSpace* ConstructConstraintSpace(NGWritingMode writing_mode, 29 NGConstraintSpace* ConstructConstraintSpace(NGWritingMode writing_mode,
30 TextDirection direction, 30 TextDirection direction,
31 NGLogicalSize size, 31 NGLogicalSize size,
32 bool shrink_to_fit = false) { 32 bool shrink_to_fit = false) {
33 return NGConstraintSpaceBuilder(writing_mode) 33 return NGConstraintSpaceBuilder(writing_mode)
34 .SetAvailableSize(size) 34 .SetAvailableSize(size)
35 .SetPercentageResolutionSize(size) 35 .SetPercentageResolutionSize(size)
36 .SetTextDirection(direction) 36 .SetTextDirection(direction)
37 .SetWritingMode(writing_mode) 37 .SetWritingMode(writing_mode)
38 .SetIsShrinkToFit(shrink_to_fit) 38 .SetIsShrinkToFit(shrink_to_fit)
39 .ToConstraintSpace(); 39 .ToConstraintSpace();
40 } 40 }
41 41
42 typedef bool TestParamLayoutNG; 42 typedef bool TestParamLayoutNG;
43 class NGBlockLayoutAlgorithmTest 43 class NGBlockLayoutAlgorithmTest
44 : public ::testing::WithParamInterface<TestParamLayoutNG>, 44 : public ::testing::WithParamInterface<TestParamLayoutNG>,
45 public RenderingTest { 45 public RenderingTest {
46 public: 46 public:
47 NGBlockLayoutAlgorithmTest() {} 47 NGBlockLayoutAlgorithmTest() {
48 RuntimeEnabledFeatures::setLayoutNGEnabled(true);
49 }
50 ~NGBlockLayoutAlgorithmTest() {
51 RuntimeEnabledFeatures::setLayoutNGEnabled(false);
52 }
48 53
49 protected: 54 protected:
50 void SetUp() override { 55 void SetUp() override {
51 style_ = ComputedStyle::create(); 56 style_ = ComputedStyle::create();
52 RenderingTest::SetUp(); 57 RenderingTest::SetUp();
53 enableCompositing(); 58 enableCompositing();
54 } 59 }
55 60
56 NGPhysicalBoxFragment* RunBlockLayoutAlgorithm(NGConstraintSpace* space, 61 NGPhysicalBoxFragment* RunBlockLayoutAlgorithm(NGConstraintSpace* space,
57 NGBlockNode* first_child) { 62 NGBlockNode* first_child) {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 184
180 const NGPhysicalFragment* child = frag->Children()[0]; 185 const NGPhysicalFragment* child = frag->Children()[0];
181 // DIV2 186 // DIV2
182 child = static_cast<const NGPhysicalBoxFragment*>(child)->Children()[0]; 187 child = static_cast<const NGPhysicalBoxFragment*>(child)->Children()[0];
183 188
184 EXPECT_EQ(kHeight, child->Height()); 189 EXPECT_EQ(kHeight, child->Height());
185 EXPECT_EQ(0, child->TopOffset()); 190 EXPECT_EQ(0, child->TopOffset());
186 EXPECT_EQ(kMarginLeft, child->LeftOffset()); 191 EXPECT_EQ(kMarginLeft, child->LeftOffset());
187 } 192 }
188 193
189 // Verifies the collapsing margins case for the next pair:
190 // - top margin of a box and top margin of its first in-flow child.
191 // Verifies that floats are positioned at the top of the first child that can 194 // Verifies that floats are positioned at the top of the first child that can
192 // determine its position after margins collapsed. 195 // determine its position after margins collapsed.
193 // TODO(glebl): Enable with new the float/margins collapsing algorithm. 196 TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase1WithFloats) {
194 TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_CollapsingMarginsCase1WithFloats) {
195 setBodyInnerHTML( 197 setBodyInnerHTML(
196 "<style>" 198 "<style>"
197 " #container {" 199 " #container {"
198 " height: 200px;" 200 " height: 200px;"
199 " width: 200px;" 201 " width: 200px;"
200 " margin-top: 10px;" 202 " margin-top: 10px;"
201 " padding: 0 7px;" 203 " padding: 0 7px;"
202 " background-color: red;" 204 " background-color: red;"
203 " }" 205 " }"
204 " #first-child {" 206 " #first-child {"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 NGLogicalOffset exclusion2_offset = {LayoutUnit(185), 290 NGLogicalOffset exclusion2_offset = {LayoutUnit(185),
289 LayoutUnit(first_child_block_offset)}; 291 LayoutUnit(first_child_block_offset)};
290 NGLogicalRect exclusion2_rect = {exclusion2_offset, exclusion2_size}; 292 NGLogicalRect exclusion2_rect = {exclusion2_offset, exclusion2_size};
291 NGExclusion expected_exclusion2 = {exclusion2_rect, NGExclusion::kFloatRight}; 293 NGExclusion expected_exclusion2 = {exclusion2_rect, NGExclusion::kFloatRight};
292 294
293 EXPECT_THAT(space->Exclusions()->storage, 295 EXPECT_THAT(space->Exclusions()->storage,
294 (ElementsAre(Pointee(expected_exclusion1), 296 (ElementsAre(Pointee(expected_exclusion1),
295 Pointee(expected_exclusion2)))); 297 Pointee(expected_exclusion2))));
296 } 298 }
297 299
298 // Verifies the collapsing margins case for the next pair: 300 // Verifies the collapsing margins case for the next pairs:
299 // - bottom margin of box and top margin of its next in-flow following sibling. 301 // - bottom margin of box and top margin of its next in-flow following sibling.
300 // - top and bottom margins of a box that does not establish a new block 302 // - top and bottom margins of a box that does not establish a new block
301 // formatting context and that has zero computed 'min-height', zero or 'auto' 303 // formatting context and that has zero computed 'min-height', zero or 'auto'
302 // computed 'height', and no in-flow children 304 // computed 'height', and no in-flow children
303 // TODO(glebl): Enable with new the float/margins collapsing algorithm. 305 TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase2WithFloats) {
304 TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_CollapsingMarginsCase2WithFloats) {
305 setBodyInnerHTML( 306 setBodyInnerHTML(
306 "<style>" 307 "<style>"
307 "#first-child {" 308 "#first-child {"
308 " background-color: red;" 309 " background-color: red;"
309 " height: 50px;" 310 " height: 50px;"
310 " margin-bottom: 20px;" 311 " margin-bottom: 20px;"
311 "}" 312 "}"
312 "#float-between-empties {" 313 "#float-between-empties {"
313 " background-color: green;" 314 " background-color: green;"
314 " float: left;" 315 " float: left;"
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 EXPECT_THAT(LayoutUnit(second_child_block_offset), 372 EXPECT_THAT(LayoutUnit(second_child_block_offset),
372 second_child_fragment->TopOffset()); 373 second_child_fragment->TopOffset());
373 374
374 auto* empty5_fragment = toNGPhysicalBoxFragment(body_fragment->Children()[2]); 375 auto* empty5_fragment = toNGPhysicalBoxFragment(body_fragment->Children()[2]);
375 // 90 = first_child's height(50) + collapsed margins(-10) + 376 // 90 = first_child's height(50) + collapsed margins(-10) +
376 // second child's height(50) 377 // second child's height(50)
377 int empty5_fragment_block_offset = 90; 378 int empty5_fragment_block_offset = 90;
378 EXPECT_THAT(LayoutUnit(empty5_fragment_block_offset), 379 EXPECT_THAT(LayoutUnit(empty5_fragment_block_offset),
379 empty5_fragment->TopOffset()); 380 empty5_fragment->TopOffset());
380 381
381 ASSERT_EQ(3UL, body_fragment->PositionedFloats().size()); 382 ASSERT_EQ(1UL, body_fragment->PositionedFloats().size());
383 ASSERT_EQ(1UL, body_fragment->PositionedFloats().size());
382 auto float_nonempties_fragment = 384 auto float_nonempties_fragment =
383 body_fragment->PositionedFloats().at(1)->fragment; 385 body_fragment->PositionedFloats().at(0)->fragment;
384 // 70 = first_child's height(50) + first child's margin-bottom(20) 386 // 70 = first_child's height(50) + first child's margin-bottom(20)
385 EXPECT_THAT(LayoutUnit(70), float_nonempties_fragment->TopOffset()); 387 EXPECT_THAT(LayoutUnit(70), float_nonempties_fragment->TopOffset());
386 EXPECT_THAT(LayoutUnit(0), float_nonempties_fragment->LeftOffset()); 388 EXPECT_THAT(LayoutUnit(0), float_nonempties_fragment->LeftOffset());
387 389
388 // ** Verify layout tree ** 390 // ** Verify layout tree **
389 Element* first_child = document().getElementById("first-child"); 391 Element* first_child = document().getElementById("first-child");
390 // -7 = body_top_offset 392 // -7 = body_top_offset
391 EXPECT_EQ(body_top_offset, first_child->offsetTop()); 393 EXPECT_EQ(body_top_offset, first_child->offsetTop());
392 394
393 NGLogicalSize float_empties_exclusion_size = {LayoutUnit(30), LayoutUnit(30)}; 395 NGLogicalSize float_empties_exclusion_size = {LayoutUnit(30), LayoutUnit(30)};
(...skipping 29 matching lines...) Expand all
423 425
424 EXPECT_THAT(space->Exclusions()->storage, 426 EXPECT_THAT(space->Exclusions()->storage,
425 (ElementsAre(Pointee(float_empties_exclusion), 427 (ElementsAre(Pointee(float_empties_exclusion),
426 Pointee(float_nonempties_exclusion), 428 Pointee(float_nonempties_exclusion),
427 Pointee(float_top_align_exclusion)))); 429 Pointee(float_top_align_exclusion))));
428 } 430 }
429 431
430 // Verifies the collapsing margins case for the next pair: 432 // Verifies the collapsing margins case for the next pair:
431 // - bottom margin of a last in-flow child and bottom margin of its parent if 433 // - bottom margin of a last in-flow child and bottom margin of its parent if
432 // the parent has 'auto' computed height 434 // the parent has 'auto' computed height
433 // TODO(glebl): Enable with new the float/margins collapsing algorithm. 435 TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase3) {
434 TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_CollapsingMarginsCase3) {
435 setBodyInnerHTML( 436 setBodyInnerHTML(
436 "<style>" 437 "<style>"
437 " #container {" 438 " #container {"
438 " margin-bottom: 20px;" 439 " margin-bottom: 20px;"
439 " }" 440 " }"
440 " #child {" 441 " #child {"
441 " margin-bottom: 200px;" 442 " margin-bottom: 200px;"
442 " height: 50px;" 443 " height: 50px;"
443 " }" 444 " }"
444 "</style>" 445 "</style>"
(...skipping 15 matching lines...) Expand all
460 container_fragment = toNGPhysicalBoxFragment(body_fragment->Children()[0]); 461 container_fragment = toNGPhysicalBoxFragment(body_fragment->Children()[0]);
461 ASSERT_EQ(1UL, container_fragment->Children().size()); 462 ASSERT_EQ(1UL, container_fragment->Children().size());
462 child_fragment = toNGPhysicalBoxFragment(container_fragment->Children()[0]); 463 child_fragment = toNGPhysicalBoxFragment(container_fragment->Children()[0]);
463 }; 464 };
464 465
465 // height == auto 466 // height == auto
466 run_test(Length(Auto)); 467 run_test(Length(Auto));
467 // Margins are collapsed with the result 200 = std::max(20, 200) 468 // Margins are collapsed with the result 200 = std::max(20, 200)
468 // The fragment size 258 == body's margin 8 + child's height 50 + 200 469 // The fragment size 258 == body's margin 8 + child's height 50 + 200
469 EXPECT_EQ(NGPhysicalSize(LayoutUnit(800), LayoutUnit(258)), fragment->Size()); 470 EXPECT_EQ(NGPhysicalSize(LayoutUnit(800), LayoutUnit(258)), fragment->Size());
470 // EXPECT_EQ(NGMarginStrut({LayoutUnit(200)}), 471 EXPECT_EQ(NGMarginStrut({LayoutUnit(200)}),
471 // container_fragment->EndMarginStrut()); 472 container_fragment->EndMarginStrut());
472 473
473 // height == fixed 474 // height == fixed
474 run_test(Length(50, Fixed)); 475 run_test(Length(50, Fixed));
475 // Margins are not collapsed, so fragment still has margins == 20. 476 // Margins are not collapsed, so fragment still has margins == 20.
476 // The fragment size 78 == body's margin 8 + child's height 50 + 20 477 // The fragment size 78 == body's margin 8 + child's height 50 + 20
477 // EXPECT_EQ(NGPhysicalSize(LayoutUnit(800), LayoutUnit(78)), 478 EXPECT_EQ(NGPhysicalSize(LayoutUnit(800), LayoutUnit(78)), fragment->Size());
478 // fragment->Size()); 479 EXPECT_EQ(NGMarginStrut(), container_fragment->EndMarginStrut());
479 // EXPECT_EQ(NGMarginStrut(), container_fragment->EndMarginStrut());
480 } 480 }
481 481
482 // Verifies that 2 adjoining margins are not collapsed if there is padding or 482 // Verifies that 2 adjoining margins are not collapsed if there is padding or
483 // border that separates them. 483 // border that separates them.
484 // TODO(glebl): Enable with new the float/margins collapsing algorithm. 484 TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase4) {
485 TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_CollapsingMarginsCase4) {
486 setBodyInnerHTML( 485 setBodyInnerHTML(
487 "<style>" 486 "<style>"
488 " #container {" 487 " #container {"
489 " margin: 30px 0px;" 488 " margin: 30px 0px;"
490 " width: 200px;" 489 " width: 200px;"
491 " }" 490 " }"
492 " #child {" 491 " #child {"
493 " margin: 200px 0px;" 492 " margin: 200px 0px;"
494 " height: 50px;" 493 " height: 50px;"
495 " background-color: blue;" 494 " background-color: blue;"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
539 // Verifies that margins of 2 adjoining blocks with different writing modes 538 // Verifies that margins of 2 adjoining blocks with different writing modes
540 // get collapsed. 539 // get collapsed.
541 // 540 //
542 // Test case's HTML representation: 541 // Test case's HTML representation:
543 // <div style="writing-mode: vertical-lr;"> 542 // <div style="writing-mode: vertical-lr;">
544 // <div style="margin-right: 60px; width: 60px;">vertical</div> 543 // <div style="margin-right: 60px; width: 60px;">vertical</div>
545 // <div style="margin-left: 100px; writing-mode: horizontal-tb;"> 544 // <div style="margin-left: 100px; writing-mode: horizontal-tb;">
546 // horizontal 545 // horizontal
547 // </div> 546 // </div>
548 // </div> 547 // </div>
549 TEST_F(NGBlockLayoutAlgorithmTest, CollapsingMarginsCase5) { 548 // TODO(glebl): fix writing modes support after new margin collapsing/floats
549 // algorithm is checked in.
550 TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_CollapsingMarginsCase5) {
550 const int kVerticalDivMarginRight = 60; 551 const int kVerticalDivMarginRight = 60;
551 const int kVerticalDivWidth = 50; 552 const int kVerticalDivWidth = 50;
552 const int kHorizontalDivMarginLeft = 100; 553 const int kHorizontalDivMarginLeft = 100;
553 554
554 style_->setWidth(Length(500, Fixed)); 555 style_->setWidth(Length(500, Fixed));
555 style_->setHeight(Length(500, Fixed)); 556 style_->setHeight(Length(500, Fixed));
556 style_->setWritingMode(WritingMode::kVerticalLr); 557 style_->setWritingMode(WritingMode::kVerticalLr);
557 558
558 // Vertical DIV 559 // Vertical DIV
559 RefPtr<ComputedStyle> vertical_style = ComputedStyle::create(); 560 RefPtr<ComputedStyle> vertical_style = ComputedStyle::create();
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
863 auto floating_object = floating_objects.takeFirst(); 864 auto floating_object = floating_objects.takeFirst();
864 ASSERT_TRUE(floating_object->isPlaced()); 865 ASSERT_TRUE(floating_object->isPlaced());
865 // 80 = float_inline_offset(25) + accumulative offset of empty blocks(35 + 20) 866 // 80 = float_inline_offset(25) + accumulative offset of empty blocks(35 + 20)
866 EXPECT_THAT(LayoutUnit(80), floating_object->x()); 867 EXPECT_THAT(LayoutUnit(80), floating_object->x());
867 // 10 = float's padding 868 // 10 = float's padding
868 EXPECT_THAT(LayoutUnit(10), floating_object->y()); 869 EXPECT_THAT(LayoutUnit(10), floating_object->y());
869 } 870 }
870 871
871 // Verifies that left/right floating and regular blocks can be positioned 872 // Verifies that left/right floating and regular blocks can be positioned
872 // correctly by the algorithm. 873 // correctly by the algorithm.
873 // TODO(glebl): Enable with new the float/margins collapsing algorithm. 874 TEST_F(NGBlockLayoutAlgorithmTest, PositionFloatFragments) {
874 TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_PositionFloatFragments) {
875 setBodyInnerHTML( 875 setBodyInnerHTML(
876 "<style>" 876 "<style>"
877 " #container {" 877 " #container {"
878 " height: 200px;" 878 " height: 200px;"
879 " width: 200px;" 879 " width: 200px;"
880 " }" 880 " }"
881 " #left-float {" 881 " #left-float {"
882 " background-color: red;" 882 " background-color: red;"
883 " float:left;" 883 " float:left;"
884 " height: 30px;" 884 " height: 30px;"
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 " <div id='left-float-with-margin'></div>" 917 " <div id='left-float-with-margin'></div>"
918 "</div>"); 918 "</div>");
919 919
920 // ** Run LayoutNG algorithm ** 920 // ** Run LayoutNG algorithm **
921 NGConstraintSpace* space; 921 NGConstraintSpace* space;
922 NGPhysicalBoxFragment* fragment; 922 NGPhysicalBoxFragment* fragment;
923 std::tie(fragment, space) = RunBlockLayoutAlgorithmForElement( 923 std::tie(fragment, space) = RunBlockLayoutAlgorithmForElement(
924 document().getElementsByTagName("html")->item(0)); 924 document().getElementsByTagName("html")->item(0));
925 925
926 // ** Verify LayoutNG fragments and the list of positioned floats ** 926 // ** Verify LayoutNG fragments and the list of positioned floats **
927 EXPECT_THAT(LayoutUnit(), fragment->TopOffset());
928 ASSERT_EQ(1UL, fragment->Children().size()); 927 ASSERT_EQ(1UL, fragment->Children().size());
929 auto* body_fragment = toNGPhysicalBoxFragment(fragment->Children()[0]); 928 auto* body_fragment = toNGPhysicalBoxFragment(fragment->Children()[0]);
930 EXPECT_THAT(LayoutUnit(8), body_fragment->TopOffset()); 929 EXPECT_THAT(LayoutUnit(8), body_fragment->TopOffset());
931 auto* container_fragment = 930 auto* container_fragment =
932 toNGPhysicalBoxFragment(body_fragment->Children()[0]); 931 toNGPhysicalBoxFragment(body_fragment->Children()[0]);
933 ASSERT_EQ(1UL, container_fragment->Children().size()); 932 ASSERT_EQ(1UL, container_fragment->Children().size());
934 ASSERT_EQ(4UL, container_fragment->PositionedFloats().size()); 933 ASSERT_EQ(4UL, container_fragment->PositionedFloats().size());
935 934
936 // ** Verify layout tree ** 935 // ** Verify layout tree **
937 Element* left_float = document().getElementById("left-float"); 936 Element* left_float = document().getElementById("left-float");
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 left_float_with_margin_exclusion_rect, NGExclusion::kFloatLeft}; 1036 left_float_with_margin_exclusion_rect, NGExclusion::kFloatLeft};
1038 1037
1039 EXPECT_THAT( 1038 EXPECT_THAT(
1040 space->Exclusions()->storage, 1039 space->Exclusions()->storage,
1041 (ElementsAre(Pointee(left_float_exclusion), Pointee(left_wide_exclusion), 1040 (ElementsAre(Pointee(left_float_exclusion), Pointee(left_wide_exclusion),
1042 Pointee(right_float_exclusion), 1041 Pointee(right_float_exclusion),
1043 Pointee(left_float_with_margin_exclusion)))); 1042 Pointee(left_float_with_margin_exclusion))));
1044 } 1043 }
1045 1044
1046 // Verifies that NG block layout algorithm respects "clear" CSS property. 1045 // Verifies that NG block layout algorithm respects "clear" CSS property.
1047 // TODO(glebl): Enable with new the float/margins collapsing algorithm. 1046 TEST_F(NGBlockLayoutAlgorithmTest, PositionFragmentsWithClear) {
1048 TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_PositionFragmentsWithClear) {
1049 setBodyInnerHTML( 1047 setBodyInnerHTML(
1050 "<style>" 1048 "<style>"
1051 " #container {" 1049 " #container {"
1052 " height: 200px;" 1050 " height: 200px;"
1053 " width: 200px;" 1051 " width: 200px;"
1054 " }" 1052 " }"
1055 " #float-left {" 1053 " #float-left {"
1056 " background-color: red;" 1054 " background-color: red;"
1057 " float: left;" 1055 " float: left;"
1058 " height: 30px;" 1056 " height: 30px;"
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 1243
1246 private: 1244 private:
1247 Member<const NGPhysicalBoxFragment> parent_; 1245 Member<const NGPhysicalBoxFragment> parent_;
1248 unsigned index_; 1246 unsigned index_;
1249 }; 1247 };
1250 1248
1251 // Test case's HTML representation: 1249 // Test case's HTML representation:
1252 // <div id="parent" style="columns:2; column-fill:auto; column-gap:10px; 1250 // <div id="parent" style="columns:2; column-fill:auto; column-gap:10px;
1253 // width:210px; height:100px;"> 1251 // width:210px; height:100px;">
1254 // </div> 1252 // </div>
1255 TEST_F(NGBlockLayoutAlgorithmTest, EmptyMulticol) { 1253 // TODO(glebl): reenable multicol after new margin collapsing/floats algorithm
1254 // is checked in.
1255 TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_EmptyMulticol) {
1256 // parent 1256 // parent
1257 RefPtr<ComputedStyle> parent_style = ComputedStyle::create(); 1257 RefPtr<ComputedStyle> parent_style = ComputedStyle::create();
1258 parent_style->setColumnCount(2); 1258 parent_style->setColumnCount(2);
1259 parent_style->setColumnFill(ColumnFillAuto); 1259 parent_style->setColumnFill(ColumnFillAuto);
1260 parent_style->setColumnGap(10); 1260 parent_style->setColumnGap(10);
1261 parent_style->setHeight(Length(100, Fixed)); 1261 parent_style->setHeight(Length(100, Fixed));
1262 parent_style->setWidth(Length(210, Fixed)); 1262 parent_style->setWidth(Length(210, Fixed));
1263 NGBlockNode* parent = new NGBlockNode(parent_style.get()); 1263 NGBlockNode* parent = new NGBlockNode(parent_style.get());
1264 1264
1265 auto* space = ConstructConstraintSpace( 1265 auto* space = ConstructConstraintSpace(
1266 kHorizontalTopBottom, TextDirection::kLtr, 1266 kHorizontalTopBottom, TextDirection::kLtr,
1267 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite)); 1267 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite));
1268 const auto* fragment = RunBlockLayoutAlgorithm(space, parent); 1268 const auto* fragment = RunBlockLayoutAlgorithm(space, parent);
1269 FragmentChildIterator iterator(fragment); 1269 FragmentChildIterator iterator(fragment);
1270 fragment = iterator.NextChild(); 1270 fragment = iterator.NextChild();
1271 ASSERT_TRUE(fragment); 1271 ASSERT_TRUE(fragment);
1272 EXPECT_EQ(LayoutUnit(210), fragment->Width()); 1272 EXPECT_EQ(LayoutUnit(210), fragment->Width());
1273 EXPECT_EQ(LayoutUnit(100), fragment->Height()); 1273 EXPECT_EQ(LayoutUnit(100), fragment->Height());
1274 EXPECT_FALSE(iterator.NextChild()); 1274 EXPECT_FALSE(iterator.NextChild());
1275 1275
1276 // There should be nothing inside the multicol container. 1276 // There should be nothing inside the multicol container.
1277 EXPECT_FALSE(FragmentChildIterator(fragment).NextChild()); 1277 EXPECT_FALSE(FragmentChildIterator(fragment).NextChild());
1278 } 1278 }
1279 1279
1280 // Test case's HTML representation: 1280 // Test case's HTML representation:
1281 // <div id="parent" style="columns:2; column-fill:auto; column-gap:10px; 1281 // <div id="parent" style="columns:2; column-fill:auto; column-gap:10px;
1282 // width:210px; height:100px;"> 1282 // width:210px; height:100px;">
1283 // <div id="child"></div> 1283 // <div id="child"></div>
1284 // </div> 1284 // </div>
1285 TEST_F(NGBlockLayoutAlgorithmTest, EmptyBlock) { 1285 // TODO(glebl): reenable multicol after new margin collapsing/floats algorithm
1286 // is checked in.
1287 TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_EmptyBlock) {
1286 // parent 1288 // parent
1287 RefPtr<ComputedStyle> parent_style = ComputedStyle::create(); 1289 RefPtr<ComputedStyle> parent_style = ComputedStyle::create();
1288 parent_style->setColumnCount(2); 1290 parent_style->setColumnCount(2);
1289 parent_style->setColumnFill(ColumnFillAuto); 1291 parent_style->setColumnFill(ColumnFillAuto);
1290 parent_style->setColumnGap(10); 1292 parent_style->setColumnGap(10);
1291 parent_style->setHeight(Length(100, Fixed)); 1293 parent_style->setHeight(Length(100, Fixed));
1292 parent_style->setWidth(Length(210, Fixed)); 1294 parent_style->setWidth(Length(210, Fixed));
1293 NGBlockNode* parent = new NGBlockNode(parent_style.get()); 1295 NGBlockNode* parent = new NGBlockNode(parent_style.get());
1294 1296
1295 // child 1297 // child
(...skipping 23 matching lines...) Expand all
1319 EXPECT_EQ(LayoutUnit(), fragment->Height()); 1321 EXPECT_EQ(LayoutUnit(), fragment->Height());
1320 EXPECT_EQ(0UL, fragment->Children().size()); 1322 EXPECT_EQ(0UL, fragment->Children().size());
1321 EXPECT_FALSE(iterator.NextChild()); 1323 EXPECT_FALSE(iterator.NextChild());
1322 } 1324 }
1323 1325
1324 // Test case's HTML representation: 1326 // Test case's HTML representation:
1325 // <div id="parent" style="columns:2; column-fill:auto; column-gap:10px; 1327 // <div id="parent" style="columns:2; column-fill:auto; column-gap:10px;
1326 // width:310px; height:100px;"> 1328 // width:310px; height:100px;">
1327 // <div id="child" style="width:60%; height:100px;"></div> 1329 // <div id="child" style="width:60%; height:100px;"></div>
1328 // </div> 1330 // </div>
1329 TEST_F(NGBlockLayoutAlgorithmTest, BlockInOneColumn) { 1331 // TODO(glebl): reenable multicol after new margin collapsing/floats algorithm
1332 // is checked in.
1333 TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_BlockInOneColumn) {
1330 // parent 1334 // parent
1331 RefPtr<ComputedStyle> parent_style = ComputedStyle::create(); 1335 RefPtr<ComputedStyle> parent_style = ComputedStyle::create();
1332 parent_style->setColumnCount(2); 1336 parent_style->setColumnCount(2);
1333 parent_style->setColumnFill(ColumnFillAuto); 1337 parent_style->setColumnFill(ColumnFillAuto);
1334 parent_style->setColumnGap(10); 1338 parent_style->setColumnGap(10);
1335 parent_style->setHeight(Length(100, Fixed)); 1339 parent_style->setHeight(Length(100, Fixed));
1336 parent_style->setWidth(Length(310, Fixed)); 1340 parent_style->setWidth(Length(310, Fixed));
1337 NGBlockNode* parent = new NGBlockNode(parent_style.get()); 1341 NGBlockNode* parent = new NGBlockNode(parent_style.get());
1338 1342
1339 // child 1343 // child
(...skipping 26 matching lines...) Expand all
1366 EXPECT_EQ(LayoutUnit(100), fragment->Height()); 1370 EXPECT_EQ(LayoutUnit(100), fragment->Height());
1367 EXPECT_EQ(0UL, fragment->Children().size()); 1371 EXPECT_EQ(0UL, fragment->Children().size());
1368 EXPECT_FALSE(iterator.NextChild()); 1372 EXPECT_FALSE(iterator.NextChild());
1369 } 1373 }
1370 1374
1371 // Test case's HTML representation: 1375 // Test case's HTML representation:
1372 // <div id="parent" style="columns:2; column-fill:auto; column-gap:10px; 1376 // <div id="parent" style="columns:2; column-fill:auto; column-gap:10px;
1373 // width:210px; height:100px;"> 1377 // width:210px; height:100px;">
1374 // <div id="child" style="width:75%; height:150px;"></div> 1378 // <div id="child" style="width:75%; height:150px;"></div>
1375 // </div> 1379 // </div>
1376 TEST_F(NGBlockLayoutAlgorithmTest, BlockInTwoColumns) { 1380 // TODO(glebl): reenable multicol after new margin collapsing/floats algorithm
1381 // is checked in.
1382 TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_BlockInTwoColumns) {
1377 // parent 1383 // parent
1378 RefPtr<ComputedStyle> parent_style = ComputedStyle::create(); 1384 RefPtr<ComputedStyle> parent_style = ComputedStyle::create();
1379 parent_style->setColumnCount(2); 1385 parent_style->setColumnCount(2);
1380 parent_style->setColumnFill(ColumnFillAuto); 1386 parent_style->setColumnFill(ColumnFillAuto);
1381 parent_style->setColumnGap(10); 1387 parent_style->setColumnGap(10);
1382 parent_style->setHeight(Length(100, Fixed)); 1388 parent_style->setHeight(Length(100, Fixed));
1383 parent_style->setWidth(Length(210, Fixed)); 1389 parent_style->setWidth(Length(210, Fixed));
1384 NGBlockNode* parent = new NGBlockNode(parent_style.get()); 1390 NGBlockNode* parent = new NGBlockNode(parent_style.get());
1385 1391
1386 // child 1392 // child
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
1422 EXPECT_EQ(LayoutUnit(50), fragment->Height()); 1428 EXPECT_EQ(LayoutUnit(50), fragment->Height());
1423 EXPECT_EQ(0U, fragment->Children().size()); 1429 EXPECT_EQ(0U, fragment->Children().size());
1424 EXPECT_FALSE(iterator.NextChild()); 1430 EXPECT_FALSE(iterator.NextChild());
1425 } 1431 }
1426 1432
1427 // Test case's HTML representation: 1433 // Test case's HTML representation:
1428 // <div id="parent" style="columns:3; column-fill:auto; column-gap:10px; 1434 // <div id="parent" style="columns:3; column-fill:auto; column-gap:10px;
1429 // width:320px; height:100px;"> 1435 // width:320px; height:100px;">
1430 // <div id="child" style="width:75%; height:250px;"></div> 1436 // <div id="child" style="width:75%; height:250px;"></div>
1431 // </div> 1437 // </div>
1432 TEST_F(NGBlockLayoutAlgorithmTest, BlockInThreeColumns) { 1438 // TODO(glebl): reenable multicol after new margin collapsing/floats algorithm
1439 // is checked in.
1440 TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_BlockInThreeColumns) {
1433 // parent 1441 // parent
1434 RefPtr<ComputedStyle> parent_style = ComputedStyle::create(); 1442 RefPtr<ComputedStyle> parent_style = ComputedStyle::create();
1435 parent_style->setColumnCount(3); 1443 parent_style->setColumnCount(3);
1436 parent_style->setColumnFill(ColumnFillAuto); 1444 parent_style->setColumnFill(ColumnFillAuto);
1437 parent_style->setColumnGap(10); 1445 parent_style->setColumnGap(10);
1438 parent_style->setHeight(Length(100, Fixed)); 1446 parent_style->setHeight(Length(100, Fixed));
1439 parent_style->setWidth(Length(320, Fixed)); 1447 parent_style->setWidth(Length(320, Fixed));
1440 NGBlockNode* parent = new NGBlockNode(parent_style.get()); 1448 NGBlockNode* parent = new NGBlockNode(parent_style.get());
1441 1449
1442 // child 1450 // child
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1487 EXPECT_EQ(LayoutUnit(50), fragment->Height()); 1495 EXPECT_EQ(LayoutUnit(50), fragment->Height());
1488 EXPECT_EQ(0U, fragment->Children().size()); 1496 EXPECT_EQ(0U, fragment->Children().size());
1489 EXPECT_FALSE(iterator.NextChild()); 1497 EXPECT_FALSE(iterator.NextChild());
1490 } 1498 }
1491 1499
1492 // Test case's HTML representation: 1500 // Test case's HTML representation:
1493 // <div id="parent" style="columns:2; column-fill:auto; column-gap:10px; 1501 // <div id="parent" style="columns:2; column-fill:auto; column-gap:10px;
1494 // width:210px; height:100px;"> 1502 // width:210px; height:100px;">
1495 // <div id="child" style="width:1px; height:250px;"></div> 1503 // <div id="child" style="width:1px; height:250px;"></div>
1496 // </div> 1504 // </div>
1497 TEST_F(NGBlockLayoutAlgorithmTest, ActualColumnCountGreaterThanSpecified) { 1505 // TODO(glebl): reenable multicol after new margin collapsing/floats algorithm
1506 // is checked in.
1507 TEST_F(NGBlockLayoutAlgorithmTest,
1508 DISABLED_ActualColumnCountGreaterThanSpecified) {
1498 // parent 1509 // parent
1499 RefPtr<ComputedStyle> parent_style = ComputedStyle::create(); 1510 RefPtr<ComputedStyle> parent_style = ComputedStyle::create();
1500 parent_style->setColumnCount(2); 1511 parent_style->setColumnCount(2);
1501 parent_style->setColumnFill(ColumnFillAuto); 1512 parent_style->setColumnFill(ColumnFillAuto);
1502 parent_style->setColumnGap(10); 1513 parent_style->setColumnGap(10);
1503 parent_style->setHeight(Length(100, Fixed)); 1514 parent_style->setHeight(Length(100, Fixed));
1504 parent_style->setWidth(Length(210, Fixed)); 1515 parent_style->setWidth(Length(210, Fixed));
1505 NGBlockNode* parent = new NGBlockNode(parent_style.get()); 1516 NGBlockNode* parent = new NGBlockNode(parent_style.get());
1506 1517
1507 // child 1518 // child
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
1553 EXPECT_EQ(0U, fragment->Children().size()); 1564 EXPECT_EQ(0U, fragment->Children().size());
1554 EXPECT_FALSE(iterator.NextChild()); 1565 EXPECT_FALSE(iterator.NextChild());
1555 } 1566 }
1556 1567
1557 // Test case's HTML representation: 1568 // Test case's HTML representation:
1558 // <div id="parent" style="columns:3; column-fill:auto; column-gap:10px; 1569 // <div id="parent" style="columns:3; column-fill:auto; column-gap:10px;
1559 // width:320px; height:100px;"> 1570 // width:320px; height:100px;">
1560 // <div id="child1" style="width:75%; height:60px;"></div> 1571 // <div id="child1" style="width:75%; height:60px;"></div>
1561 // <div id="child2" style="width:85%; height:60px;"></div> 1572 // <div id="child2" style="width:85%; height:60px;"></div>
1562 // </div> 1573 // </div>
1563 TEST_F(NGBlockLayoutAlgorithmTest, TwoBlocksInTwoColumns) { 1574 // TODO(glebl): reenable multicol after new margin collapsing/floats algorithm
1575 // is checked in.
1576 TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_TwoBlocksInTwoColumns) {
1564 // parent 1577 // parent
1565 RefPtr<ComputedStyle> parent_style = ComputedStyle::create(); 1578 RefPtr<ComputedStyle> parent_style = ComputedStyle::create();
1566 parent_style->setColumnCount(3); 1579 parent_style->setColumnCount(3);
1567 parent_style->setColumnFill(ColumnFillAuto); 1580 parent_style->setColumnFill(ColumnFillAuto);
1568 parent_style->setColumnGap(10); 1581 parent_style->setColumnGap(10);
1569 parent_style->setHeight(Length(100, Fixed)); 1582 parent_style->setHeight(Length(100, Fixed));
1570 parent_style->setWidth(Length(320, Fixed)); 1583 parent_style->setWidth(Length(320, Fixed));
1571 NGBlockNode* parent = new NGBlockNode(parent_style.get()); 1584 NGBlockNode* parent = new NGBlockNode(parent_style.get());
1572 1585
1573 // child1 1586 // child1
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1628 1641
1629 // Test case's HTML representation: 1642 // Test case's HTML representation:
1630 // <div id="parent" style="columns:3; column-fill:auto; column-gap:10px; 1643 // <div id="parent" style="columns:3; column-fill:auto; column-gap:10px;
1631 // width:320px; height:100px;"> 1644 // width:320px; height:100px;">
1632 // <div id="child1" style="width:75%; height:60px;"> 1645 // <div id="child1" style="width:75%; height:60px;">
1633 // <div id="grandchild1" style="width:50px; height:120px;"></div> 1646 // <div id="grandchild1" style="width:50px; height:120px;"></div>
1634 // <div id="grandchild2" style="width:40px; height:20px;"></div> 1647 // <div id="grandchild2" style="width:40px; height:20px;"></div>
1635 // </div> 1648 // </div>
1636 // <div id="child2" style="width:85%; height:10px;"></div> 1649 // <div id="child2" style="width:85%; height:10px;"></div>
1637 // </div> 1650 // </div>
1638 TEST_F(NGBlockLayoutAlgorithmTest, OverflowedBlock) { 1651 // TODO(glebl): reenable multicol after new margin collapsing/floats algorithm
1652 // is checked in.
1653 TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_OverflowedBlock) {
1639 // parent 1654 // parent
1640 RefPtr<ComputedStyle> parent_style = ComputedStyle::create(); 1655 RefPtr<ComputedStyle> parent_style = ComputedStyle::create();
1641 parent_style->setColumnCount(3); 1656 parent_style->setColumnCount(3);
1642 parent_style->setColumnFill(ColumnFillAuto); 1657 parent_style->setColumnFill(ColumnFillAuto);
1643 parent_style->setColumnGap(10); 1658 parent_style->setColumnGap(10);
1644 parent_style->setHeight(Length(100, Fixed)); 1659 parent_style->setHeight(Length(100, Fixed));
1645 parent_style->setWidth(Length(320, Fixed)); 1660 parent_style->setWidth(Length(320, Fixed));
1646 NGBlockNode* parent = new NGBlockNode(parent_style.get()); 1661 NGBlockNode* parent = new NGBlockNode(parent_style.get());
1647 1662
1648 // child1 1663 // child1
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1736 EXPECT_EQ(LayoutUnit(20), fragment->Height()); 1751 EXPECT_EQ(LayoutUnit(20), fragment->Height());
1737 EXPECT_FALSE(grandchild_iterator.NextChild()); 1752 EXPECT_FALSE(grandchild_iterator.NextChild());
1738 EXPECT_FALSE(iterator.NextChild()); 1753 EXPECT_FALSE(iterator.NextChild());
1739 } 1754 }
1740 1755
1741 // Test case's HTML representation: 1756 // Test case's HTML representation:
1742 // <div id="parent" style="columns:3; column-fill:auto; column-gap:10px; 1757 // <div id="parent" style="columns:3; column-fill:auto; column-gap:10px;
1743 // width:320px; height:100px;"> 1758 // width:320px; height:100px;">
1744 // <div id="child" style="float:left; width:75%; height:100px;"></div> 1759 // <div id="child" style="float:left; width:75%; height:100px;"></div>
1745 // </div> 1760 // </div>
1746 TEST_F(NGBlockLayoutAlgorithmTest, FloatInOneColumn) { 1761 // TODO(glebl): reenable multicol after new margin collapsing/floats algorithm
1762 // is checked in.
1763 TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_FloatInOneColumn) {
1747 // parent 1764 // parent
1748 RefPtr<ComputedStyle> parent_style = ComputedStyle::create(); 1765 RefPtr<ComputedStyle> parent_style = ComputedStyle::create();
1749 parent_style->setColumnCount(3); 1766 parent_style->setColumnCount(3);
1750 parent_style->setColumnFill(ColumnFillAuto); 1767 parent_style->setColumnFill(ColumnFillAuto);
1751 parent_style->setColumnGap(10); 1768 parent_style->setColumnGap(10);
1752 parent_style->setHeight(Length(100, Fixed)); 1769 parent_style->setHeight(Length(100, Fixed));
1753 parent_style->setWidth(Length(320, Fixed)); 1770 parent_style->setWidth(Length(320, Fixed));
1754 NGBlockNode* parent = new NGBlockNode(parent_style.get()); 1771 NGBlockNode* parent = new NGBlockNode(parent_style.get());
1755 1772
1756 // child 1773 // child
(...skipping 28 matching lines...) Expand all
1785 EXPECT_EQ(0UL, fragment->Children().size()); 1802 EXPECT_EQ(0UL, fragment->Children().size());
1786 EXPECT_FALSE(iterator.NextChild()); 1803 EXPECT_FALSE(iterator.NextChild());
1787 } 1804 }
1788 1805
1789 // Test case's HTML representation: 1806 // Test case's HTML representation:
1790 // <div id="parent" style="columns:3; column-fill:auto; column-gap:10px; 1807 // <div id="parent" style="columns:3; column-fill:auto; column-gap:10px;
1791 // width:320px; height:100px;"> 1808 // width:320px; height:100px;">
1792 // <div id="child1" style="float:left; width:15%; height:100px;"></div> 1809 // <div id="child1" style="float:left; width:15%; height:100px;"></div>
1793 // <div id="child2" style="float:right; width:16%; height:100px;"></div> 1810 // <div id="child2" style="float:right; width:16%; height:100px;"></div>
1794 // </div> 1811 // </div>
1795 TEST_F(NGBlockLayoutAlgorithmTest, TwoFloatsInOneColumn) { 1812 // TODO(glebl): reenable multicol after new margin collapsing/floats algorithm
1813 // is checked in.
1814 TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_TwoFloatsInOneColumn) {
1796 // parent 1815 // parent
1797 RefPtr<ComputedStyle> parent_style = ComputedStyle::create(); 1816 RefPtr<ComputedStyle> parent_style = ComputedStyle::create();
1798 parent_style->setColumnCount(3); 1817 parent_style->setColumnCount(3);
1799 parent_style->setColumnFill(ColumnFillAuto); 1818 parent_style->setColumnFill(ColumnFillAuto);
1800 parent_style->setColumnGap(10); 1819 parent_style->setColumnGap(10);
1801 parent_style->setHeight(Length(100, Fixed)); 1820 parent_style->setHeight(Length(100, Fixed));
1802 parent_style->setWidth(Length(320, Fixed)); 1821 parent_style->setWidth(Length(320, Fixed));
1803 NGBlockNode* parent = new NGBlockNode(parent_style.get()); 1822 NGBlockNode* parent = new NGBlockNode(parent_style.get());
1804 1823
1805 // child1 1824 // child1
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
1850 EXPECT_EQ(0UL, fragment->Children().size()); 1869 EXPECT_EQ(0UL, fragment->Children().size());
1851 EXPECT_FALSE(iterator.NextChild()); 1870 EXPECT_FALSE(iterator.NextChild());
1852 } 1871 }
1853 1872
1854 // Test case's HTML representation: 1873 // Test case's HTML representation:
1855 // <div id="parent" style="columns:3; column-fill:auto; column-gap:10px; 1874 // <div id="parent" style="columns:3; column-fill:auto; column-gap:10px;
1856 // width:320px; height:100px;"> 1875 // width:320px; height:100px;">
1857 // <div id="child1" style="float:left; width:15%; height:150px;"></div> 1876 // <div id="child1" style="float:left; width:15%; height:150px;"></div>
1858 // <div id="child2" style="float:right; width:16%; height:150px;"></div> 1877 // <div id="child2" style="float:right; width:16%; height:150px;"></div>
1859 // </div> 1878 // </div>
1860 TEST_F(NGBlockLayoutAlgorithmTest, TwoFloatsInTwoColumns) { 1879 // TODO(glebl): reenable multicol after new margin collapsing/floats algorithm
1880 // is checked in.
1881 TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_TwoFloatsInTwoColumns) {
1861 // parent 1882 // parent
1862 RefPtr<ComputedStyle> parent_style = ComputedStyle::create(); 1883 RefPtr<ComputedStyle> parent_style = ComputedStyle::create();
1863 parent_style->setColumnCount(3); 1884 parent_style->setColumnCount(3);
1864 parent_style->setColumnFill(ColumnFillAuto); 1885 parent_style->setColumnFill(ColumnFillAuto);
1865 parent_style->setColumnGap(10); 1886 parent_style->setColumnGap(10);
1866 parent_style->setHeight(Length(100, Fixed)); 1887 parent_style->setHeight(Length(100, Fixed));
1867 parent_style->setWidth(Length(320, Fixed)); 1888 parent_style->setWidth(Length(320, Fixed));
1868 NGBlockNode* parent = new NGBlockNode(parent_style.get()); 1889 NGBlockNode* parent = new NGBlockNode(parent_style.get());
1869 1890
1870 // child1 1891 // child1
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1928 EXPECT_EQ(LayoutUnit(194), fragment->LeftOffset()); 1949 EXPECT_EQ(LayoutUnit(194), fragment->LeftOffset());
1929 EXPECT_EQ(LayoutUnit(), fragment->TopOffset()); 1950 EXPECT_EQ(LayoutUnit(), fragment->TopOffset());
1930 EXPECT_EQ(LayoutUnit(16), fragment->Width()); 1951 EXPECT_EQ(LayoutUnit(16), fragment->Width());
1931 EXPECT_EQ(LayoutUnit(50), fragment->Height()); 1952 EXPECT_EQ(LayoutUnit(50), fragment->Height());
1932 EXPECT_EQ(0UL, fragment->Children().size()); 1953 EXPECT_EQ(0UL, fragment->Children().size());
1933 EXPECT_FALSE(iterator.NextChild()); 1954 EXPECT_FALSE(iterator.NextChild());
1934 } 1955 }
1935 1956
1936 } // namespace 1957 } // namespace
1937 } // namespace blink 1958 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698