From 42e3ba409ecc4535138f632bf87ddf7a07bd5c68 Mon Sep 17 00:00:00 2001 From: Shannon Booth Date: Sun, 12 May 2024 22:17:37 +1200 Subject: [PATCH] LibWeb: Add constructor for WheelEvent This makes https://profiler.firefox.com/ progress much further in loading :^) --- Userland/Libraries/LibWeb/UIEvents/WheelEvent.cpp | 5 +++++ Userland/Libraries/LibWeb/UIEvents/WheelEvent.h | 4 +++- Userland/Libraries/LibWeb/UIEvents/WheelEvent.idl | 2 ++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/UIEvents/WheelEvent.cpp b/Userland/Libraries/LibWeb/UIEvents/WheelEvent.cpp index 0681ec17ac7..64701f8832e 100644 --- a/Userland/Libraries/LibWeb/UIEvents/WheelEvent.cpp +++ b/Userland/Libraries/LibWeb/UIEvents/WheelEvent.cpp @@ -33,6 +33,11 @@ void WheelEvent::initialize(JS::Realm& realm) WEB_SET_PROTOTYPE_FOR_INTERFACE(WheelEvent); } +JS::NonnullGCPtr WheelEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, WheelEventInit const& wheel_event_init) +{ + return create(realm, event_name, wheel_event_init); +} + JS::NonnullGCPtr WheelEvent::create(JS::Realm& realm, FlyString const& event_name, WheelEventInit const& event_init, double page_x, double page_y, double offset_x, double offset_y) { return realm.heap().allocate(realm, realm, event_name, event_init, page_x, page_y, offset_x, offset_y); diff --git a/Userland/Libraries/LibWeb/UIEvents/WheelEvent.h b/Userland/Libraries/LibWeb/UIEvents/WheelEvent.h index ec8e37f282a..5c4ce895aaf 100644 --- a/Userland/Libraries/LibWeb/UIEvents/WheelEvent.h +++ b/Userland/Libraries/LibWeb/UIEvents/WheelEvent.h @@ -31,7 +31,9 @@ class WheelEvent final : public MouseEvent { JS_DECLARE_ALLOCATOR(WheelEvent); public: - [[nodiscard]] static JS::NonnullGCPtr create(JS::Realm&, FlyString const& event_name, WheelEventInit const& event_init = {}, double page_x = 0, double page_y = 0, double offset_x = 0, double offset_y = 0); + [[nodiscard]] static JS::NonnullGCPtr create(JS::Realm&, FlyString const& event_name, WheelEventInit const& = {}, double page_x = 0, double page_y = 0, double offset_x = 0, double offset_y = 0); + [[nodiscard]] static JS::NonnullGCPtr construct_impl(JS::Realm&, FlyString const& event_name, WheelEventInit const& = {}); + static WebIDL::ExceptionOr> create_from_platform_event(JS::Realm&, FlyString const& event_name, CSSPixelPoint screen, CSSPixelPoint page, CSSPixelPoint client, CSSPixelPoint offset, double delta_x, double delta_y, unsigned button, unsigned buttons, unsigned modifiers); virtual ~WheelEvent() override; diff --git a/Userland/Libraries/LibWeb/UIEvents/WheelEvent.idl b/Userland/Libraries/LibWeb/UIEvents/WheelEvent.idl index 36f60c7f654..0f05a93dc00 100644 --- a/Userland/Libraries/LibWeb/UIEvents/WheelEvent.idl +++ b/Userland/Libraries/LibWeb/UIEvents/WheelEvent.idl @@ -3,6 +3,8 @@ // https://www.w3.org/TR/uievents/#idl-wheelevent [Exposed=Window] interface WheelEvent : MouseEvent { + constructor(DOMString type, optional WheelEventInit eventInitDict = {}); + // DeltaModeCode const unsigned long DOM_DELTA_PIXEL = 0x00; const unsigned long DOM_DELTA_LINE = 0x01;