/src/serenity/Userland/Libraries/LibWeb/UIEvents/FocusEvent.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (c) 2022, Andreas Kling <kling@serenityos.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #include <LibWeb/Bindings/FocusEventPrototype.h> |
8 | | #include <LibWeb/Bindings/Intrinsics.h> |
9 | | #include <LibWeb/UIEvents/FocusEvent.h> |
10 | | |
11 | | namespace Web::UIEvents { |
12 | | |
13 | | JS_DEFINE_ALLOCATOR(FocusEvent); |
14 | | |
15 | | JS::NonnullGCPtr<FocusEvent> FocusEvent::create(JS::Realm& realm, FlyString const& event_name, FocusEventInit const& event_init) |
16 | 0 | { |
17 | 0 | return realm.heap().allocate<FocusEvent>(realm, realm, event_name, event_init); |
18 | 0 | } |
19 | | |
20 | | WebIDL::ExceptionOr<JS::NonnullGCPtr<FocusEvent>> FocusEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, FocusEventInit const& event_init) |
21 | 0 | { |
22 | 0 | return create(realm, event_name, event_init); |
23 | 0 | } |
24 | | |
25 | | FocusEvent::FocusEvent(JS::Realm& realm, FlyString const& event_name, FocusEventInit const& event_init) |
26 | 0 | : UIEvent(realm, event_name, event_init) |
27 | 0 | { |
28 | 0 | set_related_target(const_cast<DOM::EventTarget*>(event_init.related_target.ptr())); |
29 | 0 | } |
30 | | |
31 | 0 | FocusEvent::~FocusEvent() = default; |
32 | | |
33 | | void FocusEvent::initialize(JS::Realm& realm) |
34 | 0 | { |
35 | 0 | Base::initialize(realm); |
36 | 0 | WEB_SET_PROTOTYPE_FOR_INTERFACE(FocusEvent); |
37 | 0 | } |
38 | | |
39 | | } |