diff --git a/Userland/Libraries/LibWeb/DOM/Event.h b/Userland/Libraries/LibWeb/DOM/Event.h index eeb9784c4fd..f9cc2f74e61 100644 --- a/Userland/Libraries/LibWeb/DOM/Event.h +++ b/Userland/Libraries/LibWeb/DOM/Event.h @@ -144,6 +144,11 @@ public: Vector> composed_path() const; + template + bool fast_is() const = delete; + + virtual bool is_mouse_event() const { return false; } + protected: void initialize_event(String const&, bool, bool); diff --git a/Userland/Libraries/LibWeb/UIEvents/MouseEvent.h b/Userland/Libraries/LibWeb/UIEvents/MouseEvent.h index a27d85ffe20..69b8d085290 100644 --- a/Userland/Libraries/LibWeb/UIEvents/MouseEvent.h +++ b/Userland/Libraries/LibWeb/UIEvents/MouseEvent.h @@ -71,6 +71,8 @@ protected: virtual void initialize(JS::Realm&) override; private: + virtual bool is_mouse_event() const override { return true; } + void set_event_characteristics(); double m_screen_x { 0 }; @@ -102,3 +104,10 @@ private: }; } + +namespace Web::DOM { + +template<> +inline bool Event::fast_is() const { return is_mouse_event(); } + +}