Serenity Operating System
at master 56 lines 1.9 kB view raw
1/* 2 * Copyright (c) 2022, Andreas Kling <kling@serenityos.org> 3 * 4 * SPDX-License-Identifier: BSD-2-Clause 5 */ 6 7#pragma once 8 9#include <AK/URL.h> 10#include <AK/WeakPtr.h> 11#include <LibJS/Heap/GCPtr.h> 12#include <LibWeb/Forward.h> 13#include <LibWeb/HTML/PolicyContainers.h> 14 15namespace Web::HTML { 16 17// https://html.spec.whatwg.org/multipage/history.html#scroll-restoration-mode 18enum class ScrollRestorationMode { 19 // https://html.spec.whatwg.org/multipage/history.html#dom-scrollrestoration-auto 20 // The user agent is responsible for restoring the scroll position upon navigation. 21 Auto, 22 23 // https://html.spec.whatwg.org/multipage/history.html#dom-scrollrestoration-manual 24 // The page is responsible for restoring the scroll position and the user agent does not attempt to do so automatically. 25 Manual, 26}; 27 28// https://html.spec.whatwg.org/multipage/history.html#session-history-entry 29struct SessionHistoryEntry { 30 // URL, a URL 31 AK::URL url; 32 33 // document, a Document or null 34 JS::GCPtr<DOM::Document> document; 35 36 // serialized state, which is serialized state or null, initially null 37 Optional<DeprecatedString> serialized_state; 38 39 // policy container, a policy container or null 40 Optional<PolicyContainer> policy_container; 41 42 // scroll restoration mode, a scroll restoration mode, initially "auto" 43 ScrollRestorationMode scroll_restoration_mode { ScrollRestorationMode::Auto }; 44 45 // FIXME: scroll position data, which is scroll position data for the document's restorable scrollable regions 46 47 // browsing context name, a browsing context name or null, initially null 48 Optional<DeprecatedString> browsing_context_name; 49 50 // FIXME: persisted user state, which is implementation-defined, initially null 51 // NOTE: This is where we could remember the state of form controls, for example. 52 53 JS::GCPtr<BrowsingContext> original_source_browsing_context; 54}; 55 56}