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
Notes: sideshowbarker 2024-07-18 03:13:56 +09:00
3 changed files with 28 additions and 3 deletions

View file

@ -2474,6 +2474,7 @@ using namespace Web::DOM;
using namespace Web::Geometry;
using namespace Web::HTML;
using namespace Web::RequestIdleCallback;
using namespace Web::UIEvents;
using namespace Web::XHR;
namespace Web::Bindings {

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 };
};

View file

@ -1,4 +1,12 @@
#import <DOM/Event.idl>
interface UIEvent : Event {
constructor(DOMString type, optional UIEventInit eventInitDict = {});
readonly attribute Window? view;
readonly attribute long detail;
};
dictionary UIEventInit : EventInit {
Window? view = null;
long detail = 0;
};