Skip to content

Commit

Permalink
[GridFragmentation] Propagate break-before/break-after from container.
Browse files Browse the repository at this point in the history
...when unfragmented). This patch captures the break-before/break-after
values for grid row(s) when unfragmented. We pass in a break-between
vector into |PlaceItems| which will then use this to set the
break-before/break-after on the fragment.

We also use these values to add the correct break-before/break-after
on the grid container.

Bug: 614667
Change-Id: Ie529efe0e5bfe53262d10d874149ffc5c6e67100
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3453286
Reviewed-by: Morten Stenshorne <[email protected]>
Reviewed-by: Alison Maher <[email protected]>
Commit-Queue: Ian Kilpatrick <[email protected]>
Cr-Commit-Position: refs/heads/main@{#972206}
  • Loading branch information
bfgeek authored and chromium-wpt-export-bot committed Feb 17, 2022
1 parent 9b62565 commit 4d6dd10
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 0 deletions.
13 changes: 13 additions & 0 deletions css/css-break/grid/grid-container-fragmentation-010.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#pagination">
<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="background: red; position: relative; width: 100px; height: 100px; column-fill: auto; columns: 2; gap: 0;">
<div style="background: green; height: 50px;"></div>
<div style="background: green; display: grid; grid-template-columns: auto auto; height: 50px;">
<div></div>
<div style="break-before: column;"></div> <!-- Should result in a column break before the grid container. -->
</div>
<div style="background: green; height: 50px;"></div>
<div style="background: green; position: absolute; width: 50px; height: 50px; bottom: 0; left: 0;"></div>
</div>
13 changes: 13 additions & 0 deletions css/css-break/grid/grid-container-fragmentation-011.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#pagination">
<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="background: red; position: relative; width: 100px; height: 100px; column-fill: auto; columns: 2; gap: 0;">
<div style="background: green; display: grid; grid-template-columns: auto auto; height: 50px;">
<div style="break-after: column;"></div> <!-- Should result in a column break after the grid container. -->
<div></div>
</div>
<div style="background: green; height: 50px;"></div>
<div style="background: green; height: 50px;"></div>
<div style="background: green; position: absolute; width: 50px; height: 50px; bottom: 0; left: 0;"></div>
</div>
15 changes: 15 additions & 0 deletions css/css-break/grid/grid-item-fragmentation-046.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#pagination">
<link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
<title>Tests that break precedence for a grid row is correctly calculated.</title>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div style="position: relative; width: 100px; height: 100px; columns: 2; column-gap: 0; column-fill: auto; background: red;">
<div style="display: grid; grid-template-rows: 50px 100px;">
<div style="background: green;"></div>
<div style="background: green; break-before: avoid; display: grid; grid-template-columns: auto auto;">
<div></div>
<div style="break-before: column;"></div> <!-- This break-before should be propagated to the outermost grid row. -->
</div>
</div>
<div style="background: green; position: absolute; width: 50px; height: 50px; left: 0; bottom: 0;"></div>
</div>
15 changes: 15 additions & 0 deletions css/css-break/grid/grid-item-fragmentation-047.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#pagination">
<link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
<title>Tests that break precedence for a grid row is correctly calculated.</title>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div style="position: relative; width: 100px; height: 100px; columns: 2; column-gap: 0; column-fill: auto; background: red;">
<div style="display: grid; grid-template-rows: 50px 100px;">
<div style="background: green; break-after: avoid; display: grid; grid-template-columns: auto auto;">
<div style="break-after: column;"></div> <!-- This break-after should be propagated to the outermost grid row. -->
<div></div>
</div>
<div style="background: green;"></div>
</div>
<div style="background: green; position: absolute; width: 50px; height: 50px; left: 0; bottom: 0;"></div>
</div>
16 changes: 16 additions & 0 deletions css/css-break/grid/grid-item-fragmentation-048.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!DOCTYPE html>
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#pagination">
<link rel="match" href="../../reference/ref-filled-green-100px-square.xht">
<title>Tests that break precedence for a grid row is correctly calculated.</title>
<p>Test passes if there is a filled green square and <strong>no red</strong>.</p>
<div style="position: relative; width: 100px; height: 100px; columns: 4; column-gap: 0; column-fill: auto; background: red;">
<div style="display: grid; grid-template-rows: 50px 50px 200px;">
<div style="background: green;"></div>
<div style="background: green; break-before: avoid; break-after: avoid; display: grid; grid-template-columns: auto auto;">
<div style="break-before: column; break-after: column;"></div> <!-- The break values should be propagated to the outermost rows. -->
<div></div>
</div>
<div style="background: green;"></div>
</div>
<div style="background: green; position: absolute; width: 50px; height: 50px; left: 0; bottom: 0;"></div>
</div>

0 comments on commit 4d6dd10

Please sign in to comment.