1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 04:57:45 +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

@ -6,10 +6,32 @@
#pragma once
#include <LibWeb/DOM/Document.h>
#include <LibWeb/DOM/Element.h>
namespace Web::SVG {
namespace FIXME {
class TemporarilyEnableQuirksMode {
public:
TemporarilyEnableQuirksMode(DOM::Document const& document)
: m_document(const_cast<DOM::Document&>(document))
, m_previous_quirks_mode(document.mode())
{
m_document.set_quirks_mode(DOM::QuirksMode::Yes);
}
~TemporarilyEnableQuirksMode()
{
m_document.set_quirks_mode(m_previous_quirks_mode);
}
private:
DOM::Document& m_document;
DOM::QuirksMode m_previous_quirks_mode {};
};
}
class SVGElement : public DOM::Element {
WEB_PLATFORM_OBJECT(SVGElement, DOM::Element);