diff options
author | Andreas Kling <kling@serenityos.org> | 2022-07-25 23:55:20 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-07-26 00:04:21 +0200 |
commit | bd48d9521a4c60ffa1a6e7b0a8bc6b14e1b063ec (patch) | |
tree | 4f4c57bfa88d5563371f6b38ca1db244cddcec42 /Userland/Libraries/LibWeb/Painting | |
parent | 16c173de4375f1002f76ed6b3d1e5a150bd18863 (diff) | |
download | serenity-bd48d9521a4c60ffa1a6e7b0a8bc6b14e1b063ec.zip |
LibWeb: Simplify more code with CSS::LengthPercentage::is_auto()
Diffstat (limited to 'Userland/Libraries/LibWeb/Painting')
-rw-r--r-- | Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp b/Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp index 1d664748f4..7ba38a373e 100644 --- a/Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp +++ b/Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp @@ -139,8 +139,8 @@ void paint_background(PaintContext& context, Layout::NodeWithStyleAndBoxModelMet case CSS::BackgroundSize::LengthPercentage: { float width; float height; - bool x_is_auto = layer.size_x.is_length() && layer.size_x.length().is_auto(); - bool y_is_auto = layer.size_y.is_length() && layer.size_y.length().is_auto(); + bool x_is_auto = layer.size_x.is_auto(); + bool y_is_auto = layer.size_y.is_auto(); if (x_is_auto && y_is_auto) { width = image.width(); height = image.height(); @@ -179,10 +179,10 @@ void paint_background(PaintContext& context, Layout::NodeWithStyleAndBoxModelMet // for the other dimension, then there is a third step: that other dimension is scaled // so that the original aspect ratio is restored. if (layer.repeat_x != layer.repeat_y) { - if (layer.size_x.is_length() && layer.size_x.length().is_auto()) { + if (layer.size_x.is_auto()) { image_rect.set_width(image.width() * (image_rect.height() / image.height())); } - if (layer.size_y.is_length() && layer.size_y.length().is_auto()) { + if (layer.size_y.is_auto()) { image_rect.set_height(image.height() * (image_rect.width() / image.width())); } } |