1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 07:17:35 +00:00

LibWeb: Use the new to_px() helpers in CSS, SVG and layout code

There should be no behavior change from this, only slightly less
verbosity. :^)
This commit is contained in:
Andreas Kling 2023-05-06 16:34:55 +02:00
parent cdf0d3e905
commit ca1fa5f748
14 changed files with 141 additions and 149 deletions

View file

@ -163,12 +163,12 @@ Optional<float> SVGGraphicsElement::stroke_width() const
CSSPixels viewport_height = 0;
if (auto* svg_svg_element = first_ancestor_of_type<SVGSVGElement>()) {
if (auto* svg_svg_layout_node = svg_svg_element->layout_node()) {
viewport_width = svg_svg_layout_node->computed_values().width().resolved(*svg_svg_layout_node, CSS::Length::make_px(0)).to_px(*svg_svg_layout_node);
viewport_height = svg_svg_layout_node->computed_values().height().resolved(*svg_svg_layout_node, CSS::Length::make_px(0)).to_px(*svg_svg_layout_node);
viewport_width = svg_svg_layout_node->computed_values().width().to_px(*svg_svg_layout_node, 0);
viewport_height = svg_svg_layout_node->computed_values().height().to_px(*svg_svg_layout_node, 0);
}
}
auto scaled_viewport_size = CSS::Length::make_px((viewport_width + viewport_height) * 0.5f);
return width->resolved(*layout_node(), scaled_viewport_size).to_px(*layout_node()).value();
auto scaled_viewport_size = (viewport_width + viewport_height) * 0.5f;
return width->to_px(*layout_node(), scaled_viewport_size).value();
}
return {};
}