1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:57:45 +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

@ -18,9 +18,8 @@
namespace Web {
BrowsingContext::BrowsingContext(Page& page, HTML::BrowsingContextContainer* container, BrowsingContext& top_level_browsing_context)
BrowsingContext::BrowsingContext(Page& page, HTML::BrowsingContextContainer* container)
: m_page(page)
, m_top_level_browsing_context(top_level_browsing_context)
, m_loader(*this)
, m_event_handler({}, *this)
, m_container(container)
@ -35,16 +34,6 @@ BrowsingContext::BrowsingContext(Page& page, HTML::BrowsingContextContainer* con
});
}
BrowsingContext::BrowsingContext(HTML::BrowsingContextContainer& container, BrowsingContext& top_level_browsing_context)
: BrowsingContext(*top_level_browsing_context.page(), &container, top_level_browsing_context)
{
}
BrowsingContext::BrowsingContext(Page& page)
: BrowsingContext(page, nullptr, *this)
{
}
BrowsingContext::~BrowsingContext()
{
}