1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 17:37:34 +00:00

LibWeb: Add the missing UIEvent IDL constructor

This commit is contained in:
Idan Horowitz 2021-10-01 19:30:50 +03:00 committed by Andreas Kling
parent 7b2c63fd87
commit ac25c28c43
3 changed files with 28 additions and 3 deletions

View file

@ -12,22 +12,38 @@
namespace Web::UIEvents {
struct UIEventInit : public DOM::EventInit {
RefPtr<DOM::Window> view { nullptr };
int detail { 0 };
};
class UIEvent : public DOM::Event {
public:
using WrapperType = Bindings::UIEventWrapper;
static NonnullRefPtr<UIEvent> create_with_global_object(Bindings::WindowObject&, FlyString const& event_name, UIEventInit const& event_init)
{
return adopt_ref(*new UIEvent(event_name, event_init));
}
virtual ~UIEvent() override { }
DOM::Window const* view() const { return m_window; }
DOM::Window const* view() const { return m_view; }
int detail() const { return m_detail; }
protected:
explicit UIEvent(const FlyString& event_name)
explicit UIEvent(FlyString const& event_name)
: Event(event_name)
{
}
UIEvent(FlyString const& event_name, UIEventInit const& event_init)
: Event(event_name, event_init)
, m_view(event_init.view)
, m_detail(event_init.detail)
{
}
RefPtr<DOM::Window> m_window;
RefPtr<DOM::Window> m_view;
int m_detail { 0 };
};