mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 08:48:11 +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:
parent
85a3a1c085
commit
d85bdd3ac5
4 changed files with 17 additions and 8 deletions
|
@ -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()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue