1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 13:37:45 +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

@ -28,12 +28,11 @@ class KeyboardEvent final : public UIEvent {
WEB_PLATFORM_OBJECT(KeyboardEvent, UIEvent);
public:
static KeyboardEvent* create(HTML::Window&, FlyString const& event_name, KeyboardEventInit const& event_init = {});
static KeyboardEvent* create_with_global_object(HTML::Window&, FlyString const& event_name, KeyboardEventInit const& event_init);
static KeyboardEvent* create(JS::Realm&, FlyString const& event_name, KeyboardEventInit const& event_init = {});
static KeyboardEvent* construct_impl(JS::Realm&, FlyString const& event_name, KeyboardEventInit const& event_init);
static KeyboardEvent* create_from_platform_event(JS::Realm&, FlyString const& event_name, KeyCode, unsigned modifiers, u32 code_point);
static KeyboardEvent* create_from_platform_event(HTML::Window&, FlyString const& event_name, KeyCode, unsigned modifiers, u32 code_point);
KeyboardEvent(HTML::Window&, FlyString const& event_name, KeyboardEventInit const& event_init);
virtual ~KeyboardEvent() override;
u32 key_code() const { return m_key_code; }
@ -56,6 +55,8 @@ public:
virtual u32 which() const override { return m_key_code; }
private:
KeyboardEvent(JS::Realm&, FlyString const& event_name, KeyboardEventInit const& event_init);
String m_key;
String m_code;
u32 m_location { 0 };