Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 59484f9adc40f4c876b4c50bfb131968eb0db811
https://github.com/WebKit/WebKit/commit/59484f9adc40f4c876b4c50bfb131968eb0db811
Author: Alan Baradlay <[email protected]>
Date: 2026-06-17 (Wed, 17 Jun 2026)
Changed paths:
A
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/replaced-min-width-greater-than-max-width-expected.txt
A
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/replaced-min-width-greater-than-max-width.html
M Source/WebCore/rendering/RenderReplaced.cpp
Log Message:
-----------
[replaced] min-width is not honored over max-width when sizing a
shrink-to-fit container around a replaced element
https://bugs.webkit.org/show_bug.cgi?id=317310
<rdar://problem/179935558>
Reviewed by Antti Koivisto.
When a box's used min-width is larger than its max-width, min-width wins: per
CSS 2.1
10.4, max-width is floored to min-width (equivalently, the used width is
max(min-width, min(width, max-width))).
RenderReplaced got this right for the used width (see
computeReplacedLogicalWidthRespectingMinMaxWidth(), which clamps as
max(min, min(width, max))), but not for the min/max-content contributions
computed in
computeIntrinsicLogicalWidthContributions(). There, the explicit fixed
min/max-width
constraints were applied in the wrong order - min-width first, then max-width -
so a
smaller max-width clamped the contribution back down and won. As a result a
shrink-to-fit
ancestor (e.g. an inline-block) sized to max-width instead of min-width.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/replaced-min-width-greater-than-max-width-expected.txt:
Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/replaced-min-width-greater-than-max-width.html:
Added.
* Source/WebCore/rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeIntrinsicLogicalWidthContributions):
Canonical link: https://commits.webkit.org/315396@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications