1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 18:37:35 +00:00

LibWeb: Enable quirks when parsing SVGGraphicsElement CSS attributes

This allows valid SVG attributes such as `font-size` with a unitless
value to be parsed successfully (in an admittedly hacky way).
This commit is contained in:
MacDue 2023-07-20 20:58:13 +01:00 committed by Andreas Kling
parent 48d03a68e9
commit 4cdb4de049
3 changed files with 26 additions and 5 deletions

View file

@ -41,11 +41,7 @@ void SVGSVGElement::apply_presentational_hints(CSS::StyleProperties& style) cons
Base::apply_presentational_hints(style);
// NOTE: Hack to ensure SVG unitless widths/heights are parsed even with <!DOCTYPE html>
auto previous_quirks_mode = document().mode();
const_cast<DOM::Document&>(document()).set_quirks_mode(DOM::QuirksMode::Yes);
ScopeGuard reset_quirks_mode = [&] {
const_cast<DOM::Document&>(document()).set_quirks_mode(previous_quirks_mode);
};
FIXME::TemporarilyEnableQuirksMode enable_quirks(document());
auto width_attribute = attribute(SVG::AttributeNames::width);
auto parsing_context = CSS::Parser::ParsingContext { document() };