Skip to content

Commit 98d4272

Browse files
mstenshochromium-wpt-export-bot
authored andcommitted
Handle BR clear=all correctly in block fragmentation.
BR clearance is special in that it's applied *after* the content (the line), while regular CSS clearance is about adding spacing *before* something. If clearance from a BR element crosses fragmentainer boundaries, do two things: 1. If the line has content before the BR clear element, add an additional line break before it, so that we can fit everything on the line before the BR in the correct fragmentainer. In addition to looking good, the line may contain floats, and we cannot push those ahead of us, as we'd get no progress that way! 2. Abort layout of a line with an isolated BR clear element, if it needs to be pushed to a subsequent fragmentainer, and ignore any orphans and widows requests in this case (we're creating a line that doesn't really exist, spec-wise). Layout is aborted with NGLayoutResult::kOutOfFragmentainerSpace. We were already handling kOutOfFragmentainerSpace layout abortions for new-FC children, as this was already supported for nested multicol containers. Now that we also support it for same-FC children (such as lines), we need to update the code to not assume that layout was successful. Handle block fragmentation a bit earlier (so that we'll return before attempting to access the resulting fragment), and add checks for successful layout where needed. It might be possible to add real support for trailing clearance to the block fragmentation engine, but it just seemed like an unreasonably large effort (especially maintenance-wise) for such a corner-case. This fixes the following tests in external/wpt/css/CSS2/floats-clear/ (not part of the virtual/layout_ng_block_frag/ testsuite) when LayoutNGBlockFragmentation is enabled: floats-clear-multicol-000.html floats-clear-multicol-001.html floats-clear-multicol-balancing-000.html floats-clear-multicol-balancing-001.html Bug: 829028 Change-Id: If3ebb307cac4afd388e5edfc2ac576510afe283e Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3168884 Commit-Queue: Morten Stenshorne <[email protected]> Reviewed-by: Ian Kilpatrick <[email protected]> Reviewed-by: Koji Ishii <[email protected]> Cr-Commit-Position: refs/heads/main@{#923551}
1 parent bc1925d commit 98d4272

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

css/css-break/br-clear-all.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<!DOCTYPE html>
2+
<link rel="author" title="Morten Stenshorne" href="mailto:[email protected]">
3+
<link rel="help" href="https://www.w3.org/TR/css-break-3/#unforced-breaks">
4+
<link rel="help" href="https://www.w3.org/TR/CSS22/visuren.html#flow-control">
5+
<link rel="help" href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/br#deprecated_attributes">
6+
<link rel="match" href="../reference/ref-filled-green-100px-square.xht">
7+
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
8+
<div style="columns:4; column-gap:0; column-fill:auto; width:100px; height:100px; background:red;">
9+
<div style="float:left; width:50%; height:350px; background:green;"></div>
10+
<div style="background:green;">
11+
<br clear="all">
12+
</div>
13+
<div style="height:50px; background:green;"></div>
14+
</div>

0 commit comments

Comments
 (0)