diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.h b/Userland/Libraries/LibWeb/HTML/BrowsingContext.h
index 564d246218..7ae35ee318 100644
--- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.h
+++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2018-2021, Andreas Kling
+ * Copyright (c) 2018-2022, Andreas Kling
*
* SPDX-License-Identifier: BSD-2-Clause
*/
@@ -16,6 +16,7 @@
#include
#include
#include
+#include
#include
#include
#include
@@ -112,6 +113,9 @@ public:
String const& name() const { return m_name; }
void set_name(String const& name) { m_name = name; }
+ Vector& session_history() { return m_session_history; }
+ Vector const& session_history() const { return m_session_history; }
+
private:
explicit BrowsingContext(Page&, HTML::BrowsingContextContainer*);
@@ -122,6 +126,9 @@ private:
FrameLoader m_loader;
Web::EventHandler m_event_handler;
+ // https://html.spec.whatwg.org/multipage/history.html#session-history
+ Vector m_session_history;
+
WeakPtr m_container;
RefPtr m_active_document;
Gfx::IntSize m_size;
diff --git a/Userland/Libraries/LibWeb/HTML/SessionHistoryEntry.h b/Userland/Libraries/LibWeb/HTML/SessionHistoryEntry.h
new file mode 100644
index 0000000000..a43b5db176
--- /dev/null
+++ b/Userland/Libraries/LibWeb/HTML/SessionHistoryEntry.h
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2022, Andreas Kling
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include
+#include
+#include
+#include
+
+namespace Web::HTML {
+
+// https://html.spec.whatwg.org/multipage/history.html#scroll-restoration-mode
+enum class ScrollRestorationMode {
+ // https://html.spec.whatwg.org/multipage/history.html#dom-scrollrestoration-auto
+ // The user agent is responsible for restoring the scroll position upon navigation.
+ Auto,
+
+ // https://html.spec.whatwg.org/multipage/history.html#dom-scrollrestoration-manual
+ // The page is responsible for restoring the scroll position and the user agent does not attempt to do so automatically.
+ Manual,
+};
+
+// https://html.spec.whatwg.org/multipage/history.html#session-history-entry
+struct SessionHistoryEntry {
+ // URL, a URL
+ AK::URL url;
+
+ // document, a Document or null
+ WeakPtr document;
+
+ // serialized state, which is serialized state or null, initially null
+ Optional serialized_state;
+
+ // policy container, a policy container or null
+ Optional policy_container;
+
+ // scroll restoration mode, a scroll restoration mode, initially "auto"
+ ScrollRestorationMode scroll_restoration_mode { ScrollRestorationMode::Auto };
+
+ // FIXME: scroll position data, which is scroll position data for the document's restorable scrollable regions
+
+ // browsing context name, a browsing context name or null, initially null
+ Optional browsing_context_name;
+
+ // FIXME: persisted user state, which is implementation-defined, initially null
+ // NOTE: This is where we could remember the state of form controls, for example.
+};
+
+}