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/ng/ng_constraint_space.h" | 7 #include "core/layout/ng/ng_constraint_space.h" |
8 #include "core/layout/ng/ng_constraint_space_builder.h" | 8 #include "core/layout/ng/ng_constraint_space_builder.h" |
9 #include "core/layout/ng/ng_fragment_builder.h" | 9 #include "core/layout/ng/ng_fragment_builder.h" |
10 #include "core/layout/ng/ng_line_builder.h" | 10 #include "core/layout/ng/ng_line_builder.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 NGConstraintSpaceBuilder(kHorizontalTopBottom) | 69 NGConstraintSpaceBuilder(kHorizontalTopBottom) |
70 .ToConstraintSpace(kHorizontalTopBottom); | 70 .ToConstraintSpace(kHorizontalTopBottom); |
71 NGLineBuilder line_builder(node, constraint_space); | 71 NGLineBuilder line_builder(node, constraint_space); |
72 | 72 |
73 NGTextLayoutAlgorithm algorithm(node, constraint_space); | 73 NGTextLayoutAlgorithm algorithm(node, constraint_space); |
74 algorithm.LayoutInline(&line_builder); | 74 algorithm.LayoutInline(&line_builder); |
75 | 75 |
76 NGFragmentBuilder fragment_builder(NGPhysicalFragment::kFragmentBox, | 76 NGFragmentBuilder fragment_builder(NGPhysicalFragment::kFragmentBox, |
77 /* layout_object */ nullptr); | 77 /* layout_object */ nullptr); |
78 line_builder.CreateFragments(&fragment_builder); | 78 line_builder.CreateFragments(&fragment_builder); |
79 RefPtr<NGPhysicalBoxFragment> fragment = fragment_builder.ToBoxFragment(); | 79 RefPtr<NGLayoutResult> result = fragment_builder.ToBoxFragment(); |
80 for (const auto& child : fragment->Children()) { | 80 for (const auto& child : |
| 81 toNGPhysicalBoxFragment(result->PhysicalFragment().get()) |
| 82 ->Children()) { |
81 fragments_out->push_back(toNGPhysicalTextFragment(child.get())); | 83 fragments_out->push_back(toNGPhysicalTextFragment(child.get())); |
82 } | 84 } |
83 } | 85 } |
84 | 86 |
85 RefPtr<ComputedStyle> style_; | 87 RefPtr<ComputedStyle> style_; |
86 }; | 88 }; |
87 | 89 |
88 #define TEST_ITEM_OFFSET_DIR(item, start, end, direction) \ | 90 #define TEST_ITEM_OFFSET_DIR(item, start, end, direction) \ |
89 EXPECT_EQ(start, item.StartOffset()); \ | 91 EXPECT_EQ(start, item.StartOffset()); \ |
90 EXPECT_EQ(end, item.EndOffset()); \ | 92 EXPECT_EQ(end, item.EndOffset()); \ |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 CreateLine(node, &fragments); | 195 CreateLine(node, &fragments); |
194 ASSERT_EQ(5u, fragments.size()); | 196 ASSERT_EQ(5u, fragments.size()); |
195 TEST_TEXT_FRAGMENT(fragments[0], node, 0u, 0u, 6u, TextDirection::kLtr); | 197 TEST_TEXT_FRAGMENT(fragments[0], node, 0u, 0u, 6u, TextDirection::kLtr); |
196 TEST_TEXT_FRAGMENT(fragments[1], node, 6u, 16u, 21u, TextDirection::kRtl); | 198 TEST_TEXT_FRAGMENT(fragments[1], node, 6u, 16u, 21u, TextDirection::kRtl); |
197 TEST_TEXT_FRAGMENT(fragments[2], node, 4u, 14u, 15u, TextDirection::kLtr); | 199 TEST_TEXT_FRAGMENT(fragments[2], node, 4u, 14u, 15u, TextDirection::kLtr); |
198 TEST_TEXT_FRAGMENT(fragments[3], node, 2u, 7u, 13u, TextDirection::kRtl); | 200 TEST_TEXT_FRAGMENT(fragments[3], node, 2u, 7u, 13u, TextDirection::kRtl); |
199 TEST_TEXT_FRAGMENT(fragments[4], node, 8u, 22u, 28u, TextDirection::kLtr); | 201 TEST_TEXT_FRAGMENT(fragments[4], node, 8u, 22u, 28u, TextDirection::kLtr); |
200 } | 202 } |
201 | 203 |
202 } // namespace blink | 204 } // namespace blink |
OLD | NEW |