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

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

Issue 2668183003: [LayoutNG] Make NG algorithms non-oilpan. (Closed)
Patch Set: fix win compile 2? 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "core/layout/ng/ng_layout_input_node.h"
6
7 #include "core/layout/ng/ng_block_layout_algorithm.h"
8 #include "core/layout/ng/ng_block_node.h"
9 #include "core/layout/ng/ng_constraint_space.h"
10 #include "core/layout/ng/ng_inline_layout_algorithm.h"
11 #include "core/layout/ng/ng_inline_node.h"
12 #include "core/layout/ng/ng_layout_algorithm.h"
13 #include "core/layout/ng/ng_legacy_block_layout_algorithm.h"
14 #include "core/style/ComputedStyle.h"
15
16 namespace blink {
17
18 NGLayoutAlgorithm* NGLayoutInputNode::AlgorithmForInputNode(
19 NGLayoutInputNode* input_node,
20 NGConstraintSpace* constraint_space) {
21 // At least for now, this should never be called on LegacyInline
22 // children. However, there will be other kinds of input_node so
23 // it makes sense to do this here.
24 DCHECK(input_node->Type() == kLegacyBlock);
25 NGBlockNode* block = toNGBlockNode(input_node);
26 if (!block->CanUseNewLayout())
27 return new NGLegacyBlockLayoutAlgorithm(block, constraint_space);
28 const ComputedStyle& style = block->Style();
29 LayoutObject* layout_object = input_node->GetLayoutObject();
30 if (block->HasInlineChildren()) {
31 NGInlineNode* child = toNGInlineNode(block->FirstChild());
32 return new NGInlineLayoutAlgorithm(layout_object, &style, child,
33 constraint_space);
34 }
35 NGBlockNode* child = toNGBlockNode(block->FirstChild());
36 // TODO(layout-ng): The break token should be passed as an argument to this
37 // method instead of getting it from the NGBlockNode
38 NGBreakToken* token = block->CurrentBreakToken();
39 return new NGBlockLayoutAlgorithm(layout_object, &style, child,
40 constraint_space, token);
41 }
42 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698