1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-02 22:42:08 +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

@ -10,6 +10,7 @@
#include <LibWeb/CSS/StyleValues/IdentifierStyleValue.h>
#include <LibWeb/CSS/StyleValues/OverflowStyleValue.h>
#include <LibWeb/DOM/ShadowRoot.h>
#include <LibWeb/SVG/AttributeNames.h>
#include <LibWeb/SVG/SVGSymbolElement.h>
#include <LibWeb/SVG/SVGUseElement.h>
@ -44,8 +45,12 @@ void SVGSymbolElement::apply_presentational_hints(CSS::StyleProperties& style) c
// and this declaration must have importance over any other CSS rule or presentation attribute.
style.set_property(CSS::PropertyID::Display, CSS::DisplayStyleValue::create(CSS::Display::from_short(CSS::Display::Short::None)).release_value_but_fixme_should_propagate_errors());
}
}
// TODO: Parse viewBox and apply it in SVGGraphicsElement/SVGGraphicsPaintable
void SVGSymbolElement::attribute_changed(DeprecatedFlyString const& name, DeprecatedString const& value)
{
if (name.equals_ignoring_ascii_case(SVG::AttributeNames::viewBox))
m_view_box = try_parse_view_box(value);
}
bool SVGSymbolElement::is_direct_child_of_use_shadow_tree() const