mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 03:55:24 +00:00
LibWeb: Add the missing UIEvent IDL constructor
This commit is contained in:
parent
7b2c63fd87
commit
ac25c28c43
Notes:
sideshowbarker
2024-07-18 03:13:56 +09:00
Author: https://github.com/IdanHo Commit: https://github.com/SerenityOS/serenity/commit/ac25c28c435 Pull-request: https://github.com/SerenityOS/serenity/pull/10299
3 changed files with 28 additions and 3 deletions
|
@ -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 {
|
||||
|
|
|
@ -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 };
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue