SessionHistoryEntry.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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/URL.h>
  8. #include <AK/WeakPtr.h>
  9. #include <LibWeb/Forward.h>
  10. #include <LibWeb/HTML/PolicyContainers.h>
  11. namespace Web::HTML {
  12. // https://html.spec.whatwg.org/multipage/history.html#scroll-restoration-mode
  13. enum class ScrollRestorationMode {
  14. // https://html.spec.whatwg.org/multipage/history.html#dom-scrollrestoration-auto
  15. // The user agent is responsible for restoring the scroll position upon navigation.
  16. Auto,
  17. // https://html.spec.whatwg.org/multipage/history.html#dom-scrollrestoration-manual
  18. // The page is responsible for restoring the scroll position and the user agent does not attempt to do so automatically.
  19. Manual,
  20. };
  21. // https://html.spec.whatwg.org/multipage/history.html#session-history-entry
  22. struct SessionHistoryEntry {
  23. // URL, a URL
  24. AK::URL url;
  25. // document, a Document or null
  26. WeakPtr<DOM::Document> document;
  27. // serialized state, which is serialized state or null, initially null
  28. Optional<String> serialized_state;
  29. // policy container, a policy container or null
  30. Optional<PolicyContainer> policy_container;
  31. // scroll restoration mode, a scroll restoration mode, initially "auto"
  32. ScrollRestorationMode scroll_restoration_mode { ScrollRestorationMode::Auto };
  33. // FIXME: scroll position data, which is scroll position data for the document's restorable scrollable regions
  34. // browsing context name, a browsing context name or null, initially null
  35. Optional<String> browsing_context_name;
  36. // FIXME: persisted user state, which is implementation-defined, initially null
  37. // NOTE: This is where we could remember the state of form controls, for example.
  38. };
  39. }