From f753a4f64049cb9af7bb33f5c20788e339a1cdec Mon Sep 17 00:00:00 2001 From: MacDue Date: Mon, 10 Apr 2023 12:36:34 +0100 Subject: [PATCH] LibWeb: Always use quirks mode when parsing SVG width/height attributes This is a bit if a hack, but without this unitless values for these attributes fail to parse with . --- Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp index 4b72ae58a1..abfab45dbf 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp +++ b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.cpp @@ -37,6 +37,13 @@ JS::GCPtr SVGSVGElement::create_layout_node(NonnullRefPtr + auto previous_quirks_mode = document().mode(); + const_cast(document()).set_quirks_mode(DOM::QuirksMode::Yes); + ScopeGuard reset_quirks_mode = [&] { + const_cast(document()).set_quirks_mode(previous_quirks_mode); + }; + auto width_attribute = attribute(SVG::AttributeNames::width); auto parsing_context = CSS::Parser::ParsingContext { document() }; if (auto width_value = parse_css_value(parsing_context, attribute(Web::HTML::AttributeNames::width), CSS::PropertyID::Width)) {