summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp
diff options
context:
space:
mode:
authorSam Atkins <atkinssj@serenityos.org>2022-01-19 11:20:40 +0000
committerAndreas Kling <kling@serenityos.org>2022-01-20 00:04:10 +0100
commit784ba2ec427cf1ad4101b3dfc170f50c49887a25 (patch)
tree799042e7c3bafd49b16a3f0a1fb5b777eeb39532 /Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp
parent0162ca912b58d5c7fbe8f8c75768d4819689a0a8 (diff)
downloadserenity-784ba2ec427cf1ad4101b3dfc170f50c49887a25.zip
LibWeb: Convert background-position to LengthPercentage
Not much needed changing this time, hurrah! :^)
Diffstat (limited to 'Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp')
-rw-r--r--Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp b/Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp
index 9e4afb5db1..cd325aaef6 100644
--- a/Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp
+++ b/Userland/Libraries/LibWeb/Painting/BackgroundPainting.cpp
@@ -143,14 +143,18 @@ void paint_background(PaintContext& context, Layout::NodeWithStyleAndBoxModelMet
int space_y = background_positioning_area.height() - image_rect.height();
// Position
- int offset_x = layer.position_offset_x.resolved_or_zero(layout_node, space_x).to_px(layout_node);
+ int offset_x = layer.position_offset_x.resolved(CSS::Length::make_px(space_x))
+ .resolved_or_zero(layout_node, space_x)
+ .to_px(layout_node);
if (layer.position_edge_x == CSS::PositionEdge::Right) {
image_rect.set_right_without_resize(background_positioning_area.right() - offset_x);
} else {
image_rect.set_left(background_positioning_area.left() + offset_x);
}
- int offset_y = layer.position_offset_y.resolved_or_zero(layout_node, space_y).to_px(layout_node);
+ int offset_y = layer.position_offset_y.resolved(CSS::Length::make_px(space_y))
+ .resolved_or_zero(layout_node, space_y)
+ .to_px(layout_node);
if (layer.position_edge_y == CSS::PositionEdge::Bottom) {
image_rect.set_bottom_without_resize(background_positioning_area.bottom() - offset_y);
} else {