2022-02-07 00:04:10 +01:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
|
|
|
|
*
|
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
*/
|
|
|
|
|
|
2022-09-25 18:06:11 -06:00
|
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
2022-02-07 00:04:10 +01:00
|
|
|
#include <LibWeb/UIEvents/FocusEvent.h>
|
|
|
|
|
|
|
|
|
|
namespace Web::UIEvents {
|
|
|
|
|
|
2023-03-09 21:17:20 +01:00
|
|
|
WebIDL::ExceptionOr<JS::NonnullGCPtr<FocusEvent>> FocusEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, FocusEventInit const& event_init)
|
2022-02-07 00:04:10 +01:00
|
|
|
{
|
2023-02-19 10:17:13 +01:00
|
|
|
return MUST_OR_THROW_OOM(realm.heap().allocate<FocusEvent>(realm, realm, event_name, event_init));
|
2022-08-08 22:29:40 +02:00
|
|
|
}
|
|
|
|
|
|
2023-03-09 21:17:20 +01:00
|
|
|
FocusEvent::FocusEvent(JS::Realm& realm, FlyString const& event_name, FocusEventInit const& event_init)
|
|
|
|
|
: UIEvent(realm, event_name.to_deprecated_fly_string())
|
2022-08-08 22:29:40 +02:00
|
|
|
{
|
2022-02-07 00:04:10 +01:00
|
|
|
set_related_target(const_cast<DOM::EventTarget*>(event_init.related_target.ptr()));
|
|
|
|
|
}
|
|
|
|
|
|
2022-03-14 13:21:51 -06:00
|
|
|
FocusEvent::~FocusEvent() = default;
|
2022-02-07 00:04:10 +01:00
|
|
|
|
2023-01-28 12:33:35 -05:00
|
|
|
JS::ThrowCompletionOr<void> FocusEvent::initialize(JS::Realm& realm)
|
2023-01-10 06:28:20 -05:00
|
|
|
{
|
2023-01-28 12:33:35 -05:00
|
|
|
MUST_OR_THROW_OOM(Base::initialize(realm));
|
2023-01-10 06:28:20 -05:00
|
|
|
set_prototype(&Bindings::ensure_web_prototype<Bindings::FocusEventPrototype>(realm, "FocusEvent"));
|
2023-01-28 12:33:35 -05:00
|
|
|
|
|
|
|
|
return {};
|
2023-01-10 06:28:20 -05:00
|
|
|
}
|
|
|
|
|
|
2022-02-07 00:04:10 +01:00
|
|
|
}
|