| OLD | NEW |
| 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/LayoutTestHelper.h" | 9 #include "core/layout/LayoutTestHelper.h" |
| 10 #include "core/layout/ng/layout_ng_block_flow.h" | 10 #include "core/layout/ng/layout_ng_block_flow.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 | 53 |
| 54 class NGBlockLayoutAlgorithmTest : public NGBaseLayoutAlgorithmTest { | 54 class NGBlockLayoutAlgorithmTest : public NGBaseLayoutAlgorithmTest { |
| 55 protected: | 55 protected: |
| 56 void SetUp() override { | 56 void SetUp() override { |
| 57 NGBaseLayoutAlgorithmTest::SetUp(); | 57 NGBaseLayoutAlgorithmTest::SetUp(); |
| 58 style_ = ComputedStyle::Create(); | 58 style_ = ComputedStyle::Create(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 RefPtr<NGPhysicalBoxFragment> RunBlockLayoutAlgorithm( | 61 RefPtr<NGPhysicalBoxFragment> RunBlockLayoutAlgorithm( |
| 62 NGConstraintSpace* space, | 62 NGConstraintSpace* space, |
| 63 NGBlockNode* node) { | 63 NGBlockNode node) { |
| 64 RefPtr<NGLayoutResult> result = | 64 RefPtr<NGLayoutResult> result = |
| 65 NGBlockLayoutAlgorithm(node, space).Layout(); | 65 NGBlockLayoutAlgorithm(node, space).Layout(); |
| 66 | 66 |
| 67 return ToNGPhysicalBoxFragment(result->PhysicalFragment().Get()); | 67 return ToNGPhysicalBoxFragment(result->PhysicalFragment().Get()); |
| 68 } | 68 } |
| 69 | 69 |
| 70 MinMaxContentSize RunComputeMinAndMax(NGBlockNode* node) { | 70 MinMaxContentSize RunComputeMinAndMax(NGBlockNode node) { |
| 71 // The constraint space is not used for min/max computation, but we need | 71 // The constraint space is not used for min/max computation, but we need |
| 72 // it to create the algorithm. | 72 // it to create the algorithm. |
| 73 RefPtr<NGConstraintSpace> space = | 73 RefPtr<NGConstraintSpace> space = |
| 74 ConstructConstraintSpace(kHorizontalTopBottom, TextDirection::kLtr, | 74 ConstructConstraintSpace(kHorizontalTopBottom, TextDirection::kLtr, |
| 75 NGLogicalSize(LayoutUnit(), LayoutUnit())); | 75 NGLogicalSize(LayoutUnit(), LayoutUnit())); |
| 76 | 76 |
| 77 NGBlockLayoutAlgorithm algorithm(node, space.Get()); | 77 NGBlockLayoutAlgorithm algorithm(node, space.Get()); |
| 78 EXPECT_TRUE(algorithm.ComputeMinMaxContentSize().has_value()); | 78 EXPECT_TRUE(algorithm.ComputeMinMaxContentSize().has_value()); |
| 79 return *algorithm.ComputeMinMaxContentSize(); | 79 return *algorithm.ComputeMinMaxContentSize(); |
| 80 } | 80 } |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 | 115 |
| 116 TEST_F(NGBlockLayoutAlgorithmTest, FixedSize) { | 116 TEST_F(NGBlockLayoutAlgorithmTest, FixedSize) { |
| 117 SetBodyInnerHTML(R"HTML( | 117 SetBodyInnerHTML(R"HTML( |
| 118 <div id="box" style="width:30px; height:40px"></div> | 118 <div id="box" style="width:30px; height:40px"></div> |
| 119 )HTML"); | 119 )HTML"); |
| 120 | 120 |
| 121 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( | 121 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( |
| 122 kHorizontalTopBottom, TextDirection::kLtr, | 122 kHorizontalTopBottom, TextDirection::kLtr, |
| 123 NGLogicalSize(LayoutUnit(100), NGSizeIndefinite)); | 123 NGLogicalSize(LayoutUnit(100), NGSizeIndefinite)); |
| 124 | 124 |
| 125 auto* box = new NGBlockNode(GetLayoutObjectByElementId("box")); | 125 NGBlockNode box(ToLayoutBox(GetLayoutObjectByElementId("box"))); |
| 126 | 126 |
| 127 RefPtr<NGPhysicalFragment> frag = RunBlockLayoutAlgorithm(space.Get(), box); | 127 RefPtr<NGPhysicalFragment> frag = RunBlockLayoutAlgorithm(space.Get(), box); |
| 128 | 128 |
| 129 EXPECT_EQ(NGPhysicalSize(LayoutUnit(30), LayoutUnit(40)), frag->Size()); | 129 EXPECT_EQ(NGPhysicalSize(LayoutUnit(30), LayoutUnit(40)), frag->Size()); |
| 130 } | 130 } |
| 131 | 131 |
| 132 // Verifies that two children are laid out with the correct size and position. | 132 // Verifies that two children are laid out with the correct size and position. |
| 133 TEST_F(NGBlockLayoutAlgorithmTest, LayoutBlockChildren) { | 133 TEST_F(NGBlockLayoutAlgorithmTest, LayoutBlockChildren) { |
| 134 SetBodyInnerHTML(R"HTML( | 134 SetBodyInnerHTML(R"HTML( |
| 135 <div id="container" style="width: 30px"> | 135 <div id="container" style="width: 30px"> |
| 136 <div style="height: 20px"> | 136 <div style="height: 20px"> |
| 137 </div> | 137 </div> |
| 138 <div style="height: 30px; margin-top: 5px; margin-bottom: 20px"> | 138 <div style="height: 30px; margin-top: 5px; margin-bottom: 20px"> |
| 139 </div> | 139 </div> |
| 140 </div> | 140 </div> |
| 141 )HTML"); | 141 )HTML"); |
| 142 const int kWidth = 30; | 142 const int kWidth = 30; |
| 143 const int kHeight1 = 20; | 143 const int kHeight1 = 20; |
| 144 const int kHeight2 = 30; | 144 const int kHeight2 = 30; |
| 145 const int kMarginTop = 5; | 145 const int kMarginTop = 5; |
| 146 | 146 |
| 147 auto* container = new NGBlockNode(GetLayoutObjectByElementId("container")); | 147 NGBlockNode container(ToLayoutBox(GetLayoutObjectByElementId("container"))); |
| 148 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( | 148 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( |
| 149 kHorizontalTopBottom, TextDirection::kLtr, | 149 kHorizontalTopBottom, TextDirection::kLtr, |
| 150 NGLogicalSize(LayoutUnit(100), NGSizeIndefinite)); | 150 NGLogicalSize(LayoutUnit(100), NGSizeIndefinite)); |
| 151 | 151 |
| 152 RefPtr<NGPhysicalBoxFragment> frag = | 152 RefPtr<NGPhysicalBoxFragment> frag = |
| 153 RunBlockLayoutAlgorithm(space.Get(), container); | 153 RunBlockLayoutAlgorithm(space.Get(), container); |
| 154 | 154 |
| 155 EXPECT_EQ(LayoutUnit(kWidth), frag->Size().width); | 155 EXPECT_EQ(LayoutUnit(kWidth), frag->Size().width); |
| 156 EXPECT_EQ(LayoutUnit(kHeight1 + kHeight2 + kMarginTop), frag->Size().height); | 156 EXPECT_EQ(LayoutUnit(kHeight1 + kHeight2 + kMarginTop), frag->Size().height); |
| 157 EXPECT_EQ(NGPhysicalFragment::kFragmentBox, frag->Type()); | 157 EXPECT_EQ(NGPhysicalFragment::kFragmentBox, frag->Type()); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 181 <div id="container"> | 181 <div id="container"> |
| 182 <div id="div1" style="writing-mode: vertical-lr;"> | 182 <div id="div1" style="writing-mode: vertical-lr;"> |
| 183 <div id="div2"> | 183 <div id="div2"> |
| 184 </div> | 184 </div> |
| 185 </div> | 185 </div> |
| 186 </div> | 186 </div> |
| 187 )HTML"); | 187 )HTML"); |
| 188 const int kHeight = 50; | 188 const int kHeight = 50; |
| 189 const int kMarginLeft = 100; | 189 const int kMarginLeft = 100; |
| 190 | 190 |
| 191 auto* container = new NGBlockNode(GetLayoutObjectByElementId("container")); | 191 NGBlockNode container(ToLayoutBox(GetLayoutObjectByElementId("container"))); |
| 192 RefPtr<NGConstraintSpace> space = | 192 RefPtr<NGConstraintSpace> space = |
| 193 ConstructConstraintSpace(kHorizontalTopBottom, TextDirection::kLtr, | 193 ConstructConstraintSpace(kHorizontalTopBottom, TextDirection::kLtr, |
| 194 NGLogicalSize(LayoutUnit(500), LayoutUnit(500))); | 194 NGLogicalSize(LayoutUnit(500), LayoutUnit(500))); |
| 195 RefPtr<NGPhysicalBoxFragment> frag = | 195 RefPtr<NGPhysicalBoxFragment> frag = |
| 196 RunBlockLayoutAlgorithm(space.Get(), container); | 196 RunBlockLayoutAlgorithm(space.Get(), container); |
| 197 | 197 |
| 198 const NGPhysicalFragment* child = frag->Children()[0].Get(); | 198 const NGPhysicalFragment* child = frag->Children()[0].Get(); |
| 199 // DIV2 | 199 // DIV2 |
| 200 child = static_cast<const NGPhysicalBoxFragment*>(child)->Children()[0].Get(); | 200 child = static_cast<const NGPhysicalBoxFragment*>(child)->Children()[0].Get(); |
| 201 | 201 |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 600 <div id="div1"> | 600 <div id="div1"> |
| 601 <div id="div2">vertical</div> | 601 <div id="div2">vertical</div> |
| 602 </div> | 602 </div> |
| 603 <div id="div3"></div> | 603 <div id="div3"></div> |
| 604 </div> | 604 </div> |
| 605 )HTML"); | 605 )HTML"); |
| 606 const int kHeight = 60; | 606 const int kHeight = 60; |
| 607 const int kMarginBottom = 10; | 607 const int kMarginBottom = 10; |
| 608 const int kMarginTop = 40; | 608 const int kMarginTop = 40; |
| 609 | 609 |
| 610 auto* container = new NGBlockNode(GetLayoutObjectByElementId("container")); | 610 NGBlockNode container(ToLayoutBox(GetLayoutObjectByElementId("container"))); |
| 611 RefPtr<NGConstraintSpace> space = | 611 RefPtr<NGConstraintSpace> space = |
| 612 ConstructConstraintSpace(kHorizontalTopBottom, TextDirection::kLtr, | 612 ConstructConstraintSpace(kHorizontalTopBottom, TextDirection::kLtr, |
| 613 NGLogicalSize(LayoutUnit(500), LayoutUnit(500))); | 613 NGLogicalSize(LayoutUnit(500), LayoutUnit(500))); |
| 614 RefPtr<NGPhysicalBoxFragment> frag = | 614 RefPtr<NGPhysicalBoxFragment> frag = |
| 615 RunBlockLayoutAlgorithm(space.Get(), container); | 615 RunBlockLayoutAlgorithm(space.Get(), container); |
| 616 | 616 |
| 617 ASSERT_EQ(frag->Children().size(), 2UL); | 617 ASSERT_EQ(frag->Children().size(), 2UL); |
| 618 | 618 |
| 619 const NGPhysicalFragment* child1 = frag->Children()[0].Get(); | 619 const NGPhysicalFragment* child1 = frag->Children()[0].Get(); |
| 620 EXPECT_EQ(0, child1->Offset().top); | 620 EXPECT_EQ(0, child1->Offset().top); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 704 const int kHeight = 100; | 704 const int kHeight = 100; |
| 705 const int kBorderTop = 1; | 705 const int kBorderTop = 1; |
| 706 const int kBorderRight = 2; | 706 const int kBorderRight = 2; |
| 707 const int kBorderBottom = 3; | 707 const int kBorderBottom = 3; |
| 708 const int kBorderLeft = 4; | 708 const int kBorderLeft = 4; |
| 709 const int kPaddingTop = 5; | 709 const int kPaddingTop = 5; |
| 710 const int kPaddingRight = 6; | 710 const int kPaddingRight = 6; |
| 711 const int kPaddingBottom = 7; | 711 const int kPaddingBottom = 7; |
| 712 const int kPaddingLeft = 8; | 712 const int kPaddingLeft = 8; |
| 713 | 713 |
| 714 auto* container = new NGBlockNode(GetLayoutObjectByElementId("container")); | 714 NGBlockNode container(ToLayoutBox(GetLayoutObjectByElementId("container"))); |
| 715 | 715 |
| 716 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( | 716 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( |
| 717 kHorizontalTopBottom, TextDirection::kLtr, | 717 kHorizontalTopBottom, TextDirection::kLtr, |
| 718 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite)); | 718 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite)); |
| 719 | 719 |
| 720 RefPtr<NGPhysicalBoxFragment> frag = | 720 RefPtr<NGPhysicalBoxFragment> frag = |
| 721 RunBlockLayoutAlgorithm(space.Get(), container); | 721 RunBlockLayoutAlgorithm(space.Get(), container); |
| 722 | 722 |
| 723 ASSERT_EQ(frag->Children().size(), 1UL); | 723 ASSERT_EQ(frag->Children().size(), 1UL); |
| 724 | 724 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 741 | 741 |
| 742 TEST_F(NGBlockLayoutAlgorithmTest, PercentageResolutionSize) { | 742 TEST_F(NGBlockLayoutAlgorithmTest, PercentageResolutionSize) { |
| 743 SetBodyInnerHTML(R"HTML( | 743 SetBodyInnerHTML(R"HTML( |
| 744 <div id="container" style="width: 30px; padding-left: 10px"> | 744 <div id="container" style="width: 30px; padding-left: 10px"> |
| 745 <div id="div1" style="width: 40%"></div> | 745 <div id="div1" style="width: 40%"></div> |
| 746 </div> | 746 </div> |
| 747 )HTML"); | 747 )HTML"); |
| 748 const int kPaddingLeft = 10; | 748 const int kPaddingLeft = 10; |
| 749 const int kWidth = 30; | 749 const int kWidth = 30; |
| 750 | 750 |
| 751 auto* container = new NGBlockNode(GetLayoutObjectByElementId("container")); | 751 NGBlockNode container(ToLayoutBox(GetLayoutObjectByElementId("container"))); |
| 752 | 752 |
| 753 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( | 753 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( |
| 754 kHorizontalTopBottom, TextDirection::kLtr, | 754 kHorizontalTopBottom, TextDirection::kLtr, |
| 755 NGLogicalSize(LayoutUnit(100), NGSizeIndefinite)); | 755 NGLogicalSize(LayoutUnit(100), NGSizeIndefinite)); |
| 756 RefPtr<NGPhysicalBoxFragment> frag = | 756 RefPtr<NGPhysicalBoxFragment> frag = |
| 757 RunBlockLayoutAlgorithm(space.Get(), container); | 757 RunBlockLayoutAlgorithm(space.Get(), container); |
| 758 | 758 |
| 759 EXPECT_EQ(LayoutUnit(kWidth + kPaddingLeft), frag->Size().width); | 759 EXPECT_EQ(LayoutUnit(kWidth + kPaddingLeft), frag->Size().width); |
| 760 EXPECT_EQ(NGPhysicalFragment::kFragmentBox, frag->Type()); | 760 EXPECT_EQ(NGPhysicalFragment::kFragmentBox, frag->Type()); |
| 761 ASSERT_EQ(frag->Children().size(), 1UL); | 761 ASSERT_EQ(frag->Children().size(), 1UL); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 773 </style> | 773 </style> |
| 774 <div id="container" style="width: 30px; padding-left: 10px"> | 774 <div id="container" style="width: 30px; padding-left: 10px"> |
| 775 <div id="first"> | 775 <div id="first"> |
| 776 </div> | 776 </div> |
| 777 </div> | 777 </div> |
| 778 )HTML"); | 778 )HTML"); |
| 779 const int kPaddingLeft = 10; | 779 const int kPaddingLeft = 10; |
| 780 const int kWidth = 30; | 780 const int kWidth = 30; |
| 781 const int kChildWidth = 10; | 781 const int kChildWidth = 10; |
| 782 | 782 |
| 783 auto* container = new NGBlockNode(GetLayoutObjectByElementId("container")); | 783 NGBlockNode container(ToLayoutBox(GetLayoutObjectByElementId("container"))); |
| 784 | 784 |
| 785 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( | 785 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( |
| 786 kHorizontalTopBottom, TextDirection::kLtr, | 786 kHorizontalTopBottom, TextDirection::kLtr, |
| 787 NGLogicalSize(LayoutUnit(100), NGSizeIndefinite)); | 787 NGLogicalSize(LayoutUnit(100), NGSizeIndefinite)); |
| 788 RefPtr<NGPhysicalBoxFragment> frag = | 788 RefPtr<NGPhysicalBoxFragment> frag = |
| 789 RunBlockLayoutAlgorithm(space.Get(), container); | 789 RunBlockLayoutAlgorithm(space.Get(), container); |
| 790 | 790 |
| 791 EXPECT_EQ(LayoutUnit(kWidth + kPaddingLeft), frag->Size().width); | 791 EXPECT_EQ(LayoutUnit(kWidth + kPaddingLeft), frag->Size().width); |
| 792 EXPECT_EQ(NGPhysicalFragment::kFragmentBox, frag->Type()); | 792 EXPECT_EQ(NGPhysicalFragment::kFragmentBox, frag->Type()); |
| 793 EXPECT_EQ(LayoutUnit(kWidth + kPaddingLeft), frag->OverflowSize().width); | 793 EXPECT_EQ(LayoutUnit(kWidth + kPaddingLeft), frag->OverflowSize().width); |
| (...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1191 TEST_F(NGBlockLayoutAlgorithmTest, ComputeMinMaxContent) { | 1191 TEST_F(NGBlockLayoutAlgorithmTest, ComputeMinMaxContent) { |
| 1192 SetBodyInnerHTML(R"HTML( | 1192 SetBodyInnerHTML(R"HTML( |
| 1193 <div id="container" style="width: 50px"> | 1193 <div id="container" style="width: 50px"> |
| 1194 <div id="first-child" style="width: 20px"></div> | 1194 <div id="first-child" style="width: 20px"></div> |
| 1195 <div id="second-child" style="width: 30px"></div> | 1195 <div id="second-child" style="width: 30px"></div> |
| 1196 </div> | 1196 </div> |
| 1197 )HTML"); | 1197 )HTML"); |
| 1198 | 1198 |
| 1199 const int kSecondChildWidth = 30; | 1199 const int kSecondChildWidth = 30; |
| 1200 | 1200 |
| 1201 auto* container = new NGBlockNode(GetLayoutObjectByElementId("container")); | 1201 NGBlockNode container(ToLayoutBox(GetLayoutObjectByElementId("container"))); |
| 1202 | 1202 |
| 1203 MinMaxContentSize sizes = RunComputeMinAndMax(container); | 1203 MinMaxContentSize sizes = RunComputeMinAndMax(container); |
| 1204 EXPECT_EQ(kSecondChildWidth, sizes.min_content); | 1204 EXPECT_EQ(kSecondChildWidth, sizes.min_content); |
| 1205 EXPECT_EQ(kSecondChildWidth, sizes.max_content); | 1205 EXPECT_EQ(kSecondChildWidth, sizes.max_content); |
| 1206 } | 1206 } |
| 1207 | 1207 |
| 1208 // Tests that we correctly handle shrink-to-fit | 1208 // Tests that we correctly handle shrink-to-fit |
| 1209 TEST_F(NGBlockLayoutAlgorithmTest, ShrinkToFit) { | 1209 TEST_F(NGBlockLayoutAlgorithmTest, ShrinkToFit) { |
| 1210 SetBodyInnerHTML(R"HTML( | 1210 SetBodyInnerHTML(R"HTML( |
| 1211 <div id="container"> | 1211 <div id="container"> |
| 1212 <div id="first-child" style="width: 20px"></div> | 1212 <div id="first-child" style="width: 20px"></div> |
| 1213 <div id="second-child" style="width: 30px"></div> | 1213 <div id="second-child" style="width: 30px"></div> |
| 1214 </div> | 1214 </div> |
| 1215 )HTML"); | 1215 )HTML"); |
| 1216 const int kWidthChild2 = 30; | 1216 const int kWidthChild2 = 30; |
| 1217 | 1217 |
| 1218 auto* container = new NGBlockNode(GetLayoutObjectByElementId("container")); | 1218 NGBlockNode container(ToLayoutBox(GetLayoutObjectByElementId("container"))); |
| 1219 | 1219 |
| 1220 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( | 1220 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( |
| 1221 kHorizontalTopBottom, TextDirection::kLtr, | 1221 kHorizontalTopBottom, TextDirection::kLtr, |
| 1222 NGLogicalSize(LayoutUnit(100), NGSizeIndefinite), true); | 1222 NGLogicalSize(LayoutUnit(100), NGSizeIndefinite), true); |
| 1223 RefPtr<NGPhysicalFragment> frag = | 1223 RefPtr<NGPhysicalFragment> frag = |
| 1224 RunBlockLayoutAlgorithm(space.Get(), container); | 1224 RunBlockLayoutAlgorithm(space.Get(), container); |
| 1225 | 1225 |
| 1226 EXPECT_EQ(LayoutUnit(kWidthChild2), frag->Size().width); | 1226 EXPECT_EQ(LayoutUnit(kWidthChild2), frag->Size().width); |
| 1227 } | 1227 } |
| 1228 | 1228 |
| 1229 // TODO(glebl): reenable multicol after new margin collapsing/floats algorithm | 1229 // TODO(glebl): reenable multicol after new margin collapsing/floats algorithm |
| 1230 // is checked in. | 1230 // is checked in. |
| 1231 TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_EmptyMulticol) { | 1231 TEST_F(NGBlockLayoutAlgorithmTest, DISABLED_EmptyMulticol) { |
| 1232 SetBodyInnerHTML(R"HTML( | 1232 SetBodyInnerHTML(R"HTML( |
| 1233 <style> | 1233 <style> |
| 1234 #parent { | 1234 #parent { |
| 1235 column-count: 2; | 1235 column-count: 2; |
| 1236 column-fill: auto; | 1236 column-fill: auto; |
| 1237 column-gap: 10px; | 1237 column-gap: 10px; |
| 1238 height: 100px; | 1238 height: 100px; |
| 1239 width: 210px; | 1239 width: 210px; |
| 1240 } | 1240 } |
| 1241 </style> | 1241 </style> |
| 1242 <div id="container"> | 1242 <div id="container"> |
| 1243 <div id="parent"> | 1243 <div id="parent"> |
| 1244 </div> | 1244 </div> |
| 1245 </div> | 1245 </div> |
| 1246 )HTML"); | 1246 )HTML"); |
| 1247 | 1247 |
| 1248 auto* container = new NGBlockNode(GetLayoutObjectByElementId("container")); | 1248 NGBlockNode container(ToLayoutBox(GetLayoutObjectByElementId("container"))); |
| 1249 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( | 1249 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( |
| 1250 kHorizontalTopBottom, TextDirection::kLtr, | 1250 kHorizontalTopBottom, TextDirection::kLtr, |
| 1251 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite)); | 1251 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite)); |
| 1252 RefPtr<const NGPhysicalBoxFragment> parent_fragment = | 1252 RefPtr<const NGPhysicalBoxFragment> parent_fragment = |
| 1253 RunBlockLayoutAlgorithm(space.Get(), container); | 1253 RunBlockLayoutAlgorithm(space.Get(), container); |
| 1254 FragmentChildIterator iterator(parent_fragment.Get()); | 1254 FragmentChildIterator iterator(parent_fragment.Get()); |
| 1255 const auto* fragment = iterator.NextChild(); | 1255 const auto* fragment = iterator.NextChild(); |
| 1256 ASSERT_TRUE(fragment); | 1256 ASSERT_TRUE(fragment); |
| 1257 EXPECT_EQ(NGPhysicalSize(LayoutUnit(210), LayoutUnit(100)), fragment->Size()); | 1257 EXPECT_EQ(NGPhysicalSize(LayoutUnit(210), LayoutUnit(100)), fragment->Size()); |
| 1258 EXPECT_FALSE(iterator.NextChild()); | 1258 EXPECT_FALSE(iterator.NextChild()); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1272 } | 1272 } |
| 1273 </style> | 1273 </style> |
| 1274 <div id="container"> | 1274 <div id="container"> |
| 1275 <div id="parent"> | 1275 <div id="parent"> |
| 1276 <div id="child"> | 1276 <div id="child"> |
| 1277 </div> | 1277 </div> |
| 1278 </div> | 1278 </div> |
| 1279 </div> | 1279 </div> |
| 1280 )HTML"); | 1280 )HTML"); |
| 1281 | 1281 |
| 1282 auto* container = new NGBlockNode(GetLayoutObjectByElementId("container")); | 1282 NGBlockNode container(ToLayoutBox(GetLayoutObjectByElementId("container"))); |
| 1283 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( | 1283 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( |
| 1284 kHorizontalTopBottom, TextDirection::kLtr, | 1284 kHorizontalTopBottom, TextDirection::kLtr, |
| 1285 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite)); | 1285 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite)); |
| 1286 RefPtr<const NGPhysicalBoxFragment> parent_fragment = | 1286 RefPtr<const NGPhysicalBoxFragment> parent_fragment = |
| 1287 RunBlockLayoutAlgorithm(space.Get(), container); | 1287 RunBlockLayoutAlgorithm(space.Get(), container); |
| 1288 FragmentChildIterator iterator(parent_fragment.Get()); | 1288 FragmentChildIterator iterator(parent_fragment.Get()); |
| 1289 const auto* fragment = iterator.NextChild(); | 1289 const auto* fragment = iterator.NextChild(); |
| 1290 EXPECT_EQ(NGPhysicalSize(LayoutUnit(210), LayoutUnit(100)), fragment->Size()); | 1290 EXPECT_EQ(NGPhysicalSize(LayoutUnit(210), LayoutUnit(100)), fragment->Size()); |
| 1291 ASSERT_TRUE(fragment); | 1291 ASSERT_TRUE(fragment); |
| 1292 EXPECT_FALSE(iterator.NextChild()); | 1292 EXPECT_FALSE(iterator.NextChild()); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1315 } | 1315 } |
| 1316 </style> | 1316 </style> |
| 1317 <div id="container"> | 1317 <div id="container"> |
| 1318 <div id="parent"> | 1318 <div id="parent"> |
| 1319 <div id="child" style="width: 60%; height: 100%"> | 1319 <div id="child" style="width: 60%; height: 100%"> |
| 1320 </div> | 1320 </div> |
| 1321 </div> | 1321 </div> |
| 1322 </div> | 1322 </div> |
| 1323 )HTML"); | 1323 )HTML"); |
| 1324 | 1324 |
| 1325 auto* container = new NGBlockNode(GetLayoutObjectByElementId("container")); | 1325 NGBlockNode container(ToLayoutBox(GetLayoutObjectByElementId("container"))); |
| 1326 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( | 1326 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( |
| 1327 kHorizontalTopBottom, TextDirection::kLtr, | 1327 kHorizontalTopBottom, TextDirection::kLtr, |
| 1328 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite)); | 1328 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite)); |
| 1329 RefPtr<const NGPhysicalBoxFragment> parent_fragment = | 1329 RefPtr<const NGPhysicalBoxFragment> parent_fragment = |
| 1330 RunBlockLayoutAlgorithm(space.Get(), container); | 1330 RunBlockLayoutAlgorithm(space.Get(), container); |
| 1331 | 1331 |
| 1332 FragmentChildIterator iterator(parent_fragment.Get()); | 1332 FragmentChildIterator iterator(parent_fragment.Get()); |
| 1333 const auto* fragment = iterator.NextChild(); | 1333 const auto* fragment = iterator.NextChild(); |
| 1334 ASSERT_TRUE(fragment); | 1334 ASSERT_TRUE(fragment); |
| 1335 EXPECT_EQ(NGPhysicalSize(LayoutUnit(310), LayoutUnit(100)), fragment->Size()); | 1335 EXPECT_EQ(NGPhysicalSize(LayoutUnit(310), LayoutUnit(100)), fragment->Size()); |
| (...skipping 22 matching lines...) Expand all Loading... |
| 1358 width: 20px; | 1358 width: 20px; |
| 1359 } | 1359 } |
| 1360 </style> | 1360 </style> |
| 1361 <div id="container"> | 1361 <div id="container"> |
| 1362 <div id="parent"> | 1362 <div id="parent"> |
| 1363 <div id="child" style="width: 75%; height: 150px"></div> | 1363 <div id="child" style="width: 75%; height: 150px"></div> |
| 1364 </div> | 1364 </div> |
| 1365 </div> | 1365 </div> |
| 1366 )HTML"); | 1366 )HTML"); |
| 1367 | 1367 |
| 1368 auto* container = new NGBlockNode(GetLayoutObjectByElementId("container")); | 1368 NGBlockNode container(ToLayoutBox(GetLayoutObjectByElementId("container"))); |
| 1369 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( | 1369 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( |
| 1370 kHorizontalTopBottom, TextDirection::kLtr, | 1370 kHorizontalTopBottom, TextDirection::kLtr, |
| 1371 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite)); | 1371 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite)); |
| 1372 RefPtr<const NGPhysicalBoxFragment> parent_fragment = | 1372 RefPtr<const NGPhysicalBoxFragment> parent_fragment = |
| 1373 RunBlockLayoutAlgorithm(space.Get(), container); | 1373 RunBlockLayoutAlgorithm(space.Get(), container); |
| 1374 | 1374 |
| 1375 FragmentChildIterator iterator(parent_fragment.Get()); | 1375 FragmentChildIterator iterator(parent_fragment.Get()); |
| 1376 const auto* fragment = iterator.NextChild(); | 1376 const auto* fragment = iterator.NextChild(); |
| 1377 ASSERT_TRUE(fragment); | 1377 ASSERT_TRUE(fragment); |
| 1378 EXPECT_EQ(NGPhysicalSize(LayoutUnit(210), LayoutUnit(100)), fragment->Size()); | 1378 EXPECT_EQ(NGPhysicalSize(LayoutUnit(210), LayoutUnit(100)), fragment->Size()); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1410 } | 1410 } |
| 1411 </style> | 1411 </style> |
| 1412 <div id="container"> | 1412 <div id="container"> |
| 1413 <div id="parent"> | 1413 <div id="parent"> |
| 1414 <div id="child" style="width: 75%; height: 250px;"> | 1414 <div id="child" style="width: 75%; height: 250px;"> |
| 1415 </div> | 1415 </div> |
| 1416 </div> | 1416 </div> |
| 1417 </div> | 1417 </div> |
| 1418 )HTML"); | 1418 )HTML"); |
| 1419 | 1419 |
| 1420 auto* container = new NGBlockNode(GetLayoutObjectByElementId("container")); | 1420 NGBlockNode container(ToLayoutBox(GetLayoutObjectByElementId("container"))); |
| 1421 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( | 1421 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( |
| 1422 kHorizontalTopBottom, TextDirection::kLtr, | 1422 kHorizontalTopBottom, TextDirection::kLtr, |
| 1423 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite)); | 1423 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite)); |
| 1424 RefPtr<const NGPhysicalBoxFragment> parent_fragment = | 1424 RefPtr<const NGPhysicalBoxFragment> parent_fragment = |
| 1425 RunBlockLayoutAlgorithm(space.Get(), container); | 1425 RunBlockLayoutAlgorithm(space.Get(), container); |
| 1426 | 1426 |
| 1427 FragmentChildIterator iterator(parent_fragment.Get()); | 1427 FragmentChildIterator iterator(parent_fragment.Get()); |
| 1428 const auto* fragment = iterator.NextChild(); | 1428 const auto* fragment = iterator.NextChild(); |
| 1429 ASSERT_TRUE(fragment); | 1429 ASSERT_TRUE(fragment); |
| 1430 EXPECT_EQ(NGPhysicalSize(LayoutUnit(320), LayoutUnit(100)), fragment->Size()); | 1430 EXPECT_EQ(NGPhysicalSize(LayoutUnit(320), LayoutUnit(100)), fragment->Size()); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1471 } | 1471 } |
| 1472 </style> | 1472 </style> |
| 1473 <div id="container"> | 1473 <div id="container"> |
| 1474 <div id="parent"> | 1474 <div id="parent"> |
| 1475 <div id="child" style="width: 1px; height: 250px;"> | 1475 <div id="child" style="width: 1px; height: 250px;"> |
| 1476 </div> | 1476 </div> |
| 1477 </div> | 1477 </div> |
| 1478 </div> | 1478 </div> |
| 1479 )HTML"); | 1479 )HTML"); |
| 1480 | 1480 |
| 1481 auto* container = new NGBlockNode(GetLayoutObjectByElementId("container")); | 1481 NGBlockNode container(ToLayoutBox(GetLayoutObjectByElementId("container"))); |
| 1482 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( | 1482 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( |
| 1483 kHorizontalTopBottom, TextDirection::kLtr, | 1483 kHorizontalTopBottom, TextDirection::kLtr, |
| 1484 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite)); | 1484 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite)); |
| 1485 RefPtr<const NGPhysicalBoxFragment> parent_fragment = | 1485 RefPtr<const NGPhysicalBoxFragment> parent_fragment = |
| 1486 RunBlockLayoutAlgorithm(space.Get(), container); | 1486 RunBlockLayoutAlgorithm(space.Get(), container); |
| 1487 | 1487 |
| 1488 FragmentChildIterator iterator(parent_fragment.Get()); | 1488 FragmentChildIterator iterator(parent_fragment.Get()); |
| 1489 const auto* fragment = iterator.NextChild(); | 1489 const auto* fragment = iterator.NextChild(); |
| 1490 ASSERT_TRUE(fragment); | 1490 ASSERT_TRUE(fragment); |
| 1491 EXPECT_EQ(NGPhysicalSize(LayoutUnit(210), LayoutUnit(100)), fragment->Size()); | 1491 EXPECT_EQ(NGPhysicalSize(LayoutUnit(210), LayoutUnit(100)), fragment->Size()); |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1533 <div id="container"> | 1533 <div id="container"> |
| 1534 <div id="parent"> | 1534 <div id="parent"> |
| 1535 <div id="child1" style="width: 75%; height: 60px;"> | 1535 <div id="child1" style="width: 75%; height: 60px;"> |
| 1536 </div> | 1536 </div> |
| 1537 <div id="child2" style="width: 85%; height: 60px;"> | 1537 <div id="child2" style="width: 85%; height: 60px;"> |
| 1538 </div> | 1538 </div> |
| 1539 </div> | 1539 </div> |
| 1540 </div> | 1540 </div> |
| 1541 )HTML"); | 1541 )HTML"); |
| 1542 | 1542 |
| 1543 auto* container = new NGBlockNode(GetLayoutObjectByElementId("container")); | 1543 NGBlockNode container(ToLayoutBox(GetLayoutObjectByElementId("container"))); |
| 1544 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( | 1544 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( |
| 1545 kHorizontalTopBottom, TextDirection::kLtr, | 1545 kHorizontalTopBottom, TextDirection::kLtr, |
| 1546 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite)); | 1546 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite)); |
| 1547 RefPtr<const NGPhysicalBoxFragment> parent_fragment = | 1547 RefPtr<const NGPhysicalBoxFragment> parent_fragment = |
| 1548 RunBlockLayoutAlgorithm(space.Get(), container); | 1548 RunBlockLayoutAlgorithm(space.Get(), container); |
| 1549 | 1549 |
| 1550 FragmentChildIterator iterator(parent_fragment.Get()); | 1550 FragmentChildIterator iterator(parent_fragment.Get()); |
| 1551 const auto* fragment = iterator.NextChild(); | 1551 const auto* fragment = iterator.NextChild(); |
| 1552 ASSERT_TRUE(fragment); | 1552 ASSERT_TRUE(fragment); |
| 1553 EXPECT_EQ(NGPhysicalSize(LayoutUnit(320), LayoutUnit(100)), fragment->Size()); | 1553 EXPECT_EQ(NGPhysicalSize(LayoutUnit(320), LayoutUnit(100)), fragment->Size()); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1597 </div> | 1597 </div> |
| 1598 <div id="grandchild2" style="width: 40px; height: 20px;"> | 1598 <div id="grandchild2" style="width: 40px; height: 20px;"> |
| 1599 </div> | 1599 </div> |
| 1600 </div> | 1600 </div> |
| 1601 <div id="child2" style="width: 85%; height: 10px;"></div> | 1601 <div id="child2" style="width: 85%; height: 10px;"></div> |
| 1602 </div> | 1602 </div> |
| 1603 </div> | 1603 </div> |
| 1604 </div> | 1604 </div> |
| 1605 )HTML"); | 1605 )HTML"); |
| 1606 | 1606 |
| 1607 auto* container = new NGBlockNode(GetLayoutObjectByElementId("container")); | 1607 NGBlockNode container(ToLayoutBox(GetLayoutObjectByElementId("container"))); |
| 1608 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( | 1608 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( |
| 1609 kHorizontalTopBottom, TextDirection::kLtr, | 1609 kHorizontalTopBottom, TextDirection::kLtr, |
| 1610 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite)); | 1610 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite)); |
| 1611 RefPtr<const NGPhysicalBoxFragment> parent_fragment = | 1611 RefPtr<const NGPhysicalBoxFragment> parent_fragment = |
| 1612 RunBlockLayoutAlgorithm(space.Get(), container); | 1612 RunBlockLayoutAlgorithm(space.Get(), container); |
| 1613 | 1613 |
| 1614 FragmentChildIterator iterator(parent_fragment.Get()); | 1614 FragmentChildIterator iterator(parent_fragment.Get()); |
| 1615 const auto* fragment = iterator.NextChild(); | 1615 const auto* fragment = iterator.NextChild(); |
| 1616 ASSERT_TRUE(fragment); | 1616 ASSERT_TRUE(fragment); |
| 1617 EXPECT_EQ(NGPhysicalSize(LayoutUnit(320), LayoutUnit(100)), fragment->Size()); | 1617 EXPECT_EQ(NGPhysicalSize(LayoutUnit(320), LayoutUnit(100)), fragment->Size()); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1672 } | 1672 } |
| 1673 </style> | 1673 </style> |
| 1674 <div id="container"> | 1674 <div id="container"> |
| 1675 <div id="parent"> | 1675 <div id="parent"> |
| 1676 <div id="child" style="float: left; width: 75%; height: 100px;"> | 1676 <div id="child" style="float: left; width: 75%; height: 100px;"> |
| 1677 </div> | 1677 </div> |
| 1678 </div> | 1678 </div> |
| 1679 </div> | 1679 </div> |
| 1680 )HTML"); | 1680 )HTML"); |
| 1681 | 1681 |
| 1682 auto* container = new NGBlockNode(GetLayoutObjectByElementId("container")); | 1682 NGBlockNode container(ToLayoutBox(GetLayoutObjectByElementId("container"))); |
| 1683 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( | 1683 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( |
| 1684 kHorizontalTopBottom, TextDirection::kLtr, | 1684 kHorizontalTopBottom, TextDirection::kLtr, |
| 1685 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite)); | 1685 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite)); |
| 1686 RefPtr<const NGPhysicalBoxFragment> parent_fragment = | 1686 RefPtr<const NGPhysicalBoxFragment> parent_fragment = |
| 1687 RunBlockLayoutAlgorithm(space.Get(), container); | 1687 RunBlockLayoutAlgorithm(space.Get(), container); |
| 1688 | 1688 |
| 1689 FragmentChildIterator iterator(parent_fragment.Get()); | 1689 FragmentChildIterator iterator(parent_fragment.Get()); |
| 1690 const auto* fragment = iterator.NextChild(); | 1690 const auto* fragment = iterator.NextChild(); |
| 1691 ASSERT_TRUE(fragment); | 1691 ASSERT_TRUE(fragment); |
| 1692 EXPECT_EQ(NGPhysicalSize(LayoutUnit(320), LayoutUnit(100)), fragment->Size()); | 1692 EXPECT_EQ(NGPhysicalSize(LayoutUnit(320), LayoutUnit(100)), fragment->Size()); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 1718 <div id="container"> | 1718 <div id="container"> |
| 1719 <div id="parent"> | 1719 <div id="parent"> |
| 1720 <div id="child1" style="float: left; width: 15%; height: 100px;"> | 1720 <div id="child1" style="float: left; width: 15%; height: 100px;"> |
| 1721 </div> | 1721 </div> |
| 1722 <div id="child2" style="float: right; width: 16%; height: 100px;"> | 1722 <div id="child2" style="float: right; width: 16%; height: 100px;"> |
| 1723 </div> | 1723 </div> |
| 1724 </div> | 1724 </div> |
| 1725 </div> | 1725 </div> |
| 1726 )HTML"); | 1726 )HTML"); |
| 1727 | 1727 |
| 1728 auto* container = new NGBlockNode(GetLayoutObjectByElementId("container")); | 1728 NGBlockNode container(ToLayoutBox(GetLayoutObjectByElementId("container"))); |
| 1729 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( | 1729 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( |
| 1730 kHorizontalTopBottom, TextDirection::kLtr, | 1730 kHorizontalTopBottom, TextDirection::kLtr, |
| 1731 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite)); | 1731 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite)); |
| 1732 RefPtr<const NGPhysicalBoxFragment> parent_fragment = | 1732 RefPtr<const NGPhysicalBoxFragment> parent_fragment = |
| 1733 RunBlockLayoutAlgorithm(space.Get(), container); | 1733 RunBlockLayoutAlgorithm(space.Get(), container); |
| 1734 | 1734 |
| 1735 FragmentChildIterator iterator(parent_fragment.Get()); | 1735 FragmentChildIterator iterator(parent_fragment.Get()); |
| 1736 const auto* fragment = iterator.NextChild(); | 1736 const auto* fragment = iterator.NextChild(); |
| 1737 ASSERT_TRUE(fragment); | 1737 ASSERT_TRUE(fragment); |
| 1738 EXPECT_EQ(NGPhysicalSize(LayoutUnit(320), LayoutUnit(100)), fragment->Size()); | 1738 EXPECT_EQ(NGPhysicalSize(LayoutUnit(320), LayoutUnit(100)), fragment->Size()); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1770 <div id="container"> | 1770 <div id="container"> |
| 1771 <div id="parent"> | 1771 <div id="parent"> |
| 1772 <div id="child1" style="float: left; width: 15%; height: 150px;"> | 1772 <div id="child1" style="float: left; width: 15%; height: 150px;"> |
| 1773 </div> | 1773 </div> |
| 1774 <div id="child2" style="float: right; width: 16%; height: 150px;"> | 1774 <div id="child2" style="float: right; width: 16%; height: 150px;"> |
| 1775 </div> | 1775 </div> |
| 1776 </div> | 1776 </div> |
| 1777 </div> | 1777 </div> |
| 1778 )HTML"); | 1778 )HTML"); |
| 1779 | 1779 |
| 1780 auto* container = new NGBlockNode(GetLayoutObjectByElementId("container")); | 1780 NGBlockNode container(ToLayoutBox(GetLayoutObjectByElementId("container"))); |
| 1781 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( | 1781 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( |
| 1782 kHorizontalTopBottom, TextDirection::kLtr, | 1782 kHorizontalTopBottom, TextDirection::kLtr, |
| 1783 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite)); | 1783 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite)); |
| 1784 RefPtr<const NGPhysicalBoxFragment> parent_fragment = | 1784 RefPtr<const NGPhysicalBoxFragment> parent_fragment = |
| 1785 RunBlockLayoutAlgorithm(space.Get(), container); | 1785 RunBlockLayoutAlgorithm(space.Get(), container); |
| 1786 | 1786 |
| 1787 FragmentChildIterator iterator(parent_fragment.Get()); | 1787 FragmentChildIterator iterator(parent_fragment.Get()); |
| 1788 const auto* fragment = iterator.NextChild(); | 1788 const auto* fragment = iterator.NextChild(); |
| 1789 ASSERT_TRUE(fragment); | 1789 ASSERT_TRUE(fragment); |
| 1790 EXPECT_EQ(NGPhysicalSize(LayoutUnit(320), LayoutUnit(100)), fragment->Size()); | 1790 EXPECT_EQ(NGPhysicalSize(LayoutUnit(320), LayoutUnit(100)), fragment->Size()); |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1967 #container { | 1967 #container { |
| 1968 width: 150px; | 1968 width: 150px; |
| 1969 height: 200px; | 1969 height: 200px; |
| 1970 } | 1970 } |
| 1971 </style> | 1971 </style> |
| 1972 <div id='container'></div> | 1972 <div id='container'></div> |
| 1973 )HTML"); | 1973 )HTML"); |
| 1974 | 1974 |
| 1975 LayoutUnit kFragmentainerSpaceAvailable(200); | 1975 LayoutUnit kFragmentainerSpaceAvailable(200); |
| 1976 | 1976 |
| 1977 NGBlockNode* node = new NGBlockNode( | 1977 NGBlockNode node(ToLayoutBox(GetLayoutObjectByElementId("container"))); |
| 1978 ToLayoutBlockFlow(GetLayoutObjectByElementId("container"))); | |
| 1979 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( | 1978 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( |
| 1980 kHorizontalTopBottom, TextDirection::kLtr, | 1979 kHorizontalTopBottom, TextDirection::kLtr, |
| 1981 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite), false, true, | 1980 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite), false, true, |
| 1982 kFragmentainerSpaceAvailable); | 1981 kFragmentainerSpaceAvailable); |
| 1983 | 1982 |
| 1984 // We should only have one 150x200 fragment with no fragmentation. | 1983 // We should only have one 150x200 fragment with no fragmentation. |
| 1985 RefPtr<const NGPhysicalFragment> fragment = | 1984 RefPtr<const NGPhysicalFragment> fragment = |
| 1986 NGBlockLayoutAlgorithm(node, space.Get()).Layout()->PhysicalFragment(); | 1985 NGBlockLayoutAlgorithm(node, space.Get()).Layout()->PhysicalFragment(); |
| 1987 EXPECT_EQ(NGPhysicalSize(LayoutUnit(150), LayoutUnit(200)), fragment->Size()); | 1986 EXPECT_EQ(NGPhysicalSize(LayoutUnit(150), LayoutUnit(200)), fragment->Size()); |
| 1988 ASSERT_TRUE(fragment->BreakToken()->IsFinished()); | 1987 ASSERT_TRUE(fragment->BreakToken()->IsFinished()); |
| 1989 } | 1988 } |
| 1990 | 1989 |
| 1991 // Tests that a block will fragment if it reaches the fragmentation line. | 1990 // Tests that a block will fragment if it reaches the fragmentation line. |
| 1992 TEST_F(NGBlockLayoutAlgorithmTest, SimpleFragmentation) { | 1991 TEST_F(NGBlockLayoutAlgorithmTest, SimpleFragmentation) { |
| 1993 SetBodyInnerHTML(R"HTML( | 1992 SetBodyInnerHTML(R"HTML( |
| 1994 <!DOCTYPE html> | 1993 <!DOCTYPE html> |
| 1995 <style> | 1994 <style> |
| 1996 #container { | 1995 #container { |
| 1997 width: 150px; | 1996 width: 150px; |
| 1998 height: 300px; | 1997 height: 300px; |
| 1999 } | 1998 } |
| 2000 </style> | 1999 </style> |
| 2001 <div id='container'></div> | 2000 <div id='container'></div> |
| 2002 )HTML"); | 2001 )HTML"); |
| 2003 | 2002 |
| 2004 LayoutUnit kFragmentainerSpaceAvailable(200); | 2003 LayoutUnit kFragmentainerSpaceAvailable(200); |
| 2005 | 2004 |
| 2006 NGBlockNode* node = new NGBlockNode( | 2005 NGBlockNode node(ToLayoutBox(GetLayoutObjectByElementId("container"))); |
| 2007 ToLayoutBlockFlow(GetLayoutObjectByElementId("container"))); | |
| 2008 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( | 2006 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( |
| 2009 kHorizontalTopBottom, TextDirection::kLtr, | 2007 kHorizontalTopBottom, TextDirection::kLtr, |
| 2010 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite), false, true, | 2008 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite), false, true, |
| 2011 kFragmentainerSpaceAvailable); | 2009 kFragmentainerSpaceAvailable); |
| 2012 | 2010 |
| 2013 RefPtr<const NGPhysicalFragment> fragment = | 2011 RefPtr<const NGPhysicalFragment> fragment = |
| 2014 NGBlockLayoutAlgorithm(node, space.Get()).Layout()->PhysicalFragment(); | 2012 NGBlockLayoutAlgorithm(node, space.Get()).Layout()->PhysicalFragment(); |
| 2015 EXPECT_EQ(NGPhysicalSize(LayoutUnit(150), LayoutUnit(200)), fragment->Size()); | 2013 EXPECT_EQ(NGPhysicalSize(LayoutUnit(150), LayoutUnit(200)), fragment->Size()); |
| 2016 ASSERT_FALSE(fragment->BreakToken()->IsFinished()); | 2014 ASSERT_FALSE(fragment->BreakToken()->IsFinished()); |
| 2017 | 2015 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 2043 } | 2041 } |
| 2044 </style> | 2042 </style> |
| 2045 <div id='container'> | 2043 <div id='container'> |
| 2046 <div id='child1'></div> | 2044 <div id='child1'></div> |
| 2047 <div id='child2'></div> | 2045 <div id='child2'></div> |
| 2048 </div> | 2046 </div> |
| 2049 )HTML"); | 2047 )HTML"); |
| 2050 | 2048 |
| 2051 LayoutUnit kFragmentainerSpaceAvailable(200); | 2049 LayoutUnit kFragmentainerSpaceAvailable(200); |
| 2052 | 2050 |
| 2053 NGBlockNode* node = new NGBlockNode( | 2051 NGBlockNode node(ToLayoutBox(GetLayoutObjectByElementId("container"))); |
| 2054 ToLayoutBlockFlow(GetLayoutObjectByElementId("container"))); | |
| 2055 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( | 2052 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( |
| 2056 kHorizontalTopBottom, TextDirection::kLtr, | 2053 kHorizontalTopBottom, TextDirection::kLtr, |
| 2057 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite), false, true, | 2054 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite), false, true, |
| 2058 kFragmentainerSpaceAvailable); | 2055 kFragmentainerSpaceAvailable); |
| 2059 | 2056 |
| 2060 RefPtr<const NGPhysicalFragment> fragment = | 2057 RefPtr<const NGPhysicalFragment> fragment = |
| 2061 NGBlockLayoutAlgorithm(node, space.Get()).Layout()->PhysicalFragment(); | 2058 NGBlockLayoutAlgorithm(node, space.Get()).Layout()->PhysicalFragment(); |
| 2062 EXPECT_EQ(NGPhysicalSize(LayoutUnit(150), LayoutUnit(200)), fragment->Size()); | 2059 EXPECT_EQ(NGPhysicalSize(LayoutUnit(150), LayoutUnit(200)), fragment->Size()); |
| 2063 ASSERT_FALSE(fragment->BreakToken()->IsFinished()); | 2060 ASSERT_FALSE(fragment->BreakToken()->IsFinished()); |
| 2064 | 2061 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2111 } | 2108 } |
| 2112 </style> | 2109 </style> |
| 2113 <div id='container'> | 2110 <div id='container'> |
| 2114 <div id='child1'></div> | 2111 <div id='child1'></div> |
| 2115 <div id='child2'></div> | 2112 <div id='child2'></div> |
| 2116 </div> | 2113 </div> |
| 2117 )HTML"); | 2114 )HTML"); |
| 2118 | 2115 |
| 2119 LayoutUnit kFragmentainerSpaceAvailable(200); | 2116 LayoutUnit kFragmentainerSpaceAvailable(200); |
| 2120 | 2117 |
| 2121 NGBlockNode* node = new NGBlockNode( | 2118 NGBlockNode node(ToLayoutBox(GetLayoutObjectByElementId("container"))); |
| 2122 ToLayoutBlockFlow(GetLayoutObjectByElementId("container"))); | |
| 2123 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( | 2119 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( |
| 2124 kHorizontalTopBottom, TextDirection::kLtr, | 2120 kHorizontalTopBottom, TextDirection::kLtr, |
| 2125 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite), false, true, | 2121 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite), false, true, |
| 2126 kFragmentainerSpaceAvailable); | 2122 kFragmentainerSpaceAvailable); |
| 2127 | 2123 |
| 2128 RefPtr<const NGPhysicalFragment> fragment = | 2124 RefPtr<const NGPhysicalFragment> fragment = |
| 2129 NGBlockLayoutAlgorithm(node, space.Get()).Layout()->PhysicalFragment(); | 2125 NGBlockLayoutAlgorithm(node, space.Get()).Layout()->PhysicalFragment(); |
| 2130 EXPECT_EQ(NGPhysicalSize(LayoutUnit(150), LayoutUnit(200)), fragment->Size()); | 2126 EXPECT_EQ(NGPhysicalSize(LayoutUnit(150), LayoutUnit(200)), fragment->Size()); |
| 2131 ASSERT_FALSE(fragment->BreakToken()->IsFinished()); | 2127 ASSERT_FALSE(fragment->BreakToken()->IsFinished()); |
| 2132 | 2128 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2177 } | 2173 } |
| 2178 </style> | 2174 </style> |
| 2179 <div id='container'> | 2175 <div id='container'> |
| 2180 <div id='child1'></div> | 2176 <div id='child1'></div> |
| 2181 <div id='child2'></div> | 2177 <div id='child2'></div> |
| 2182 </div> | 2178 </div> |
| 2183 )HTML"); | 2179 )HTML"); |
| 2184 | 2180 |
| 2185 LayoutUnit kFragmentainerSpaceAvailable(200); | 2181 LayoutUnit kFragmentainerSpaceAvailable(200); |
| 2186 | 2182 |
| 2187 NGBlockNode* node = new NGBlockNode( | 2183 NGBlockNode node(ToLayoutBox(GetLayoutObjectByElementId("container"))); |
| 2188 ToLayoutBlockFlow(GetLayoutObjectByElementId("container"))); | |
| 2189 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( | 2184 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( |
| 2190 kHorizontalTopBottom, TextDirection::kLtr, | 2185 kHorizontalTopBottom, TextDirection::kLtr, |
| 2191 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite), false, true, | 2186 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite), false, true, |
| 2192 kFragmentainerSpaceAvailable); | 2187 kFragmentainerSpaceAvailable); |
| 2193 | 2188 |
| 2194 RefPtr<const NGPhysicalFragment> fragment = | 2189 RefPtr<const NGPhysicalFragment> fragment = |
| 2195 NGBlockLayoutAlgorithm(node, space.Get()).Layout()->PhysicalFragment(); | 2190 NGBlockLayoutAlgorithm(node, space.Get()).Layout()->PhysicalFragment(); |
| 2196 EXPECT_EQ(NGPhysicalSize(LayoutUnit(150), LayoutUnit(70)), fragment->Size()); | 2191 EXPECT_EQ(NGPhysicalSize(LayoutUnit(150), LayoutUnit(70)), fragment->Size()); |
| 2197 ASSERT_FALSE(fragment->BreakToken()->IsFinished()); | 2192 ASSERT_FALSE(fragment->BreakToken()->IsFinished()); |
| 2198 | 2193 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2244 } | 2239 } |
| 2245 </style> | 2240 </style> |
| 2246 <div id='container'> | 2241 <div id='container'> |
| 2247 <div id='float1'></div> | 2242 <div id='float1'></div> |
| 2248 <div id='float2'></div> | 2243 <div id='float2'></div> |
| 2249 </div> | 2244 </div> |
| 2250 )HTML"); | 2245 )HTML"); |
| 2251 | 2246 |
| 2252 LayoutUnit kFragmentainerSpaceAvailable(150); | 2247 LayoutUnit kFragmentainerSpaceAvailable(150); |
| 2253 | 2248 |
| 2254 NGBlockNode* node = new NGBlockNode( | 2249 NGBlockNode node(ToLayoutBlockFlow(GetLayoutObjectByElementId("container"))); |
| 2255 ToLayoutBlockFlow(GetLayoutObjectByElementId("container"))); | |
| 2256 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( | 2250 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( |
| 2257 kHorizontalTopBottom, TextDirection::kLtr, | 2251 kHorizontalTopBottom, TextDirection::kLtr, |
| 2258 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite), false, true, | 2252 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite), false, true, |
| 2259 kFragmentainerSpaceAvailable); | 2253 kFragmentainerSpaceAvailable); |
| 2260 | 2254 |
| 2261 RefPtr<const NGPhysicalFragment> fragment = | 2255 RefPtr<const NGPhysicalFragment> fragment = |
| 2262 NGBlockLayoutAlgorithm(node, space.Get()).Layout()->PhysicalFragment(); | 2256 NGBlockLayoutAlgorithm(node, space.Get()).Layout()->PhysicalFragment(); |
| 2263 EXPECT_EQ(NGPhysicalSize(LayoutUnit(150), LayoutUnit(50)), fragment->Size()); | 2257 EXPECT_EQ(NGPhysicalSize(LayoutUnit(150), LayoutUnit(50)), fragment->Size()); |
| 2264 ASSERT_FALSE(fragment->BreakToken()->IsFinished()); | 2258 ASSERT_FALSE(fragment->BreakToken()->IsFinished()); |
| 2265 | 2259 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2327 } | 2321 } |
| 2328 </style> | 2322 </style> |
| 2329 <div id='container'> | 2323 <div id='container'> |
| 2330 <div id='float1'></div> | 2324 <div id='float1'></div> |
| 2331 <div id='float2'></div> | 2325 <div id='float2'></div> |
| 2332 </div> | 2326 </div> |
| 2333 )HTML"); | 2327 )HTML"); |
| 2334 | 2328 |
| 2335 LayoutUnit kFragmentainerSpaceAvailable(150); | 2329 LayoutUnit kFragmentainerSpaceAvailable(150); |
| 2336 | 2330 |
| 2337 NGBlockNode* node = new NGBlockNode( | 2331 NGBlockNode node(ToLayoutBlockFlow(GetLayoutObjectByElementId("container"))); |
| 2338 ToLayoutBlockFlow(GetLayoutObjectByElementId("container"))); | |
| 2339 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( | 2332 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( |
| 2340 kHorizontalTopBottom, TextDirection::kLtr, | 2333 kHorizontalTopBottom, TextDirection::kLtr, |
| 2341 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite), false, true, | 2334 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite), false, true, |
| 2342 kFragmentainerSpaceAvailable); | 2335 kFragmentainerSpaceAvailable); |
| 2343 | 2336 |
| 2344 RefPtr<const NGPhysicalFragment> fragment = | 2337 RefPtr<const NGPhysicalFragment> fragment = |
| 2345 NGBlockLayoutAlgorithm(node, space.Get()).Layout()->PhysicalFragment(); | 2338 NGBlockLayoutAlgorithm(node, space.Get()).Layout()->PhysicalFragment(); |
| 2346 EXPECT_EQ(NGPhysicalSize(LayoutUnit(150), LayoutUnit(60)), fragment->Size()); | 2339 EXPECT_EQ(NGPhysicalSize(LayoutUnit(150), LayoutUnit(60)), fragment->Size()); |
| 2347 ASSERT_TRUE(fragment->BreakToken()->IsFinished()); | 2340 ASSERT_TRUE(fragment->BreakToken()->IsFinished()); |
| 2348 | 2341 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 2378 </style> | 2371 </style> |
| 2379 <div id='container'> | 2372 <div id='container'> |
| 2380 <div id='zero'> | 2373 <div id='zero'> |
| 2381 <div id='float'></div> | 2374 <div id='float'></div> |
| 2382 </div> | 2375 </div> |
| 2383 </div> | 2376 </div> |
| 2384 )HTML"); | 2377 )HTML"); |
| 2385 | 2378 |
| 2386 LayoutUnit kFragmentainerSpaceAvailable(150); | 2379 LayoutUnit kFragmentainerSpaceAvailable(150); |
| 2387 | 2380 |
| 2388 NGBlockNode* node = new NGBlockNode( | 2381 NGBlockNode node(ToLayoutBlockFlow(GetLayoutObjectByElementId("container"))); |
| 2389 ToLayoutBlockFlow(GetLayoutObjectByElementId("container"))); | |
| 2390 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( | 2382 RefPtr<NGConstraintSpace> space = ConstructConstraintSpace( |
| 2391 kHorizontalTopBottom, TextDirection::kLtr, | 2383 kHorizontalTopBottom, TextDirection::kLtr, |
| 2392 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite), false, true, | 2384 NGLogicalSize(LayoutUnit(1000), NGSizeIndefinite), false, true, |
| 2393 kFragmentainerSpaceAvailable); | 2385 kFragmentainerSpaceAvailable); |
| 2394 | 2386 |
| 2395 RefPtr<const NGPhysicalFragment> fragment = | 2387 RefPtr<const NGPhysicalFragment> fragment = |
| 2396 NGBlockLayoutAlgorithm(node, space.Get()).Layout()->PhysicalFragment(); | 2388 NGBlockLayoutAlgorithm(node, space.Get()).Layout()->PhysicalFragment(); |
| 2397 EXPECT_EQ(NGPhysicalSize(LayoutUnit(150), LayoutUnit(50)), fragment->Size()); | 2389 EXPECT_EQ(NGPhysicalSize(LayoutUnit(150), LayoutUnit(50)), fragment->Size()); |
| 2398 ASSERT_FALSE(fragment->BreakToken()->IsFinished()); | 2390 ASSERT_FALSE(fragment->BreakToken()->IsFinished()); |
| 2399 | 2391 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2483 run_test(Length(120, kFixed)); | 2475 run_test(Length(120, kFixed)); |
| 2484 // 30 = #float's height | 2476 // 30 = #float's height |
| 2485 EXPECT_THAT(new_fc_fragment->Offset(), | 2477 EXPECT_THAT(new_fc_fragment->Offset(), |
| 2486 NGPhysicalOffset(LayoutUnit(0), LayoutUnit(30))); | 2478 NGPhysicalOffset(LayoutUnit(0), LayoutUnit(30))); |
| 2487 // 8 = body's margins, no margin collapsing | 2479 // 8 = body's margins, no margin collapsing |
| 2488 EXPECT_THAT(body_fragment->Offset(), | 2480 EXPECT_THAT(body_fragment->Offset(), |
| 2489 NGPhysicalOffset(LayoutUnit(8), LayoutUnit(8))); | 2481 NGPhysicalOffset(LayoutUnit(8), LayoutUnit(8))); |
| 2490 } | 2482 } |
| 2491 } // namespace | 2483 } // namespace |
| 2492 } // namespace blink | 2484 } // namespace blink |
| OLD | NEW |