1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-06-01 09:58:14 +00:00

LibWeb: Add DOM::Document::is_active()

This is a spec concept that means a document is the associated document
of its browsing context's active window.
This commit is contained in:
Andreas Kling 2021-09-19 12:28:22 +02:00
parent 79c2762a0d
commit 5fbd0c5ea0
2 changed files with 8 additions and 0 deletions

View file

@ -985,6 +985,13 @@ bool Document::is_fully_active() const
return browsing_context() && browsing_context()->active_document() == this && (browsing_context()->is_top_level() || browsing_context()->container_document()->is_fully_active());
}
// https://html.spec.whatwg.org/multipage/browsers.html#active-document
bool Document::is_active() const
{
// A browsing context's active document is its active window's associated Document.
return browsing_context() && browsing_context()->active_document() == this;
}
// https://html.spec.whatwg.org/multipage/history.html#dom-document-location
Bindings::LocationObject* Document::location()
{