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

LibWeb: Allow (explicitly) converting CSSPixels to float and int

...and remove some unnecessary cast chains.
This commit is contained in:
MacDue 2023-08-07 22:12:21 +01:00 committed by Alexander Kalenik
parent c20df34b79
commit 5f0d3c083f
11 changed files with 16 additions and 14 deletions

View file

@ -29,10 +29,10 @@ Optional<Gfx::AffineTransform> SVGTextBox::layout_transform() const
auto& geometry_element = dom_node();
auto transform = geometry_element.get_transform();
auto* svg_box = geometry_element.first_ancestor_of_type<SVG::SVGSVGElement>();
auto origin = viewbox_origin().to_type<double>().to_type<float>();
auto origin = viewbox_origin().to_type<float>();
Gfx::FloatPoint paint_offset = {};
if (svg_box && svg_box->view_box().has_value())
paint_offset = svg_box->paintable_box()->absolute_rect().location().to_type<double>().to_type<float>();
paint_offset = svg_box->paintable_box()->absolute_rect().location().to_type<float>();
return Gfx::AffineTransform {}.translate(paint_offset).translate(-origin).multiply(transform);
}