Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: ae84aaacde21b714ad14a945b08cd896950cc460
      
https://github.com/WebKit/WebKit/commit/ae84aaacde21b714ad14a945b08cd896950cc460
  Author: Sammy Gill <[email protected]>
  Date:   2025-12-03 (Wed, 03 Dec 2025)

  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/PlacedGridItem.h

  Log Message:
  -----------
  [GFC] Add initial implementation for automatic inline sizes of grid items.
https://bugs.webkit.org/show_bug.cgi?id=303441
rdar://165728471

Reviewed by Brandon Stewart and Alan Baradlay.

The automatic sizes of grid items is defined in:
https://drafts.csswg.org/css-grid-1/#grid-item-sizing

This patch adds some initial code to start supporting the automatic
*inline* sizes of grid items that we can build upon. In particular, this
is for content in which the grid item:

1.) is non-replaced element
2.) does not have a preferred aspect ratio
3.) has non-auto margins
4.) has an alignment position of normal

This ends up placing us into the "Fill grid area," portion of this
section of the spec. "Fill grid area," seems to refer to "the grid item is
sized as for align-self: stretch," which after following a couple of
spec links leads to:
https://www.w3.org/TR/css-align-3/#justify-self-property

This is the core logic that is implemented as part of
usedInlineSizeForGridItem.

* Source/WebCore/layout/formattingContexts/grid/GridLayout.cpp:
(WebCore::Layout::GridLayout::performInlineAxisSelfAlignment):
Since "Normal," is handled by grid item sizing there is nothing to do
here as part of alignment.

* Source/WebCore/layout/formattingContexts/grid/GridLayoutUtils.cpp:
(WebCore::Layout::GridLayoutUtils::usedInlineSizeForGridItem):
This is the core of the logic that is written to implement the
aforementioned portion of the spec. Basically we need to determine the
total size of the columns the grid item spans and then stretch it to fit
within that size while still respecting the min and max sizes specified
by style.

Note that there was was small change made when for the fixed inline size
case. Now we add in the border and padding within this function instead
of it being done on top of what we returned from this function. This is
because we need the border and padding in order to properly stretch the
grid item.

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



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

Reply via email to