Skip to content

Commit

Permalink
Add a performance entry type for visibility state changes
Browse files Browse the repository at this point in the history
  • Loading branch information
noamr committed Aug 18, 2022
1 parent 814668e commit 2afe6ea
Showing 1 changed file with 73 additions and 4 deletions.
77 changes: 73 additions & 4 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -2686,6 +2686,22 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
</ul>
</dd>

<dt>Performance Timeline</dt>

<dd>
<p>The following terms are defined in <cite>Performance Timeline</cite>: <ref spec=PERFORMANCETIMELINE></p>

<ul class="brief">
<li><dfn data-x-href="https://w3c.github.io/performance-timeline/#dom-performanceentry"><code>PerformanceEntry</code></dfn>
<dfn data-x="PerformanceEntry-name" data-x-href="https://w3c.github.io/performance-timeline/#dom-performanceentry-name"><code>name</code></dfn>,
<dfn data-x="PerformanceEntry-entryType" data-x-href="https://w3c.github.io/performance-timeline/#dom-performanceentry-entrytype"><code>entryType</code></dfn>,
<dfn data-x="PerformanceEntry-startTime" data-x-href="https://w3c.github.io/performance-timeline/#dom-performanceentry-starttime"><code>startTime</code></dfn>, and
<dfn data-x="PerformanceEntry-duration" data-x-href="https://w3c.github.io/performance-timeline/#dom-performanceentry-duration"><code>duration</code></dfn> attributes.</li>

<li><dfn data-x-href="https://w3c.github.io/performance-timeline/#queue-a-performanceentry">Queue a performance entry</dfn></li>
</ul>
</dd>

<dt>Long Tasks</dt>

<dd>
Expand Down Expand Up @@ -75890,8 +75906,8 @@ END:VCARD</pre>
<li><p>If <var>document</var>'s <span>visibility state</span> equals <var>visibilityState</var>,
then return.</p></li>

<li><p>Set <var>document</var>'s <span>visibility state</span> to
<var>visibilityState</var>.</p></li>
<li><p><span>Set the visibility state</span> of <var>document</var> to
<var>visibilityState</var>.</p>

<li>
<p>Run any <dfn export>page visibility change steps</dfn> which may be defined in other
Expand All @@ -75911,6 +75927,55 @@ END:VCARD</pre>
initialized to true.</p></li>
</ol>

<p>To <dfn>set the visibility state</dfn> of <code>Document</code> <var>document</var> to
<var>visibilityState</var>:<p>

<ol>
<li><p>Set <var>this</var>'s <span>visibility state</span> to
<var>visibilityState</var>.</p></li>

<li><p><span data-x="queue a performance entry">Queue</span> a new
<code>VisibilityStateEntry</code> whose
<span data-x="VisibilityStateEntry-state">visibility state</span> is
<var>visibilityState</var> and whose <span
data-x="VisibilityStateEntry-timestamp">timestamp</span> is
the <span>current high resolution time</span> given <var>document</var>'s
<span>relevant global object</span>.</p>
</ol>

<h4>The <code>VisibilityStateEntry</code> interface</h4>

<p>The <code>VisibilityStateEntry</code> interface exposes visibility changes to the document,
from the moment the document becomes active.</p>

<pre><code class="idl">[Exposed=(Window)]
interface <dfn interface>VisibilityStateEntry</dfn> : <code data-x="PerformanceEntry">PerformanceEntry</code>{
attribute DOMString <span data-x="VisibilityStateEntry-name">name</span>; // shadows inherited <span data-x="PerformanceEntry-name">name</span>
attribute DOMString <span data-x="VisibilityStateEntry-entryType">entryType</span>; // shadows inherited <span data-x="PerformanceEntry-entryType">entryType</span>
attribute DOMHighResTimeStamp <span data-x="VisibilityStateEntry-startTime">startTime</span>; // shadows inherited <span data-x="PerformanceEntry-startTime">startTime</span>
attribute unsigned long <span data-x="VisibilityStateEntry-duration">duration</span>; // shadows inherited <span data-x="PerformanceEntry-duration">duration</span>
};</code></pre>

<p>The <code>VisibilityStateEntry</code> has an associated
<span><code>DOMHighResTimeStamp</code></span>
<dfn data-x="VisibilityStateEntry-timestamp">timestamp</dfn>.</p>

<p>The <code>VisibilityStateEntry</code> has an associated "<code data-x="">visible</code>" or
"<code data-x="">hidden</code>" <dfn
data-x="VisibilityStateEntry-state">visibility state</dfn>.</p>

<p>The <dfn data-x="VisibilityStateEntry-name">name</dfn> getter steps are to return
<span>this</span>'s <span data-x="VisibilityStateEntry-state">state</span>.</p>

<p>The <dfn data-x="VisibilityStateEntry-entryType">entryType</dfn> getter steps are to return
"<code data-x="">visibility-state</code>".</p>

<p>The <dfn data-x="VisibilityStateEntry-startTime">startTime</dfn> getter steps are to return
<span>this</span>'s <span data-x="VisibilityStateEntry-timestamp">timestamp</span>.</p>

<p>The <dfn data-x="VisibilityStateEntry-duration">duration</dfn> getter steps are to return
zero.</p>


<h3>Inert subtrees</h3>

Expand Down Expand Up @@ -81116,8 +81181,9 @@ popup4.close();</code></pre></div>
<li><p>Let <var>window</var> be <var>document</var>'s <span>relevant global
object</span>.</p></li>

<li><p>Set <var>document</var>'s <span>visibility state</span> to <var>browsingContext</var>'s
<span>top-level browsing context</span>'s <span>system visibility state</span>.</p></li>
<li><p><span>Set the visibility state</span> of <var>document</var> to
<var>browsingContext</var>'s <span>top-level browsing context</span>'s
<span>system visibility state</span>.</p></li>

<li><p>Set <var>browsingContext</var>'s <span>active window</span> to <var>window</var>.</p></li>

Expand Down Expand Up @@ -127730,6 +127796,9 @@ INSERT INTERFACES HERE
<dt id="refsPDF">[PDF]</dt>
<dd>(Non-normative) <cite><a href="https://www.adobe.com/content/dam/Adobe/en/devnet/acrobat/pdfs/PDF32000_2008.pdf">Document management &mdash; Portable document format &mdash; Part 1: PDF</a></cite>. ISO.</dd>

<dt id="refsPERFORMANCETIMELINE">[PERFORMANCETIMELINE]</dt>
<dd><cite><a href="https://w3c.github.io/performance-timeline/">Performance Timeline</a></cite>, N. Pena Moreno, W3C.</dd>

<dt id="refsPERMISSIONSPOLICY">[PERMISSIONSPOLICY]</dt>
<dd><cite><a href="https://w3c.github.io/webappsec-feature-policy/">Permissions Policy</a></cite>, I. Clelland, W3C.</dd>

Expand Down

0 comments on commit 2afe6ea

Please sign in to comment.