Commit 08916fed authored by Morten Stenshorne's avatar Morten Stenshorne Committed by Commit Bot

[LayoutNG] Don't add zero-width floats to the exclusion space.

The only thing such floats should affect is the block position of
subsequent floats (float rule §5 [1] and clearance). They should not
affect the inline position or inline size of subsequent floats or new
formatting contexts.

The spec isn't actually clear here, although the browsers agree on the
above. Submitted https://github.com/w3c/csswg-drafts/issues/2312

[1] https://www.w3.org/TR/CSS22/visuren.html#float-position

Cq-Include-Trybots: master.tryserver.chromium.linux:linux_layout_tests_layout_ng
Change-Id: Ia9e724c8a58fcb017f86f26bdf90394f09414f4e
Reviewed-on: https://chromium-review.googlesource.com/919065Reviewed-by: default avatarIan Kilpatrick <ikilpatrick@chromium.org>
Commit-Queue: Morten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#537274}
parent 4eaf12cd
...@@ -2362,7 +2362,6 @@ crbug.com/591099 fast/block/basic/quirk-percent-height-grandchild.html [ Failure ...@@ -2362,7 +2362,6 @@ crbug.com/591099 fast/block/basic/quirk-percent-height-grandchild.html [ Failure
crbug.com/591099 fast/block/basic/quirk-percent-height-table-cell.html [ Failure ] crbug.com/591099 fast/block/basic/quirk-percent-height-table-cell.html [ Failure ]
crbug.com/591099 fast/block/block-add-child-crash.html [ Crash ] crbug.com/591099 fast/block/block-add-child-crash.html [ Crash ]
crbug.com/591099 fast/block/block-width-recalc-with-relative-height.html [ Failure ] crbug.com/591099 fast/block/block-width-recalc-with-relative-height.html [ Failure ]
crbug.com/591099 fast/block/containing-block-negative-margins.html [ Failure ]
crbug.com/591099 fast/block/float-avoids-padding-inline-ancestors.html [ Crash ] crbug.com/591099 fast/block/float-avoids-padding-inline-ancestors.html [ Crash ]
crbug.com/810335 fast/block/float/003.html [ Failure ] crbug.com/810335 fast/block/float/003.html [ Failure ]
crbug.com/591099 fast/block/float/br-with-clear-2.html [ Failure ] crbug.com/591099 fast/block/float/br-with-clear-2.html [ Failure ]
......
<!DOCTYPE html>
<title>Zero width floats</title>
<link rel="author" title="Morten Stenshorne" href="mstensho@chromium.org">
<link rel="help" href="https://www.w3.org/TR/CSS22/visudet.html#float-width" title="10.3.5 Floating, non-replaced elements">
<link rel="match" href="../../reference/ref-filled-green-200px-square.html">
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div style="margin-left:50px; width:100px;">
<div style="float:left; width:0; height:50px;"></div>
<div style="float:right; clear:left; width:0; height:150px;"></div>
<div style="overflow:hidden; margin:0 -50px; height:100px; background:green;"></div>
</div>
<div style="position:relative; top:-100px; overflow:hidden; clear:both; width:200px; height:100px; background:green;"></div>
...@@ -172,6 +172,12 @@ void NGExclusionSpace::Add(scoped_refptr<const NGExclusion> exclusion) { ...@@ -172,6 +172,12 @@ void NGExclusionSpace::Add(scoped_refptr<const NGExclusion> exclusion) {
std::max(right_float_clear_offset_, exclusion->rect.BlockEndOffset()); std::max(right_float_clear_offset_, exclusion->rect.BlockEndOffset());
} }
// If the exclusion takes up no inline space, we shouldn't pay any further
// attention to it. The only thing it can affect is block-axis positioning of
// subsequent floats (dealt with above).
if (exclusion->rect.LineEndOffset() <= exclusion->rect.LineStartOffset())
return;
#if DCHECK_IS_ON() #if DCHECK_IS_ON()
bool inserted = false; bool inserted = false;
#endif #endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment