| 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" | |
| 11 #include "core/layout/ng/ng_length_utils.h" | 10 #include "core/layout/ng/ng_length_utils.h" |
| 12 #include "core/layout/ng/ng_physical_box_fragment.h" | 11 #include "core/layout/ng/ng_physical_box_fragment.h" |
| 13 #include "core/layout/ng/ng_physical_fragment.h" | 12 #include "core/layout/ng/ng_physical_fragment.h" |
| 14 #include "core/layout/ng/ng_units.h" | 13 #include "core/layout/ng/ng_units.h" |
| 15 #include "core/layout/LayoutTestHelper.h" | 14 #include "core/layout/LayoutTestHelper.h" |
| 16 #include "core/style/ComputedStyle.h" | 15 #include "core/style/ComputedStyle.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 17 |
| 19 namespace blink { | 18 namespace blink { |
| 20 namespace { | 19 namespace { |
| (...skipping 25 matching lines...) Expand all Loading... |
| 46 enableCompositing(); | 45 enableCompositing(); |
| 47 } | 46 } |
| 48 | 47 |
| 49 NGPhysicalBoxFragment* RunBlockLayoutAlgorithm(NGConstraintSpace* space, | 48 NGPhysicalBoxFragment* RunBlockLayoutAlgorithm(NGConstraintSpace* space, |
| 50 NGBlockNode* first_child) { | 49 NGBlockNode* first_child) { |
| 51 NGBlockNode parent(style_.get()); | 50 NGBlockNode parent(style_.get()); |
| 52 parent.SetFirstChild(first_child); | 51 parent.SetFirstChild(first_child); |
| 53 | 52 |
| 54 NGBlockLayoutAlgorithm algorithm(style_.get(), first_child, space); | 53 NGBlockLayoutAlgorithm algorithm(style_.get(), first_child, space); |
| 55 | 54 |
| 56 NGPhysicalFragment* fragment; | 55 NGPhysicalFragment* fragment = algorithm.Layout(); |
| 57 NGLayoutAlgorithm* not_used; | |
| 58 EXPECT_EQ(kNewFragment, algorithm.Layout(nullptr, &fragment, ¬_used)); | |
| 59 | |
| 60 return toNGPhysicalBoxFragment(fragment); | 56 return toNGPhysicalBoxFragment(fragment); |
| 61 } | 57 } |
| 62 | 58 |
| 63 MinAndMaxContentSizes RunComputeMinAndMax(NGBlockNode* first_child) { | 59 MinAndMaxContentSizes RunComputeMinAndMax(NGBlockNode* first_child) { |
| 64 // The constraint space is not used for min/max computation, but we need | 60 // The constraint space is not used for min/max computation, but we need |
| 65 // it to create the algorithm. | 61 // it to create the algorithm. |
| 66 NGConstraintSpace* space = | 62 NGConstraintSpace* space = |
| 67 ConstructConstraintSpace(kHorizontalTopBottom, TextDirection::kLtr, | 63 ConstructConstraintSpace(kHorizontalTopBottom, TextDirection::kLtr, |
| 68 NGLogicalSize(LayoutUnit(), LayoutUnit())); | 64 NGLogicalSize(LayoutUnit(), LayoutUnit())); |
| 69 NGBlockLayoutAlgorithm algorithm(style_.get(), first_child, space); | 65 NGBlockLayoutAlgorithm algorithm(style_.get(), first_child, space); |
| (...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1562 EXPECT_EQ(LayoutUnit(194), fragment->LeftOffset()); | 1558 EXPECT_EQ(LayoutUnit(194), fragment->LeftOffset()); |
| 1563 EXPECT_EQ(LayoutUnit(), fragment->TopOffset()); | 1559 EXPECT_EQ(LayoutUnit(), fragment->TopOffset()); |
| 1564 EXPECT_EQ(LayoutUnit(16), fragment->Width()); | 1560 EXPECT_EQ(LayoutUnit(16), fragment->Width()); |
| 1565 EXPECT_EQ(LayoutUnit(50), fragment->Height()); | 1561 EXPECT_EQ(LayoutUnit(50), fragment->Height()); |
| 1566 EXPECT_EQ(0UL, fragment->Children().size()); | 1562 EXPECT_EQ(0UL, fragment->Children().size()); |
| 1567 EXPECT_FALSE(iterator.NextChild()); | 1563 EXPECT_FALSE(iterator.NextChild()); |
| 1568 } | 1564 } |
| 1569 | 1565 |
| 1570 } // namespace | 1566 } // namespace |
| 1571 } // namespace blink | 1567 } // namespace blink |
| OLD | NEW |