Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 16c999a1edc5ccb2b430de67d7551883d348d44c
https://github.com/WebKit/WebKit/commit/16c999a1edc5ccb2b430de67d7551883d348d44c
Author: Alan Baradlay <[email protected]>
Date: 2026-04-16 (Thu, 16 Apr 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/abspos-intrinsic-height-inset-percentage-child-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/abspos-intrinsic-height-inset-percentage-child.html
M Source/WebCore/rendering/RenderBlock.cpp
Log Message:
-----------
out-of-flow content has the incorrect height when its height is set to
fit-content
https://bugs.webkit.org/show_bug.cgi?id=242837
<rdar://problem/97492632>
Reviewed by Antti Koivisto.
Given:
<div style="position: absolute; inset: 0; height: fit-content">
<div style="height: 100%">
<div style="height: 80px"></div>
</div>
</div>
The out-of-flow container is sized to 0px, while the correct height is 80px.
availableLogicalHeightForPercentageComputation has a condition
that decides if an out-of-flow element's height is definite for its
children's percentage resolution. It has two branches:
1. height is specified (length/percent/calc) -> definite
2. both insets are set -> definite
is always definite and can be used to resolve the percent height.
However with content-dependent values like fit-content, answering "how
tall is the parent?" requires laying out the children first -
but the child is asking precisely because it needs that answer to
size itself. That's a cyclic dependency, so the answer should be
"indefinite" and the percentage falls back to auto.
The fix restricts #2 to height:auto. For intrinsic keywords,
availableLogicalHeightForPercentageComputation now returns nullopt
and the child's percentage falls back to auto.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/abspos-intrinsic-height-inset-percentage-child-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/abspos-intrinsic-height-inset-percentage-child.html:
Added.
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::availableLogicalHeightForPercentageComputation const):
Canonical link: https://commits.webkit.org/311375@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications