mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-09-11 13:36:13 +03:00
LibWeb: Make Document::is_fully_active() more robust
We were missing a check for null browsing context container documents.
This commit is contained in:
parent
4901f69345
commit
a835f313f7
Notes:
sideshowbarker
2024-07-17 11:30:05 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/a835f313f7 Pull-request: https://github.com/SerenityOS/serenity/pull/14816 Reviewed-by: https://github.com/ADKaster Reviewed-by: https://github.com/linusg ✅
@ -1471,7 +1471,18 @@ bool Document::is_fully_active() const
|
||||
{
|
||||
// A Document d is said to be fully active when d's browsing context is non-null, d's browsing context's active document is d,
|
||||
// and either d's browsing context is a top-level browsing context, or d's browsing context's container document is fully active.
|
||||
return browsing_context() && browsing_context()->active_document() == this && (browsing_context()->is_top_level() || browsing_context()->container_document()->is_fully_active());
|
||||
auto* browsing_context = this->browsing_context();
|
||||
if (!browsing_context)
|
||||
return false;
|
||||
if (browsing_context->active_document() != this)
|
||||
return false;
|
||||
if (browsing_context->is_top_level())
|
||||
return true;
|
||||
if (auto* browsing_context_container_document = browsing_context->container_document()) {
|
||||
if (browsing_context_container_document->is_fully_active())
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/browsers.html#active-document
|
||||
|
Loading…
Reference in New Issue
Block a user