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 123efd1d75ff8929fa4a54b211d66745c9054684..7eea9c52ca863396c53434393f74e831c802f935 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 |
@@ -127,9 +127,19 @@ NGLogicalOffset PositionFloat(NGFloatingObject* floating_object, |
toNGPhysicalBoxFragment(floating_object->fragment.get())); |
// Find a layout opportunity that will fit our float. |
- const NGLayoutOpportunity opportunity = FindLayoutOpportunityForFragment( |
+ NGLayoutOpportunity opportunity = FindLayoutOpportunityForFragment( |
new_parent_space, float_fragment, floating_object); |
- DCHECK(!opportunity.IsEmpty()) << "Opportunity is empty but it shouldn't be"; |
+ |
+ // TODO(glebl): This should check for infinite opportunity instead. |
+ if (opportunity.IsEmpty()) { |
+ // Because of the implementation specific of the layout opportunity iterator |
+ // an empty opportunity can mean 2 things: |
+ // - search for layout opportunities is exhausted. |
+ // - opportunity has an infinite size. That's because CS is infinite. |
+ opportunity = NGLayoutOpportunity( |
+ NGLogicalOffset(), |
+ NGLogicalSize(float_fragment.InlineSize(), float_fragment.BlockSize())); |
+ } |
// Calculate the float offset if needed. |
LayoutUnit float_offset; |