Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: cbb4aa7abde3d37ebf051844649fb0da12e9e7f9
https://github.com/WebKit/WebKit/commit/cbb4aa7abde3d37ebf051844649fb0da12e9e7f9
Author: Alan Baradlay <[email protected]>
Date: 2026-10-05 (Mon, 05 Oct 2026)
Changed paths:
M LayoutTests/TestExpectations
A
LayoutTests/fast/replaced/aspect-ratio-coerces-natural-block-size-expected.txt
A LayoutTests/fast/replaced/aspect-ratio-coerces-natural-block-size.html
M
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-043-expected.txt
M
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-044-expected.txt
M Source/WebCore/rendering/RenderReplaced.cpp
Log Message:
-----------
Replaced element ignores aspect-ratio when both width and height are auto
https://bugs.webkit.org/show_bug.cgi?id=326213
<rdar://problem/189096923>
Reviewed by Antti Koivisto.
<canvas style="aspect-ratio: 1 / 4"></canvas>
With both width and height auto, the canvas used its 300x150 natural size as is
and the aspect-ratio was ignored.
The CSSWG resolved that, as the final step in determining natural sizes, the
natural block size is the natural inline
size transferred through the preferred aspect ratio, so this canvas is 300x1200.
https://github.com/w3c/csswg-drafts/issues/11236#issuecomment-2718502765
https://drafts.csswg.org/css-sizing-4/#aspect-ratio-automatic
When aspect-ratio is a <ratio> (with auto && <ratio> the natural aspect ratio
wins), transfer the natural inline size
through the preferred aspect ratio to get the natural block size, using the box
specified by box-sizing and before
min/max constraints get transferred through the ratio.
m_intrinsicSize is left alone as painting (e.g. object-fit) needs the actual
natural size.
Test: fast/replaced/aspect-ratio-coerces-natural-block-size.html
* LayoutTests/TestExpectations: replaced-element-045 and replaced-element-046
now pass.
*
LayoutTests/fast/replaced/aspect-ratio-coerces-natural-block-size-expected.txt:
Added.
* LayoutTests/fast/replaced/aspect-ratio-coerces-natural-block-size.html: Added.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-043-expected.txt:
Progression.
*
LayoutTests/imported/w3c/web-platform-tests/css/css-sizing/aspect-ratio/replaced-element-044-expected.txt:
Progression.
* Source/WebCore/rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::computeIntrinsicSizesConstrainedByTransferredMinMaxSizes
const):
Canonical link: https://commits.webkit.org/322745@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications