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

  Changed paths:
    M Source/WebCore/layout/formattingContexts/grid/GridFormattingContext.cpp

  Log Message:
  -----------
  [GFC] Percentage track sizes may need to be treated as auto
https://bugs.webkit.org/show_bug.cgi?id=306123
rdar://168769483

Reviewed by Brandon Stewart.

"If the size of the grid container depends on the size of its tracks, then the 
<percentage>
must be treated as auto, for the purpose of calculating the intrinsic sizes of 
the grid
container and then resolve against that resulting grid container size for the 
purpose of
laying out the grid and its items."
https://drafts.csswg.org/css-grid-1/#track-sizes

To implement this idea we do two main things:

1.) Add a helper function that will be used to determine if the grid
container's size depends on the size of its tracks. This is just an
empty stub function that returns false for now and will be populated in
the future when we decide on how we want to do this.

2.) Take the grid template columns/rows lists and transform any
percentage sizes in them to auto. We can then feed these newly
transformed lists into GridDefinition which gets passed into GridLayout.
GridLayout does not have to worry about this state and can operate on
the track sizes in the same exact way.

* Source/WebCore/layout/formattingContexts/grid/GridFormattingContext.cpp:
(WebCore::Layout::trackSizeWithPercentagesConvertedToAuto):
(WebCore::Layout::repeatTrackListWithPercentagesConvertedToAuto):
(WebCore::Layout::gridTemplateListWithPercentagesConvertedToAuto):
Newly introduced helper functions that go through and transform
grid-template-columns/rows. This is done by going through each entry in
the associated GridTrackList and changing any percentage entries to
auto. This newly transformed GridTrackList is then used to construct a
new GridTemplateList to replace the one passed in.

It is important to do it this way since the various fields in
GridTemplateList are populated based upon the passed in GridTrackList
and simply modifying the fields directly would result in a mismatch
between the two.

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



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

Reply via email to