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_text_layout_algorithm.h" | 5 #include "core/layout/ng/ng_text_layout_algorithm.h" |
6 | 6 |
7 #include "core/layout/ng/ng_box_fragment.h" | 7 #include "core/layout/ng/ng_box_fragment.h" |
8 #include "core/layout/ng/ng_break_token.h" | 8 #include "core/layout/ng/ng_break_token.h" |
9 #include "core/layout/ng/ng_constraint_space.h" | 9 #include "core/layout/ng/ng_constraint_space.h" |
10 #include "core/layout/ng/ng_fragment_builder.h" | 10 #include "core/layout/ng/ng_fragment_builder.h" |
11 #include "core/layout/ng/ng_inline_node.h" | 11 #include "core/layout/ng/ng_inline_node.h" |
12 #include "core/layout/ng/ng_line_builder.h" | 12 #include "core/layout/ng/ng_line_builder.h" |
13 #include "core/layout/ng/ng_text_fragment.h" | 13 #include "core/layout/ng/ng_text_fragment.h" |
14 #include "core/style/ComputedStyle.h" | 14 #include "core/style/ComputedStyle.h" |
15 #include "platform/text/TextBreakIterator.h" | 15 #include "platform/text/TextBreakIterator.h" |
16 | 16 |
17 namespace blink { | 17 namespace blink { |
18 | 18 |
19 NGTextLayoutAlgorithm::NGTextLayoutAlgorithm( | 19 NGTextLayoutAlgorithm::NGTextLayoutAlgorithm( |
20 NGInlineNode* inline_box, | 20 NGInlineNode* inline_box, |
21 NGConstraintSpace* constraint_space, | 21 NGConstraintSpace* constraint_space, |
22 NGBreakToken* break_token) | 22 NGBreakToken* break_token) |
23 : inline_box_(inline_box), | 23 : inline_box_(inline_box), |
24 constraint_space_(constraint_space), | 24 constraint_space_(constraint_space), |
25 break_token_(break_token) { | 25 break_token_(break_token) { |
26 DCHECK(inline_box_); | 26 DCHECK(inline_box_); |
27 } | 27 } |
28 | 28 |
29 RefPtr<NGPhysicalFragment> NGTextLayoutAlgorithm::Layout() { | 29 RefPtr<NGLayoutResult> NGTextLayoutAlgorithm::Layout() { |
30 ASSERT_NOT_REACHED(); | 30 ASSERT_NOT_REACHED(); |
31 return nullptr; | 31 return nullptr; |
32 } | 32 } |
33 | 33 |
34 static bool IsHangable(UChar ch) { | 34 static bool IsHangable(UChar ch) { |
35 return ch == ' '; | 35 return ch == ' '; |
36 } | 36 } |
37 | 37 |
38 void NGTextLayoutAlgorithm::LayoutInline(NGLineBuilder* line_builder) { | 38 void NGTextLayoutAlgorithm::LayoutInline(NGLineBuilder* line_builder) { |
39 // TODO(kojii): Make this tickable. Each line is easy. Needs more thoughts | 39 // TODO(kojii): Make this tickable. Each line is easy. Needs more thoughts |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 } | 104 } |
105 } | 105 } |
106 | 106 |
107 // If inline children ended with items left in the line builder, create a line | 107 // If inline children ended with items left in the line builder, create a line |
108 // for them. | 108 // for them. |
109 if (line_builder->HasItems()) | 109 if (line_builder->HasItems()) |
110 line_builder->CreateLine(); | 110 line_builder->CreateLine(); |
111 } | 111 } |
112 | 112 |
113 } // namespace blink | 113 } // namespace blink |
OLD | NEW |