Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 8a24e523135a4c11da09016898efe5459f8a7c9e
https://github.com/WebKit/WebKit/commit/8a24e523135a4c11da09016898efe5459f8a7c9e
Author: Alan Baradlay <[email protected]>
Date: 2026-05-12 (Tue, 12 May 2026)
Changed paths:
M LayoutTests/TestExpectations
M Source/WebCore/rendering/RenderReplaced.cpp
Log Message:
-----------
[Replaced] Apply transferred min/max block-size constraints for intrinsic
keyword widths
https://bugs.webkit.org/show_bug.cgi?id=309997
Reviewed by Antti Koivisto.
<img src="1x1-green.png" style="min-height: 100px; width: max-content">
The image has a 1x1 intrinsic size (aspect ratio 1:1). With width: max-content,
the preferred width was just the intrinsic width (1px). But min-height: 100px
should transfer through the aspect ratio to give a minimum width of 100px.
CSS Sizing 4 section 5.3 says min/max constraints transfer through the aspect
ratio and apply to any "indefinite" size in the other axis. width: max-content
is indefinite, so the transferred min applies. (A definite width like
width: 100px would NOT be affected -- the spec note says "any definite sizes are
completely unaffected by a transferred constraint.")
The bug: RenderReplaced::computePreferredLogicalWidths only applied transferred
min/max in the percentage-width branch (where width is unresolvable). The else
branch (which handles auto, max-content, min-content, fit-content) never called
applyTransferredMinMaxSizesFromAspectRatio.
Non-replaced content already gets this transfer via
constrainPreferredLogicalWidthsByMinMax (the
shouldComputeLogicalHeightFromAspectRatio
path). But RenderReplaced has its own computePreferredLogicalWidths that never
calls that shared function -- so it needed the explicit call.
* Source/WebCore/rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computePreferredLogicalWidths):
* LayoutTests/TestExpectations:
Canonical link: https://commits.webkit.org/313091@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications