2022-08-08 23:29:40 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
2022-09-26 03:06:11 +03:00
|
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
2022-08-08 23:29:40 +03:00
|
|
|
#include <LibWeb/UIEvents/UIEvent.h>
|
|
|
|
|
|
|
|
namespace Web::UIEvents {
|
|
|
|
|
2023-01-09 03:23:00 +03:00
|
|
|
UIEvent* UIEvent::create(JS::Realm& realm, DeprecatedFlyString const& event_name)
|
2022-08-08 23:29:40 +03:00
|
|
|
{
|
2022-09-26 03:06:11 +03:00
|
|
|
return realm.heap().allocate<UIEvent>(realm, realm, event_name);
|
2022-08-08 23:29:40 +03:00
|
|
|
}
|
|
|
|
|
2023-01-09 03:23:00 +03:00
|
|
|
UIEvent* UIEvent::construct_impl(JS::Realm& realm, DeprecatedFlyString const& event_name, UIEventInit const& event_init)
|
2022-08-08 23:29:40 +03:00
|
|
|
{
|
2022-09-26 03:06:11 +03:00
|
|
|
return realm.heap().allocate<UIEvent>(realm, realm, event_name, event_init);
|
2022-08-08 23:29:40 +03:00
|
|
|
}
|
|
|
|
|
2023-01-09 03:23:00 +03:00
|
|
|
UIEvent::UIEvent(JS::Realm& realm, DeprecatedFlyString const& event_name)
|
2022-09-26 03:06:11 +03:00
|
|
|
: Event(realm, event_name)
|
2022-08-08 23:29:40 +03:00
|
|
|
{
|
2022-09-26 03:06:11 +03:00
|
|
|
set_prototype(&Bindings::cached_web_prototype(realm, "UIEvent"));
|
2022-08-08 23:29:40 +03:00
|
|
|
}
|
|
|
|
|
2023-01-09 03:23:00 +03:00
|
|
|
UIEvent::UIEvent(JS::Realm& realm, DeprecatedFlyString const& event_name, UIEventInit const& event_init)
|
2022-09-26 03:06:11 +03:00
|
|
|
: Event(realm, event_name, event_init)
|
2022-08-08 23:29:40 +03:00
|
|
|
, m_view(event_init.view)
|
|
|
|
, m_detail(event_init.detail)
|
|
|
|
{
|
2022-09-26 03:06:11 +03:00
|
|
|
set_prototype(&Bindings::cached_web_prototype(realm, "UIEvent"));
|
2022-08-08 23:29:40 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
UIEvent::~UIEvent() = default;
|
|
|
|
|
2022-08-28 14:42:07 +03:00
|
|
|
void UIEvent::visit_edges(Cell::Visitor& visitor)
|
|
|
|
{
|
|
|
|
Base::visit_edges(visitor);
|
|
|
|
visitor.visit(m_view.ptr());
|
|
|
|
}
|
|
|
|
|
2022-08-08 23:29:40 +03:00
|
|
|
}
|