summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/Layout
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-10-27 17:58:19 +0200
committerAndreas Kling <kling@serenityos.org>2021-10-27 17:58:19 +0200
commitc908fa83e3472f3b3c0f8eea846a177d7fddb032 (patch)
treebb5ad1f3dc32054203abf5e91b75a012e2fcc1bf /Userland/Libraries/LibWeb/Layout
parent8554952690e469cc9481ea7bc8d81039a4db55a1 (diff)
downloadserenity-c908fa83e3472f3b3c0f8eea846a177d7fddb032.zip
LibWeb: Add fast_is<T>() for Layout::Label
Spotted this in a profile while wheel scrolling up & down.
Diffstat (limited to 'Userland/Libraries/LibWeb/Layout')
-rw-r--r--Userland/Libraries/LibWeb/Layout/Label.h7
-rw-r--r--Userland/Libraries/LibWeb/Layout/Node.h1
2 files changed, 7 insertions, 1 deletions
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<CSS::StyleProperties>);
virtual ~Label() override;
@@ -27,10 +27,15 @@ public:
void handle_mousemove_on_label(Badge<TextNode>, 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<Label>() const { return is_label(); }
+
}
diff --git a/Userland/Libraries/LibWeb/Layout/Node.h b/Userland/Libraries/LibWeb/Layout/Node.h
index f466652439..014db131d4 100644
--- a/Userland/Libraries/LibWeb/Layout/Node.h
+++ b/Userland/Libraries/LibWeb/Layout/Node.h
@@ -104,6 +104,7 @@ public:
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; }
+ virtual bool is_label() const { return false; }
template<typename T>
bool fast_is() const = delete;