mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 07:07:34 +00:00
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 <!DOCTYPE html>.
This commit is contained in:
parent
809c15d1ee
commit
f753a4f640
1 changed files with 7 additions and 0 deletions
|
@ -37,6 +37,13 @@ JS::GCPtr<Layout::Node> SVGSVGElement::create_layout_node(NonnullRefPtr<CSS::Sty
|
|||
|
||||
void SVGSVGElement::apply_presentational_hints(CSS::StyleProperties& style) const
|
||||
{
|
||||
// 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);
|
||||
};
|
||||
|
||||
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)) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue