commit 3e955407bd4834dfb81cf537a7f9387f9bf993fd
parent 0b0c0f80c2660adc5e2fdb42af658336e9ebfceb
Author: Sam Davis Omekara (from Dev Box) <samomekarajr@microsoft.com>
Date: Thu, 9 Oct 2025 20:36:56 +0000
Bug 1992362 [wpt PR 55215] - [Gap Decorations]: Prevent crash with collapsed tracks in auto-fit rows, a=testonly
Automatic update from web-platform-tests
[Gap Decorations]: Prevent crash with collapsed tracks in auto-fit rows
This CL fixes a crash that occurs with a sparse grid using auto-fit
rows leading to some tracks being collapsed. In this scenario, no
actual gaps existed, but free space was attributed to the gutter via
the `space-around` alignment property.
Previously, we emitted gaps for every track (including collapsed ones)
resulting in a situation where we can have multiple gaps with the same
offset. In this case, collapsed tracks do not have any associated sets
and as such the corresponding set index was `kNotFound`. Therefore,
when attempting to place such gaps, accessing their set index would
hit the CHECK and cause a crash.
The fixes introduced in this CL include:
* Emit only one gap per set of collapsed tracks, avoiding redundant gaps.
* Correct a subtle bug in the gap placement loop: We previously broke
from the loop only after placing gaps **and** encountering one that
didn’t fit. Now, we break immediately upon finding a gap that
doesn’t fit within the fragmentainer.
Bug: 447412344
Change-Id: I9abdae21603834ee0875c35429ccdec2746c6373
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/7000980
Commit-Queue: Sam Davis Omekara <samomekarajr@microsoft.com>
Reviewed-by: Alison Maher <almaher@microsoft.com>
Reviewed-by: Kurt Catti-Schmidt <kschmi@microsoft.com>
Cr-Commit-Position: refs/heads/main@{#1524527}
--
wpt-commits: a64ac4fae2824892acbf03ff22fa30eb6e561355
wpt-pr: 55215
Diffstat:
1 file changed, 27 insertions(+), 0 deletions(-)
diff --git a/testing/web-platform/tests/css/css-gaps/grid/fragmentation/grid-gap-decorations-fragmentation-018-crash.html b/testing/web-platform/tests/css/css-gaps/grid/fragmentation/grid-gap-decorations-fragmentation-018-crash.html
@@ -0,0 +1,27 @@
+<!DOCTYPE html>
+<title>
+ Avoid crash when we have collapsed tracks due to auto-fit.
+</title>
+<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/11520">
+<link rel="author" title="Sam Davis Omekara Jr." href="mailto:samomekarajr@microsoft.com">
+<style>
+ body {
+ margin: 0px;
+ }
+ .multi-col {
+ columns: 3;
+ column-fill: auto;
+ height: 100px;
+ }
+ .grid-container {
+ display: grid;
+ height: 300px;
+ grid-template-rows: repeat(auto-fit, 20px);
+ align-content: space-around;
+ }
+</style>
+<div class="multi-col">
+ <div class="grid-container">
+ <div style="width: 10px; height: 15px;"> </div>
+ </div>
+</div>