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 | 15 |
16 namespace blink { | 16 namespace blink { |
17 | 17 |
18 NGTextLayoutAlgorithm::NGTextLayoutAlgorithm( | 18 NGTextLayoutAlgorithm::NGTextLayoutAlgorithm( |
19 NGInlineNode* inline_box, | 19 NGInlineNode* inline_box, |
20 NGConstraintSpace* constraint_space, | 20 NGConstraintSpace* constraint_space, |
21 NGBreakToken* break_token) | 21 NGBreakToken* break_token) |
22 : NGLayoutAlgorithm(kTextLayoutAlgorithm), | 22 : NGLayoutAlgorithm(kTextLayoutAlgorithm), |
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 NGLayoutStatus NGTextLayoutAlgorithm::Layout(NGPhysicalFragment*, | 29 NGPhysicalFragment* NGTextLayoutAlgorithm::Layout() { |
30 NGPhysicalFragment** fragment_out, | |
31 NGLayoutAlgorithm**) { | |
32 ASSERT_NOT_REACHED(); | 30 ASSERT_NOT_REACHED(); |
33 *fragment_out = nullptr; | 31 return nullptr; |
34 return kNewFragment; | |
35 } | 32 } |
36 | 33 |
37 bool NGTextLayoutAlgorithm::LayoutInline(NGLineBuilder* line_builder) { | 34 bool NGTextLayoutAlgorithm::LayoutInline(NGLineBuilder* line_builder) { |
38 // TODO(kojii): Make this tickable. Each line is easy. Needs more thoughts | 35 // TODO(kojii): Make this tickable. Each line is easy. Needs more thoughts |
39 // for each fragment in a line. Bidi reordering is probably atomic. | 36 // for each fragment in a line. Bidi reordering is probably atomic. |
40 // TODO(kojii): oof is not well-thought yet. The bottom static position may be | 37 // TODO(kojii): oof is not well-thought yet. The bottom static position may be |
41 // in the next line, https://github.com/w3c/csswg-drafts/issues/609 | 38 // in the next line, https://github.com/w3c/csswg-drafts/issues/609 |
42 const Vector<NGLayoutInlineItem>& items = inline_box_->Items(); | 39 const Vector<NGLayoutInlineItem>& items = inline_box_->Items(); |
43 for (unsigned start_index = 0; start_index < items.size();) { | 40 for (unsigned start_index = 0; start_index < items.size();) { |
44 const NGLayoutInlineItem& start_item = items[start_index]; | 41 const NGLayoutInlineItem& start_item = items[start_index]; |
(...skipping 28 matching lines...) Expand all Loading... |
73 } | 70 } |
74 | 71 |
75 DEFINE_TRACE(NGTextLayoutAlgorithm) { | 72 DEFINE_TRACE(NGTextLayoutAlgorithm) { |
76 NGLayoutAlgorithm::trace(visitor); | 73 NGLayoutAlgorithm::trace(visitor); |
77 visitor->trace(inline_box_); | 74 visitor->trace(inline_box_); |
78 visitor->trace(constraint_space_); | 75 visitor->trace(constraint_space_); |
79 visitor->trace(break_token_); | 76 visitor->trace(break_token_); |
80 } | 77 } |
81 | 78 |
82 } // namespace blink | 79 } // namespace blink |
OLD | NEW |