Chromium Code Reviews| 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 f73475e43a4b7ef73881966f2c7e1e216ec1397f..178dd138478ca0dd7f576c76c9319eded546f6bf 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,12 +23,18 @@ NGFragment* NGBlockLayoutAlgorithm::layout( |
| const NGConstraintSpace& constraintSpace) { |
| LayoutUnit inlineSize = |
| computeInlineSizeForFragment(constraintSpace, *m_style); |
| + // TODO(layout-ng): For quirks mode, should we pass blockSize instead of -1? |
|
eae
2016/08/23 16:54:09
Might make sense to have a NGQuirksModeBlockLayout
|
| + LayoutUnit blockSize = |
| + computeBlockSizeForFragment(constraintSpace, *m_style, LayoutUnit(-1)); |
| + NGConstraintSpace constraint_space_for_children( |
| + constraintSpace, NGLogicalSize(inlineSize, blockSize)); |
| HeapVector<Member<const NGFragmentBase>> childFragments; |
| LayoutUnit contentSize; |
| for (NGBox box : m_boxIterator) { |
| - NGBoxMargins childMargins = computeMargins(constraintSpace, *box.style()); |
| - NGFragment* fragment = box.layout(constraintSpace); |
| + NGBoxMargins childMargins = |
| + computeMargins(constraint_space_for_children, *box.style()); |
| + NGFragment* fragment = box.layout(constraint_space_for_children); |
| // TODO(layout-ng): Support auto margins |
| fragment->setOffset(childMargins.inlineStart, |
| contentSize + childMargins.blockStart); |
| @@ -37,7 +43,8 @@ NGFragment* NGBlockLayoutAlgorithm::layout( |
| childFragments.append(fragment); |
| } |
| - LayoutUnit blockSize = |
| + // Recompute the block-axis size now that we know our content size. |
| + blockSize = |
| computeBlockSizeForFragment(constraintSpace, *m_style, contentSize); |
| NGFragment* returnFragment = |
| new NGFragment(inlineSize, blockSize, inlineSize, blockSize, |