Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ec9ec4703dd7acfcadd38cfe7500ac67bc3ab085
      
https://github.com/WebKit/WebKit/commit/ec9ec4703dd7acfcadd38cfe7500ac67bc3ab085
  Author: Sammy Gill <[email protected]>
  Date:   2026-08-31 (Mon, 31 Aug 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/flex-sizing-rows-min-max-height-002-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/flex-sizing-rows-min-max-height-002.html
    M Source/WebCore/layout/formattingContexts/grid/TrackSizingAlgorithm.cpp

  Log Message:
  -----------
  [GFC] Flexible tracks should respect grid container's min/max size.
https://bugs.webkit.org/process_bug.cgi
rdar://problem/186103325

Reviewed by Alan Baradlay.

When the available grid space is indefinite, 
https://drafts.csswg.org/css-grid-2/#algo-flex-tracks
requires that if using the flex fraction found for the tracks would make the 
grid smaller than
the grid container's min-height, or larger than its max-height, the step is 
redone treating the
free space as definite and the available grid space as the container's content 
box size when it
is sized to that minimum (maximum).

expandFlexibleTracks() never consulted the container minimum and maximum size 
carried on
AxisConstraint, so flexible tracks were left at their base size. Only 
stretchAutoTracks() reads
the minimum, via freeSpaceForStretchAutoTracks(), so a grid container with a 
definite min-height
stretched its 'auto' tracks but not its flexible ones. With 
'grid-template-rows: 1fr 1fr' and
'min-height: 200px' the two rows stayed at their content height instead of 
filling the
minimum height.

Find the used flex fraction first and apply it to the tracks once, which 
follows the shape of
the spec, and redo the indefinite case against the container's minimum and 
maximum size when the
candidate fraction would take the grid outside of them.

Test: 
imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/flex-sizing-rows-min-max-height-002.html

The existing flex-sizing-rows-min-max-height-001.html covers the same spec 
clause but sizes its
rows with minmax(), which LayoutIntegrationGridCoverage rejects, so it never 
exercises GFC.

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/flex-sizing-rows-min-max-height-002-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/flex-sizing-rows-min-max-height-002.html:
 Added.
* Source/WebCore/layout/formattingContexts/grid/TrackSizingAlgorithm.cpp:
(WebCore::Layout::flexTrackIncrementsForFlexFraction): Return the growth each 
flexible track
would get from a flex fraction, so that the size the grid would end up with can 
be measured
before a fraction is committed to.
(WebCore::Layout::applyFlexFractionToTracks):
(WebCore::Layout::usedFlexFractionForMaxContent): Redo the step against the 
grid container's
minimum and maximum size when the candidate fraction would take the grid 
outside of them.
(WebCore::Layout::usedFlexFractionForDefiniteLength):
(WebCore::Layout::expandFlexibleTracks): Find the used flex fraction, then 
apply it once.
(WebCore::Layout::expandFlexibleTracksForMinContent): Deleted.
(WebCore::Layout::expandFlexibleTracksForMaxContent): Deleted.
(WebCore::Layout::expandFlexibleTracksForDefiniteLength): Deleted.

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



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

Reply via email to