LibWeb: Replace nested_browsing_context() with content_navigable()

This commit is contained in:
Aliaksandr Kalenik 2024-11-03 17:22:22 +01:00 committed by Alexander Kalenik
commit feba8e6218
Notes: github-actions[bot] 2024-11-03 17:44:43 +00:00
3 changed files with 5 additions and 21 deletions

View file

@ -325,10 +325,8 @@ void dump_tree(StringBuilder& builder, Layout::Node const& layout_node, bool sho
if (is<Layout::FrameBox>(box)) { if (is<Layout::FrameBox>(box)) {
auto const& frame_box = static_cast<Layout::FrameBox const&>(box); auto const& frame_box = static_cast<Layout::FrameBox const&>(box);
if (auto* nested_browsing_context = frame_box.dom_node().nested_browsing_context()) { if (auto const* document = frame_box.dom_node().content_document_without_origin_check()) {
if (auto* document = nested_browsing_context->active_document()) { builder.appendff(" (url: {})", document->url());
builder.appendff(" (url: {})", document->url());
}
} }
} }

View file

@ -204,12 +204,11 @@ void run_focusing_steps(DOM::Node* new_focus_target, DOM::Node* fallback_target,
new_focus_target = fallback_target; new_focus_target = fallback_target;
} }
// 3. If new focus target is a navigable container with non-null nested browsing context, // 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.
// then set new focus target to the nested browsing context's active document.
if (is<HTML::NavigableContainer>(*new_focus_target)) { if (is<HTML::NavigableContainer>(*new_focus_target)) {
auto& navigable_container = static_cast<HTML::NavigableContainer&>(*new_focus_target); auto& navigable_container = static_cast<HTML::NavigableContainer&>(*new_focus_target);
if (auto* nested_browsing_context = navigable_container.nested_browsing_context()) if (auto content_navigable = navigable_container.content_navigable())
new_focus_target = nested_browsing_context->active_document(); 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. // FIXME: 4. If new focus target is a focusable area and its DOM anchor is inert, then return.

View file

@ -24,19 +24,6 @@ public:
JS::GCPtr<Navigable> content_navigable() { return m_content_navigable; } JS::GCPtr<Navigable> content_navigable() { return m_content_navigable; }
JS::GCPtr<Navigable const> content_navigable() const { return m_content_navigable.ptr(); } JS::GCPtr<Navigable const> 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; const DOM::Document* content_document() const;
DOM::Document const* content_document_without_origin_check() const; DOM::Document const* content_document_without_origin_check() const;