mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 00:27:43 +00:00
LibWeb: Add NavigationTransition, a transient property of Navigation
This property is useful for web content to determine whether an ongoing navigation has settled or not.
This commit is contained in:
parent
4989375191
commit
3dd3b2019d
11 changed files with 118 additions and 1 deletions
48
Userland/Libraries/LibWeb/HTML/NavigationTransition.h
Normal file
48
Userland/Libraries/LibWeb/HTML/NavigationTransition.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
/*
|
||||
* Copyright (c) 2023, Andrew Kaster <akaster@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <LibWeb/Bindings/PlatformObject.h>
|
||||
#include <LibWeb/HTML/NavigationType.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#navigationtransition
|
||||
class NavigationTransition : public Bindings::PlatformObject {
|
||||
WEB_PLATFORM_OBJECT(NavigationTransition, Bindings::PlatformObject);
|
||||
|
||||
public:
|
||||
[[nodiscard]] static JS::NonnullGCPtr<NavigationTransition> create(JS::Realm&, Bindings::NavigationType, JS::NonnullGCPtr<NavigationHistoryEntry>, JS::GCPtr<JS::Promise>);
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationtransition-navigationtype
|
||||
Bindings::NavigationType navigation_type() const { return m_navigation_type; }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationtransition-from
|
||||
JS::NonnullGCPtr<NavigationHistoryEntry> from() const { return m_from_entry; }
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#dom-navigationtransition-finished
|
||||
JS::GCPtr<JS::Promise> finished() const { return m_finished_promise; }
|
||||
|
||||
virtual ~NavigationTransition() override;
|
||||
|
||||
private:
|
||||
NavigationTransition(JS::Realm&, Bindings::NavigationType, JS::NonnullGCPtr<NavigationHistoryEntry>, JS::GCPtr<JS::Promise>);
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(JS::Cell::Visitor&) override;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-navigationtransition-navigationtype
|
||||
Bindings::NavigationType m_navigation_type;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-navigationtransition-from
|
||||
JS::NonnullGCPtr<NavigationHistoryEntry> m_from_entry;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/nav-history-apis.html#concept-navigationtransition-finished
|
||||
JS::GCPtr<JS::Promise> m_finished_promise;
|
||||
};
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue