Commit 5350ec36 authored by Ian Kilpatrick's avatar Ian Kilpatrick Committed by Commit Bot

[LayoutNG] Ignore margins when determining if a new-fc will fit in a layout opportunity.

Previously we calculated layout opportunities by shrinking the available
child space by the child's margins.

This resulted in layout opportunities which were too small, and would
push the new formatting context down to the next opportunity.

This logic now allows margins to "overhang" a layout opportunity.

At the same time I refactored a lot of the code, as we were
adding/subtracting margins for different calculations. Hopefully this
is more readable!

Bug: 1003193
Change-Id: I6c05b050332afe9880ca7d9a5b426b4b94fde3f5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1808661
Commit-Queue: Ian Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: default avatarMorten Stenshorne <mstensho@chromium.org>
Cr-Commit-Position: refs/heads/master@{#698954}
parent c412e9bb
......@@ -173,12 +173,13 @@ class CORE_EXPORT NGBlockLayoutAlgorithm
// Performs the actual layout of a new formatting context. This may be called
// multiple times from HandleNewFormattingContext.
std::pair<scoped_refptr<const NGLayoutResult>, NGLayoutOpportunity>
LayoutNewFormattingContext(NGLayoutInputNode child,
const NGBreakToken* child_break_token,
const NGInflowChildData&,
NGBfcOffset origin_offset,
bool abort_if_cleared);
scoped_refptr<const NGLayoutResult> LayoutNewFormattingContext(
NGLayoutInputNode child,
const NGBreakToken* child_break_token,
const NGInflowChildData&,
NGBfcOffset origin_offset,
bool abort_if_cleared,
NGBfcOffset* out_child_bfc_offset);
// Handle an in-flow child.
// Returns false if we need to abort layout, because a previously unknown BFC
......
......@@ -10,6 +10,7 @@ crbug.com/591099 external/wpt/css/CSS2/abspos/hypothetical-box-dynamic.html [ Fa
crbug.com/591099 external/wpt/css/CSS2/floats/float-nowrap-3.html [ Failure ]
crbug.com/591099 external/wpt/css/CSS2/floats/floats-line-wrap-shifted-001.html [ Failure ]
crbug.com/591099 external/wpt/css/CSS2/floats/overhanging-float-paint-order.html [ Failure ]
crbug.com/591099 external/wpt/css/CSS2/floats/zero-width-floats-positioning.tentative.html [ Failure ]
### external/wpt/css/CSS2/floats-clear/
crbug.com/591099 external/wpt/css/CSS2/floats-clear/no-clearance-adjoining-opposite-float.html [ Failure ]
......
<!DOCTYPE html>
<link rel="help" href="https://www.w3.org/TR/CSS22/visuren.html#bfc-next-to-float" title="9.5 Floats">
<meta name="assert" content="The new formatting context's margin-right does not push it down to the next area.">
<link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div style="width: 100px; height: 100px; background: red; direction: rtl;">
<div style="float: left; width: 50px; height: 100px; background: green;"></div>
<div style="overflow: hidden; height: 100px; margin-left: -20px; background: green;"></div>
</div>
<!DOCTYPE html>
<link rel="help" href="https://www.w3.org/TR/CSS22/visuren.html#bfc-next-to-float" title="9.5 Floats">
<meta name="assert" content="The new formatting context's margin-right does not push it down to the next area.">
<link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div style="width: 100px; height: 100px; background: red;">
<div style="float:left; width:50px; height:100px; background:green;"></div>
<div style="overflow: hidden; margin-right: 1px; width:50px; height:100px; background:green;"></div>
</div>
......@@ -4,7 +4,7 @@
<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-100px-square-only.html">
<p>Test passes if there is a filled green square.</p>
<div style="margin-left: 50px; width: 125px;">
<div style="width: 125px;">
<div style="float: left; width: 0px; height: 50px;"></div>
<div style="float: right; clear: left; width: 25px; height: 50px;"></div>
<div style="overflow: hidden; margin-left: -50px; height: 100px; background: green;"></div>
......
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