From 4acb3c67790e87fb1b048cdc9eab50180d4ff14b Mon Sep 17 00:00:00 2001
From: Noam Rosenthal
enum DocumentReadyState { "loading", "interactive", "complete" };
+enum DocumentVisibilityState { "visible", "hidden" };
typedef (HTMLScriptElement or SVGScriptElement) HTMLOrSVGScriptElement;
[LegacyOverrideBuiltIns]
@@ -9318,6 +9319,8 @@ partial interface Document {
boolean queryCommandState(DOMString commandId);
boolean queryCommandSupported(DOMString commandId);
DOMString queryCommandValue(DOMString commandId);
+ readonly attribute boolean hidden;
+ readonly attribute DocumentVisibilityState visibilityState;
// special event handler IDL attributes that only apply to Document objects
[LegacyLenientThis] attribute EventHandler onreadystatechange;
@@ -74108,6 +74111,61 @@ END:VCARD
+ A top-level browsing context has a system visibility state,
+ which is either "hidden
" or "visible
".
The system visibility state is determined by the user-agent, and + represents, for example, whether the browser window is minimized, a browser tab is currently in + the background, or a system element such as a task switcher obscures the page.
+ +When a user-agent determines that the system visibility state for
+ top-level browsing context context has changed to newState,
+ it must queue a task on the user interaction task source to
+ update the visibility state of all the Document
objects in the
+ top-level browsing context's document family with
+ newState.
A Document
has a visibility state, which is either
+ "hidden
" or "visible
", initially set to
+ "hidden
".
The visibilityState
getter steps are to return
+ this's visibility state.
The hidden
getter
+ steps are to return true if this's visibility state is
+ "hidden
", otherwise false.
To update the visibility state of Document
document to
+ visibilityState:
If document's visibility state equals visibilityState, + then return.
Set document's visibility state to + visibilityState.
Run any page visibility change steps which may be defined in other + specificactions, with visibility state and document.
+ +It would be better if specification authors sent a pull request to add calls + from here into their specifications directly, instead of using the page visibility change + steps hook, to ensure well-defined cross-specification call order. As of the time of + this writing the following specifications are known to have page visibility change + steps, which will be run in an unspecified order: Device Posture API, + Screen Orientation API, and Web NFC.
+Fire an event named visibilitychange
at
+ document, with its bubbles
attribute
+ initialized to true.
Let window be document's relevant global object.
Set document's visibility state to browsingContext's + top-level browsing context's system visibility state.
Set browsingContext's active window to window.
Set window's associated @@ -79369,8 +79430,8 @@ popup4.close(); data-x="concept-document-permissions-policy">permissions policy is permissionsPolicy, cross-origin opener policy is coop, - navigation id is null, - and which is ready for post-load tasks.
Assert: document's URL and
document's relevant settings object's Set newDocument's page showing flag to true.
Fire an event named visibilitychange
at
- newDocument, with its bubbles
attribute
- initialized to true.
Update the visibility state of newDocument to
+ "hidden
".
Fire a page transition event named pageshow
at newDocument's relevant global
@@ -89106,9 +89166,8 @@ dictionary PageTransitionEventInit : EventInit with document's salvageable state.
Fire an event named visibilitychange
at
- newDocument, with its bubbles
attribute
- initialized to true.
Update the visibility state of newDocument to
+ "hidden
".
Browsing context rendering opportunities are determined based on hardware constraints such as display refresh - rates and other factors such as page performance or whether the page is in the background. - Rendering opportunities typically occur at regular intervals.
+ rates and other factors such as page performance or whether the document's + visibility state is "visible
". Rendering opportunities
+ typically occur at regular intervals.
This specification does not mandate any particular model for selecting rendering opportunities. But for example, if the browser is attempting to achieve a 60Hz @@ -126095,6 +126155,9 @@ INSERT INTERFACES HERE