1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:58:11 +00:00

LibWeb: Use viewbox attribute in SVG symbol element

Previously when a viewBox was passed to a SVG symbol element it would
not be taken into account when drawing the SVG.
This commit is contained in:
Tom 2023-07-31 18:37:44 +02:00 committed by Andreas Kling
parent 9f73fc87a8
commit e61fdd1dc6
9 changed files with 67 additions and 4 deletions

View file

@ -33,7 +33,7 @@ Optional<Gfx::AffineTransform> SVGGeometryBox::layout_transform() const
double scaling = 1;
auto origin = viewbox_origin().to_type<double>().to_type<float>();
Gfx::FloatPoint paint_offset = {};
if (svg_box && svg_box->view_box().has_value()) {
if (svg_box && geometry_element.view_box().has_value()) {
// Note: SVGFormattingContext has already done the scaling based on the viewbox,
// we now have to derive what it was from the original bounding box size.
// FIXME: It would be nice if we could store the transform from layout somewhere, so we don't have to solve for it here.