From e8d10fb42933f548add3076cb1beaa4dc201d9d4 Mon Sep 17 00:00:00 2001 From: K-Adam Date: Thu, 5 Aug 2021 10:26:09 +0200 Subject: LibWeb: Ignore svg elements outside of when building layout tree An svg layout element without a `SVGSVGElement` ancestor caused a failed assertion before, because the svg context does not exist when `paint()` is called --- Userland/Libraries/LibWeb/SVG/SVGElement.h | 2 ++ Userland/Libraries/LibWeb/SVG/SVGSVGElement.h | 3 +++ 2 files changed, 5 insertions(+) (limited to 'Userland/Libraries/LibWeb/SVG') diff --git a/Userland/Libraries/LibWeb/SVG/SVGElement.h b/Userland/Libraries/LibWeb/SVG/SVGElement.h index 8ef9a6256d..221d88d552 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGElement.h @@ -14,6 +14,8 @@ class SVGElement : public DOM::Element { public: using WrapperType = Bindings::SVGElementWrapper; + virtual bool requires_svg_container() const override { return true; } + protected: SVGElement(DOM::Document&, QualifiedName); }; diff --git a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.h b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.h index 7ec562bdf6..6a6342f25e 100644 --- a/Userland/Libraries/LibWeb/SVG/SVGSVGElement.h +++ b/Userland/Libraries/LibWeb/SVG/SVGSVGElement.h @@ -22,6 +22,9 @@ public: unsigned width() const; unsigned height() const; + virtual bool requires_svg_container() const override { return false; } + virtual bool is_svg_container() const override { return true; } + private: RefPtr m_bitmap; }; -- cgit v1.2.3