/src/serenity/Userland/Libraries/LibWeb/HTML/DragEvent.cpp
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2024, Maciej <sppmacd@pm.me> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #include <LibWeb/Bindings/DragEventPrototype.h> |
8 | | #include <LibWeb/Bindings/Intrinsics.h> |
9 | | #include <LibWeb/HTML/DragEvent.h> |
10 | | |
11 | | namespace Web::HTML { |
12 | | |
13 | | JS_DEFINE_ALLOCATOR(DragEvent); |
14 | | |
15 | | JS::NonnullGCPtr<DragEvent> DragEvent::create(JS::Realm& realm, FlyString const& event_name, DragEventInit const& event_init, double page_x, double page_y, double offset_x, double offset_y) |
16 | 0 | { |
17 | 0 | return realm.heap().allocate<DragEvent>(realm, realm, event_name, event_init, page_x, page_y, offset_x, offset_y); |
18 | 0 | } |
19 | | |
20 | | WebIDL::ExceptionOr<JS::NonnullGCPtr<DragEvent>> DragEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, DragEventInit const& event_init) |
21 | 0 | { |
22 | 0 | return create(realm, event_name, event_init); |
23 | 0 | } |
24 | | |
25 | | DragEvent::DragEvent(JS::Realm& realm, FlyString const& event_name, DragEventInit const& event_init, double page_x, double page_y, double offset_x, double offset_y) |
26 | 0 | : MouseEvent(realm, event_name, event_init, page_x, page_y, offset_x, offset_y) |
27 | 0 | , m_data_transfer(event_init.data_transfer) |
28 | 0 | { |
29 | 0 | } |
30 | | |
31 | 0 | DragEvent::~DragEvent() = default; |
32 | | |
33 | | void DragEvent::initialize(JS::Realm& realm) |
34 | 0 | { |
35 | 0 | Base::initialize(realm); |
36 | 0 | WEB_SET_PROTOTYPE_FOR_INTERFACE(DragEvent); |
37 | 0 | } |
38 | | |
39 | | void DragEvent::visit_edges(JS::Cell::Visitor& visitor) |
40 | 0 | { |
41 | 0 | Base::visit_edges(visitor); |
42 | 0 | visitor.visit(m_data_transfer); |
43 | 0 | } |
44 | | |
45 | | } |