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 e4f148ad47b744dc0ff123f04fbb55dd2f2b188d..9dae0ce353e93100f5433eb0e85a0df1ea1b7238 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 |
@@ -344,8 +344,11 @@ NGLogicalOffset NGBlockLayoutAlgorithm::PrepareChildLayout( |
curr_margin_strut_.Append(curr_child_margins_.block_start); |
} |
- // Should collapse margins if inline. |
- if (child->IsInline()) { |
+ bool is_legacy_block = |
+ child->IsBlock() && !ToNGBlockNode(child)->CanUseNewLayout(); |
+ |
+ // Should collapse margins if inline or legacy block |
+ if (child->IsInline() || is_legacy_block) { |
curr_bfc_offset_.block_offset += curr_margin_strut_.Sum(); |
MaybeUpdateFragmentBfcOffset(ConstraintSpace(), curr_bfc_offset_, |
&container_builder_); |