| Index: third_party/WebKit/Source/core/layout/ng/ng_floats_utils.cc
|
| diff --git a/third_party/WebKit/Source/core/layout/ng/ng_floats_utils.cc b/third_party/WebKit/Source/core/layout/ng/ng_floats_utils.cc
|
| index 2f77bb3282685b38755ae907f2f7b19d240aad42..a7dc3b25074bdf3b5de52abcea4dff95e304ac59 100644
|
| --- a/third_party/WebKit/Source/core/layout/ng/ng_floats_utils.cc
|
| +++ b/third_party/WebKit/Source/core/layout/ng/ng_floats_utils.cc
|
| @@ -5,6 +5,7 @@
|
| #include "core/layout/ng/ng_floats_utils.h"
|
|
|
| #include "core/layout/ng/ng_box_fragment.h"
|
| +#include "core/layout/ng/ng_layout_opportunity_iterator.h"
|
|
|
| namespace blink {
|
| namespace {
|
| @@ -39,31 +40,15 @@ NGLogicalOffset AdjustToTopEdgeAlignmentRule(const NGConstraintSpace& space,
|
| // @param floating_object Floating object for which we need to find a layout
|
| // opportunity.
|
| // @return Layout opportunity for the fragment.
|
| -const NGLayoutOpportunity FindLayoutOpportunityForFragment(
|
| +const NGLayoutOpportunity FindLayoutOpportunityForFloat(
|
| const NGConstraintSpace* space,
|
| const NGFragment& fragment,
|
| const NGFloatingObject* floating_object) {
|
| NGLogicalOffset adjusted_origin_point =
|
| AdjustToTopEdgeAlignmentRule(*space, floating_object->origin_offset);
|
| -
|
| - NGLayoutOpportunityIterator opportunity_iter(space->Exclusions().get(),
|
| - floating_object->available_size,
|
| - adjusted_origin_point);
|
| - NGLayoutOpportunity opportunity;
|
| - NGLayoutOpportunity opportunity_candidate = opportunity_iter.Next();
|
| -
|
| - NGBoxStrut margins = floating_object->margins;
|
| - while (!opportunity_candidate.IsEmpty()) {
|
| - opportunity = opportunity_candidate;
|
| - // Checking opportunity's block size is not necessary as a float cannot be
|
| - // positioned on top of another float inside of the same constraint space.
|
| - auto fragment_inline_size = fragment.InlineSize() + margins.InlineSum();
|
| - if (opportunity.size.inline_size >= fragment_inline_size)
|
| - break;
|
| -
|
| - opportunity_candidate = opportunity_iter.Next();
|
| - }
|
| - return opportunity;
|
| + return FindLayoutOpportunityForFragment(
|
| + space->Exclusions().get(), floating_object->available_size,
|
| + adjusted_origin_point, floating_object->margins, fragment);
|
| }
|
|
|
| // Calculates the logical offset for opportunity.
|
| @@ -128,7 +113,7 @@ NGLogicalOffset PositionFloat(NGFloatingObject* floating_object,
|
| ToNGPhysicalBoxFragment(floating_object->fragment.Get()));
|
|
|
| // Find a layout opportunity that will fit our float.
|
| - NGLayoutOpportunity opportunity = FindLayoutOpportunityForFragment(
|
| + NGLayoutOpportunity opportunity = FindLayoutOpportunityForFloat(
|
| new_parent_space, float_fragment, floating_object);
|
|
|
| // TODO(glebl): This should check for infinite opportunity instead.
|
|
|