diff --git a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp index 011102400e..b687816b7c 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include 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); +} + } diff --git a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.h b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.h index 6a6342f25e..7388347f7f 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.h @@ -8,6 +8,7 @@ #include #include +#include namespace Web::SVG { @@ -25,8 +26,13 @@ public: virtual bool requires_svg_container() const override { return false; } virtual bool is_svg_container() const override { return true; } + Optional const& view_box() { return m_view_box; } + private: + virtual void parse_attribute(FlyString const& name, String const& value) override; + RefPtr m_bitmap; + Optional m_view_box; }; }