mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 02:27:43 +00:00
LibWeb: Remove reference_for_percent parameter from Length::resolved()
Despite looking like it was still needed, it was only used for passing to other calls to Length::resolved() recursively. This makes the various `foo.resolved().resolved()` calls a lot less awkward. (Though, still quite awkward.) I think we'd need to separate calculated lengths out to properly tidy these calls up, but one yak at a time. :^)
This commit is contained in:
parent
cff44831a8
commit
bfcbab0dcf
11 changed files with 133 additions and 132 deletions
|
@ -89,20 +89,20 @@ void paint_background(PaintContext& context, Layout::NodeWithStyleAndBoxModelMet
|
|||
height = image.height();
|
||||
} else if (x_is_auto) {
|
||||
height = layer.size_y.resolved(CSS::Length::make_px(background_positioning_area.height()))
|
||||
.resolved_or_zero(layout_node, background_positioning_area.height())
|
||||
.resolved_or_zero(layout_node)
|
||||
.to_px(layout_node);
|
||||
width = roundf(image.width() * ((float)height / (float)image.height()));
|
||||
} else if (y_is_auto) {
|
||||
width = layer.size_x.resolved(CSS::Length::make_px(background_positioning_area.width()))
|
||||
.resolved_or_zero(layout_node, background_positioning_area.width())
|
||||
.resolved_or_zero(layout_node)
|
||||
.to_px(layout_node);
|
||||
height = roundf(image.height() * ((float)width / (float)image.width()));
|
||||
} else {
|
||||
width = layer.size_x.resolved(CSS::Length::make_px(background_positioning_area.width()))
|
||||
.resolved_or_zero(layout_node, background_positioning_area.width())
|
||||
.resolved_or_zero(layout_node)
|
||||
.to_px(layout_node);
|
||||
height = layer.size_y.resolved(CSS::Length::make_px(background_positioning_area.height()))
|
||||
.resolved_or_zero(layout_node, background_positioning_area.height())
|
||||
.resolved_or_zero(layout_node)
|
||||
.to_px(layout_node);
|
||||
}
|
||||
|
||||
|
@ -144,7 +144,7 @@ void paint_background(PaintContext& context, Layout::NodeWithStyleAndBoxModelMet
|
|||
|
||||
// Position
|
||||
int offset_x = layer.position_offset_x.resolved(CSS::Length::make_px(space_x))
|
||||
.resolved_or_zero(layout_node, space_x)
|
||||
.resolved_or_zero(layout_node)
|
||||
.to_px(layout_node);
|
||||
if (layer.position_edge_x == CSS::PositionEdge::Right) {
|
||||
image_rect.set_right_without_resize(background_positioning_area.right() - offset_x);
|
||||
|
@ -153,7 +153,7 @@ void paint_background(PaintContext& context, Layout::NodeWithStyleAndBoxModelMet
|
|||
}
|
||||
|
||||
int offset_y = layer.position_offset_y.resolved(CSS::Length::make_px(space_y))
|
||||
.resolved_or_zero(layout_node, space_y)
|
||||
.resolved_or_zero(layout_node)
|
||||
.to_px(layout_node);
|
||||
if (layer.position_edge_y == CSS::PositionEdge::Bottom) {
|
||||
image_rect.set_bottom_without_resize(background_positioning_area.bottom() - offset_y);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue