From 225a5f2fe698e3edbfdceade953f484afd6df085 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Mon, 18 Oct 2021 16:26:05 +0200 Subject: LibWeb: Add fast_is() for SVGBox and SVGPathBox --- Userland/Libraries/LibWeb/Layout/Node.h | 2 ++ Userland/Libraries/LibWeb/Layout/SVGBox.h | 6 ++++++ Userland/Libraries/LibWeb/Layout/SVGPathBox.h | 6 ++++++ 3 files changed, 14 insertions(+) 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 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() 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(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() const { return is_svg_path_box(); } + } -- cgit v1.2.3