Index: third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc |
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc |
index b66e1967aa737344d900025f1c0fcd08555507e9..f73475e43a4b7ef73881966f2c7e1e216ec1397f 100644 |
--- a/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc |
+++ b/third_party/WebKit/Source/core/layout/ng/ng_block_layout_algorithm.cc |
@@ -8,6 +8,7 @@ |
#include "core/layout/ng/ng_constraint_space.h" |
#include "core/layout/ng/ng_fragment.h" |
#include "core/layout/ng/ng_length_utils.h" |
+#include "core/layout/ng/ng_margin_strut.h" |
#include "core/style/ComputedStyle.h" |
#include "platform/LengthFunctions.h" |
@@ -26,11 +27,13 @@ NGFragment* NGBlockLayoutAlgorithm::layout( |
HeapVector<Member<const NGFragmentBase>> childFragments; |
LayoutUnit contentSize; |
for (NGBox box : m_boxIterator) { |
+ NGBoxMargins childMargins = computeMargins(constraintSpace, *box.style()); |
NGFragment* fragment = box.layout(constraintSpace); |
- // TODO(layout-ng): Take margins into account |
- fragment->setOffset(LayoutUnit(), contentSize); |
+ // TODO(layout-ng): Support auto margins |
+ fragment->setOffset(childMargins.inlineStart, |
+ contentSize + childMargins.blockStart); |
box.positionUpdated(*fragment); |
- contentSize += fragment->blockSize(); |
+ contentSize += fragment->blockSize() + childMargins.blockSum(); |
childFragments.append(fragment); |
} |