summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-10-18 16:26:05 +0200
committerAndreas Kling <kling@serenityos.org>2021-10-19 19:13:58 +0200
commit225a5f2fe698e3edbfdceade953f484afd6df085 (patch)
tree250b26e238d9a0eb864c9fce2f60ddc185a51b4d
parent04c0c103e0fc60102f531c82a24e348e93d17f19 (diff)
downloadserenity-225a5f2fe698e3edbfdceade953f484afd6df085.zip
LibWeb: Add fast_is<T>() for SVGBox and SVGPathBox
-rw-r--r--Userland/Libraries/LibWeb/Layout/Node.h2
-rw-r--r--Userland/Libraries/LibWeb/Layout/SVGBox.h6
-rw-r--r--Userland/Libraries/LibWeb/Layout/SVGPathBox.h6
3 files changed, 14 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/Node.h b/Userland/Libraries/LibWeb/Layout/Node.h
index ccd58dc45f..f9d384f190 100644
--- a/Userland/Libraries/LibWeb/Layout/Node.h
+++ b/Userland/Libraries/LibWeb/Layout/Node.h
@@ -101,6 +101,8 @@ public:
virtual bool is_block_container() const { return false; }
virtual bool is_text_node() const { return false; }
virtual bool is_initial_containing_block_box() const { return false; }
+ virtual bool is_svg_box() const { return false; }
+ virtual bool is_svg_path_box() const { return false; }
template<typename T>
bool fast_is() const = delete;
diff --git a/Userland/Libraries/LibWeb/Layout/SVGBox.h b/Userland/Libraries/LibWeb/Layout/SVGBox.h
index 1ba13689a5..e3aa207df6 100644
--- a/Userland/Libraries/LibWeb/Layout/SVGBox.h
+++ b/Userland/Libraries/LibWeb/Layout/SVGBox.h
@@ -21,6 +21,12 @@ public:
virtual void before_children_paint(PaintContext& context, PaintPhase phase) override;
virtual void after_children_paint(PaintContext& context, PaintPhase phase) override;
+
+private:
+ virtual bool is_svg_box() const final { return true; }
};
+template<>
+inline bool Node::fast_is<SVGBox>() const { return is_svg_box(); }
+
}
diff --git a/Userland/Libraries/LibWeb/Layout/SVGPathBox.h b/Userland/Libraries/LibWeb/Layout/SVGPathBox.h
index 5984443613..54617f6087 100644
--- a/Userland/Libraries/LibWeb/Layout/SVGPathBox.h
+++ b/Userland/Libraries/LibWeb/Layout/SVGPathBox.h
@@ -19,6 +19,12 @@ public:
SVG::SVGPathElement& dom_node() { return verify_cast<SVG::SVGPathElement>(SVGGraphicsBox::dom_node()); }
virtual void paint(PaintContext& context, PaintPhase phase) override;
+
+private:
+ virtual bool is_svg_path_box() const final { return true; }
};
+template<>
+inline bool Node::fast_is<SVGPathBox>() const { return is_svg_path_box(); }
+
}