1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:17:44 +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()); 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 // https://html.spec.whatwg.org/multipage/history.html#dom-document-location
Bindings::LocationObject* Document::location() Bindings::LocationObject* Document::location()
{ {

View file

@ -277,6 +277,7 @@ public:
bool has_a_style_sheet_that_is_blocking_scripts() const; bool has_a_style_sheet_that_is_blocking_scripts() const;
bool is_fully_active() const; bool is_fully_active() const;
bool is_active() const;
NonnullRefPtr<HTML::History> history() const { return m_history; } NonnullRefPtr<HTML::History> history() const { return m_history; }