Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 17e42973bf0bd571cff40c0069a383c6615c8d82
https://github.com/WebKit/WebKit/commit/17e42973bf0bd571cff40c0069a383c6615c8d82
Author: Alan Baradlay <[email protected]>
Date: 2026-05-22 (Fri, 22 May 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-percentage-height-stale-width-expected.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-percentage-height-stale-width.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/reference/flex-aspect-ratio-percentage-height-stale-width-ref.html
M Source/WebCore/rendering/RenderBlock.cpp
Log Message:
-----------
[Flex] Aspect-ratio flex container resolves descendant percentage height
against stale logical width during preferred-width computation
https://bugs.webkit.org/show_bug.cgi?id=315334
Reviewed by Antti Koivisto.
<div id=ancestor style="width: 100px">
<div style="display: flex">
<div style="display: flex; aspect-ratio: 1">
<div>
<div style="height: 100%; aspect-ratio: 2">X</div>
</div>
</div>
</div>
</div>
<script>ancestor.style.width = "200px";</script>
Changing the outer width should not change the inner aspect-ratio box's
size. Instead its block-axis size doubled because the inner flex
container's percent-height resolution fed a stale logical width into its
own aspect-ratio derivation.
availableLogicalHeightForPercentageComputation has an aspect-ratio branch
that calls blockSizeFromAspectRatio with logicalWidth(). During preferred-
width recompute logicalWidth() still carries the previous layout's value;
only RenderGrid was guarded against this. Flex containers can be in the
same state, so the guard is extended to RenderFlexibleBox.
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::availableLogicalHeightForPercentageComputation):
*
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-percentage-height-stale-width-expected.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-percentage-height-stale-width.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-flexbox/reference/flex-aspect-ratio-percentage-height-stale-width-ref.html:
Added.
Canonical link: https://commits.webkit.org/313727@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications