2023-08-23 10:53:11 -06:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2023, Andrew Kaster <akaster@serenityos.org>
|
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
*/
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <LibWeb/DOM/Event.h>
|
|
|
|
#include <LibWeb/HTML/NavigationType.h>
|
|
|
|
|
|
|
|
namespace Web::HTML {
|
|
|
|
|
|
|
|
struct NavigationCurrentEntryChangeEventInit : public DOM::EventInit {
|
|
|
|
Optional<Bindings::NavigationType> navigation_type = {};
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ptr<NavigationHistoryEntry> from;
|
2023-08-23 10:53:11 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
class NavigationCurrentEntryChangeEvent final : public DOM::Event {
|
|
|
|
WEB_PLATFORM_OBJECT(NavigationCurrentEntryChangeEvent, DOM::Event);
|
2024-11-15 04:01:23 +13:00
|
|
|
GC_DECLARE_ALLOCATOR(NavigationCurrentEntryChangeEvent);
|
2023-08-23 10:53:11 -06:00
|
|
|
|
|
|
|
public:
|
2024-11-15 04:01:23 +13:00
|
|
|
[[nodiscard]] static GC::Ref<NavigationCurrentEntryChangeEvent> construct_impl(JS::Realm&, FlyString const& event_name, NavigationCurrentEntryChangeEventInit const&);
|
2023-08-23 10:53:11 -06:00
|
|
|
|
|
|
|
virtual ~NavigationCurrentEntryChangeEvent() override;
|
|
|
|
|
|
|
|
Optional<Bindings::NavigationType> const& navigation_type() const { return m_navigation_type; }
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ref<NavigationHistoryEntry> from() const { return m_from; }
|
2023-08-23 10:53:11 -06:00
|
|
|
|
|
|
|
private:
|
|
|
|
NavigationCurrentEntryChangeEvent(JS::Realm&, FlyString const& event_name, NavigationCurrentEntryChangeEventInit const& event_init);
|
|
|
|
|
|
|
|
virtual void initialize(JS::Realm&) override;
|
|
|
|
virtual void visit_edges(Cell::Visitor&) override;
|
|
|
|
|
|
|
|
Optional<Bindings::NavigationType> m_navigation_type;
|
2024-11-15 04:01:23 +13:00
|
|
|
GC::Ref<NavigationHistoryEntry> m_from;
|
2023-08-23 10:53:11 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|