LibWeb: Add constructor for WheelEvent

This makes https://profiler.firefox.com/ progress much further in
loading :^)
This commit is contained in:
Shannon Booth 2024-05-12 22:17:37 +12:00 committed by Alexander Kalenik
parent 0c799b23cb
commit 42e3ba409e
Notes: sideshowbarker 2024-07-17 02:21:14 +09:00
3 changed files with 10 additions and 1 deletions

View file

@ -33,6 +33,11 @@ void WheelEvent::initialize(JS::Realm& realm)
WEB_SET_PROTOTYPE_FOR_INTERFACE(WheelEvent);
}
JS::NonnullGCPtr<WheelEvent> 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> 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<WheelEvent>(realm, realm, event_name, event_init, page_x, page_y, offset_x, offset_y);

View file

@ -31,7 +31,9 @@ class WheelEvent final : public MouseEvent {
JS_DECLARE_ALLOCATOR(WheelEvent);
public:
[[nodiscard]] static JS::NonnullGCPtr<WheelEvent> 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<WheelEvent> 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<WheelEvent> construct_impl(JS::Realm&, FlyString const& event_name, WheelEventInit const& = {});
static WebIDL::ExceptionOr<JS::NonnullGCPtr<WheelEvent>> 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;

View file

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