/src/serenity/Userland/Libraries/LibWeb/Clipboard/ClipboardEvent.cpp
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2024, Tim Flynn <trflynn89@serenityos.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #include <LibJS/Runtime/Realm.h> |
8 | | #include <LibWeb/Bindings/ClipboardEventPrototype.h> |
9 | | #include <LibWeb/Bindings/Intrinsics.h> |
10 | | #include <LibWeb/Clipboard/ClipboardEvent.h> |
11 | | |
12 | | namespace Web::Clipboard { |
13 | | |
14 | | JS_DEFINE_ALLOCATOR(ClipboardEvent); |
15 | | |
16 | | JS::NonnullGCPtr<ClipboardEvent> ClipboardEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, ClipboardEventInit const& event_init) |
17 | 0 | { |
18 | 0 | return realm.heap().allocate<ClipboardEvent>(realm, realm, event_name, event_init); |
19 | 0 | } |
20 | | |
21 | | ClipboardEvent::ClipboardEvent(JS::Realm& realm, FlyString const& event_name, ClipboardEventInit const& event_init) |
22 | 0 | : DOM::Event(realm, event_name, event_init) |
23 | 0 | , m_clipboard_data(event_init.clipboard_data) |
24 | 0 | { |
25 | 0 | } |
26 | | |
27 | 0 | ClipboardEvent::~ClipboardEvent() = default; |
28 | | |
29 | | void ClipboardEvent::initialize(JS::Realm& realm) |
30 | 0 | { |
31 | 0 | Base::initialize(realm); |
32 | 0 | WEB_SET_PROTOTYPE_FOR_INTERFACE(ClipboardEvent); |
33 | 0 | } |
34 | | |
35 | | void ClipboardEvent::visit_edges(JS::Cell::Visitor& visitor) |
36 | 0 | { |
37 | 0 | Base::visit_edges(visitor); |
38 | 0 | visitor.visit(m_clipboard_data); |
39 | 0 | } |
40 | | |
41 | | } |