mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 05:38:11 +00:00
LibWeb: Flesh out a chunk of the HTML spec's frame navigation algorithms
This commit is contained in:
parent
e5f6d36616
commit
4ee5dfbe4b
8 changed files with 479 additions and 8 deletions
|
@ -15,6 +15,7 @@
|
|||
#include <LibGfx/Size.h>
|
||||
#include <LibWeb/DOM/Position.h>
|
||||
#include <LibWeb/HTML/BrowsingContextContainer.h>
|
||||
#include <LibWeb/HTML/HistoryHandlingBehavior.h>
|
||||
#include <LibWeb/HTML/Origin.h>
|
||||
#include <LibWeb/HTML/SessionHistoryEntry.h>
|
||||
#include <LibWeb/Loader/FrameLoader.h>
|
||||
|
@ -47,6 +48,9 @@ public:
|
|||
|
||||
void set_active_document(DOM::Document*);
|
||||
|
||||
HTML::Window* active_window();
|
||||
HTML::Window const* active_window() const;
|
||||
|
||||
Page* page() { return m_page; }
|
||||
Page const* page() const { return m_page; }
|
||||
|
||||
|
@ -131,6 +135,31 @@ public:
|
|||
// https://html.spec.whatwg.org/multipage/browsers.html#bcg-remove
|
||||
void remove();
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/browsers.html#allowed-to-navigate
|
||||
bool is_allowed_to_navigate(BrowsingContext const&) const;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate
|
||||
DOM::ExceptionOr<void> navigate(
|
||||
Fetch::Infrastructure::Request resource,
|
||||
BrowsingContext& source_browsing_context,
|
||||
bool exceptions_enabled = false,
|
||||
HistoryHandlingBehavior history_handling = HistoryHandlingBehavior::Default,
|
||||
Optional<PolicyContainer> history_policy_container = {},
|
||||
String navigation_type = "other",
|
||||
Optional<String> navigation_id = {},
|
||||
Function<void(NonnullOwnPtr<Fetch::Infrastructure::Response>)> process_response_end_of_body = {});
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate-fragid
|
||||
DOM::ExceptionOr<void> navigate_to_a_fragment(AK::URL const&, HistoryHandlingBehavior, String navigation_id);
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/origin.html#one-permitted-sandboxed-navigator
|
||||
BrowsingContext const* the_one_permitted_sandboxed_navigator() const;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#traverse-the-history
|
||||
DOM::ExceptionOr<void> traverse_the_history(size_t entry_index, HistoryHandlingBehavior = HistoryHandlingBehavior::Default, bool explicit_history_navigation = false);
|
||||
|
||||
bool document_family_contains(DOM::Document const&) const;
|
||||
|
||||
private:
|
||||
explicit BrowsingContext(Page&, HTML::BrowsingContextContainer*);
|
||||
|
||||
|
@ -143,6 +172,11 @@ private:
|
|||
FrameLoader m_loader;
|
||||
Web::EventHandler m_event_handler;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/history.html#current-entry
|
||||
SessionHistoryEntry& current_entry() { return m_session_history[*m_session_history_index]; }
|
||||
SessionHistoryEntry const& current_entry() const { return m_session_history[*m_session_history_index]; }
|
||||
Optional<size_t> m_session_history_index { 0 };
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/history.html#session-history
|
||||
Vector<SessionHistoryEntry> m_session_history;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue