LibWeb: Add fast_is<T> for UIEvents::MouseEvent

This commit is contained in:
Andreas Kling 2024-03-16 14:47:54 +01:00
parent c0d7f748ed
commit 7121539576
Notes: sideshowbarker 2024-07-17 06:35:16 +09:00
2 changed files with 14 additions and 0 deletions

View File

@ -144,6 +144,11 @@ public:
Vector<JS::Handle<EventTarget>> composed_path() const;
template<typename T>
bool fast_is() const = delete;
virtual bool is_mouse_event() const { return false; }
protected:
void initialize_event(String const&, bool, bool);

View File

@ -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<UIEvents::MouseEvent>() const { return is_mouse_event(); }
}