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

  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

  Log Message:
  -----------
  [GFC] Add initial implementation for automatic block sizes
https://bugs.webkit.org/show_bug.cgi?id=305870
rdar://165728545

Reviewed by Brandon Stewart and Alan Baradlay.

In 303843@main, we added some logic to add initial support for computing
the automatic inline size of grid items. Here, we add the matching
behavior for the block size of similar types of grid items (non-replaced
ones that are stretching). The logic for this is exactly the same except
we are working with attributes in the opposite axis (height values,
align-self, etc.).

Since this is just the initial implementation of this logic, I ended up
writing the logic by modifying the inline axis one instead of trying to
abstract it into some helper function that is shared by both. This is
because we will need to build upon both versions, and while here we were
easily able to adopt ideas from one version to another, that may not be
the case in the future. Eventually, both will evolve to a point where we
can do this and share code, but in the beginning, we will just be verbose
to keep implementation straightforward.

* Source/WebCore/layout/formattingContexts/grid/GridLayout.cpp:
(WebCore::Layout::GridLayout::performBlockAxisSelfAlignment):
If we are in the "start," case we end up returning the same value as the
start alignment value. If we are in the "stretch," case we still return
the same value, which is 0 so there is no alignment shift to, to allow
the stretching logic to get performed later.

(WebCore::Layout::GridLayout::layoutGridItems const):
* Source/WebCore/layout/formattingContexts/grid/GridLayoutUtils.cpp:
(WebCore::Layout::GridLayoutUtils::usedBlockSizeForGridItem):
Same idea as usedInlineSizeForGridItem in that if we have an automatic
size, are non-replaced, and are stretching, then we will stretch into
the available space. We also need to start adding in the
borderAndPadding here, rather than outside the function where it was
previously occurring, since the stretching logic will need it.

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



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

Reply via email to