Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: a0992f0bb3d09714ce0f5748d69af63c64925ac8
https://github.com/WebKit/WebKit/commit/a0992f0bb3d09714ce0f5748d69af63c64925ac8
Author: Sammy Gill <[email protected]>
Date: 2026-07-27 (Mon, 27 Jul 2026)
Changed paths:
M Source/WebCore/layout/formattingContexts/grid/GridItemSizingFunctions.cpp
M Source/WebCore/layout/formattingContexts/grid/GridItemSizingFunctions.h
M Source/WebCore/layout/formattingContexts/grid/GridLayoutUtils.cpp
M Source/WebCore/layout/formattingContexts/grid/GridLayoutUtils.h
M Source/WebCore/layout/formattingContexts/grid/TrackSizingAlgorithm.cpp
Log Message:
-----------
[GFC] Automatic minimum size should not resolve percentages against unknown
available space during track sizing
https://bugs.webkit.org/show_bug.cgi?id=320400
rdar://problem/183357284
Reviewed by Alan Baradlay.
During track sizing we may need to apply the automatic minimum size
logic for a grid item. If we are evaluating whether or not the grid item
has a specified size suggestion we are not able to resolve percentages
in the middle of track sizing for it. As a result, the item should not
have a specified size suggestion so we need to check the transferred
size suggestion or content size suggestion. Currently we attempt to
resolve the percentage which results in incorrect behavior.
One way we can fix this is by changing the automatic minimum size
functions to take in an optionl LayoutUnit for the available space.
During track sizing this will be empty to rerpesent the fact there is no
available space. Then we computing the specified size suggestion we can
use this information to return empty for that size as well and fall back
to the other two sizes mentioned earlier.
The way we implement this is by checking how GridItemSizingFunction's
used minimum size callback works. Instead of calling out to the version
on GridLayoutUtils it just implements its logic inline. This is done
because almost all of the functions was just a switch on the minimum
size with the only difference being the space that was used to resolve
percentages/calc or pass into the automatic minimum size function. Now
the GridItemSizingFunctions version resolve against 0 for
percentages/calc and passes in std::nullopt for the automatic minimum
size functions (which get plumbed to the specified size suggestion).
The GridLayoutUtils variant will just be used for the final sizing of the
grid item instead. This does result in a tiny bit of code duplication,
but I think this is fine for now since a lot of the duplication is just
boiler plate related to calling WTF::switchOn and handling the cases
slighlty differently. I thought about passing in std::optional into the
used minimum size functions directly but I think this makes it a little
less clear as to what is happening inside the implementation of
inlineMinimumSize/blockMinimumSize. So we can definitely revisit this in
the future but will probably need to think about how to do so without
making the code confusing.
Canonical link: https://commits.webkit.org/318032@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications