Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 8cf8128ecc084d3b006591a183bf5a1cc309287e
https://github.com/WebKit/WebKit/commit/8cf8128ecc084d3b006591a183bf5a1cc309287e
Author: Alan Baradlay <[email protected]>
Date: 2026-10-07 (Wed, 07 Oct 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/replaced-percent-min-width-max-content-expected.html
A
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/replaced-percent-min-width-max-content.html
M Source/WebCore/rendering/RenderReplaced.cpp
Log Message:
-----------
[replaced] min-width: max-content is ignored for a percentage-width replaced
element's min-content contribution
https://bugs.webkit.org/show_bug.cgi?id=317318
<rdar://problem/179947068>
Reviewed by Antti Koivisto.
Consider a percentage-width replaced element with min-width: max-content inside
a min-content-sized
container (the canvas has a 100px natural width):
<div style="width: min-content">
<canvas width="100" height="100" style="width: 50%; min-width:
max-content"></canvas>
</div>
The container should be 100px wide - it should hug the canvas - but before this
change it collapsed
to 0px and the canvas overflowed it.
Per CSS Sizing 3 section 5.2.1, the canvas's "width: 50%" is a cyclic
percentage (the container is
sized to its contents), so it resolves against zero for the canvas's
min-content contribution; that
contribution is then floored by the minimum size in its own axis.
Here "min-width: max-content" floors it by the canvas's max-content size - its
100px natural width -
so the min-content contribution, and therefore the "width: min-content"
container, is 100px.
RenderReplaced::computeIntrinsicLogicalWidthContributions() applied the
explicit min/max-width
constraints to the contributions but only handled fixed lengths, dropping a
min-content/max-content
keyword min-width. For a non-percentage width this was harmless, since the
keyword min/max-width is
already resolved by computeReplacedLogicalWidthRespectingMinMaxWidth(); but for
a percentage width the
second pass is the only place min/max-width is applied, so the min-content
contribution stayed at zero
and the container collapsed to 0px.
Resolve a min-content/max-content keyword min-width when clamping the
contributions, flooring by the
box's own min-content/max-content contribution. This matches
RenderBox::constrainIntrinsicLogicalWidthsByMinMax().
*
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/replaced-percent-min-width-max-content-expected.html:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/replaced-percent-min-width-max-content.html:
Added.
* Source/WebCore/rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeIntrinsicLogicalWidthContributions):
Canonical link: https://commits.webkit.org/322974@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications