Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3974cac991a427729b1011d17d9f803d9f567d29
      
https://github.com/WebKit/WebKit/commit/3974cac991a427729b1011d17d9f803d9f567d29
  Author: Sammy Gill <[email protected]>
  Date:   2026-09-09 (Wed, 09 Sep 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/automatic-minimum-size-clamped-to-fixed-max-track-sizing-function-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/automatic-minimum-size-clamped-to-fixed-max-track-sizing-function.html
    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] A grid item's automatic minimum size is not clamped to a fixed max 
track sizing function.
https://bugs.webkit.org/show_bug.cgi?id=323369
rdar://problem/186606479

Reviewed by Alan Baradlay.

https://drafts.csswg.org/css-grid-1/#min-size-auto says that if a grid item 
spans only grid tracks
that have a fixed max track sizing function, then its specified size suggestion 
and content size
suggestion are further clamped to less than or equal to the stretch fit into 
the grid area's
maximum size in that dimension, as represented by the sum of those grid tracks' 
max track sizing
functions plus any intervening fixed gutters.

GFC never applied that clause. automaticMinimumInlineSize() and 
automaticMinimumBlockSize() only
clamped the size suggestion by the item's own maximum size, so an item whose 
content is taller or
wider than its grid area kept a content-based minimum size larger than the 
maximum the author gave
the tracks it spans.

The automatic minimum size is queried in two places, and the two know the grid 
area differently.

While track sizing is in progress the grid area does not exist yet, so 
gridAreaMaximumSize()
approximates it by the sum of the spanned tracks' max track sizing functions 
plus the gutters
between them. This is the size described in the blub from the portion of
the spec mentioned earlier.

Once the tracks are sized the grid area is resolved, so inlineMinimumSize() and 
blockMinimumSize()
clamp against the grid area itself. Without this the row is capped correctly 
but the item inside it
is still laid out at its content size and overflows its own grid area.

Test: 
imported/w3c/web-platform-tests/css/css-grid/layout-algorithm/automatic-minimum-size-clamped-to-fixed-max-track-sizing-function.html
Canonical link: https://commits.webkit.org/320750@main



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

Reply via email to