1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 09:48:11 +00:00

LibWeb: Add AbstractImageStyleValue::natural_aspect_ratio()

This commit is contained in:
MacDue 2023-12-27 23:51:00 +01:00 committed by Andreas Kling
parent bbceb155ce
commit d2c96e213f
3 changed files with 17 additions and 0 deletions

View file

@ -124,6 +124,13 @@ Optional<CSSPixels> ImageStyleValue::natural_height() const
return {};
}
Optional<CSSPixelFraction> ImageStyleValue::natural_aspect_ratio() const
{
if (auto image_data = this->image_data())
return image_data->intrinsic_aspect_ratio();
return {};
}
void ImageStyleValue::paint(PaintContext& context, DevicePixelRect const& dest_rect, CSS::ImageRendering image_rendering) const
{
if (auto const* b = bitmap(m_current_frame_index, dest_rect.size().to_type<int>()); b != nullptr) {