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 a5cd8189476db4b88d20f3630328abff73dc1565..a7d1b70392b3b6e94edf6492e1f7758a0b20bbcb 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 |
@@ -194,6 +194,7 @@ RefPtr<NGLayoutResult> NGBlockLayoutAlgorithm::Layout() { |
UpdateFragmentBfcOffset(curr_bfc_offset_); |
DCHECK_EQ(builder_.BfcOffset().value(), NGLogicalOffset()); |
DCHECK_EQ(curr_margin_strut_, NGMarginStrut()); |
+ curr_bfc_offset_ = {}; |
ikilpatrick
2017/03/24 21:17:34
can you add a todo here that this should be a DCHE
Gleb Lanbin
2017/03/24 21:49:36
Done.
|
} |
curr_bfc_offset_.block_offset += content_size_; |
@@ -347,7 +348,8 @@ void NGBlockLayoutAlgorithm::FinishChildLayout( |
toNGBlockNode(child)->Style().isFloating()) { |
RefPtr<NGFloatingObject> floating_object = NGFloatingObject::Create( |
child_space, constraint_space_, toNGBlockNode(child)->Style(), |
- curr_child_margins_, layout_result->PhysicalFragment().get()); |
+ curr_child_margins_, child_space->AvailableSize(), |
+ layout_result->PhysicalFragment().get()); |
builder_.AddUnpositionedFloat(floating_object); |
// No need to postpone the positioning if we know the correct offset. |
if (builder_.BfcOffset()) { |
@@ -486,8 +488,8 @@ RefPtr<NGConstraintSpace> NGBlockLayoutAlgorithm::CreateConstraintSpaceForChild( |
const ComputedStyle& child_style = toNGBlockNode(child)->Style(); |
- bool is_new_bfc = IsNewFormattingContextForInFlowBlockLevelChild( |
- ConstraintSpace(), child_style); |
+ bool is_new_bfc = |
+ IsNewFormattingContextForBlockLevelChild(ConstraintSpace(), child_style); |
space_builder_.SetIsNewFormattingContext(is_new_bfc) |
.SetBfcOffset(curr_bfc_offset_) |
.SetClearanceOffset( |
@@ -510,6 +512,9 @@ RefPtr<NGConstraintSpace> NGBlockLayoutAlgorithm::CreateConstraintSpaceForChild( |
if (is_new_bfc) { |
DCHECK(builder_.BfcOffset()); |
space_available -= curr_bfc_offset_.block_offset; |
+ // TODO(glebl): We need to reset BFCOffset in ToConstraintSpace() after we |
+ // started handling the fragmentation for floats. |
+ space_builder_.SetBfcOffset(NGLogicalOffset()); |
} |
} |
space_builder_.SetFragmentainerSpaceAvailable(space_available); |