layout: Stop making <video> fall back to a preferred aspect ratio of 2 (#38705)

This is simpler, and has been successfully shipped in Blink.
See https://github.com/w3c/csswg-drafts/issues/12053 for more
information.

Testing: Improves WPT tests.

Signed-off-by: Oriol Brufau <obrufau@igalia.com>
This commit is contained in:
Oriol Brufau 2025-08-19 05:09:36 -07:00 committed by GitHub
parent 39629560c8
commit f31edc5d6a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 4 additions and 38 deletions

View file

@ -474,20 +474,10 @@ impl ReplacedContents {
style: &ComputedValues,
padding_border_sums: &LogicalVec2<Au>,
) -> Option<AspectRatio> {
style
.preferred_aspect_ratio(
self.inline_size_over_block_size_intrinsic_ratio(style),
padding_border_sums,
)
.or_else(|| {
matches!(self.kind, ReplacedContentKind::Video(_)).then(Self::default_aspect_ratio)
})
}
/// The aspect ratio of the default object sizes.
/// <https://drafts.csswg.org/css-images-3/#default-object-size>
pub(crate) fn default_aspect_ratio() -> AspectRatio {
AspectRatio::from_content_ratio(2.0)
style.preferred_aspect_ratio(
self.inline_size_over_block_size_intrinsic_ratio(style),
padding_border_sums,
)
}
/// The inline size that would result from combining the natural size

View file

@ -1,9 +0,0 @@
[intrinsic-size-fallback-video.html]
[.wrapper 2]
expected: FAIL
[.wrapper 3]
expected: FAIL
[.wrapper 4]
expected: FAIL

View file

@ -1,3 +0,0 @@
[video-aspect-ratio.html]
[Aspect ratio for regular video with aspect-ratio:auto]
expected: FAIL

View file

@ -1,9 +1,3 @@
[video-intrinsic-width-height.html]
[only width attribute]
expected: FAIL
[only height attribute]
expected: FAIL
[both width/height attributes and style keeping aspect-ratio]
expected: FAIL

View file

@ -1,6 +0,0 @@
[intrinsic_sizes.htm]
[default height is still 150]
expected: FAIL
[default width is still 300]
expected: FAIL