1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 05:37:44 +00:00

LibWeb: Make DOM::Event and all its subclasses GC-allocated

This commit is contained in:
Andreas Kling 2022-08-08 22:29:40 +02:00
parent a4ddb0ef87
commit 7c3db526b0
76 changed files with 892 additions and 565 deletions

View file

@ -22,17 +22,17 @@ struct MouseEventInit : public EventModifierInit {
};
class MouseEvent final : public UIEvent {
JS_OBJECT(MouseEvent, UIEvent);
public:
using WrapperType = Bindings::MouseEventWrapper;
static MouseEvent* create(Bindings::WindowObject&, FlyString const& event_name, MouseEventInit const& event_init = {});
static MouseEvent* create_from_platform_event(Bindings::WindowObject&, FlyString const& event_name, double offset_x, double offset_y, double client_x, double client_y, unsigned mouse_button = 1);
static NonnullRefPtr<MouseEvent> create(FlyString const& event_name, MouseEventInit const& event_init = {})
{
return adopt_ref(*new MouseEvent(event_name, event_init));
}
MouseEvent(Bindings::WindowObject&, FlyString const& event_name, MouseEventInit const& event_init);
static NonnullRefPtr<MouseEvent> create_from_platform_event(FlyString const& event_name, double offset_x, double offset_y, double client_x, double client_y, unsigned mouse_button = 1);
virtual ~MouseEvent() override;
virtual ~MouseEvent() override = default;
MouseEvent& impl() { return *this; }
double offset_x() const { return m_offset_x; }
double offset_y() const { return m_offset_y; }
@ -48,8 +48,6 @@ public:
virtual u32 which() const override { return m_button + 1; }
private:
MouseEvent(FlyString const& event_name, MouseEventInit const& event_init);
void set_event_characteristics();
double m_offset_x { 0 };
@ -60,3 +58,8 @@ private:
};
}
namespace Web::Bindings {
inline JS::Object* wrap(JS::Realm&, Web::UIEvents::MouseEvent& object) { return &object; }
using MouseEventWrapper = Web::UIEvents::MouseEvent;
}