Index: third_party/WebKit/Source/core/layout/ng/ng_block_node.cc |
diff --git a/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc b/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc |
index 771d4b449c00ae8661b59847ac5bb3008f25436e..0727c5582c6310755cce40607085a59eeb20fe01 100644 |
--- a/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc |
+++ b/third_party/WebKit/Source/core/layout/ng/ng_block_node.cc |
@@ -135,7 +135,10 @@ RefPtr<NGLayoutResult> NGBlockNode::Layout(NGConstraintSpace* constraint_space, |
RefPtr<NGLayoutResult> layout_result = |
LayoutWithAlgorithm(Style(), *this, constraint_space, break_token); |
- CopyFragmentDataToLayoutBox(*constraint_space, layout_result.Get()); |
+ if (layout_result->Status() == NGLayoutResult::kSuccess && |
+ layout_result->UnpositionedFloats().IsEmpty()) |
+ CopyFragmentDataToLayoutBox(*constraint_space, layout_result.Get()); |
+ |
return layout_result; |
} |
@@ -283,10 +286,16 @@ void NGBlockNode::CopyFragmentDataToLayoutBox( |
if (child_fragment->IsPlaced()) |
FragmentPositionUpdated(ToNGPhysicalBoxFragment(*child_fragment)); |
- for (const NGPositionedFloat& positioned_float : |
- ToNGPhysicalBoxFragment(child_fragment.Get())->PositionedFloats()) { |
- FloatingObjectPositionedUpdated( |
- positioned_float, ToLayoutBox(child_fragment->GetLayoutObject())); |
+ if (child_fragment->GetLayoutObject()->IsLayoutBlockFlow()) |
+ ToLayoutBlockFlow(child_fragment->GetLayoutObject()) |
+ ->AddOverflowFromFloats(); |
+ |
+ if (child_fragment->GetLayoutObject() == box_) { |
eae
2017/07/10 23:27:49
When would this be false?
ikilpatrick
2017/07/11 17:20:41
So this is actually for the _child_, i.e.
NGBoxFr
|
+ for (const NGPositionedFloat& positioned_float : |
+ ToNGPhysicalBoxFragment(child_fragment.Get())->PositionedFloats()) { |
+ FloatingObjectPositionedUpdated( |
+ positioned_float, ToLayoutBox(child_fragment->GetLayoutObject())); |
+ } |
} |
} |
@@ -303,7 +312,11 @@ void NGBlockNode::CopyFragmentDataToLayoutBox( |
box_->ClearNeedsLayout(); |
if (box_->IsLayoutBlockFlow()) { |
- ToLayoutBlockFlow(box_)->UpdateIsSelfCollapsing(); |
+ LayoutBlockFlow* block_flow = ToLayoutBlockFlow(box_); |
+ block_flow->UpdateIsSelfCollapsing(); |
+ |
+ if (block_flow->CreatesNewFormattingContext()) |
+ block_flow->AddOverflowFromFloats(); |
} |
} |