Skip to content

[GFC] Implement step 2.4 of Distributing Extra Space - #71661

Open
yulunwu2 wants to merge 1 commit into
WebKit:mainfrom
yulunwu2:gfc-distribute-space-beyond-limits
Open

[GFC] Implement step 2.4 of Distributing Extra Space#71661
yulunwu2 wants to merge 1 commit into
WebKit:mainfrom
yulunwu2:gfc-distribute-space-beyond-limits

Conversation

@yulunwu2

@yulunwu2 yulunwu2 commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

718cc2a

[GFC] Implement step 2.4 of Distributing Extra Space
https://bugs.webkit.org/show_bug.cgi?id=321799
<rdar://184933769>

Reviewed by NOBODY (OOPS!).

This PR implements Step 2.4 of https://drafts.csswg.org/css-grid-1/#extra-space

tracksToGrowBeyondGrowthLimits() collects the tracks the item spans that should be unfrozen
and grown beyond its limits. shouldTrackGrowBeyondGrowthLimits() checks whether the track's
max sizing function is of the type that should be unfrozen in a given phase.

* Source/WebCore/layout/formattingContexts/grid/TrackSizingAlgorithm.cpp:
(WebCore::Layout::shouldTrackGrowBeyondGrowthLimits):
(WebCore::Layout::tracksToGrowBeyondGrowthLimits):
(WebCore::Layout::distributeExtraSpace):
(WebCore::Layout::resolveIntrinsicTrackSizesWithSpanningItems):

718cc2a

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows Apple Internal
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win ✅ 🛠 ios-apple
✅ 🧪 bindings ✅ 🛠 ios-sim ✅ 🛠 mac-AS-debug ✅ 🧪 wpe-wk2 ⏳ 🧪 win-tests ✅ 🛠 mac-apple
✅ 🧪 webkitperl ✅ 🧪 ios-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe ✅ 🛠 vision-apple
✅ 🧪 ios-wk2-wpt ✅ 🧪 api-mac-debug
✅ 🧪 api-ios ✅ 🧪 mac-wk2 ✅ 🛠 gtk3-gcc
✅ 🛠 ios-safer-cpp ✅ 🧪 mac-AS-debug-wk2 ✅ 🛠 gtk
✅ 🛠 vision ✅ 🧪 gtk-wk2
✅ 🛠 vision-sim ✅ 🧪 mac-intel-wk2 ✅ 🧪 api-gtk
✅ 🧪 vision-wk2 ✅ 🛠 mac-safer-cpp ✅ 🛠 playstation
✅ 🛠 tv ✅ 🧪 mac-site-isolation
✅ 🛠 tv-sim
✅ 🛠 watch
✅ 🛠 watch-sim

https://bugs.webkit.org/show_bug.cgi?id=321799
<rdar://184933769>

Reviewed by NOBODY (OOPS!).

This PR implements Step 2.4 of https://drafts.csswg.org/css-grid-1/#extra-space

tracksToGrowBeyondGrowthLimits() collects the tracks the item spans that should be unfrozen
and grown beyond its limits. shouldTrackGrowBeyondGrowthLimits() checks whether the track's
max sizing function is of the type that should be unfrozen in a given phase.

* Source/WebCore/layout/formattingContexts/grid/TrackSizingAlgorithm.cpp:
(WebCore::Layout::shouldTrackGrowBeyondGrowthLimits):
(WebCore::Layout::tracksToGrowBeyondGrowthLimits):
(WebCore::Layout::distributeExtraSpace):
(WebCore::Layout::resolveIntrinsicTrackSizesWithSpanningItems):
@yulunwu2 yulunwu2 self-assigned this Aug 14, 2026
@yulunwu2 yulunwu2 added the Layout and Rendering For bugs with layout and rendering of Web pages. label Aug 14, 2026
@yulunwu2
yulunwu2 requested a review from sammygill August 14, 2026 22:58

// https://drafts.csswg.org/css-grid-1/#extra-space
// 2.4: whether this track should be affected when distributing extra space beyond limits.
static bool shouldTrackGrowBeyondGrowthLimits(const UnsizedTrack& track, GridItemSizeContributionType sizeContributionType)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this function needs to take in not only the type of contribution we are accommodating but also the type of the affected track (i.e. whether it is for the base sizes or the growth limit). Even if "Increase sizes to accommodate spanning items crossing content-sized tracks" is written in a way that makes the current approach ok, I think it requires a bit more of a complicated analysis to come to that conclusion compared to if we had both of those arguments here to match how the text is written.

Also I think we might want to revisit our name for GridItemSizeContributionType. It really isn't representing so much as the contribution type for the grid item but a characteristic of the tracks' sizing function. For example, ForIntrinsicMinimums is really about tracks with an intrinsic min track sizing function and accommodating the minimum contribution is just a side effect of what the spec text is using that information for here. If rename the current enum and have GridItemSizeContributionType just be the actual contribution types (e.g. GridItemSizeType::MinimumContribution) we remove that coupling and can reuse it more clearly here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Layout and Rendering For bugs with layout and rendering of Web pages.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants