mirror of
https://github.com/RGBCube/serenity
synced 2025-05-30 21:58:10 +00:00
LibWeb: Inherit BrowsingContext from AbstractBrowsingContext
This commit is contained in:
parent
c4f94b0846
commit
40ec976781
3 changed files with 14 additions and 25 deletions
|
@ -620,7 +620,7 @@ BrowsingContext::ChosenBrowsingContext BrowsingContext::choose_a_browsing_contex
|
||||||
// a boolean noopener are as follows:
|
// a boolean noopener are as follows:
|
||||||
|
|
||||||
// 1. Let chosen be null.
|
// 1. Let chosen be null.
|
||||||
JS::GCPtr<BrowsingContext> chosen = nullptr;
|
JS::GCPtr<AbstractBrowsingContext> chosen = nullptr;
|
||||||
|
|
||||||
// 2. Let windowType be "existing or none".
|
// 2. Let windowType be "existing or none".
|
||||||
auto window_type = WindowType::ExistingOrNone;
|
auto window_type = WindowType::ExistingOrNone;
|
||||||
|
@ -734,7 +734,7 @@ BrowsingContext::ChosenBrowsingContext BrowsingContext::choose_a_browsing_contex
|
||||||
}
|
}
|
||||||
|
|
||||||
// 9. Return chosen and windowType.
|
// 9. Return chosen and windowType.
|
||||||
return { chosen, window_type };
|
return { chosen.ptr(), window_type };
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/browsers.html#document-tree-child-browsing-context
|
// https://html.spec.whatwg.org/multipage/browsers.html#document-tree-child-browsing-context
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
#include <LibJS/Forward.h>
|
#include <LibJS/Forward.h>
|
||||||
#include <LibJS/Heap/Cell.h>
|
#include <LibJS/Heap/Cell.h>
|
||||||
#include <LibWeb/DOM/Position.h>
|
#include <LibWeb/DOM/Position.h>
|
||||||
|
#include <LibWeb/HTML/AbstractBrowsingContext.h>
|
||||||
#include <LibWeb/HTML/BrowsingContextContainer.h>
|
#include <LibWeb/HTML/BrowsingContextContainer.h>
|
||||||
#include <LibWeb/HTML/HistoryHandlingBehavior.h>
|
#include <LibWeb/HTML/HistoryHandlingBehavior.h>
|
||||||
#include <LibWeb/HTML/Origin.h>
|
#include <LibWeb/HTML/Origin.h>
|
||||||
|
@ -29,15 +30,15 @@
|
||||||
namespace Web::HTML {
|
namespace Web::HTML {
|
||||||
|
|
||||||
class BrowsingContext final
|
class BrowsingContext final
|
||||||
: public JS::Cell
|
: public AbstractBrowsingContext
|
||||||
, public Weakable<BrowsingContext> {
|
, public Weakable<BrowsingContext> {
|
||||||
JS_CELL(BrowsingContext, JS::Cell);
|
JS_CELL(BrowsingContext, AbstractBrowsingContext);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static JS::NonnullGCPtr<BrowsingContext> create_a_new_browsing_context(Page&, JS::GCPtr<DOM::Document> creator, JS::GCPtr<DOM::Element> embedder, BrowsingContextGroup&);
|
static JS::NonnullGCPtr<BrowsingContext> create_a_new_browsing_context(Page&, JS::GCPtr<DOM::Document> creator, JS::GCPtr<DOM::Element> embedder, BrowsingContextGroup&);
|
||||||
static JS::NonnullGCPtr<BrowsingContext> create_a_new_top_level_browsing_context(Page&);
|
static JS::NonnullGCPtr<BrowsingContext> create_a_new_top_level_browsing_context(Page&);
|
||||||
|
|
||||||
~BrowsingContext();
|
virtual ~BrowsingContext() override;
|
||||||
|
|
||||||
JS::GCPtr<BrowsingContext> parent() const { return m_parent; }
|
JS::GCPtr<BrowsingContext> parent() const { return m_parent; }
|
||||||
void append_child(JS::NonnullGCPtr<BrowsingContext>);
|
void append_child(JS::NonnullGCPtr<BrowsingContext>);
|
||||||
|
@ -121,12 +122,8 @@ public:
|
||||||
|
|
||||||
void set_active_document(JS::NonnullGCPtr<DOM::Document>);
|
void set_active_document(JS::NonnullGCPtr<DOM::Document>);
|
||||||
|
|
||||||
HTML::WindowProxy* window_proxy();
|
virtual HTML::WindowProxy* window_proxy() override;
|
||||||
HTML::WindowProxy const* window_proxy() const;
|
virtual HTML::WindowProxy const* window_proxy() const override;
|
||||||
|
|
||||||
JS::GCPtr<BrowsingContext> opener_browsing_context() const { return m_opener_browsing_context; }
|
|
||||||
|
|
||||||
void set_opener_browsing_context(JS::GCPtr<BrowsingContext> browsing_context) { m_opener_browsing_context = browsing_context; }
|
|
||||||
|
|
||||||
HTML::Window* active_window();
|
HTML::Window* active_window();
|
||||||
HTML::Window const* active_window() const;
|
HTML::Window const* active_window() const;
|
||||||
|
@ -170,7 +167,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ChosenBrowsingContext {
|
struct ChosenBrowsingContext {
|
||||||
JS::GCPtr<BrowsingContext> browsing_context;
|
JS::GCPtr<AbstractBrowsingContext> browsing_context;
|
||||||
WindowType window_type;
|
WindowType window_type;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -211,9 +208,6 @@ public:
|
||||||
|
|
||||||
JS::GCPtr<DOM::Node> currently_focused_area();
|
JS::GCPtr<DOM::Node> currently_focused_area();
|
||||||
|
|
||||||
DeprecatedString const& name() const { return m_name; }
|
|
||||||
void set_name(DeprecatedString const& name) { m_name = name; }
|
|
||||||
|
|
||||||
Vector<SessionHistoryEntry>& session_history() { return m_session_history; }
|
Vector<SessionHistoryEntry>& session_history() { return m_session_history; }
|
||||||
Vector<SessionHistoryEntry> const& session_history() const { return m_session_history; }
|
Vector<SessionHistoryEntry> const& session_history() const { return m_session_history; }
|
||||||
size_t session_history_index() const { return *m_session_history_index; }
|
size_t session_history_index() const { return *m_session_history_index; }
|
||||||
|
@ -231,7 +225,7 @@ public:
|
||||||
bool is_allowed_to_navigate(BrowsingContext const&) const;
|
bool is_allowed_to_navigate(BrowsingContext const&) const;
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate
|
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate
|
||||||
WebIDL::ExceptionOr<void> navigate(
|
virtual WebIDL::ExceptionOr<void> navigate(
|
||||||
JS::NonnullGCPtr<Fetch::Infrastructure::Request> resource,
|
JS::NonnullGCPtr<Fetch::Infrastructure::Request> resource,
|
||||||
BrowsingContext& source_browsing_context,
|
BrowsingContext& source_browsing_context,
|
||||||
bool exceptions_enabled = false,
|
bool exceptions_enabled = false,
|
||||||
|
@ -239,7 +233,7 @@ public:
|
||||||
Optional<PolicyContainer> history_policy_container = {},
|
Optional<PolicyContainer> history_policy_container = {},
|
||||||
DeprecatedString navigation_type = "other",
|
DeprecatedString navigation_type = "other",
|
||||||
Optional<DeprecatedString> navigation_id = {},
|
Optional<DeprecatedString> navigation_id = {},
|
||||||
Function<void(JS::NonnullGCPtr<Fetch::Infrastructure::Response>)> process_response_end_of_body = {});
|
Function<void(JS::NonnullGCPtr<Fetch::Infrastructure::Response>)> process_response_end_of_body = {}) override;
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate-fragid
|
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate-fragid
|
||||||
WebIDL::ExceptionOr<void> navigate_to_a_fragment(AK::URL const&, HistoryHandlingBehavior, DeprecatedString navigation_id);
|
WebIDL::ExceptionOr<void> navigate_to_a_fragment(AK::URL const&, HistoryHandlingBehavior, DeprecatedString navigation_id);
|
||||||
|
@ -256,8 +250,6 @@ public:
|
||||||
VisibilityState system_visibility_state() const;
|
VisibilityState system_visibility_state() const;
|
||||||
void set_system_visibility_state(VisibilityState);
|
void set_system_visibility_state(VisibilityState);
|
||||||
|
|
||||||
void set_is_popup(bool is_popup) { m_is_popup = is_popup; }
|
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/window-object.html#a-browsing-context-is-discarded
|
// https://html.spec.whatwg.org/multipage/window-object.html#a-browsing-context-is-discarded
|
||||||
void discard();
|
void discard();
|
||||||
bool has_been_discarded() const { return m_has_been_discarded; }
|
bool has_been_discarded() const { return m_has_been_discarded; }
|
||||||
|
@ -267,8 +259,8 @@ public:
|
||||||
|
|
||||||
Optional<AK::URL> const& creator_url() const { return m_creator_url; }
|
Optional<AK::URL> const& creator_url() const { return m_creator_url; }
|
||||||
|
|
||||||
String const& window_handle() const { return m_window_handle; }
|
virtual String const& window_handle() const override { return m_window_handle; }
|
||||||
void set_window_handle(String handle) { m_window_handle = move(handle); }
|
virtual void set_window_handle(String handle) override { m_window_handle = move(handle); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit BrowsingContext(Page&, HTML::BrowsingContextContainer*);
|
explicit BrowsingContext(Page&, HTML::BrowsingContextContainer*);
|
||||||
|
@ -311,9 +303,6 @@ private:
|
||||||
// https://html.spec.whatwg.org/multipage/browsers.html#browsing-context
|
// https://html.spec.whatwg.org/multipage/browsers.html#browsing-context
|
||||||
JS::GCPtr<HTML::WindowProxy> m_window_proxy;
|
JS::GCPtr<HTML::WindowProxy> m_window_proxy;
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/browsers.html#opener-browsing-context
|
|
||||||
JS::GCPtr<BrowsingContext> m_opener_browsing_context;
|
|
||||||
|
|
||||||
DOM::Position m_cursor_position;
|
DOM::Position m_cursor_position;
|
||||||
RefPtr<Platform::Timer> m_cursor_blink_timer;
|
RefPtr<Platform::Timer> m_cursor_blink_timer;
|
||||||
bool m_cursor_blink_state { false };
|
bool m_cursor_blink_state { false };
|
||||||
|
|
|
@ -537,7 +537,7 @@ void HTMLHyperlinkElementUtils::follow_the_hyperlink(Optional<DeprecatedString>
|
||||||
// FIXME: "navigate" means implementing the navigation algorithm here:
|
// FIXME: "navigate" means implementing the navigation algorithm here:
|
||||||
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate
|
// https://html.spec.whatwg.org/multipage/browsing-the-web.html#navigate
|
||||||
hyperlink_element_utils_queue_an_element_task(Task::Source::DOMManipulation, [url_string, target] {
|
hyperlink_element_utils_queue_an_element_task(Task::Source::DOMManipulation, [url_string, target] {
|
||||||
target->loader().load(url_string, FrameLoader::Type::Navigation);
|
verify_cast<BrowsingContext>(*target).loader().load(url_string, FrameLoader::Type::Navigation);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue