Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: third_party/WebKit/Source/core/layout/ng/ng_layout_input_node.cc

Issue 2631513002: [LayoutNG] Make NGLayoutInputNode::AlgorithmForInputNode() more readable. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 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 if (!block->CanUseNewLayout())
27 if (block->CanUseNewLayout()) { 27 return new NGLegacyBlockLayoutAlgorithm(block, constraint_space);
28 if (block->HasInlineChildren()) 28 const ComputedStyle* style = block->Style();
29 return new NGInlineLayoutAlgorithm(block->Style(), 29 if (block->HasInlineChildren()) {
30 toNGInlineNode(block->FirstChild()), 30 NGInlineNode* child = toNGInlineNode(block->FirstChild());
31 constraint_space); 31 return new NGInlineLayoutAlgorithm(style, child, constraint_space);
32 return new NGBlockLayoutAlgorithm(
33 block->Style(), toNGBlockNode(block->FirstChild()), constraint_space);
34 } 32 }
35 33 NGBlockNode* child = toNGBlockNode(block->FirstChild());
36 return new NGLegacyBlockLayoutAlgorithm(block, constraint_space); 34 return new NGBlockLayoutAlgorithm(style, child, constraint_space);
37 } 35 }
38 } 36 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698