TraversableNavigable.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. /*
  2. * Copyright (c) 2022, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/Vector.h>
  8. #include <LibWeb/HTML/Navigable.h>
  9. #include <LibWeb/HTML/VisibilityState.h>
  10. namespace Web::HTML {
  11. // https://html.spec.whatwg.org/multipage/document-sequences.html#traversable-navigable
  12. class TraversableNavigable final : public Navigable {
  13. JS_CELL(TraversableNavigable, Navigable);
  14. public:
  15. virtual ~TraversableNavigable() override;
  16. bool is_top_level_traversable() const;
  17. int current_session_history_step() const { return m_current_session_history_step; };
  18. Vector<JS::NonnullGCPtr<SessionHistoryEntry>> const& session_history_entries() const { return m_session_history_entries; };
  19. bool running_nested_apply_history_step() const { return m_running_nested_apply_history_step; };
  20. VisibilityState system_visibility_state() const { return m_system_visibility_state; };
  21. private:
  22. TraversableNavigable();
  23. virtual void visit_edges(Cell::Visitor&) override;
  24. // https://html.spec.whatwg.org/multipage/document-sequences.html#tn-current-session-history-step
  25. int m_current_session_history_step { 0 };
  26. // https://html.spec.whatwg.org/multipage/document-sequences.html#tn-session-history-entries
  27. Vector<JS::NonnullGCPtr<SessionHistoryEntry>> m_session_history_entries;
  28. // FIXME: https://html.spec.whatwg.org/multipage/document-sequences.html#tn-session-history-traversal-queue
  29. // https://html.spec.whatwg.org/multipage/document-sequences.html#tn-running-nested-apply-history-step
  30. bool m_running_nested_apply_history_step { false };
  31. // https://html.spec.whatwg.org/multipage/document-sequences.html#system-visibility-state
  32. VisibilityState m_system_visibility_state { VisibilityState::Visible };
  33. };
  34. }