diff --git a/Userland/Libraries/LibWeb/SVG/SVGUseElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGUseElement.cpp index 066a7c4bcb..8fbc281046 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGUseElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGUseElement.cpp @@ -62,14 +62,15 @@ void SVGUseElement::attribute_changed(FlyString const& name, DeprecatedString co } } -Optional SVGUseElement::parse_id_from_href(DeprecatedString const& href) +Optional SVGUseElement::parse_id_from_href(DeprecatedString const& href) { auto id_seperator = href.find('#'); if (!id_seperator.has_value()) { return {}; } - return href.substring_view(id_seperator.value() + 1); + auto id = href.substring_view(id_seperator.value() + 1); + return MUST(FlyString::from_utf8(id)); } Gfx::AffineTransform SVGUseElement::element_transform() const @@ -115,7 +116,7 @@ JS::GCPtr SVGUseElement::referenced_element() } // FIXME: Support loading of external svg documents - return document().get_element_by_id(MUST(FlyString::from_utf8(m_referenced_id.value()))); + return document().get_element_by_id(m_referenced_id.value()); } // https://svgwg.org/svg2-draft/struct.html#UseShadowTree diff --git a/Userland/Libraries/LibWeb/SVG/SVGUseElement.h b/Userland/Libraries/LibWeb/SVG/SVGUseElement.h index 6e4c21ce5d..8a5584db88 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGUseElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGUseElement.h @@ -6,6 +6,7 @@ #pragma once +#include #include #include #include @@ -46,7 +47,7 @@ private: virtual JS::GCPtr create_layout_node(NonnullRefPtr) override; - Optional parse_id_from_href(DeprecatedString const& href); + Optional parse_id_from_href(DeprecatedString const& href); JS::GCPtr referenced_element(); @@ -56,7 +57,7 @@ private: Optional m_x; Optional m_y; - Optional m_referenced_id; + Optional m_referenced_id; JS::GCPtr m_document_observer; };