mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-26 03:09:08 +00:00
LibWeb: Use CSSPixelFraction to represent aspect ratios
This allows us to retain perfect precision for aspect ratios derived from either the intrinsic sizes of replaced elements, or the `aspect-ratio` CSS property.
This commit is contained in:
@@ -47,9 +47,9 @@ Optional<CSSPixels> AnimatedBitmapDecodedImageData::intrinsic_height() const
|
||||
return m_frames.first().bitmap->height();
|
||||
}
|
||||
|
||||
Optional<float> AnimatedBitmapDecodedImageData::intrinsic_aspect_ratio() const
|
||||
Optional<CSSPixelFraction> AnimatedBitmapDecodedImageData::intrinsic_aspect_ratio() const
|
||||
{
|
||||
return static_cast<float>(m_frames.first().bitmap->width()) / static_cast<float>(m_frames.first().bitmap->height());
|
||||
return CSSPixels(m_frames.first().bitmap->width()) / CSSPixels(m_frames.first().bitmap->height());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user