1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 15:57:36 +00:00

LibWeb: Remove unecessary dependence on Window from UIEvents classes

These classes only needed Window to get at its realm. Pass a realm
directly to construct UIEvents classes.
This commit is contained in:
Andrew Kaster 2022-09-25 18:06:11 -06:00 committed by Linus Groh
parent d0efc7734a
commit 6a10352712
10 changed files with 70 additions and 57 deletions

View file

@ -25,11 +25,10 @@ class MouseEvent final : public UIEvent {
WEB_PLATFORM_OBJECT(MouseEvent, UIEvent);
public:
static MouseEvent* create(HTML::Window&, FlyString const& event_name, MouseEventInit const& event_init = {});
static MouseEvent* create(JS::Realm&, FlyString const& event_name, MouseEventInit const& event_init = {});
static MouseEvent* create_from_platform_event(JS::Realm&, FlyString const& event_name, double offset_x, double offset_y, double client_x, double client_y, unsigned mouse_button = 1);
static MouseEvent* create_from_platform_event(HTML::Window&, FlyString const& event_name, double offset_x, double offset_y, double client_x, double client_y, unsigned mouse_button = 1);
MouseEvent(HTML::Window&, FlyString const& event_name, MouseEventInit const& event_init);
virtual ~MouseEvent() override;
double offset_x() const { return m_offset_x; }
@ -46,6 +45,8 @@ public:
virtual u32 which() const override { return m_button + 1; }
private:
MouseEvent(JS::Realm&, FlyString const& event_name, MouseEventInit const& event_init);
void set_event_characteristics();
double m_offset_x { 0 };