Skip to content

Commit f31edc5

Browse files
authored
layout: Stop making <video> fall back to a preferred aspect ratio of 2 (servo#38705)
This is simpler, and has been successfully shipped in Blink. See w3c/csswg-drafts#12053 for more information. Testing: Improves WPT tests. Signed-off-by: Oriol Brufau <[email protected]>
1 parent 3962956 commit f31edc5

File tree

5 files changed

+4
-38
lines changed

5 files changed

+4
-38
lines changed

components/layout/replaced.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -474,20 +474,10 @@ impl ReplacedContents {
474474
style: &ComputedValues,
475475
padding_border_sums: &LogicalVec2<Au>,
476476
) -> Option<AspectRatio> {
477-
style
478-
.preferred_aspect_ratio(
479-
self.inline_size_over_block_size_intrinsic_ratio(style),
480-
padding_border_sums,
481-
)
482-
.or_else(|| {
483-
matches!(self.kind, ReplacedContentKind::Video(_)).then(Self::default_aspect_ratio)
484-
})
485-
}
486-
487-
/// The aspect ratio of the default object sizes.
488-
/// <https://drafts.csswg.org/css-images-3/#default-object-size>
489-
pub(crate) fn default_aspect_ratio() -> AspectRatio {
490-
AspectRatio::from_content_ratio(2.0)
477+
style.preferred_aspect_ratio(
478+
self.inline_size_over_block_size_intrinsic_ratio(style),
479+
padding_border_sums,
480+
)
491481
}
492482

493483
/// The inline size that would result from combining the natural size

tests/wpt/meta/css/css-sizing/intrinsic-size-fallback-video.html.ini

Lines changed: 0 additions & 9 deletions
This file was deleted.

tests/wpt/meta/html/rendering/replaced-elements/attributes-for-embedded-content-and-images/video-aspect-ratio.html.ini

Lines changed: 0 additions & 3 deletions
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,3 @@
11
[video-intrinsic-width-height.html]
2-
[only width attribute]
3-
expected: FAIL
4-
5-
[only height attribute]
6-
expected: FAIL
7-
82
[both width/height attributes and style keeping aspect-ratio]
93
expected: FAIL

tests/wpt/meta/html/semantics/embedded-content/the-video-element/intrinsic_sizes.htm.ini

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)