1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 14:28:12 +00:00

LibWeb: Parse the <svg viewBox> attribute

Just parse it into an SVG::ViewBox object for now, we don't actually use
it for anything yet.
This commit is contained in:
Andreas Kling 2021-09-15 01:12:41 +02:00
parent 63c4fcdc69
commit 7de23aede2
2 changed files with 15 additions and 0 deletions

View file

@ -9,6 +9,7 @@
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Event.h>
#include <LibWeb/Layout/SVGSVGBox.h>
#include <LibWeb/SVG/AttributeNames.h>
#include <LibWeb/SVG/SVGSVGElement.h>
namespace Web::SVG {
@ -36,4 +37,12 @@ unsigned SVGSVGElement::height() const
return attribute(HTML::AttributeNames::height).to_uint().value_or(150);
}
void SVGSVGElement::parse_attribute(FlyString const& name, String const& value)
{
SVGGraphicsElement::parse_attribute(name, value);
if (name.equals_ignoring_case(SVG::AttributeNames::viewBox))
m_view_box = try_parse_view_box(value);
}
}