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.
This commit is contained in:
Tobias Christiansen 2023-10-30 15:52:26 +01:00 committed by Andreas Kling
parent 78c04cb8b2
commit 3a4d30dddc

View file

@ -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::Element>(*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;