Commit 690cb481 authored by mstensho's avatar mstensho Committed by Commit bot

[LayoutNG] Make NGLayoutInputNode::AlgorithmForInputNode() more readable.

Use early returns and variables to avoid unwanted line breaks in statements.

Review-Url: https://codereview.chromium.org/2631513002
Cr-Commit-Position: refs/heads/master@{#443284}
parent b0002b84
...@@ -23,16 +23,14 @@ NGLayoutAlgorithm* NGLayoutInputNode::AlgorithmForInputNode( ...@@ -23,16 +23,14 @@ NGLayoutAlgorithm* NGLayoutInputNode::AlgorithmForInputNode(
// it makes sense to do this here. // it makes sense to do this here.
DCHECK(input_node->Type() == kLegacyBlock); DCHECK(input_node->Type() == kLegacyBlock);
NGBlockNode* block = toNGBlockNode(input_node); NGBlockNode* block = toNGBlockNode(input_node);
if (!block->CanUseNewLayout())
if (block->CanUseNewLayout()) { return new NGLegacyBlockLayoutAlgorithm(block, constraint_space);
if (block->HasInlineChildren()) const ComputedStyle* style = block->Style();
return new NGInlineLayoutAlgorithm(block->Style(), if (block->HasInlineChildren()) {
toNGInlineNode(block->FirstChild()), NGInlineNode* child = toNGInlineNode(block->FirstChild());
constraint_space); return new NGInlineLayoutAlgorithm(style, child, constraint_space);
return new NGBlockLayoutAlgorithm(
block->Style(), toNGBlockNode(block->FirstChild()), constraint_space);
} }
NGBlockNode* child = toNGBlockNode(block->FirstChild());
return new NGLegacyBlockLayoutAlgorithm(block, constraint_space); return new NGBlockLayoutAlgorithm(style, child, constraint_space);
} }
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment