From fda420875d4b0ce9309c41a7f1f8c5b98a3b95ec Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Mon, 4 Sep 2023 00:04:09 +0200 Subject: [PATCH] LibWeb: Delete BrowsingContext::set_active_document() Superseded by Document::make_active() --- .../Libraries/LibWeb/HTML/BrowsingContext.cpp | 30 ------------------- .../Libraries/LibWeb/HTML/BrowsingContext.h | 2 -- .../Libraries/LibWeb/Loader/FrameLoader.cpp | 4 +-- 3 files changed, 2 insertions(+), 34 deletions(-) diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp index 80f1889549..34afe297c4 100644 --- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp +++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp @@ -357,36 +357,6 @@ bool BrowsingContext::is_focused_context() const return m_page && &m_page->focused_context() == this; } -// https://html.spec.whatwg.org/multipage/browsers.html#set-the-active-document -void BrowsingContext::set_active_document(JS::NonnullGCPtr document) -{ - auto previously_active_document = active_document(); - - // 1. Let window be document's relevant global object. - auto& window = verify_cast(relevant_global_object(document)); - - // 2. Set document's visibility state to browsingContext's top-level browsing context's system visibility state. - document->set_visibility_state({}, top_level_browsing_context().system_visibility_state()); - - // 3. Set browsingContext's active window to window. - m_window_proxy->set_window(window); - - // 4. Set window's associated Document to document. - window.set_associated_document(document); - - // 5. Set window's relevant settings object's execution ready flag. - relevant_settings_object(window).execution_ready = true; - - // AD-HOC: - document->set_browsing_context(this); - - if (m_page && m_page->top_level_traversable_is_initialized() && this == &m_page->top_level_browsing_context()) - m_page->client().page_did_change_title(document->title()); - - if (previously_active_document && previously_active_document != document.ptr()) - previously_active_document->did_stop_being_active_document_in_browsing_context({}); -} - void BrowsingContext::scroll_to(CSSPixelPoint position) { // NOTE: Scrolling to a position requires up-to-date layout *unless* we're scrolling to (0, 0) diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.h b/Userland/Libraries/LibWeb/HTML/BrowsingContext.h index b384272528..775d687af0 100644 --- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.h +++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.h @@ -122,8 +122,6 @@ public: DOM::Document const* active_document() const; DOM::Document* active_document(); - void set_active_document(JS::NonnullGCPtr); - virtual HTML::WindowProxy* window_proxy() override; virtual HTML::WindowProxy const* window_proxy() const override; diff --git a/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp b/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp index 65e81d9643..aa70fa8787 100644 --- a/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp +++ b/Userland/Libraries/LibWeb/Loader/FrameLoader.cpp @@ -166,7 +166,7 @@ void FrameLoader::load_html(StringView html, const AK::URL& url) .navigable = nullptr, }; auto document = DOM::Document::create_and_initialize(DOM::Document::Type::HTML, "text/html", navigation_params).release_value_but_fixme_should_propagate_errors(); - browsing_context().set_active_document(document); + // browsing_context().set_active_document(document); auto parser = HTML::HTMLParser::create(document, html, "utf-8"); parser->run(url); @@ -334,7 +334,7 @@ void FrameLoader::resource_did_load() document->set_content_type(MUST(String::from_deprecated_string(resource()->mime_type()))); - browsing_context().set_active_document(document); + // browsing_context().set_active_document(document); if (auto* page = browsing_context().page()) page->client().page_did_create_new_document(*document);