Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ea5f8d15a93d7a62da8be51cd7d68ce4ee862386
      
https://github.com/WebKit/WebKit/commit/ea5f8d15a93d7a62da8be51cd7d68ce4ee862386
  Author: Sammy Gill <[email protected]>
  Date:   2026-01-23 (Fri, 23 Jan 2026)

  Changed paths:
    M Source/WebCore/layout/formattingContexts/grid/GridLayout.cpp
    M Source/WebCore/layout/formattingContexts/grid/GridLayout.h
    M Source/WebCore/layout/formattingContexts/grid/GridTypeAliases.h
    M Source/WebCore/layout/formattingContexts/grid/TrackSizingAlgorithm.cpp
    M Source/WebCore/layout/formattingContexts/grid/TrackSizingAlgorithm.h

  Log Message:
  -----------
  [GFC] Implement logic to support track sizing with min-content as track 
sizing functions.
https://bugs.webkit.org/show_bug.cgi?id=303597
rdar://165062010

Reviewed by Brandon Stewart.

This patch builds upon the track sizing algorithm to start considering
min-content as a track sizing function for the columns.
https://drafts.csswg.org/css-grid-1/#algo-track-sizing

We have already added logic in regards to making sure the base size and
growth limits for these tracks are set properly so we do not need to add
any extra work for that step here so most of the new code here focuses
on step two of the track sizing algorithm (resolve intrinsic track sizes):
https://drafts.csswg.org/css-grid-1/#algo-content

The general idea is that we will loop over the tracks that are
intrinsically sized, get the items that are completely contained within
that track, get the item's min-content contribution, and update the base
size and growth limit if needed.

* Source/WebCore/layout/formattingContexts/grid/GridLayout.cpp:
In order to perform the track sizing algorithm properly, we will need
to know which tracks a grid item spans. In addition to passing in the
PlacedGridItems to the track sizing function, I have decided to also
create and pass in a SpanList that holds a Range corresponding to the
tracks the associated grid item spans. Each index in the SpanList maps
to an entry in the grid item list, so a span at index 1 is associated
with the grid item at index 1.

(WebCore::Layout::GridLayout::performGridSizingAlgorithm const):
(WebCore::Layout::GridLayout::performGridSizingAlgorithm): Deleted.
* Source/WebCore/layout/formattingContexts/grid/GridLayout.h:
* Source/WebCore/layout/formattingContexts/grid/GridTypeAliases.h:
* Source/WebCore/layout/formattingContexts/grid/TrackSizingAlgorithm.cpp:
(WebCore::Layout::singleSpanningItemsWithinTrack):
Helper function that is used to collect the items corresponding with the
"consider the items in it with a span of 1," portion of the spec. This
takes in the SpanList and returns the indexes of the grid items that
have a span of one. I prefer this instead of passing in the grid items,
iterating over them, and constructing another list of grid items as a
result. Here we are working with simple structures that contain just the
information we need to perform the task instead of a list of items that
contain more information than necessary.

(WebCore::Layout::tracksWithIntrinsicSizingFunction):
Helper function that is used to collect the tracks corresponding with
the "For each track with an intrinsic track sizing function and not a
flexible sizing function" portion of the spec. Same reasoning as above
for the overall structure.

(WebCore::Layout::minContentContributions):
Stub for a helper function that will be used to get the min-content
contributions of the grid items. This will get filled in with whatever
API we end up coming up with to get these sizes.

(WebCore::Layout::resolveIntrinsicTrackSizes):
This is basically just the spec as written in 11.5.2 so there should
hopefully be no surprises here!

Canonical link: https://commits.webkit.org/306091@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to