mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 23:47:45 +00:00
LibWeb: Allow (explicitly) converting CSSPixels to float and int
...and remove some unnecessary cast chains.
This commit is contained in:
parent
c20df34b79
commit
5f0d3c083f
11 changed files with 16 additions and 14 deletions
|
@ -36,7 +36,7 @@ Optional<HitTestResult> SVGGeometryPaintable::hit_test(CSSPixelPoint position, H
|
|||
if (auto transform = layout_box().layout_transform(); transform.has_value()) {
|
||||
auto transformed_bounding_box = transform->map_to_quad(
|
||||
const_cast<SVG::SVGGeometryElement&>(geometry_element).get_path().bounding_box());
|
||||
if (!transformed_bounding_box.contains(position.to_type<double>().to_type<float>()))
|
||||
if (!transformed_bounding_box.contains(position.to_type<float>()))
|
||||
return {};
|
||||
}
|
||||
return result;
|
||||
|
@ -103,7 +103,7 @@ void SVGGeometryPaintable::paint(PaintContext& context, PaintPhase phase) const
|
|||
auto svg_viewport = [&] {
|
||||
if (maybe_view_box.has_value())
|
||||
return Gfx::FloatRect { maybe_view_box->min_x, maybe_view_box->min_y, maybe_view_box->width, maybe_view_box->height };
|
||||
return Gfx::FloatRect { { 0, 0 }, svg_element_rect.size().to_type<double>().to_type<float>() };
|
||||
return Gfx::FloatRect { { 0, 0 }, svg_element_rect.size().to_type<float>() };
|
||||
}();
|
||||
|
||||
SVG::SVGPaintContext paint_context {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue