Index: third_party/WebKit/Source/core/layout/ng/ng_layout_algorithm.cc |
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_layout_algorithm.cc b/third_party/WebKit/Source/core/layout/ng/ng_layout_algorithm.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..ea9e8b1c91796c49f733386ce5e9b5834de3dc97 |
--- /dev/null |
+++ b/third_party/WebKit/Source/core/layout/ng/ng_layout_algorithm.cc |
@@ -0,0 +1,43 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "core/layout/ng/ng_layout_algorithm.h" |
+ |
+#include "core/layout/ng/ng_block_break_token.h" |
+#include "core/layout/ng/ng_block_node.h" |
+#include "core/layout/ng/ng_inline_break_token.h" |
+#include "core/layout/ng/ng_inline_node.h" |
+#include "core/layout/ng/ng_length_utils.h" |
+ |
+namespace blink { |
+ |
+template <typename NGInputNodeType, typename NGBreakTokenType> |
kojii
2017/04/06 13:44:52
I'm probably missing something but can you explain
Gleb Lanbin
2017/04/06 16:35:36
Acknowledged.
|
+NGBoxStrut |
+NGLayoutAlgorithm<NGInputNodeType, NGBreakTokenType>::ComputeMarginsForChild( |
ikilpatrick
2017/04/06 16:24:31
So I don't think we want to pull this down into th
Gleb Lanbin
2017/04/06 16:35:36
Acknowledged.
|
+ const NGConstraintSpace& space, |
+ NGLayoutInputNode* child) { |
+ DCHECK(child); |
+ const ComputedStyle& child_style = child->Style(); |
kojii
2017/04/06 13:44:52
This doesn't look right to me...NGInlineNode::Styl
Gleb Lanbin
2017/04/06 16:35:36
Acknowledged.
|
+ |
+ WTF::Optional<MinMaxContentSize> sizes; |
+ if (NeedMinMaxContentSize(space, child_style)) |
+ sizes = child->ComputeMinMaxContentSize(); |
+ |
+ LayoutUnit child_inline_size = |
+ ComputeInlineSizeForFragment(space, child_style, sizes); |
+ NGBoxStrut margins = ComputeMargins(space, child_style, space.WritingMode(), |
+ space.Direction()); |
+ ApplyAutoMargins(space, child_style, child_inline_size, &margins); |
+ return margins; |
+} |
+template NGBoxStrut |
+NGLayoutAlgorithm<NGBlockNode, NGBlockBreakToken>::ComputeMarginsForChild( |
+ NGConstraintSpace const&, |
+ NGLayoutInputNode*); |
+template NGBoxStrut |
+NGLayoutAlgorithm<NGInlineNode, NGInlineBreakToken>::ComputeMarginsForChild( |
+ NGConstraintSpace const&, |
+ NGLayoutInputNode*); |
+ |
+} // namespace blink |