mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:38: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:
parent
9f73fc87a8
commit
e61fdd1dc6
9 changed files with 67 additions and 4 deletions
|
@ -16,6 +16,7 @@
|
|||
#include <LibWeb/SVG/SVGGradientElement.h>
|
||||
#include <LibWeb/SVG/SVGGraphicsElement.h>
|
||||
#include <LibWeb/SVG/SVGSVGElement.h>
|
||||
#include <LibWeb/SVG/SVGSymbolElement.h>
|
||||
|
||||
namespace Web::SVG {
|
||||
|
||||
|
@ -230,4 +231,19 @@ Optional<float> SVGGraphicsElement::stroke_width() const
|
|||
return width.to_px(*layout_node(), scaled_viewport_size).to_double();
|
||||
}
|
||||
|
||||
Optional<ViewBox> SVGGraphicsElement::view_box() const
|
||||
{
|
||||
if (auto* svg_svg_element = shadow_including_first_ancestor_of_type<SVGSVGElement>()) {
|
||||
if (svg_svg_element->view_box().has_value())
|
||||
return svg_svg_element->view_box();
|
||||
}
|
||||
|
||||
if (auto* svg_symbol_element = shadow_including_first_ancestor_of_type<SVGSymbolElement>()) {
|
||||
if (svg_symbol_element->view_box().has_value())
|
||||
return svg_symbol_element->view_box();
|
||||
}
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue