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