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 ae4722e5639624aede739e87e0b97c50998941fa..7802a947690f6703c24801e81f04ca18f931363a 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 |
| @@ -38,16 +38,20 @@ bool NGBlockLayoutAlgorithm::Layout(const NGConstraintSpace* constraint_space, |
| NGPhysicalFragment** out) { |
| switch (state_) { |
| case kStateInit: { |
| + border_and_padding_ = |
| + computeBorders(*style_) + computePadding(*constraint_space, *style_); |
| + |
| LayoutUnit inline_size = |
| computeInlineSizeForFragment(*constraint_space, *style_); |
| // TODO(layout-ng): For quirks mode, should we pass blockSize instead of |
| // -1? |
| LayoutUnit block_size = computeBlockSizeForFragment( |
| *constraint_space, *style_, LayoutUnit(-1)); |
| - constraint_space_for_children_ = |
| - new NGConstraintSpace(*constraint_space, NGLogicalOffset(), |
| - NGLogicalSize(inline_size, block_size)); |
| - content_size_ = LayoutUnit(); |
| + constraint_space_for_children_ = new NGConstraintSpace( |
| + *constraint_space, NGLogicalOffset(), |
| + NGLogicalSize(inline_size - border_and_padding_.inline_start, |
|
mstensho (USE GERRIT)
2016/09/12 20:05:50
I may lack some understanding of how this thing wo
cbiesinger
2016/09/13 18:04:54
Great point! That should be changed, thanks.
|
| + block_size - border_and_padding_.block_start)); |
| + content_size_ = border_and_padding_.block_start; |
| builder_ = new NGFragmentBuilder(NGPhysicalFragmentBase::FragmentBox); |
| builder_->SetInlineSize(inline_size).SetBlockSize(block_size); |
| @@ -68,13 +72,15 @@ bool NGBlockLayoutAlgorithm::Layout(const NGConstraintSpace* constraint_space, |
| // TODO(layout-ng): Support auto margins |
| builder_->AddChild(fragment, |
| - NGLogicalOffset(child_margins.inline_start, |
| + NGLogicalOffset(border_and_padding_.inline_start + |
| + child_margins.inline_start, |
| content_size_ + margin_block_start)); |
| content_size_ += fragment->BlockSize() + margin_block_start; |
| max_inline_size_ = |
| - std::max(max_inline_size_, |
| - fragment->InlineSize() + child_margins.InlineSum()); |
| + std::max(max_inline_size_, fragment->InlineSize() + |
| + child_margins.InlineSum() + |
| + border_and_padding_.InlineSum()); |
| current_child_ = current_child_->NextSibling(); |
| if (current_child_) |
| return false; |
| @@ -83,6 +89,7 @@ bool NGBlockLayoutAlgorithm::Layout(const NGConstraintSpace* constraint_space, |
| return false; |
| } |
| case kStateFinalize: { |
| + content_size_ += border_and_padding_.block_end; |
| // Recompute the block-axis size now that we know our content size. |
| LayoutUnit block_size = computeBlockSizeForFragment( |
| *constraint_space, *style_, content_size_); |