Skip to content

Commit

Permalink
Upstream Long Animation Frames monkey-patches
Browse files Browse the repository at this point in the history
Long Animation Frames (https://w3c.github.io/long-animation-frames/) expects a few calls from HTML and other specs, for reporting when tasks, rendering or JS entry points take place. This moves those calls from the Long Animation Frames spec to HTML.
  • Loading branch information
noamr committed Mar 27, 2024
1 parent c1b467a commit 1f0ac4b
Showing 1 changed file with 65 additions and 6 deletions.
71 changes: 65 additions & 6 deletions source
Expand Up @@ -2762,6 +2762,24 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
</ul>
</dd>

<dt>Long Animation Frames</dt>

<dd>
<p>The following terms are defined in <cite>Long Animation Frames</cite>: <ref>LONGANIMATIONFRAMES</ref></p>

<ul class="brief">
<li><dfn data-x-href="https://w3c.github.io/long-animation-frames/#record-task-start-time">record task start time</dfn></li>
<li><dfn data-x-href="https://w3c.github.io/long-animation-frames/#record-task-end-time">record task end time</dfn></li>
<li><dfn data-x-href="https://w3c.github.io/long-animation-frames/#record-rendering-time">record rendering time</dfn></li>
<li><dfn data-x-href="https://w3c.github.io/long-animation-frames/#record-classic-script-creation-time">record classic script creation time</dfn></li>
<li><dfn data-x-href="https://w3c.github.io/long-animation-frames/#record-classic-script-execution-start-time">record classic script execution start time</dfn></li>
<li><dfn data-x-href="https://w3c.github.io/long-animation-frames/#record-module-script-execution-start-time">record module script execution start time</dfn></li>
<li><dfn data-x-href="https://w3c.github.io/long-animation-frames/#record-pause-duration">Record pause duration</dfn></li>
<li><dfn data-x-href="https://w3c.github.io/long-animation-frames/#record-timing-info-for-timer-handler">record timing info for timer handler</dfn></li>
<li><dfn data-x-href="https://w3c.github.io/long-animation-frames/#record-timing-info-for-microtask-checkpoint">record timing info for microtask checkpoint</dfn></li>
</ul>
</dd>

<dt>Long Tasks</dt>

<dd>
Expand Down Expand Up @@ -3385,6 +3403,7 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute
current time</dfn>, the <dfn
data-x-href="https://w3c.github.io/hr-time/#dfn-shared-monotonic-clock">shared monotonic clock</dfn>,
the <dfn data-x-href="https://w3c.github.io/hr-time/#dfn-unsafe-moment">unsafe moment</dfn>,
the <dfn data-x-href="https://w3c.github.io/hr-time/#dfn-duration-from">duration from</dfn>,
the <dfn data-x-href="https://w3c.github.io/hr-time/#dfn-coarsen-time">coarsen time</dfn>
algorithm, and the <dfn
data-x-href="https://w3c.github.io/hr-time/#dom-domhighrestimestamp"><code>DOMHighResTimeStamp</code></dfn>
Expand Down Expand Up @@ -106349,8 +106368,8 @@ document.querySelector("button").addEventListener("click", bound);

<li><p>Let <var>script</var> be the result of <span>creating a classic script</span> given
<var>sourceText</var>, <var>settingsObject</var>, <var>response</var>'s <span
data-x="concept-response-url">URL</span>, <var>options</var>, and
<var>mutedErrors</var>.</p></li>
data-x="concept-response-url">URL</span>, <var>options</var>,
<var>mutedErrors</var>, and <var>url</var>.</p></li>

<li>Run <var>onComplete</var> given <var>script</var>.</li>
</ol>
Expand Down Expand Up @@ -107030,7 +107049,8 @@ document.querySelector("button").addEventListener("click", bound);
<p>To <dfn data-x="creating a classic script">create a classic script</dfn>, given a
<span>string</span> <var>source</var>, an <span>environment settings object</span>
<var>settings</var>, a <span>URL</span> <var>baseURL</var>, a <span>script fetch options</span>
<var>options</var>, and an optional boolean <var>mutedErrors</var> (default false):</p>
<var>options</var>, an optional boolean <var>mutedErrors</var> (default false), and an optional
<span>URL</span>-or-null <var>sourceURLForWindowScripts</var> (default null):</p>

<ol>
<li>
Expand Down Expand Up @@ -107063,6 +107083,9 @@ document.querySelector("button").addEventListener("click", bound);
<li><p>Set <var>script</var>'s <span data-x="concept-script-parse-error">parse error</span> and
<span data-x="concept-script-error-to-rethrow">error to rethrow</span> to null.</p></li>

<li><p><span>Record classic script creation time</span> given <var>script</var> and
<var>sourceURLForWindowScripts</var>.</p></li>

<li>
<p>Let <var>result</var> be <span data-x="js-ParseScript">ParseScript</span>(<var>source</var>,
<var>settings</var>'s <span data-x="environment settings object's realm">realm</span>,
Expand Down Expand Up @@ -107344,6 +107367,8 @@ document.querySelector("button").addEventListener("click", bound);
<li><p><span>Check if we can run script</span> with <var>settings</var>. If this returns "do
not run" then return <span>NormalCompletion</span>(empty).</p></li>

<li><p><span>Record classic script execution start time</span> given <var>script</var>.</p></li>

<li><p><span>Prepare to run script</span> given <var>settings</var>.</p></li>

<li><p>Let <var>evaluationStatus</var> be null.</p></li>
Expand Down Expand Up @@ -107426,6 +107451,8 @@ document.querySelector("button").addEventListener("click", bound);
<li><p><span>Check if we can run script</span> with <var>settings</var>. If this returns "do not
run", then return <span>a promise resolved with</span> with undefined.</p></li>

<li><p><span>Record module script execution start time</span> given <var>script</var>.</p></li>

<li><p><span>Prepare to run script</span> given <var>settings</var>.</p></li>

<li><p>Let <var>evaluationPromise</var> be null.</p></li>
Expand Down Expand Up @@ -109675,6 +109702,10 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
<var>taskQueue</var>, and <span data-x="list remove">remove</span> it from
<var>taskQueue</var>.</p></li>

<li><p>If <var>oldestTask</var>'s <span data-x="concept-task-document">document</span> is not
null, then <span>record task start time</span> given <var>taskStartTime</var> and
<var>oldestTask</var>'s <span data-x="concept-task-document">document</span>.</p></li>

<li><p>Set the <span>event loop</span>'s <span>currently running task</span> to
<var>oldestTask</var>.</p></li>

Expand All @@ -109687,7 +109718,8 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
</ol>
</li>

<li><p>Let <var>now</var> be the <span>unsafe shared current time</span>. <ref>HRT</ref></p></li>
<li><p>Let <var>taskEndTime</var> be the <span>unsafe shared current time</span>.
<ref>HRT</ref></p></li>

<li>
<p>If <var>oldestTask</var> is not null, then:</p>
Expand Down Expand Up @@ -109717,9 +109749,13 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
</ol>
</li>

<li><p><span>Report long tasks</span>, passing in <var>taskStartTime</var>, <var>now</var> (the
end time of the task), <var>top-level browsing contexts</var>, and
<li><p><span>Report long tasks</span>, passing in <var>taskStartTime</var>,
<var>taskEndTime</var>, <var>top-level browsing contexts</var>, and
<var>oldestTask</var>.</p></li>

<li><p>If <var>oldestTask</var>'s <span data-x="concept-task-document">document</span> is not
null, then <span>record task end time</span> given <var>taskEndTime</var> and
<var>oldestTask</var>'s <span data-x="concept-task-document">document</span>.</p></li>
</ol>
</li>

Expand Down Expand Up @@ -110004,6 +110040,9 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
given <var>frameTimestamp</var> and <var>doc</var>'s <span>relevant global object</span> as
the timestamp.</p></li>

<li><p>Let <var>unsafeLayoutStartTime</var> be the <span>unsafe shared current
time</span>.</p>

<li>
<p>For each <var>doc</var> of <var>docs</var>:</p>

Expand Down Expand Up @@ -110102,6 +110141,9 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
time</span> given <var>now</var> and <var>doc</var>'s <span>relevant global object</span> as
the timestamp. <ref>INTERSECTIONOBSERVER</ref></p></li>

<li><p>For each <var>doc</var> of <var>docs</var>, <span>record rendering time</span> for
<var>doc</var> given <var>unsafeStyleAndLayoutStartTime</var>.</p></li>

<li><p>For each <var>doc</var> of <var>docs</var>, <span>mark paint timing</span> for
<var>doc</var>.</p></li>

Expand Down Expand Up @@ -110187,6 +110229,8 @@ import "https://example.com/foo/../module2.mjs";</code></pre>

<li><p>Set the <span>event loop</span>'s <span>performing a microtask checkpoint</span> to
false.</p></li>

<li><p><span>Record timing info for microtask checkpoint</span>.</p></li>
</ol>

<hr>
Expand Down Expand Up @@ -110395,6 +110439,11 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
<var>goal</var> is met. This means running the following steps:</p>

<ol>
<li><p>Let <var>global</var> be the <span>current global object</span>.</p></li>

<li><p>Let <var>timeBeforePause</var> be the <span>current high resolution time</span> given
<var>global</var>.</p></li>

<li><p>If necessary, update the rendering or user interface of any <code>Document</code> or
<span>navigable</span> to reflect the current state.</p></li>

Expand All @@ -110404,6 +110453,10 @@ import "https://example.com/foo/../module2.mjs";</code></pre>
data-x="concept-task">task</span> must block. User agents should remain responsive to user input
while paused, however, albeit in a reduced capacity since the <span>event loop</span> will not be
doing anything.</p></li>

<li><p><span>Record pause duration</span> given the <span>duration from</span>
<var>timeBeforePause</var> to the <span>current high resolution time</span> given
<var>global</var>.</p></li>
</ol>

<div class="warning">
Expand Down Expand Up @@ -112712,6 +112765,9 @@ partial interface <span id="ShadowRoot-partial">ShadowRoot</span> {
<li><p>If <var>id</var> does not <span data-x="map exists">exist</span> in <var>global</var>'s
<span>map of active timers</span>, then abort these steps.</p></li>

<li><p><span>Record timing info for timer handler</span> given <var>handler</var>, <var>global</var>'s
<span>relevant settings object</span>, and <var>repeat</var>.</p></li>

<li><p>If <var>handler</var> is a <code data-x="idl-Function">Function</code>, then <span
data-x="es-invoking-callback-functions">invoke</span> <var>handler</var> given
<var>arguments</var> with the <span data-x="dfn-callback-this-value">callback this
Expand Down Expand Up @@ -142233,6 +142289,9 @@ INSERT INTERFACES HERE
<dt id="refsLONGTASKS">[LONGTASKS]</dt>
<dd><cite><a href="https://w3c.github.io/longtasks/">Long Tasks</a></cite>, D. Denicola, I. Grigorik, S. Panicker. W3C.</dd>

<dt id="refsLONGANIMATIONFRAMES">[LONGANIMATIONFRAMES]</dt>
<dd><cite><a href="https://w3c.github.io/long-animation-frames/">Long Animation Frames</a></cite>, N. Rosenthal. W3C.</dd>

<dt id="refsMAILTO">[MAILTO]</dt>
<dd>(Non-normative) <cite><a href="https://www.rfc-editor.org/rfc/rfc6068">The 'mailto' URI scheme</a></cite>, M. Duerst, L. Masinter, J. Zawinski. IETF.</dd>

Expand Down

0 comments on commit 1f0ac4b

Please sign in to comment.