mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Properly handle degenerate aspect ratios (#30245)
When a replaced element has a degenerate aspect ratio, it should be handled as if that element did not have an aspect ratio according to https://drafts.csswg.org/css-images/#natural-aspect-ratio.
This commit is contained in:
parent
5e60088276
commit
f25ab59406
2 changed files with 35 additions and 29 deletions
|
@ -566,11 +566,7 @@ impl<'a> BuilderForBoxFragment<'a> {
|
|||
match image {
|
||||
Image::None => {},
|
||||
Image::Gradient(ref gradient) => {
|
||||
let intrinsic = IntrinsicSizes {
|
||||
width: None,
|
||||
height: None,
|
||||
ratio: None,
|
||||
};
|
||||
let intrinsic = IntrinsicSizes::empty();
|
||||
if let Some(layer) =
|
||||
&background::layout_layer(self, &source, builder, index, intrinsic)
|
||||
{
|
||||
|
@ -607,13 +603,10 @@ impl<'a> BuilderForBoxFragment<'a> {
|
|||
|
||||
// FIXME: https://drafts.csswg.org/css-images-4/#the-image-resolution
|
||||
let dppx = 1.0;
|
||||
|
||||
let intrinsic = IntrinsicSizes {
|
||||
width: Some(Length::new(width as f32 / dppx)),
|
||||
height: Some(Length::new(height as f32 / dppx)),
|
||||
// FIXME https://github.com/w3c/csswg-drafts/issues/4572
|
||||
ratio: Some(width as f32 / height as f32),
|
||||
};
|
||||
let intrinsic = IntrinsicSizes::from_width_and_height(
|
||||
width as f32 / dppx,
|
||||
height as f32 / dppx,
|
||||
);
|
||||
|
||||
if let Some(layer) =
|
||||
background::layout_layer(self, &source, builder, index, intrinsic)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue