| 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/layout/ng/ng_block_node.h" | 7 #include "core/layout/ng/ng_block_node.h" |
| 8 #include "core/layout/ng/ng_constraint_space.h" | 8 #include "core/layout/ng/ng_constraint_space.h" |
| 9 #include "core/layout/ng/ng_constraint_space_builder.h" | 9 #include "core/layout/ng/ng_constraint_space_builder.h" |
| 10 #include "core/layout/ng/ng_layout_coordinator.h" | 10 #include "core/layout/ng/ng_layout_coordinator.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 class NGBlockLayoutAlgorithmTest : public ::testing::Test { | 34 class NGBlockLayoutAlgorithmTest : public ::testing::Test { |
| 35 protected: | 35 protected: |
| 36 void SetUp() override { style_ = ComputedStyle::create(); } | 36 void SetUp() override { style_ = ComputedStyle::create(); } |
| 37 | 37 |
| 38 NGPhysicalBoxFragment* RunBlockLayoutAlgorithm(NGConstraintSpace* space, | 38 NGPhysicalBoxFragment* RunBlockLayoutAlgorithm(NGConstraintSpace* space, |
| 39 NGBlockNode* first_child) { | 39 NGBlockNode* first_child) { |
| 40 NGBlockNode parent(style_.get()); | 40 NGBlockNode parent(style_.get()); |
| 41 parent.SetFirstChild(first_child); | 41 parent.SetFirstChild(first_child); |
| 42 | 42 |
| 43 NGLayoutCoordinator coordinator(&parent, space); | 43 NGBlockLayoutAlgorithm algorithm(style_.get(), first_child, space); |
| 44 |
| 44 NGPhysicalFragment* fragment; | 45 NGPhysicalFragment* fragment; |
| 45 coordinator.Tick(&fragment); | 46 NGLayoutAlgorithm* not_used; |
| 46 EXPECT_EQ(kBlockLayoutAlgorithm, | 47 EXPECT_EQ(kNewFragment, algorithm.Layout(nullptr, &fragment, ¬_used)); |
| 47 coordinator.GetAlgorithmStackForTesting()[0]->algorithmType()); | |
| 48 while (!coordinator.Tick(&fragment)) | |
| 49 ; | |
| 50 | 48 |
| 51 return toNGPhysicalBoxFragment(fragment); | 49 return toNGPhysicalBoxFragment(fragment); |
| 52 } | 50 } |
| 53 | 51 |
| 54 MinAndMaxContentSizes RunComputeMinAndMax(NGBlockNode* first_child) { | 52 MinAndMaxContentSizes RunComputeMinAndMax(NGBlockNode* first_child) { |
| 55 // The constraint space is not used for min/max computation, but we need | 53 // The constraint space is not used for min/max computation, but we need |
| 56 // it to create the algorithm. | 54 // it to create the algorithm. |
| 57 NGConstraintSpace* space = | 55 NGConstraintSpace* space = |
| 58 ConstructConstraintSpace(kHorizontalTopBottom, TextDirection::kLtr, | 56 ConstructConstraintSpace(kHorizontalTopBottom, TextDirection::kLtr, |
| 59 NGLogicalSize(LayoutUnit(), LayoutUnit())); | 57 NGLogicalSize(LayoutUnit(), LayoutUnit())); |
| (...skipping 1493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1553 EXPECT_EQ(LayoutUnit(194), fragment->LeftOffset()); | 1551 EXPECT_EQ(LayoutUnit(194), fragment->LeftOffset()); |
| 1554 EXPECT_EQ(LayoutUnit(), fragment->TopOffset()); | 1552 EXPECT_EQ(LayoutUnit(), fragment->TopOffset()); |
| 1555 EXPECT_EQ(LayoutUnit(16), fragment->Width()); | 1553 EXPECT_EQ(LayoutUnit(16), fragment->Width()); |
| 1556 EXPECT_EQ(LayoutUnit(50), fragment->Height()); | 1554 EXPECT_EQ(LayoutUnit(50), fragment->Height()); |
| 1557 EXPECT_EQ(0UL, fragment->Children().size()); | 1555 EXPECT_EQ(0UL, fragment->Children().size()); |
| 1558 EXPECT_FALSE(iterator.NextChild()); | 1556 EXPECT_FALSE(iterator.NextChild()); |
| 1559 } | 1557 } |
| 1560 | 1558 |
| 1561 } // namespace | 1559 } // namespace |
| 1562 } // namespace blink | 1560 } // namespace blink |
| OLD | NEW |