NavigationTransition.h 1.9 KB

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