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..3607bcd5b5e342b6d8286ec16c162014ae9c01f4 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 |
@@ -47,7 +47,7 @@ bool NGBlockLayoutAlgorithm::Layout(const NGConstraintSpace* constraint_space, |
constraint_space_for_children_ = |
new NGConstraintSpace(*constraint_space, NGLogicalOffset(), |
NGLogicalSize(inline_size, block_size)); |
- content_size_ = LayoutUnit(); |
+ content_size_ = computeBorderAndPaddingBefore(*constraint_space, *style_); |
builder_ = new NGFragmentBuilder(NGPhysicalFragmentBase::FragmentBox); |
builder_->SetInlineSize(inline_size).SetBlockSize(block_size); |
@@ -66,10 +66,16 @@ bool NGBlockLayoutAlgorithm::Layout(const NGConstraintSpace* constraint_space, |
LayoutUnit margin_block_start = |
CollapseMargins(child_margins, fragment->MarginStrut()); |
+ // TODO(layout-ng): This is probably something we shouldn't calculate |
+ // over and over again for each child. |
+ LayoutUnit content_start_edge = |
+ computeBorderAndPaddingStart(*constraint_space, *style_); |
+ |
// TODO(layout-ng): Support auto margins |
- builder_->AddChild(fragment, |
- NGLogicalOffset(child_margins.inline_start, |
- content_size_ + margin_block_start)); |
+ builder_->AddChild( |
+ fragment, |
+ NGLogicalOffset(content_start_edge + child_margins.inline_start, |
+ content_size_ + margin_block_start)); |
content_size_ += fragment->BlockSize() + margin_block_start; |
max_inline_size_ = |