2024-04-10 21:25:31 -07:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
#include <LibGC/Heap.h>
|
2024-04-10 21:25:31 -07:00
|
|
|
#include <LibJS/Runtime/Realm.h>
|
|
|
|
#include <LibWeb/Bindings/Intrinsics.h>
|
|
|
|
#include <LibWeb/Bindings/PopStateEventPrototype.h>
|
|
|
|
#include <LibWeb/HTML/PopStateEvent.h>
|
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC_DEFINE_ALLOCATOR(PopStateEvent);
|
2024-04-10 21:25:31 -07:00
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
[[nodiscard]] GC::Ref<PopStateEvent> PopStateEvent::create(JS::Realm& realm, FlyString const& event_name, PopStateEventInit const& event_init)
|
2024-04-10 21:25:31 -07:00
|
|
|
{
|
2024-11-14 05:50:17 +13:00
|
|
|
return realm.create<PopStateEvent>(realm, event_name, event_init);
|
2024-04-10 21:25:31 -07:00
|
|
|
}
|
|
|
|
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ref<PopStateEvent> PopStateEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, PopStateEventInit const& event_init)
|
2024-04-10 21:25:31 -07:00
|
|
|
{
|
2024-11-14 05:50:17 +13:00
|
|
|
return realm.create<PopStateEvent>(realm, event_name, event_init);
|
2024-04-10 21:25:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
PopStateEvent::PopStateEvent(JS::Realm& realm, FlyString const& event_name, PopStateEventInit const& event_init)
|
|
|
|
: DOM::Event(realm, event_name, event_init)
|
|
|
|
, m_state(event_init.state)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void PopStateEvent::initialize(JS::Realm& realm)
|
|
|
|
{
|
|
|
|
WEB_SET_PROTOTYPE_FOR_INTERFACE(PopStateEvent);
|
2025-04-20 16:22:57 +02:00
|
|
|
Base::initialize(realm);
|
2024-04-10 21:25:31 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
void PopStateEvent::visit_edges(JS::Cell::Visitor& visitor)
|
|
|
|
{
|
|
|
|
Base::visit_edges(visitor);
|
|
|
|
visitor.visit(m_state);
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|