| Index: third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.cc
|
| diff --git a/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.cc b/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.cc
|
| index f5eadaae5e4e44c9579e7eec7a547eacfb76fe4b..d5c2cb31379bc46fdee7c439d210008038f09414 100644
|
| --- a/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.cc
|
| +++ b/third_party/WebKit/Source/core/layout/ng/inline/ng_line_breaker.cc
|
| @@ -56,13 +56,16 @@ std::pair<unsigned, LayoutUnit> ShapeLineMock(
|
|
|
| } // namespace
|
|
|
| -NGLineBreaker::NGLineBreaker(NGInlineNode node,
|
| - NGConstraintSpace* space,
|
| - NGFragmentBuilder* container_builder,
|
| - const NGInlineBreakToken* break_token)
|
| +NGLineBreaker::NGLineBreaker(
|
| + NGInlineNode node,
|
| + NGConstraintSpace* space,
|
| + NGFragmentBuilder* container_builder,
|
| + Vector<RefPtr<NGUnpositionedFloat>>* unpositioned_floats,
|
| + const NGInlineBreakToken* break_token)
|
| : node_(node),
|
| constraint_space_(space),
|
| container_builder_(container_builder),
|
| + unpositioned_floats_(unpositioned_floats),
|
| item_index_(0),
|
| offset_(0),
|
| break_iterator_(node.Text()),
|
| @@ -423,17 +426,20 @@ void NGLineBreaker::HandleFloat(const NGInlineItem& item,
|
| // I.e. we may not have come across any text yet, in order to be able to
|
| // resolve the BFC position.
|
| bool float_does_not_fit =
|
| - !HasAvailableWidth() ||
|
| - position_ + inline_size + margins.InlineSum() > AvailableWidth();
|
| + (!constraint_space_->FloatsBfcOffset() ||
|
| + container_builder_->BfcOffset()) &&
|
| + (!HasAvailableWidth() ||
|
| + position_ + inline_size + margins.InlineSum() > AvailableWidth());
|
|
|
| // Check if we already have a pending float. That's because a float cannot be
|
| // higher than any block or floated box generated before.
|
| - if (!container_builder_->UnpositionedFloats().IsEmpty() ||
|
| - float_does_not_fit) {
|
| - container_builder_->AddUnpositionedFloat(unpositioned_float);
|
| + if (!unpositioned_floats_->IsEmpty() || float_does_not_fit) {
|
| + unpositioned_floats_->push_back(std::move(unpositioned_float));
|
| } else {
|
| NGLogicalOffset container_bfc_offset =
|
| - container_builder_->BfcOffset().value();
|
| + container_builder_->BfcOffset()
|
| + ? container_builder_->BfcOffset().value()
|
| + : constraint_space_->FloatsBfcOffset().value();
|
| LayoutUnit origin_block_offset =
|
| container_bfc_offset.block_offset + content_offset_.block_offset;
|
|
|
| @@ -443,7 +449,8 @@ void NGLineBreaker::HandleFloat(const NGInlineItem& item,
|
|
|
| // We need to recalculate the available_width as the float probably
|
| // consumed space on the line.
|
| - UpdateAvailableWidth();
|
| + if (container_builder_->BfcOffset())
|
| + UpdateAvailableWidth();
|
| }
|
|
|
| // Floats are already positioned in the container_builder.
|
|
|