A float avoider should never take a vertical position where a float is present even when its used width is zero
https://bugs.webkit.org/show_bug.cgi?id=238895
Reviewed by Antti Koivisto.
Source/WebCore:
A zero width available space is never a valid vertical position for a float avoider even when its width is zero too.
Test: fast/block/float/float-avoider-with-zero-width.html
* rendering/RenderBlockFlow.cpp:
(WebCore::RenderBlockFlow::getClearDelta): skip and check the next candidate poisition when no space is available.
LayoutTests:
* TestExpectations: inline-size-bfc-floats.html: never produced correct rendering, the red box just happened to be hidden (which made this test pass).
* fast/block/float/float-avoider-with-zero-width-expected.html: Added.
* fast/block/float/float-avoider-with-zero-width.html: Added.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@292532 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/rendering/RenderBlockFlow.cpp b/Source/WebCore/rendering/RenderBlockFlow.cpp
index 878638b..a272a7a 100644
--- a/Source/WebCore/rendering/RenderBlockFlow.cpp
+++ b/Source/WebCore/rendering/RenderBlockFlow.cpp
@@ -2843,7 +2843,8 @@
child.setMarginLeft(childOldMarginLeft);
child.setMarginRight(childOldMarginRight);
- if (childLogicalWidthAtNewLogicalTopOffset <= availableLogicalWidthAtNewLogicalTopOffset) {
+ auto shouldAvoidCurrentVerticalPosition = !availableLogicalWidthAtNewLogicalTopOffset || childLogicalWidthAtNewLogicalTopOffset > availableLogicalWidthAtNewLogicalTopOffset;
+ if (!shouldAvoidCurrentVerticalPosition) {
// Even though we may not be moving, if the logical width did shrink because of the presence of new floats, then
// we need to force a relayout as though we shifted. This happens because of the dynamic addition of overhanging floats
// from previous siblings when negative margins exist on a child (see the addOverhangingFloats call at the end of collapseMargins).