From feba8e621867e666f75f4ba1eb1346aec08521c3 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Sun, 3 Nov 2024 17:22:22 +0100 Subject: [PATCH] LibWeb: Replace nested_browsing_context() with content_navigable() --- Userland/Libraries/LibWeb/Dump.cpp | 6 ++---- Userland/Libraries/LibWeb/HTML/Focus.cpp | 7 +++---- Userland/Libraries/LibWeb/HTML/NavigableContainer.h | 13 ------------- 3 files changed, 5 insertions(+), 21 deletions(-) diff --git a/Userland/Libraries/LibWeb/Dump.cpp b/Userland/Libraries/LibWeb/Dump.cpp index 17ad3bf0b63..5a6109af7f0 100644 --- a/Userland/Libraries/LibWeb/Dump.cpp +++ b/Userland/Libraries/LibWeb/Dump.cpp @@ -325,10 +325,8 @@ void dump_tree(StringBuilder& builder, Layout::Node const& layout_node, bool sho if (is(box)) { auto const& frame_box = static_cast(box); - if (auto* nested_browsing_context = frame_box.dom_node().nested_browsing_context()) { - if (auto* document = nested_browsing_context->active_document()) { - builder.appendff(" (url: {})", document->url()); - } + if (auto const* document = frame_box.dom_node().content_document_without_origin_check()) { + builder.appendff(" (url: {})", document->url()); } } diff --git a/Userland/Libraries/LibWeb/HTML/Focus.cpp b/Userland/Libraries/LibWeb/HTML/Focus.cpp index e303b786d74..c21f423570e 100644 --- a/Userland/Libraries/LibWeb/HTML/Focus.cpp +++ b/Userland/Libraries/LibWeb/HTML/Focus.cpp @@ -204,12 +204,11 @@ void run_focusing_steps(DOM::Node* new_focus_target, DOM::Node* fallback_target, new_focus_target = fallback_target; } - // 3. If new focus target is a navigable container with non-null nested browsing context, - // then set new focus target to the nested browsing context's active document. + // 3. If new focus target is a navigable container with non-null content navigable, then set new focus target to the content navigable's active document. if (is(*new_focus_target)) { auto& navigable_container = static_cast(*new_focus_target); - if (auto* nested_browsing_context = navigable_container.nested_browsing_context()) - new_focus_target = nested_browsing_context->active_document(); + if (auto content_navigable = navigable_container.content_navigable()) + new_focus_target = content_navigable->active_document(); } // FIXME: 4. If new focus target is a focusable area and its DOM anchor is inert, then return. diff --git a/Userland/Libraries/LibWeb/HTML/NavigableContainer.h b/Userland/Libraries/LibWeb/HTML/NavigableContainer.h index c29097cf792..16895bba070 100644 --- a/Userland/Libraries/LibWeb/HTML/NavigableContainer.h +++ b/Userland/Libraries/LibWeb/HTML/NavigableContainer.h @@ -24,19 +24,6 @@ public: JS::GCPtr content_navigable() { return m_content_navigable; } JS::GCPtr content_navigable() const { return m_content_navigable.ptr(); } - BrowsingContext* nested_browsing_context() - { - if (m_content_navigable) - return m_content_navigable->active_browsing_context(); - return nullptr; - } - BrowsingContext const* nested_browsing_context() const - { - if (m_content_navigable) - return m_content_navigable->active_browsing_context(); - return nullptr; - } - const DOM::Document* content_document() const; DOM::Document const* content_document_without_origin_check() const;