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_layout_algorithm.h" | 5 #include "core/layout/ng/ng_inline_layout_algorithm.h" |
6 | 6 |
7 #include "core/layout/ng/ng_break_token.h" | 7 #include "core/layout/ng/ng_break_token.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.h" | 10 #include "core/layout/ng/ng_fragment.h" |
11 #include "core/layout/ng/ng_fragment_builder.h" | 11 #include "core/layout/ng/ng_fragment_builder.h" |
12 #include "core/layout/ng/ng_inline_node.h" | 12 #include "core/layout/ng/ng_inline_node.h" |
13 #include "core/layout/ng/ng_length_utils.h" | 13 #include "core/layout/ng/ng_length_utils.h" |
14 #include "core/layout/ng/ng_line_builder.h" | 14 #include "core/layout/ng/ng_line_builder.h" |
15 #include "core/layout/ng/ng_physical_box_fragment.h" | 15 #include "core/layout/ng/ng_physical_box_fragment.h" |
16 #include "core/style/ComputedStyle.h" | 16 #include "core/style/ComputedStyle.h" |
17 | 17 |
18 namespace blink { | 18 namespace blink { |
19 | 19 |
20 NGInlineLayoutAlgorithm::NGInlineLayoutAlgorithm( | 20 NGInlineLayoutAlgorithm::NGInlineLayoutAlgorithm( |
21 LayoutObject* layout_object, | 21 LayoutObject* layout_object, |
22 PassRefPtr<const ComputedStyle> style, | 22 PassRefPtr<const ComputedStyle> style, |
23 NGInlineNode* first_child, | 23 NGInlineNode* first_child, |
24 NGConstraintSpace* constraint_space, | 24 NGConstraintSpace* constraint_space, |
25 NGBreakToken* break_token) | 25 NGBreakToken* break_token) |
26 : NGLayoutAlgorithm(kInlineLayoutAlgorithm), | 26 : style_(style), |
27 style_(style), | |
28 first_child_(first_child), | 27 first_child_(first_child), |
29 constraint_space_(constraint_space), | 28 constraint_space_(constraint_space), |
30 break_token_(break_token), | 29 break_token_(break_token), |
31 builder_(new NGFragmentBuilder(NGPhysicalFragment::kFragmentBox, | 30 builder_(new NGFragmentBuilder(NGPhysicalFragment::kFragmentBox, |
32 layout_object)) { | 31 layout_object)) { |
33 DCHECK(style_); | 32 DCHECK(style_); |
34 } | 33 } |
35 | 34 |
36 NGPhysicalFragment* NGInlineLayoutAlgorithm::Layout() { | 35 NGPhysicalFragment* NGInlineLayoutAlgorithm::Layout() { |
37 // TODO(kojii): Implement sizing and child constraint spaces. Share common | 36 // TODO(kojii): Implement sizing and child constraint spaces. Share common |
(...skipping 20 matching lines...) Expand all Loading... |
58 NGConstraintSpace* NGInlineLayoutAlgorithm::CreateConstraintSpaceForChild( | 57 NGConstraintSpace* NGInlineLayoutAlgorithm::CreateConstraintSpaceForChild( |
59 const NGInlineNode& child) const { | 58 const NGInlineNode& child) const { |
60 // TODO(kojii): Implement child constraint space. | 59 // TODO(kojii): Implement child constraint space. |
61 NGConstraintSpace* child_space = | 60 NGConstraintSpace* child_space = |
62 NGConstraintSpaceBuilder(constraint_space_->WritingMode()) | 61 NGConstraintSpaceBuilder(constraint_space_->WritingMode()) |
63 .SetTextDirection(constraint_space_->Direction()) | 62 .SetTextDirection(constraint_space_->Direction()) |
64 .ToConstraintSpace(); | 63 .ToConstraintSpace(); |
65 return child_space; | 64 return child_space; |
66 } | 65 } |
67 | 66 |
68 DEFINE_TRACE(NGInlineLayoutAlgorithm) { | |
69 NGLayoutAlgorithm::trace(visitor); | |
70 visitor->trace(first_child_); | |
71 visitor->trace(constraint_space_); | |
72 visitor->trace(break_token_); | |
73 visitor->trace(builder_); | |
74 } | |
75 | |
76 } // namespace blink | 67 } // namespace blink |
OLD | NEW |