Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 362ed3e5e59374c8606e413b77ab494d5ae01bdd
https://github.com/WebKit/WebKit/commit/362ed3e5e59374c8606e413b77ab494d5ae01bdd
Author: Brent Fulgham <[email protected]>
Date: 2026-09-23 (Wed, 23 Sep 2026)
Changed paths:
M LayoutTests/TestExpectations
A
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/replaced-element-max-content-contribution-transferred-size-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/replaced-element-max-content-contribution-transferred-size.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/table-cell-definite-height-transferred-size-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/table-cell-definite-height-transferred-size.html
M LayoutTests/platform/glib/TestExpectations
M LayoutTests/platform/ios/tables/mozilla/bugs/bug137388-2-expected.txt
M LayoutTests/tables/mozilla/bugs/bug137388-2-expected.txt
M Source/WebCore/rendering/RenderBlock.cpp
M Source/WebCore/rendering/RenderReplaced.cpp
Log Message:
-----------
Replaced element with percentage width and resolvable percentage height
produces wrong intrinsic width
https://bugs.webkit.org/show_bug.cgi?id=203509
rdar://187522214
Reviewed by Sammy Gill.
This builds on an earlier attempt (313003@main) to fix percentage width
combined with a
resolvable percentage height. That try broke a website, which is why
fast/replaced/replaced-percentage-size-in-aspect-ratio-shrink-to-fit.html
exists.
An aspect-ratio box being shrink-to-fit sized fed a previous-layout width back
into the
transfer, growing on every relayout. The guard meant to block that feedback in
RenderBlock::availableLogicalHeightForPercentageComputation() only covered
RenderGrid, so
nothing stopped a plain shrink-to-fit aspect-ratio block from taking the same
path.
That guard now also covers sizesLogicalWidthToFitContent(), which is the set of
boxes whose
inline size comes from their content rather than from their containing block,
so have no
usable logicalWidth() until they are laid out. A block-level in-flow box keeps
resolving
as before, because its width:auto is definite as soon as its containing block's
inline
size is known.
Widening the guard by renderer type instead was tried in 313727@main and
reverted in
314405@main for breaking a video player container. Keying on how the inline
size is
determined separates the two cases: the flex containers in that test are flex
items, and so
shrink-to-fit, while a block-level flex container filling its parent is not.
That also
recovers flex-aspect-ratio-percentage-height-stale-width.html, failing since
the revert.
This does change table cells, which previously fell back to the default sizing
algorithm.
However, this change is more web-compatible, matching Chrome and WPT
expectations across
more content. This impacted the 2002 Mozilla imported test
"tables/mozilla/bugs/bug137388-2.html",
which is rebaselined accordingly.
Test: fast/replaced/replaced-percentage-size-in-aspect-ratio-shrink-to-fit.html
imported/w3c/web-platform-tests/css/css-sizing/replaced-element-max-content-contribution-transferred-size.html
imported/w3c/web-platform-tests/css/css-sizing/table-cell-definite-height-transferred-size.html
tables/mozilla/bugs/bug137388-2.html
imported/w3c/web-platform-tests/css/css-sizing/auto-scrollbar-inside-stf-abspos.html
imported/w3c/web-platform-tests/css/css-flexbox/flex-aspect-ratio-percentage-height-stale-width.html
imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/block-aspect-ratio-057.tentative.html
imported/w3c/web-platform-tests/css/css-sizing/intrinsic-percent-replaced-019.html
imported/w3c/web-platform-tests/css/css-sizing/intrinsic-percent-replaced-dynamic-011.html
* LayoutTests/TestExpectations:
*
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/replaced-element-max-content-contribution-transferred-size-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/replaced-element-max-content-contribution-transferred-size.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/table-cell-definite-height-transferred-size-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/table-cell-definite-height-transferred-size.html:
Added.
* LayoutTests/platform/glib/TestExpectations:
* LayoutTests/platform/ios/tables/mozilla/bugs/bug137388-2-expected.txt:
* LayoutTests/tables/mozilla/bugs/bug137388-2-expected.txt:
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::availableLogicalHeightForPercentageComputation const):
* Source/WebCore/rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeAspectRatioAdjustedIntrinsicLogicalWidths
const):
Canonical link: https://commits.webkit.org/321748@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications