mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-30 05:08:56 +00:00
LibWeb: Add API for finding NavigableContainer by content navigable
This is only needed because currently spec doesn't explicitly define that navigable should have a pointer to associated container and when this pointer should be set.
This commit is contained in:
committed by
Andreas Kling
parent
85a3a1c085
commit
d85bdd3ac5
@@ -27,9 +27,13 @@ HashTable<NavigableContainer*>& NavigableContainer::all_instances()
|
||||
NavigableContainer::NavigableContainer(DOM::Document& document, DOM::QualifiedName qualified_name)
|
||||
: HTMLElement(document, move(qualified_name))
|
||||
{
|
||||
all_instances().set(this);
|
||||
}
|
||||
|
||||
NavigableContainer::~NavigableContainer() = default;
|
||||
NavigableContainer::~NavigableContainer()
|
||||
{
|
||||
all_instances().remove(this);
|
||||
}
|
||||
|
||||
void NavigableContainer::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
@@ -37,6 +41,15 @@ void NavigableContainer::visit_edges(Cell::Visitor& visitor)
|
||||
visitor.visit(m_nested_browsing_context);
|
||||
}
|
||||
|
||||
JS::GCPtr<NavigableContainer> NavigableContainer::navigable_container_with_content_navigable(JS::NonnullGCPtr<Navigable> navigable)
|
||||
{
|
||||
for (auto* navigable_container : all_instances()) {
|
||||
if (navigable_container->content_navigable() == navigable)
|
||||
return navigable_container;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/browsers.html#creating-a-new-nested-browsing-context
|
||||
void NavigableContainer::create_new_nested_browsing_context()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user