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_inline_node.h" | 5 #include "core/layout/ng/ng_inline_node.h" |
6 | 6 |
7 #include "core/layout/LayoutTestHelper.h" | 7 #include "core/layout/LayoutTestHelper.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_fragment_builder.h" | 10 #include "core/layout/ng/ng_fragment_builder.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 if (!layout_block_flow_) | 82 if (!layout_block_flow_) |
83 SetupHtml("t", "<div id=t style='font:10px'>test</div>"); | 83 SetupHtml("t", "<div id=t style='font:10px'>test</div>"); |
84 return new NGInlineNodeForTest(layout_object_, layout_block_flow_); | 84 return new NGInlineNodeForTest(layout_object_, layout_block_flow_); |
85 } | 85 } |
86 | 86 |
87 void CreateLine(NGInlineNode* node, | 87 void CreateLine(NGInlineNode* node, |
88 Vector<RefPtr<const NGPhysicalTextFragment>>* fragments_out) { | 88 Vector<RefPtr<const NGPhysicalTextFragment>>* fragments_out) { |
89 RefPtr<NGConstraintSpace> constraint_space = | 89 RefPtr<NGConstraintSpace> constraint_space = |
90 NGConstraintSpaceBuilder(kHorizontalTopBottom) | 90 NGConstraintSpaceBuilder(kHorizontalTopBottom) |
91 .ToConstraintSpace(kHorizontalTopBottom); | 91 .ToConstraintSpace(kHorizontalTopBottom); |
92 NGLineBuilder line_builder(node, constraint_space.get(), nullptr); | 92 NGLineBuilder line_builder(node, constraint_space.get()); |
93 | 93 |
94 NGTextLayoutAlgorithm algorithm(node); | 94 NGTextLayoutAlgorithm algorithm(node); |
95 algorithm.LayoutInline(&line_builder); | 95 algorithm.LayoutInline(&line_builder); |
96 | 96 |
97 RefPtr<NGLayoutResult> result = line_builder.CreateFragments(); | 97 RefPtr<NGLayoutResult> result = line_builder.CreateFragments(); |
98 for (const auto& child : | 98 for (const auto& child : |
99 toNGPhysicalBoxFragment(result->PhysicalFragment().get()) | 99 toNGPhysicalBoxFragment(result->PhysicalFragment().get()) |
100 ->Children()) { | 100 ->Children()) { |
101 fragments_out->push_back(toNGPhysicalTextFragment(child.get())); | 101 fragments_out->push_back(toNGPhysicalTextFragment(child.get())); |
102 } | 102 } |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 MinMaxContentSize sizes = node->ComputeMinMaxContentSize(); | 251 MinMaxContentSize sizes = node->ComputeMinMaxContentSize(); |
252 // |min_content| should be the width of "BC" because there is an element | 252 // |min_content| should be the width of "BC" because there is an element |
253 // boundary between "B" and "C" but no break opportunities. | 253 // boundary between "B" and "C" but no break opportunities. |
254 // TODO(kojii): min_content should be 20, but is 30 until NGLineBuilder | 254 // TODO(kojii): min_content should be 20, but is 30 until NGLineBuilder |
255 // implements trailing spaces correctly. | 255 // implements trailing spaces correctly. |
256 EXPECT_EQ(30, sizes.min_content); | 256 EXPECT_EQ(30, sizes.min_content); |
257 EXPECT_EQ(60, sizes.max_content); | 257 EXPECT_EQ(60, sizes.max_content); |
258 } | 258 } |
259 | 259 |
260 } // namespace blink | 260 } // namespace blink |
OLD | NEW |