Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: cb6b33a71e6da84074becc264a56355ff82c56f0
https://github.com/WebKit/WebKit/commit/cb6b33a71e6da84074becc264a56355ff82c56f0
Author: Yulun Wu <[email protected]>
Date: 2026-02-14 (Sat, 14 Feb 2026)
Changed paths:
M Source/WebCore/Headers.cmake
M Source/WebCore/layout/formattingContexts/grid/GridLayout.cpp
M Source/WebCore/layout/formattingContexts/grid/GridLayout.h
M Source/WebCore/layout/formattingContexts/grid/ImplicitGrid.cpp
M Source/WebCore/layout/formattingContexts/grid/ImplicitGrid.h
Log Message:
-----------
[GFC] Implement Steps 3 and 4 of grid auto-placement for single-cell items.
https://bugs.webkit.org/show_bug.cgi?id=306960
<rdar://169629496>
Reviewed by Elika Etemad.
This PR implements Steps 3 and 4 of the CSS Grid auto-placement algorithm
for Grid Formatting Context. Step 3 sets the column count for the implicit grid
by checking the column positions and spans of the unplaced items.
Step 4 positions the remaining auto-positioned items using the auto placement
cursor tracking the current insertion point.
This PR supports both sparse and dense packing.
Definite column positioned items are positioned by searching down their
specificed column, while fully automatically positioned items are positioned
by searching left->right and top->down. We dynamically add implicit rows as
needed during placement.
* Source/WebCore/Headers.cmake:
* Source/WebCore/layout/formattingContexts/grid/GridLayout.cpp:
(WebCore::Layout::GridLayout::calculateInitialImplicitGridDimensions):
(WebCore::Layout::GridLayout::constructInitialImplicitGrid):
(WebCore::Layout::GridLayout::placeGridItems):
(WebCore::Layout::GridLayout::calculateGridDimensions): Deleted.
* Source/WebCore/layout/formattingContexts/grid/GridLayout.h:
* Source/WebCore/layout/formattingContexts/grid/ImplicitGrid.cpp:
(WebCore::Layout::ImplicitGrid::insertDefiniteRowItem):
(WebCore::Layout::ImplicitGrid::determineImplicitGridColumns):
(WebCore::Layout::ImplicitGrid::insertAutoPositionedItems):
(WebCore::Layout::ImplicitGrid::growColumnsToFit):
(WebCore::Layout::ImplicitGrid::growRowsToFit):
(WebCore::Layout::ImplicitGrid::placeAutoPositionedItemWithDefiniteColumn):
(WebCore::Layout::ImplicitGrid::placeAutoPositionedItemWithAutoColumnAndRow):
(WebCore::Layout::ImplicitGrid::verifyHasEmptyLastColumn const): Deleted.
* Source/WebCore/layout/formattingContexts/grid/ImplicitGrid.h:
Canonical link: https://commits.webkit.org/307590@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications