From 3a4d30dddcbee39860c532873fd4aeb394a25720 Mon Sep 17 00:00:00 2001 From: Tobias Christiansen Date: Mon, 30 Oct 2023 15:52:26 +0100 Subject: [PATCH] LibWeb: Avoid truncation of aspect-ratio-computation in ImagePaintable The value of the aspect ratio of the bitmap got truncated and this lead to funky rendering problems when using object-fit and object-position. --- Userland/Libraries/LibWeb/Painting/ImagePaintable.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Painting/ImagePaintable.cpp b/Userland/Libraries/LibWeb/Painting/ImagePaintable.cpp index cc82e9da8a..5c0762c7a3 100644 --- a/Userland/Libraries/LibWeb/Painting/ImagePaintable.cpp +++ b/Userland/Libraries/LibWeb/Painting/ImagePaintable.cpp @@ -68,7 +68,7 @@ void ImagePaintable::paint(PaintContext& context, PaintPhase phase) const auto scaling_mode = to_gfx_scaling_mode(computed_values().image_rendering(), bitmap_rect, image_int_rect); auto& dom_element = verify_cast(*dom_node()); auto object_fit = dom_element.computed_css_values()->object_fit(); - auto bitmap_aspect_ratio = bitmap_rect.height() / bitmap_rect.width(); + auto bitmap_aspect_ratio = (float)bitmap_rect.height() / bitmap_rect.width(); auto image_aspect_ratio = (float)image_rect.height().value() / image_rect.width().value(); auto scale_x = 0.0f;