mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 18:27:39 +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:
parent
9f73fc87a8
commit
e61fdd1dc6
9 changed files with 67 additions and 4 deletions
|
@ -159,7 +159,7 @@ void SVGFormattingContext::run(Box const& box, LayoutMode layout_mode, Available
|
|||
auto path_transform = dom_node.get_transform();
|
||||
|
||||
double viewbox_scale = 1;
|
||||
auto maybe_view_box = svg_svg_element.view_box();
|
||||
auto maybe_view_box = dom_node.view_box();
|
||||
if (maybe_view_box.has_value()) {
|
||||
// FIXME: This should allow just one of width or height to be specified.
|
||||
// E.g. We should be able to layout <svg width="100%"> where height is unspecified/auto.
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue