summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/SVG
diff options
context:
space:
mode:
authorK-Adam <kecskes.adam@outlook.com>2021-08-05 10:26:09 +0200
committerAndreas Kling <kling@serenityos.org>2021-08-05 20:17:08 +0200
commite8d10fb42933f548add3076cb1beaa4dc201d9d4 (patch)
treefa1137da810b07c8f606957e5b4c14207d2c58fd /Userland/Libraries/LibWeb/SVG
parent758d816b23e86cbe9f24471988e73f3c15f8c080 (diff)
downloadserenity-e8d10fb42933f548add3076cb1beaa4dc201d9d4.zip
LibWeb: Ignore svg elements outside of <svg> 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
Diffstat (limited to 'Userland/Libraries/LibWeb/SVG')
-rw-r--r--Userland/Libraries/LibWeb/SVG/SVGElement.h2
-rw-r--r--Userland/Libraries/LibWeb/SVG/SVGSVGElement.h3
2 files changed, 5 insertions, 0 deletions
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<Gfx::Bitmap> m_bitmap;
};