mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-20 11:36:10 +00:00
LibWeb+WebContent: Remove unused code in BrowsingContext
This commit is contained in:
parent
cf7b775709
commit
184ae687c5
Notes:
github-actions[bot]
2025-02-18 06:38:18 +00:00
Author: https://github.com/kalenikaliaksandr Commit: https://github.com/LadybirdBrowser/ladybird/commit/184ae687c58 Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/3607 Reviewed-by: https://github.com/trflynn89 ✅
4 changed files with 8 additions and 85 deletions
|
@ -9,28 +9,20 @@
|
|||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/DOM/ElementFactory.h>
|
||||
#include <LibWeb/DOM/Event.h>
|
||||
#include <LibWeb/DOM/HTMLCollection.h>
|
||||
#include <LibWeb/DOM/Range.h>
|
||||
#include <LibWeb/DOMURL/DOMURL.h>
|
||||
#include <LibWeb/HTML/BrowsingContext.h>
|
||||
#include <LibWeb/HTML/BrowsingContextGroup.h>
|
||||
#include <LibWeb/HTML/CrossOrigin/OpenerPolicy.h>
|
||||
#include <LibWeb/HTML/DocumentState.h>
|
||||
#include <LibWeb/HTML/HTMLAnchorElement.h>
|
||||
#include <LibWeb/HTML/HTMLDocument.h>
|
||||
#include <LibWeb/HTML/HTMLInputElement.h>
|
||||
#include <LibWeb/HTML/NavigableContainer.h>
|
||||
#include <LibWeb/HTML/SandboxingFlagSet.h>
|
||||
#include <LibWeb/HTML/Scripting/WindowEnvironmentSettingsObject.h>
|
||||
#include <LibWeb/HTML/TraversableNavigable.h>
|
||||
#include <LibWeb/HTML/Window.h>
|
||||
#include <LibWeb/HTML/WindowProxy.h>
|
||||
#include <LibWeb/HighResolutionTime/TimeOrigin.h>
|
||||
#include <LibWeb/Layout/BreakNode.h>
|
||||
#include <LibWeb/Layout/Viewport.h>
|
||||
#include <LibWeb/Namespace.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
#include <LibWeb/Painting/Paintable.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
|
@ -312,7 +304,7 @@ void BrowsingContext::visit_edges(Cell::Visitor& visitor)
|
|||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/document-sequences.html#bc-traversable
|
||||
GC::Ref<HTML::TraversableNavigable> BrowsingContext::top_level_traversable() const
|
||||
GC::Ref<TraversableNavigable> BrowsingContext::top_level_traversable() const
|
||||
{
|
||||
// A browsing context's top-level traversable is its active document's node navigable's top-level traversable.
|
||||
auto traversable = active_document()->navigable()->top_level_traversable();
|
||||
|
@ -435,15 +427,6 @@ BrowsingContext const* BrowsingContext::the_one_permitted_sandboxed_navigator()
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
GC::Ptr<BrowsingContext> BrowsingContext::first_child() const
|
||||
{
|
||||
return m_first_child;
|
||||
}
|
||||
GC::Ptr<BrowsingContext> BrowsingContext::next_sibling() const
|
||||
{
|
||||
return m_next_sibling;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/document-sequences.html#ancestor-browsing-context
|
||||
bool BrowsingContext::is_ancestor_of(BrowsingContext const& potential_descendant) const
|
||||
{
|
||||
|
|
|
@ -6,24 +6,13 @@
|
|||
|
||||
#pragma once
|
||||
|
||||
#include <AK/Function.h>
|
||||
#include <AK/Noncopyable.h>
|
||||
#include <AK/RefPtr.h>
|
||||
#include <AK/WeakPtr.h>
|
||||
#include <LibGfx/Bitmap.h>
|
||||
#include <LibGfx/Rect.h>
|
||||
#include <LibGfx/Size.h>
|
||||
#include <LibJS/Forward.h>
|
||||
#include <LibJS/Heap/Cell.h>
|
||||
#include <LibURL/Origin.h>
|
||||
#include <LibWeb/HTML/ActivateTab.h>
|
||||
#include <LibWeb/HTML/NavigableContainer.h>
|
||||
#include <LibWeb/HTML/SandboxingFlagSet.h>
|
||||
#include <LibWeb/HTML/SessionHistoryEntry.h>
|
||||
#include <LibWeb/HTML/TokenizedFeatures.h>
|
||||
#include <LibWeb/HTML/VisibilityState.h>
|
||||
#include <LibWeb/Platform/Timer.h>
|
||||
#include <LibWeb/TreeNode.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
|
@ -42,58 +31,11 @@ public:
|
|||
|
||||
virtual ~BrowsingContext() override;
|
||||
|
||||
GC::Ref<HTML::TraversableNavigable> top_level_traversable() const;
|
||||
|
||||
GC::Ptr<BrowsingContext> first_child() const;
|
||||
GC::Ptr<BrowsingContext> next_sibling() const;
|
||||
GC::Ref<TraversableNavigable> top_level_traversable() const;
|
||||
|
||||
bool is_ancestor_of(BrowsingContext const&) const;
|
||||
bool is_familiar_with(BrowsingContext const&) const;
|
||||
|
||||
template<typename Callback>
|
||||
TraversalDecision for_each_in_inclusive_subtree(Callback callback) const
|
||||
{
|
||||
if (callback(*this) == TraversalDecision::Break)
|
||||
return TraversalDecision::Break;
|
||||
for (auto child = first_child(); child; child = child->next_sibling()) {
|
||||
if (child->for_each_in_inclusive_subtree(callback) == TraversalDecision::Break)
|
||||
return TraversalDecision::Break;
|
||||
}
|
||||
return TraversalDecision::Continue;
|
||||
}
|
||||
|
||||
template<typename Callback>
|
||||
TraversalDecision for_each_in_inclusive_subtree(Callback callback)
|
||||
{
|
||||
if (callback(*this) == TraversalDecision::Break)
|
||||
return TraversalDecision::Break;
|
||||
for (auto child = first_child(); child; child = child->next_sibling()) {
|
||||
if (child->for_each_in_inclusive_subtree(callback) == TraversalDecision::Break)
|
||||
return TraversalDecision::Break;
|
||||
}
|
||||
return TraversalDecision::Continue;
|
||||
}
|
||||
|
||||
template<typename Callback>
|
||||
TraversalDecision for_each_in_subtree(Callback callback) const
|
||||
{
|
||||
for (auto child = first_child(); child; child = child->next_sibling()) {
|
||||
if (child->for_each_in_inclusive_subtree(callback) == TraversalDecision::Break)
|
||||
return TraversalDecision::Break;
|
||||
}
|
||||
return TraversalDecision::Continue;
|
||||
}
|
||||
|
||||
template<typename Callback>
|
||||
TraversalDecision for_each_in_subtree(Callback callback)
|
||||
{
|
||||
for (auto child = first_child(); child; child = child->next_sibling()) {
|
||||
if (child->for_each_in_inclusive_subtree(callback) == TraversalDecision::Break)
|
||||
return TraversalDecision::Break;
|
||||
}
|
||||
return TraversalDecision::Continue;
|
||||
}
|
||||
|
||||
bool is_top_level() const;
|
||||
bool is_auxiliary() const { return m_is_auxiliary; }
|
||||
|
||||
|
@ -147,7 +89,7 @@ private:
|
|||
GC::Ref<Page> m_page;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/document-sequences.html#browsing-context
|
||||
GC::Ptr<HTML::WindowProxy> m_window_proxy;
|
||||
GC::Ptr<WindowProxy> m_window_proxy;
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/browsers.html#opener-browsing-context
|
||||
GC::Ptr<BrowsingContext> m_opener_browsing_context;
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include <LibWeb/Loader/ResourceLoader.h>
|
||||
#include <LibWeb/Page/Page.h>
|
||||
#include <LibWeb/Platform/EventLoopPlugin.h>
|
||||
#include <LibWeb/Platform/Timer.h>
|
||||
#include <LibWeb/WebIDL/DOMException.h>
|
||||
#include <LibWeb/WebIDL/ExceptionOr.h>
|
||||
#include <LibWeb/XHR/EventNames.h>
|
||||
|
|
|
@ -439,14 +439,11 @@ void ConnectionFromClient::inspect_dom_node(u64 page_id, Web::UniqueNodeID const
|
|||
if (!page.has_value())
|
||||
return;
|
||||
|
||||
auto& top_context = page->page().top_level_browsing_context();
|
||||
|
||||
top_context.for_each_in_inclusive_subtree([&](auto& ctx) {
|
||||
if (ctx.active_document() != nullptr) {
|
||||
ctx.active_document()->set_inspected_node(nullptr, {});
|
||||
for (auto& navigable : Web::HTML::all_navigables()) {
|
||||
if (navigable->active_document() != nullptr) {
|
||||
navigable->active_document()->set_inspected_node(nullptr, {});
|
||||
}
|
||||
return Web::TraversalDecision::Continue;
|
||||
});
|
||||
}
|
||||
|
||||
auto* node = Web::DOM::Node::from_unique_id(node_id);
|
||||
// Note: Nodes without layout (aka non-visible nodes, don't have style computed)
|
||||
|
|
Loading…
Add table
Reference in a new issue