From c908fa83e3472f3b3c0f8eea846a177d7fddb032 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Wed, 27 Oct 2021 17:58:19 +0200 Subject: [PATCH] LibWeb: Add fast_is() for Layout::Label Spotted this in a profile while wheel scrolling up & down. --- Userland/Libraries/LibWeb/Layout/Label.h | 7 ++++++- Userland/Libraries/LibWeb/Layout/Node.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Layout/Label.h b/Userland/Libraries/LibWeb/Layout/Label.h index 4c132e459c..31fcbfea83 100644 --- a/Userland/Libraries/LibWeb/Layout/Label.h +++ b/Userland/Libraries/LibWeb/Layout/Label.h @@ -11,7 +11,7 @@ namespace Web::Layout { -class Label : public BlockContainer { +class Label final : public BlockContainer { public: Label(DOM::Document&, HTML::HTMLLabelElement*, NonnullRefPtr); virtual ~Label() override; @@ -27,10 +27,15 @@ public: void handle_mousemove_on_label(Badge, const Gfx::IntPoint&, unsigned button); private: + virtual bool is_label() const override { return true; } + static Label* label_for_control_node(LabelableNode&); LabelableNode* control_node(); bool m_tracking_mouse { false }; }; +template<> +inline bool Node::fast_is