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 846f71ddd145d63e0ad014cd8e8e983358163f8b..45e959ef1f60657a42347f4f22e36371dc2652d5 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 |
@@ -297,6 +297,19 @@ RefPtr<NGLayoutResult> NGBlockLayoutAlgorithm::Layout() { |
end_margin_strut.Sum()); |
end_margin_strut = NGMarginStrut(); |
} |
+ |
+ // If the current layout is a new formatting context, we need to encapsulate |
+ // all of our floats. |
+ if (ConstraintSpace().IsNewFormattingContext()) { |
+ // We can use the BFC coordinates, as we are a new formatting context. |
+ DCHECK_EQ(container_builder_.BfcOffset().value(), NGLogicalOffset()); |
+ |
+ WTF::Optional<LayoutUnit> float_end_offset = |
+ GetClearanceOffset(ConstraintSpace().Exclusions(), EClear::kBoth); |
+ if (float_end_offset) |
+ content_size_ = std::max(content_size_, float_end_offset.value()); |
+ } |
+ |
content_size_ += border_scrollbar_padding_.block_end; |
// Recompute the block-axis size now that we know our content size. |