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_layout_input_node.h" | 5 #include "core/layout/ng/ng_layout_input_node.h" |
6 | 6 |
7 #include "core/layout/ng/ng_block_layout_algorithm.h" | 7 #include "core/layout/ng/ng_block_layout_algorithm.h" |
8 #include "core/layout/ng/ng_block_node.h" | 8 #include "core/layout/ng/ng_block_node.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_inline_node.h" | 10 #include "core/layout/ng/ng_inline_node.h" |
11 #include "core/layout/ng/ng_inline_layout_algorithm.h" | 11 #include "core/layout/ng/ng_inline_layout_algorithm.h" |
12 #include "core/layout/ng/ng_layout_algorithm.h" | 12 #include "core/layout/ng/ng_layout_algorithm.h" |
13 #include "core/layout/ng/ng_legacy_block_layout_algorithm.h" | 13 #include "core/layout/ng/ng_legacy_block_layout_algorithm.h" |
14 #include "core/style/ComputedStyle.h" | 14 #include "core/style/ComputedStyle.h" |
15 | 15 |
16 namespace blink { | 16 namespace blink { |
17 | 17 |
18 NGLayoutAlgorithm* NGLayoutInputNode::AlgorithmForInputNode( | 18 NGLayoutAlgorithm* NGLayoutInputNode::AlgorithmForInputNode( |
19 NGLayoutInputNode* input_node, | 19 NGLayoutInputNode* input_node, |
20 const NGConstraintSpace* constraint_space) { | 20 NGConstraintSpace* constraint_space) { |
21 // At least for now, this should never be called on LegacyInline | 21 // At least for now, this should never be called on LegacyInline |
22 // children. However, there will be other kinds of input_node so | 22 // children. However, there will be other kinds of input_node so |
23 // it makes sense to do this here. | 23 // it makes sense to do this here. |
24 DCHECK(input_node->Type() == kLegacyBlock); | 24 DCHECK(input_node->Type() == kLegacyBlock); |
25 NGBlockNode* block = toNGBlockNode(input_node); | 25 NGBlockNode* block = toNGBlockNode(input_node); |
26 | 26 |
27 if (block->CanUseNewLayout()) { | 27 if (block->CanUseNewLayout()) { |
28 if (block->HasInlineChildren()) | 28 if (block->HasInlineChildren()) |
29 return new NGInlineLayoutAlgorithm( | 29 return new NGInlineLayoutAlgorithm(block->Style(), |
30 block->Style(), toNGInlineNode(block->FirstChild()), | 30 toNGInlineNode(block->FirstChild()), |
31 constraint_space->ChildSpace(block->Style())); | 31 constraint_space); |
32 return new NGBlockLayoutAlgorithm( | 32 return new NGBlockLayoutAlgorithm( |
33 block->Style(), toNGBlockNode(block->FirstChild()), | 33 block->Style(), toNGBlockNode(block->FirstChild()), constraint_space); |
34 constraint_space->ChildSpace(block->Style())); | |
35 } | 34 } |
36 | 35 |
37 return new NGLegacyBlockLayoutAlgorithm(block, constraint_space); | 36 return new NGLegacyBlockLayoutAlgorithm(block, constraint_space); |
38 } | 37 } |
39 } | 38 } |
OLD | NEW |