summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/HTML/SessionHistoryEntry.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-08-01 16:34:56 +0200
committerAndreas Kling <kling@serenityos.org>2022-08-05 12:42:46 +0200
commitc4a0b7057b08b72d4d16b41bc6bf074aa2d264e7 (patch)
tree719026ce3d826a804e00d7955b6d964fa9d7ae8b /Userland/Libraries/LibWeb/HTML/SessionHistoryEntry.h
parent29a4266367f8798f84219e0dad5c026886d3bbb0 (diff)
downloadserenity-c4a0b7057b08b72d4d16b41bc6bf074aa2d264e7.zip
LibWeb: Add basic skeleton of HTML "session history" to BrowsingContext
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/SessionHistoryEntry.h')
-rw-r--r--Userland/Libraries/LibWeb/HTML/SessionHistoryEntry.h53
1 files changed, 53 insertions, 0 deletions
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 <kling@serenityos.org>
+ *
+ * SPDX-License-Identifier: BSD-2-Clause
+ */
+
+#pragma once
+
+#include <AK/URL.h>
+#include <AK/WeakPtr.h>
+#include <LibWeb/Forward.h>
+#include <LibWeb/HTML/PolicyContainers.h>
+
+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<DOM::Document> document;
+
+ // serialized state, which is serialized state or null, initially null
+ Optional<String> serialized_state;
+
+ // policy container, a policy container or null
+ Optional<PolicyContainer> 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<String> 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.
+};
+
+}