Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: cfd340d39b1abaf102ae3e7e8566d9b17f5c684b
https://github.com/WebKit/WebKit/commit/cfd340d39b1abaf102ae3e7e8566d9b17f5c684b
Author: Sammy Gill <[email protected]>
Date: 2026-01-26 (Mon, 26 Jan 2026)
Changed paths:
M Source/WebCore/layout/formattingContexts/grid/GridLayout.cpp
M Source/WebCore/layout/formattingContexts/grid/GridLayoutUtils.cpp
M Source/WebCore/layout/formattingContexts/grid/GridLayoutUtils.h
M Source/WebCore/layout/formattingContexts/grid/TrackSizingAlgorithm.cpp
M Source/WebCore/layout/formattingContexts/grid/TrackSizingAlgorithm.h
Log Message:
-----------
[GFC] Introduce GridItemSizingFunctions.
https://bugs.webkit.org/show_bug.cgi?id=306045
rdar://problem/168686652
Reviewed by Alan Baradlay.
During the track sizing algorithm we may need to get different types of
sizes for a grid item depending on what they track sizing functions are.
For example, we may need to get the item's min-content contributions
when we are in the "Resolve Intrinsic Track Sizes," step of the track
sizing algorithm.
Currently, the track sizing algorithm does not care about which
direction (columns vs rows) it is running and it would be nice to keep
it this way to maintain simplicity. When it comes to the size
contributions of an item, we need to know which dimension to get the
contribution from (width vs height). To be able to do this while keeping
TrackSizingAlgorithm agnostic of the direction we can allow the caller
to pass in the set of functions that will be used to get the size of the
item.
* Source/WebCore/layout/formattingContexts/grid/TrackSizingAlgorithm.h:
(WebCore::Layout::GridItemSizingFunctions::GridItemSizingFunctions):
New struct that will be populated by the caller with the functions that
will be used to get the grid items' min and max content contributions.
* Source/WebCore/layout/formattingContexts/grid/GridLayout.cpp:
(WebCore::Layout::GridLayout::performGridSizingAlgorithm):
* Source/WebCore/layout/formattingContexts/grid/GridLayout.h:
* Source/WebCore/layout/formattingContexts/grid/GridLayoutUtils.cpp:
(WebCore::Layout::GridLayoutUtils::inlineAxisMinContentContribution):
(WebCore::Layout::GridLayoutUtils::inlineAxisMaxContentContribution):
For the inline axis we get the min and max content contributions for
grid items using the min and max preferred widths API which is what
RenderTree currently uses (see GridTrackSizingAlgorithm).
(WebCore::Layout::GridLayoutUtils::inlineAxisGridItemSizingFunctions):
Just makes it easy to get the GridItemSizingFunctions for the inline
axis when passing it into TrackSizingAlgorithm::sizeTracks.
(WebCore::Layout::GridLayoutUtils::blockAxisMinContentContribution):
(WebCore::Layout::GridLayoutUtils::blockAxisMaxContentContribution):
Empty stubs that we will implement later.
(WebCore::Layout::GridLayoutUtils::blockAxisGridItemSizingFunctions):
Same idea as the inline axis equivalent.
* Source/WebCore/layout/formattingContexts/grid/TrackSizingAlgorithm.cpp:
(WebCore::Layout::TrackSizingAlgorithm::sizeTracks):
Since the API for getting the min and max content contribution relies on
IntegrationUtils we need to plumb it into the TrackSizingAlgorithm.
Canonical link: https://commits.webkit.org/306234@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications