-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[LayoutNG] OOFs and column balancing
OOFs currently only affect the initial column balancing pass, but we want them to affect column balancing on later passes, too. To do so, we need to lay out the OOFs during column layout. Currently, though, OOFs are laid out at the end of multicol layout (to ensure the containing block has completed layout). However, we can perform layout earlier for OOFs whose CB hasn't broken so that they affect column balancing. The problem is that these columns haven't been added to the builder at the time when the columns are being balanced, so the OOFs haven't been propagated up to the builder, either. To address this, add a new ColumnBalancingInfo struct to hold the current columns so that NGOutOfFlowLayoutPart will know which columns to use. This will also store a list of OOFs so that we can propagate the OOFs to this struct rather than to the builder. This struct will then be passed into HandleFragmentation() so that a special layout pass can be run on the current unbalanced columns, where we will propagate the info needed to successfully affect column balancing (such as the minimal space shortage, # of new columns added, and if there was a violating break). This special layout pass won't update the builder (i.e. the OOF results aren't added and new columns aren't created). Since we don't actually add the OOFs in this pass to the builder, we will continue to lay out the OOFs at a later point (as is currently done) where they will be officially laid out and added to the builder. Note that out-of-flow-in-multicolumn-099.html passed previously to this CL since break-inside:avoid doesn't affect the OOF. This was simply added to make sure that case was working as expected. Bug: 1341358 Change-Id: Ic1fa6b57a8e4fa26a3f0e1acbd2efe7425787ab0 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3761109 Commit-Queue: Alison Maher <almaher@microsoft.com> Reviewed-by: Daniel Libby <dlibby@microsoft.com> Cr-Commit-Position: refs/heads/main@{#1024906}
- Loading branch information
1 parent
92c5a8f
commit 77d05b2
Showing
6 changed files
with
103 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<!DOCTYPE html> | ||
<title> | ||
OOFs and column balancing. | ||
</title> | ||
<link rel="help" href="https://www.w3.org/TR/css-position-3/#abspos-breaking"> | ||
<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="height:200px; width:200px; background:red;"> | ||
<div style="width:200px; columns:2; column-rule:solid green; background:green;"> | ||
<div style="contain:size; height:100px;"></div> | ||
<div style="contain:size; height:100px;"></div> | ||
<div style="position:relative;"> | ||
<div style="position:absolute; height:100px;"></div> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<title> | ||
OOFs and column balancing. | ||
</title> | ||
<link rel="help" href="https://www.w3.org/TR/css-position-3/#abspos-breaking"> | ||
<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="height:200px; width:200px; background:red;"> | ||
<div style="width:200px; columns:2; column-rule:solid green; background:green;"> | ||
<div style="contain:size; height:100px;"></div> | ||
<div style="position:relative; height:100px;"> | ||
<div style="position:absolute; contain:size; height:100px;"></div> | ||
</div> | ||
<div style="position:relative;"> | ||
<div style="position:absolute; contain:size; height:100px;"></div> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<title> | ||
OOFs and nested column balancing. | ||
</title> | ||
<link rel="help" href="https://www.w3.org/TR/css-position-3/#abspos-breaking"> | ||
<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="height:200px; width:200px; background:red;"> | ||
<div style="width:200px; columns:1;"> | ||
<div style="width:200px; columns:2; column-rule:solid green; background:green;"> | ||
<div style="contain:size; height:100px;"></div> | ||
<div style="contain:size; height:100px;"></div> | ||
<div style="position:relative;"> | ||
<div style="position:absolute; height:100px;"></div> | ||
</div> | ||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<title> | ||
OOFs and column balancing with a spanner. | ||
</title> | ||
<link rel="help" href="https://www.w3.org/TR/css-position-3/#abspos-breaking"> | ||
<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="height:200px; width:200px; background:red;"></div> | ||
<div style="width:200px; columns:2; column-rule:20px solid green; margin-top:-300px; position:relative;"> | ||
<div style="contain:size; height:80px;"></div> | ||
<div style="column-span:all; height:20px;"></div> | ||
<div style="contain:size; height:100px; width:100%; background:green;"></div> | ||
<div style="contain:size; height:100px; width:100%; background:green;"></div> | ||
<div style="position:relative;"> | ||
<div style="position:absolute; width:100%; height:100px; background:green;"></div> | ||
</div> | ||
<div style="position:absolute; bottom:0; right:0; width:90px; height:100px; background:green;"></div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<!DOCTYPE html> | ||
<title> | ||
OOFs and column balancing with a spanner and the CB breaks across the spanner. | ||
</title> | ||
<link rel="help" href="https://www.w3.org/TR/css-position-3/#abspos-breaking"> | ||
<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="height:200px; width:200px; background:red;"></div> | ||
<div style="width:200px; columns:2; column-rule:20px solid green; margin-top:-300px; position:relative;"> | ||
<div style="position:relative;"> | ||
<div style="contain:size; height:80px;"></div> | ||
<div style="column-span:all; height:20px;"></div> | ||
<div style="contain:size; height:100px; width:100%; background:green;"></div> | ||
<div style="contain:size; height:100px; width:100%; background:green;"></div> | ||
<div style="position:absolute; width:100%; height:100px; background:green;"></div> | ||
</div> | ||
<div style="position:absolute; bottom:0; right:0; width:90px; height:100px; background:green;"></div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<!DOCTYPE html> | ||
<title> | ||
OOFs and column balancing with a nested break-inside:avoid. | ||
</title> | ||
<link rel="help" href="https://www.w3.org/TR/css-position-3/#abspos-breaking"> | ||
<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="width:200px; columns:2; column-rule:solid green; background:green;"> | ||
<div style="contain:size; height:100px;"></div> | ||
<div style="position:relative; height:200px; width:100%; background:red;"> | ||
<div style="position:absolute; width:100%; background:green;"> | ||
<div style="height:200px; break-inside:avoid;"></div> | ||
</div> | ||
</div> | ||
</div> |