diff options
author | Andreas Kling <kling@serenityos.org> | 2021-10-27 17:58:57 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-10-27 17:58:57 +0200 |
commit | 4333d0d639edd14c94aaebaf141603593d045450 (patch) | |
tree | ee18c4594beb44bbe3b55218ee9ef7bad076875f /Userland/Libraries/LibWeb | |
parent | c908fa83e3472f3b3c0f8eea846a177d7fddb032 (diff) | |
download | serenity-4333d0d639edd14c94aaebaf141603593d045450.zip |
LibWeb: Add fast_is<T>() for HTML::HTMLHtmlElement
Another one spotted in a scroll-up-and-down profile.
Diffstat (limited to 'Userland/Libraries/LibWeb')
-rw-r--r-- | Userland/Libraries/LibWeb/DOM/Node.h | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.h | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/Node.h b/Userland/Libraries/LibWeb/DOM/Node.h index c1e02624f1..cc4fa09e84 100644 --- a/Userland/Libraries/LibWeb/DOM/Node.h +++ b/Userland/Libraries/LibWeb/DOM/Node.h @@ -82,6 +82,7 @@ public: virtual bool is_editable() const; + virtual bool is_html_html_element() const { return false; } virtual bool is_html_template_element() const { return false; } ExceptionOr<NonnullRefPtr<Node>> pre_insert(NonnullRefPtr<Node>, RefPtr<Node>); diff --git a/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.h b/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.h index 3e689b5a5b..fac96b510b 100644 --- a/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.h +++ b/Userland/Libraries/LibWeb/HTML/HTMLHtmlElement.h @@ -18,6 +18,14 @@ public: virtual ~HTMLHtmlElement() override; bool should_use_body_background_properties() const; + +private: + virtual bool is_html_html_element() const override { return true; } }; } + +namespace Web::DOM { +template<> +inline bool Node::fast_is<HTML::HTMLHtmlElement>() const { return is_html_html_element(); } +} |