diff options
Diffstat (limited to 'Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp b/Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp index 0661debd4b..a78e4b76a4 100644 --- a/Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp +++ b/Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp @@ -148,16 +148,16 @@ void paint_background(PaintContext& context, Layout::NodeWithStyleAndBoxModelMet CSSPixelRect image_rect; switch (layer.size_type) { case CSS::BackgroundSize::Contain: { - float max_width_ratio = (background_positioning_area.width() / natural_image_width).value(); - float max_height_ratio = (background_positioning_area.height() / natural_image_height).value(); - float ratio = min(max_width_ratio, max_height_ratio); + double max_width_ratio = (background_positioning_area.width() / natural_image_width).value(); + double max_height_ratio = (background_positioning_area.height() / natural_image_height).value(); + double ratio = min(max_width_ratio, max_height_ratio); image_rect.set_size(natural_image_width * ratio, natural_image_height * ratio); break; } case CSS::BackgroundSize::Cover: { - float max_width_ratio = (background_positioning_area.width() / natural_image_width).value(); - float max_height_ratio = (background_positioning_area.height() / natural_image_height).value(); - float ratio = max(max_width_ratio, max_height_ratio); + double max_width_ratio = (background_positioning_area.width() / natural_image_width).value(); + double max_height_ratio = (background_positioning_area.height() / natural_image_height).value(); + double ratio = max(max_width_ratio, max_height_ratio); image_rect.set_size(natural_image_width * ratio, natural_image_height * ratio); break; } @@ -253,7 +253,7 @@ void paint_background(PaintContext& context, Layout::NodeWithStyleAndBoxModelMet repeat_x = false; } else { auto space = fmod(background_positioning_area.width(), image_rect.width()); - x_step = image_rect.width() + (space / (float)(whole_images - 1)); + x_step = image_rect.width() + (space / static_cast<double>(whole_images - 1)); repeat_x = true; } break; @@ -284,7 +284,7 @@ void paint_background(PaintContext& context, Layout::NodeWithStyleAndBoxModelMet repeat_y = false; } else { auto space = fmod(background_positioning_area.height(), image_rect.height()); - y_step = image_rect.height() + ((float)space / (float)(whole_images - 1)); + y_step = image_rect.height() + (static_cast<double>(space) / static_cast<double>(whole_images - 1)); repeat_y = true; } break; |