Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: e9d18bf8e3d27e18e3f1ad2393eeca129d834e86
https://github.com/WebKit/WebKit/commit/e9d18bf8e3d27e18e3f1ad2393eeca129d834e86
Author: Alan Baradlay <[email protected]>
Date: 2026-04-20 (Mon, 20 Apr 2026)
Changed paths:
M LayoutTests/TestExpectations
M Source/WebCore/rendering/RenderFlexibleBox.cpp
Log Message:
-----------
[Flex] Fix
imported/w3c/web-platform-tests/css/css-flexbox/flexbox-min-width-auto-005.html
and -006.html
https://bugs.webkit.org/show_bug.cgi?id=312567
Reviewed by Antti Koivisto.
Given:
<div style="display: flex">
<div style="display: flex; height: 50px">
<img src="40x20-green.png">
</div>
</div>
The image should be 100x50. The inner flex has height: 50px, the
image stretches to 50px (cross-axis stretch), and the 2:1 aspect
ratio gives width = 100px. Instead the image was 40x50 -- using
its natural width.
Per the spec resolution (csswg-drafts#6693), a flex item's
stretched cross-size should be transferred through the aspect ratio
when computing the content size suggestion.
ScopedCrossAxisOverrideForFlexItem had a !isFlexItem() guard that
blocked setting the cross-axis override when the flex container was
itself a flex item. The intent was to avoid using a stale cross size
from the parent flex during preferred width computation.
But hasDefiniteCrossSizeForFlexItem already handles this correctly:
it returns false for auto-height containers (where the cross size
depends on the parent) and true for explicit-height containers
(where the cross size is independent). The !isFlexItem() guard was
redundant and overly conservative -- it blocked the override even
when the inner flex had an explicit definite height.
* LayoutTests/TestExpectations:
* Source/WebCore/rendering/RenderFlexibleBox.cpp:
(WebCore::ScopedCrossAxisOverrideForFlexItem::ScopedCrossAxisOverrideForFlexItem):
(WebCore::RenderFlexibleBox::canUseFlexItemForPercentageResolution):
Canonical link: https://commits.webkit.org/311578@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications