mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:37:45 +00:00
LibWeb: Update Document::is_fully_active() to match latest spec
This commit is contained in:
parent
bd119b92f1
commit
537bf4c917
1 changed files with 13 additions and 12 deletions
|
@ -2006,22 +2006,23 @@ void Document::set_referrer(DeprecatedString referrer)
|
||||||
m_referrer = referrer;
|
m_referrer = referrer;
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/browsers.html#fully-active
|
// https://html.spec.whatwg.org/multipage/document-sequences.html#fully-active
|
||||||
bool Document::is_fully_active() const
|
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,
|
// A Document d is said to be fully active when d is the active document of a navigable navigable, and either
|
||||||
// and either d's browsing context is a top-level browsing context, or d's browsing context's container document is fully active.
|
// navigable is a top-level traversable or navigable's container document is fully active.
|
||||||
auto* browsing_context = this->browsing_context();
|
auto navigable = this->navigable();
|
||||||
if (!browsing_context)
|
if (!navigable)
|
||||||
return false;
|
return false;
|
||||||
if (browsing_context->active_document() != this)
|
|
||||||
return false;
|
auto traversable = navigable->traversable_navigable();
|
||||||
if (browsing_context->is_top_level())
|
if (navigable == traversable && traversable->is_top_level_traversable())
|
||||||
return true;
|
return true;
|
||||||
if (auto* navigable_container_document = browsing_context->container_document()) {
|
|
||||||
if (navigable_container_document->is_fully_active())
|
auto container_document = navigable->container_document();
|
||||||
return true;
|
if (container_document && container_document->is_fully_active())
|
||||||
}
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue