1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:07:34 +00:00

LibWeb: Make "top-level browsing context" concept more spec-compliant

Any browsing context that doesn't have a parent browsing context is now
considered a top-level browsing context. This matches the HTML spec.

This means we no longer keep a pointer to the top-level context, since
we can simply walk the parent chain until we find the topmost ancestor.
This commit is contained in:
Andreas Kling 2021-09-10 01:51:09 +02:00
parent 4e5becf36e
commit 8fabaaa2a8
3 changed files with 16 additions and 25 deletions

View file

@ -27,7 +27,8 @@ void BrowsingContextContainer::inserted()
if (!is_connected())
return;
if (auto* frame = document().browsing_context()) {
m_nested_browsing_context = BrowsingContext::create_nested(*this, frame->top_level_browsing_context());
VERIFY(frame->page());
m_nested_browsing_context = BrowsingContext::create_nested(*frame->page(), *this);
m_nested_browsing_context->set_frame_nesting_levels(frame->frame_nesting_levels());
m_nested_browsing_context->register_frame_nesting(document().url());
}