Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 8a2b0661029000540a7bcbd7c53c4ff8c708b29b
https://github.com/WebKit/WebKit/commit/8a2b0661029000540a7bcbd7c53c4ff8c708b29b
Author: Ahmad Saleem <[email protected]>
Date: 2026-09-15 (Tue, 15 Sep 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-template-columns-rows-resolved-values-003-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-template-columns-rows-resolved-values-003.html
M Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp
Log Message:
-----------
getComputedStyle computes wrong grid-template-columns for an empty grid using
repeat(auto-fill) with flexible tracks (gaps ignored)
https://bugs.webkit.org/show_bug.cgi?id=304242
rdar://167077082
Reviewed by Sammy Gill.
This patch aligns WebKit with Gecko / Firefox and Blink / Chromium.
For a grid container using `repeat(auto-fill, minmax(<length>, 1fr))`, the used
size of the flexible tracks must be resolved against the free space left after
subtracting the column/row gaps. GridTrackSizingAlgorithm::setup() computed the
gutters to subtract from the free space using Grid::numTracks(), which returns 0
for an empty grid (no items placed means the internal grid storage has no
rows/columns), so no gaps were subtracted. Meanwhile the track vector is built
from the numTracks parameter, which falls back to the explicit grid count from
the auto-fill repetition, so the flexible tracks were sized as if there were no
gaps. A non-empty grid was unaffected because RenderGrid::numTracks() matches
Grid::numTracks() once rows exist.
Use the numTracks argument that setup() is called with (which equals
Grid::numTracks() for a non-empty grid, and the auto-repeat-derived track count
for an empty one) when computing the gutters, so the free space is correct in
both cases.
Test:
imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-template-columns-rows-resolved-values-003.html
*
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-template-columns-rows-resolved-values-003-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/grid-definition/grid-template-columns-rows-resolved-values-003.html:
Added.
* Source/WebCore/rendering/GridTrackSizingAlgorithm.cpp:
(WebCore::GridTrackSizingAlgorithm::setup):
Canonical link: https://commits.webkit.org/321181@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications