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 894b00c4a227a8802d92a137f327495286c620c4..d21d3927d98c5334f4b181dc4381a835d60bcfdf 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 |
@@ -23,13 +23,23 @@ NGFragment* NGBlockLayoutAlgorithm::layout( |
LayoutUnit inlineSize = |
computeInlineSizeForFragment(constraintSpace, *m_style); |
+ HeapVector<Member<const NGFragmentBase>> childFragments; |
+ |
+ LayoutUnit contentSize; |
for (NGBox curr = m_firstChild; curr; curr.nextSibling()) { |
- curr.layout(constraintSpace); |
+ NGFragment* fragment = curr.layout(constraintSpace); |
+ // TODO(layout-ng): Take margins into account |
+ fragment->setOffset(LayoutUnit(), contentSize); |
+ contentSize += fragment->blockSize(); |
+ childFragments.append(fragment); |
} |
LayoutUnit blockSize = |
- computeBlockSizeForFragment(constraintSpace, *m_style, LayoutUnit()); |
- return new NGFragment(inlineSize, blockSize, inlineSize, blockSize); |
+ computeBlockSizeForFragment(constraintSpace, *m_style, contentSize); |
+ NGFragment* returnFragment = |
+ new NGFragment(inlineSize, blockSize, inlineSize, blockSize); |
+ returnFragment->swapChildren(childFragments); |
+ return returnFragment; |
} |
} // namespace blink |