/src/serenity/Userland/Libraries/LibWeb/HTML/NavigationTransition.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (c) 2023, Andrew Kaster <akaster@serenityos.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #pragma once |
8 | | |
9 | | #include <LibWeb/Bindings/PlatformObject.h> |
10 | | #include <LibWeb/HTML/NavigationType.h> |
11 | | |
12 | | namespace Web::HTML { |
13 | | |
14 | | // https://html.spec.whatwg.org/multipage/nav-history-apis.html#navigationtransition |
15 | | class NavigationTransition : public Bindings::PlatformObject { |
16 | | WEB_PLATFORM_OBJECT(NavigationTransition, Bindings::PlatformObject); |
17 | | JS_DECLARE_ALLOCATOR(NavigationTransition); |
18 | | |
19 | | public: |
20 | | [[nodiscard]] static JS::NonnullGCPtr<NavigationTransition> create(JS::Realm&, Bindings::NavigationType, JS::NonnullGCPtr<NavigationHistoryEntry>, JS::GCPtr<JS::Promise>); |
21 | | |
22 | | // https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationtransition-navigationtype |
23 | 0 | Bindings::NavigationType navigation_type() const { return m_navigation_type; } |
24 | | |
25 | | // https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationtransition-from |
26 | 0 | JS::NonnullGCPtr<NavigationHistoryEntry> from() const { return m_from_entry; } |
27 | | |
28 | | // https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationtransition-finished |
29 | 0 | JS::GCPtr<JS::Promise> finished() const { return m_finished_promise; } |
30 | | |
31 | | virtual ~NavigationTransition() override; |
32 | | |
33 | | private: |
34 | | NavigationTransition(JS::Realm&, Bindings::NavigationType, JS::NonnullGCPtr<NavigationHistoryEntry>, JS::GCPtr<JS::Promise>); |
35 | | |
36 | | virtual void initialize(JS::Realm&) override; |
37 | | virtual void visit_edges(JS::Cell::Visitor&) override; |
38 | | |
39 | | // https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-navigationtransition-navigationtype |
40 | | Bindings::NavigationType m_navigation_type; |
41 | | |
42 | | // https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-navigationtransition-from |
43 | | JS::NonnullGCPtr<NavigationHistoryEntry> m_from_entry; |
44 | | |
45 | | // https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-navigationtransition-finished |
46 | | JS::GCPtr<JS::Promise> m_finished_promise; |
47 | | }; |
48 | | |
49 | | } |