Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 815aeeda6a95c02498475fffe26a8f5898b64c16
https://github.com/WebKit/WebKit/commit/815aeeda6a95c02498475fffe26a8f5898b64c16
Author: Alan Baradlay <[email protected]>
Date: 2026-04-17 (Fri, 17 Apr 2026)
Changed paths:
M LayoutTests/TestExpectations
A
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-wrap-column-grow-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-wrap-column-grow.html
M
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/justify-content-007-expected.txt
M Source/WebCore/rendering/RenderFlexibleBox.cpp
M Source/WebCore/rendering/RenderFlexibleBox.h
Log Message:
-----------
[Flex] flex-grow does not distribute free space in multi-line column flex
https://bugs.webkit.org/show_bug.cgi?id=312537
Reviewed by Antti Koivisto.
Given:
<div style="display: flex; flex-direction: column; flex-wrap: wrap;
max-height: 100px">
<div style="height: 50px; flex-grow: 1"></div>
<div style="height: 100px"></div>
</div>
The first item should grow from 50px to 100px. Instead it stayed at 50px.
In a multi-line column flex, items wrap into columns. The container's
main size (height) is determined by the tallest column -- in this
case 100px from the second item. Per spec, "the main size of a line
is always the same as the main size of the flex container's content
box" so each line has 100px available for flex-grow.
But WebKit resolved flex-grow per-line during layout, before the
container's final height was known. Line 1 computed its available
space from its own content (50px), saw zero free space, and didn't
grow.
The fix adds a post-layout pass for multi-line column flex. After
all lines are laid out and the container's height is finalized via
updateLogicalHeight(), lines with undistributed free space get their
flexible lengths re-resolved using the actual container height, then
items are re-laid out and repositioned via layoutAndPlaceFlexItems.
* LayoutTests/TestExpectations:
*
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-wrap-column-grow-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-wrap-column-grow.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/justify-content-007-expected.txt:
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::RenderFlexibleBox::distributeMainAxisFreeSpaceForMultilineColumnIfNeeded):
(WebCore::RenderFlexibleBox::performFlexLayout):
* Source/WebCore/rendering/RenderFlexibleBox.h:
Canonical link: https://commits.webkit.org/311456@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications