From 6665f0db439cc81f03d85a5ebd0fe7d41372303f Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Sun, 3 Sep 2023 23:04:35 +0200 Subject: [PATCH] LibWeb: Delete unused `document_tree_child_browsing_context_count()` The function is no longer needed with navigables. --- Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp | 14 -------------- Userland/Libraries/LibWeb/HTML/BrowsingContext.h | 2 -- Userland/Libraries/LibWeb/HTML/Window.cpp | 12 ------------ Userland/Libraries/LibWeb/HTML/Window.h | 2 -- 4 files changed, 30 deletions(-) diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp index d9d4f45869..c46b435a4b 100644 --- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp +++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.cpp @@ -881,20 +881,6 @@ BrowsingContext::ChosenBrowsingContext BrowsingContext::choose_a_browsing_contex return { chosen.ptr(), window_type }; } -// https://html.spec.whatwg.org/multipage/browsers.html#document-tree-child-browsing-context -size_t BrowsingContext::document_tree_child_browsing_context_count() const -{ - size_t count = 0; - - // A browsing context child is a document-tree child browsing context of parent if child is a child browsing context and child's container is in a document tree. - for_each_child([this, &count](BrowsingContext const& child) { - if (child.is_child_of(*this) && child.container()->in_a_document_tree()) - ++count; - }); - - return count; -} - // https://html.spec.whatwg.org/multipage/browsers.html#child-browsing-context bool BrowsingContext::is_child_of(BrowsingContext const& parent) const { diff --git a/Userland/Libraries/LibWeb/HTML/BrowsingContext.h b/Userland/Libraries/LibWeb/HTML/BrowsingContext.h index e09220e4f1..8646a1b006 100644 --- a/Userland/Libraries/LibWeb/HTML/BrowsingContext.h +++ b/Userland/Libraries/LibWeb/HTML/BrowsingContext.h @@ -169,8 +169,6 @@ public: ChosenBrowsingContext choose_a_browsing_context(StringView name, TokenizedFeature::NoOpener no_opener, ActivateTab = ActivateTab::Yes); - size_t document_tree_child_browsing_context_count() const; - bool is_child_of(BrowsingContext const&) const; HTML::NavigableContainer* container() { return m_container; } diff --git a/Userland/Libraries/LibWeb/HTML/Window.cpp b/Userland/Libraries/LibWeb/HTML/Window.cpp index 780fdc5375..832e42c7f9 100644 --- a/Userland/Libraries/LibWeb/HTML/Window.cpp +++ b/Userland/Libraries/LibWeb/HTML/Window.cpp @@ -1394,16 +1394,4 @@ JS::NonnullGCPtr Window::custom_elements() return JS::NonnullGCPtr { *m_custom_element_registry }; } -// https://html.spec.whatwg.org/multipage/window-object.html#number-of-document-tree-child-browsing-contexts -size_t Window::document_tree_child_browsing_context_count() const -{ - // 1. If W's browsing context is null, then return 0. - auto* this_browsing_context = associated_document().browsing_context(); - if (!this_browsing_context) - return 0; - - // 2. Return the number of document-tree child browsing contexts of W's browsing context. - return this_browsing_context->document_tree_child_browsing_context_count(); -} - } diff --git a/Userland/Libraries/LibWeb/HTML/Window.h b/Userland/Libraries/LibWeb/HTML/Window.h index 2b8f47dfe1..0a1be8341e 100644 --- a/Userland/Libraries/LibWeb/HTML/Window.h +++ b/Userland/Libraries/LibWeb/HTML/Window.h @@ -85,8 +85,6 @@ public: JS::GCPtr navigable() const; - size_t document_tree_child_browsing_context_count() const; - ImportMap const& import_map() const { return m_import_map; } bool import_maps_allowed() const { return m_import_maps_allowed; }