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

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

Issue 2664383003: [LayoutNG] Make NGBlockNode return a const style reference. (Closed)
Patch Set: . Created 3 years, 10 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
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_layout_algorithm.h" 10 #include "core/layout/ng/ng_inline_layout_algorithm.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_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 if (!block->CanUseNewLayout()) 26 if (!block->CanUseNewLayout())
27 return new NGLegacyBlockLayoutAlgorithm(block, constraint_space); 27 return new NGLegacyBlockLayoutAlgorithm(block, constraint_space);
28 const ComputedStyle* style = block->Style(); 28 const ComputedStyle& style = block->Style();
29 LayoutObject* layout_object = input_node->GetLayoutObject(); 29 LayoutObject* layout_object = input_node->GetLayoutObject();
30 if (block->HasInlineChildren()) { 30 if (block->HasInlineChildren()) {
31 NGInlineNode* child = toNGInlineNode(block->FirstChild()); 31 NGInlineNode* child = toNGInlineNode(block->FirstChild());
32 return new NGInlineLayoutAlgorithm(layout_object, style, child, 32 return new NGInlineLayoutAlgorithm(layout_object, &style, child,
33 constraint_space); 33 constraint_space);
34 } 34 }
35 NGBlockNode* child = toNGBlockNode(block->FirstChild()); 35 NGBlockNode* child = toNGBlockNode(block->FirstChild());
36 // TODO(layout-ng): The break token should be passed as an argument to this 36 // TODO(layout-ng): The break token should be passed as an argument to this
37 // method instead of getting it from the NGBlockNode 37 // method instead of getting it from the NGBlockNode
38 NGBreakToken* token = block->CurrentBreakToken(); 38 NGBreakToken* token = block->CurrentBreakToken();
39 return new NGBlockLayoutAlgorithm(layout_object, style, child, 39 return new NGBlockLayoutAlgorithm(layout_object, &style, child,
40 constraint_space, token); 40 constraint_space, token);
41 } 41 }
42 } 42 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698