/src/serenity/Userland/Libraries/LibWeb/HTML/PopStateEvent.cpp
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2024, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #include <LibJS/Heap/Heap.h> |
8 | | #include <LibJS/Runtime/Realm.h> |
9 | | #include <LibWeb/Bindings/Intrinsics.h> |
10 | | #include <LibWeb/Bindings/PopStateEventPrototype.h> |
11 | | #include <LibWeb/HTML/PopStateEvent.h> |
12 | | |
13 | | namespace Web::HTML { |
14 | | |
15 | | JS_DEFINE_ALLOCATOR(PopStateEvent); |
16 | | |
17 | | [[nodiscard]] JS::NonnullGCPtr<PopStateEvent> PopStateEvent::create(JS::Realm& realm, FlyString const& event_name, PopStateEventInit const& event_init) |
18 | 0 | { |
19 | 0 | return realm.heap().allocate<PopStateEvent>(realm, realm, event_name, event_init); |
20 | 0 | } |
21 | | |
22 | | JS::NonnullGCPtr<PopStateEvent> PopStateEvent::construct_impl(JS::Realm& realm, FlyString const& event_name, PopStateEventInit const& event_init) |
23 | 0 | { |
24 | 0 | return realm.heap().allocate<PopStateEvent>(realm, realm, event_name, event_init); |
25 | 0 | } |
26 | | |
27 | | PopStateEvent::PopStateEvent(JS::Realm& realm, FlyString const& event_name, PopStateEventInit const& event_init) |
28 | 0 | : DOM::Event(realm, event_name, event_init) |
29 | 0 | , m_state(event_init.state) |
30 | 0 | { |
31 | 0 | } |
32 | | |
33 | | void PopStateEvent::initialize(JS::Realm& realm) |
34 | 0 | { |
35 | 0 | Base::initialize(realm); |
36 | 0 | WEB_SET_PROTOTYPE_FOR_INTERFACE(PopStateEvent); |
37 | 0 | } |
38 | | |
39 | | void PopStateEvent::visit_edges(JS::Cell::Visitor& visitor) |
40 | 0 | { |
41 | 0 | Base::visit_edges(visitor); |
42 | 0 | visitor.visit(m_state); |
43 | 0 | } |
44 | | |
45 | | } |