Permalink
Browse files

Add promise support to Fullscreen. Fixes https://www.w3.org/Bugs/Publ…

  • Loading branch information...
annevk committed Jul 18, 2015
1 parent 67fb879 commit fd19ec7a0f35e09b0cc4de0f676d37f6bd480560
Showing with 48 additions and 24 deletions.
  1. +24 −12 Overview.html
  2. +24 −12 Overview.src.html
@@ -204,14 +204,14 @@ <h2 id="model"><span class="secno">3 </span>Model</h2>
<h2 id="api"><span class="secno">4 </span>API</h2>
<pre class="idl">partial interface <a class="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#element">Element</a> {
void <a href="#dom-element-requestfullscreen" title="dom-Element-requestFullscreen">requestFullscreen</a>();
Promise&lt;void&gt; <a href="#dom-element-requestfullscreen" title="dom-Element-requestFullscreen">requestFullscreen</a>();
};
partial interface <a class="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#document">Document</a> {
readonly attribute boolean <a href="#dom-document-fullscreenenabled" title="dom-Document-fullscreenEnabled">fullscreenEnabled</a>;
readonly attribute <a class="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#element">Element</a>? <a href="#dom-document-fullscreenelement" title="dom-Document-fullscreenElement">fullscreenElement</a>;
void <a href="#dom-document-exitfullscreen" title="dom-Document-exitFullscreen">exitFullscreen</a>();
Promise&lt;void&gt; <a href="#dom-document-exitfullscreen" title="dom-Document-exitFullscreen">exitFullscreen</a>();
attribute <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler">EventHandler</a> <a href="#handler-document-onfullscreenchange" title="handler-document-onfullscreenchange">onfullscreenchange</a>;
attribute <a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler">EventHandler</a> <a href="#handler-document-onfullscreenerror" title="handler-document-onfullscreenerror">onfullscreenerror</a>;
@@ -278,6 +278,8 @@ <h2 id="api"><span class="secno">4 </span>API</h2>
<li><p>Let <var title="">error</var> be false.
<li><p>Let <var>promise</var> be a new promise.
<li>
<p>If any of the following conditions are true, set <var title="">error</var> to true:
@@ -291,7 +293,8 @@ <h2 id="api"><span class="secno">4 </span>API</h2>
<li><p><a href="#fullscreen-is-supported" title="Fullscreen is supported">Fullscreen is <em>not</em> supported</a>.
</ul>
<li><p>Return, and run the remaining steps asynchronously.
<li><p>Return <var>promise</var>, and run the remaining steps
<a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel">in parallel</a>.
<li><p>If <var title="">error</var> is false: Resize <var title="">pending</var>'s
<a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/browsers.html#top-level-browsing-context">top-level browsing context</a>'s
@@ -308,8 +311,9 @@ <h2 id="api"><span class="secno">4 </span>API</h2>
<a href="#fullscreen-element-ready-check">fullscreen element ready check</a> for <var title="">pending</var> returns false,
<a class="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#concept-event-fire" title="concept-event-fire">fire an event</a> named
<code>fullscreenerror</code> on <var title="">pending</var>'s
<a class="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#concept-node-document" title="concept-node-document">node document</a> and
terminate these steps.
<a class="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#concept-node-document" title="concept-node-document">node document</a>,
reject <var>promise</var> with a <code>TypeError</code> exception, and terminate these
steps.
<!-- cross-process; check is only needed on pending as it is recursive already -->
<li><p>Let <var title="">fullscreenElements</var> be an ordered set initially consisting
@@ -346,6 +350,8 @@ <h2 id="api"><span class="secno">4 </span>API</h2>
<li><p>For each <var>doc</var> in <var>eventDocs</var>, in order,
<a class="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#concept-event-fire" title="concept-event-fire">fire an event</a> named
<code>fullscreenchange</code> on <var title="">doc</var>.
<li><p>Fulfill <var>promise</var> with undefined.
</ol>
<p class="XXX"><span>Animation frame task</span> is not really defined yet, including
@@ -395,8 +401,11 @@ <h2 id="api"><span class="secno">4 </span>API</h2>
these steps:
<ol>
<li><p>If <var title="">doc</var>'s <a href="#fullscreen-element">fullscreen element</a> is null, terminate these
steps.
<li><p>Let <var>promise</var> be a new promise.
<li><p>If <var title="">doc</var>'s <a href="#fullscreen-element">fullscreen element</a> is null, reject
<var>promise</var> with a <code>TypeError</code> exception, and return
<var>promise</var>.
<li><p>Let <var title="">resize</var> be false.
@@ -413,7 +422,8 @@ <h2 id="api"><span class="secno">4 </span>API</h2>
<li><p>If <var title="">topLevelDoc</var> is in <var title="">docs</var>, set
<var title="">resize</var> to true.
<li><p>Return, and run the remaining steps asynchronously.
<li><p>Return <var>promise</var>, and run the remaining steps
<a class="external" data-anolis-spec="html" href="https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel">in parallel</a>.
<li><p>If <var title="">resize</var> is true, resize <var title="">topLevelDoc</var>'s viewport
to its "normal" dimensions.
@@ -428,8 +438,8 @@ <h2 id="api"><span class="secno">4 </span>API</h2>
<!-- cross-process -->
<li><p>If <var title="">resize</var> is true and <var title="">topLevelDoc</var> is not in
<var title="">exitDocs</var>, <a href="#fully-exit-fullscreen">fully exit fullscreen</a> and terminate these
steps.
<var title="">exitDocs</var>, <a href="#fully-exit-fullscreen">fully exit fullscreen</a>, reject
<var>promise</var> with a <code>TypeError</code> exception, and terminate these steps.
<li><p>If <var>exitDocs</var> is the empty set, append <var>doc</var> to
<var>exitDocs</var>.
@@ -468,6 +478,8 @@ <h2 id="api"><span class="secno">4 </span>API</h2>
<a class="external" data-anolis-spec="dom" href="https://dom.spec.whatwg.org/#concept-event-fire" title="concept-event-fire">fire an event</a> named
<code>fullscreenchange</code> on <var title="">exitDoc</var>.
<!-- cross-process -->
<li><p>Fulfill <var>promise</var> with undefined.
</ol>
<p class="note">This results in events being fired from the innermost to the outermost
@@ -476,8 +488,8 @@ <h2 id="api"><span class="secno">4 </span>API</h2>
<p>The
<dfn id="dom-document-exitfullscreen" title="dom-Document-exitFullscreen"><code>exitFullscreen()</code></dfn>
method, when invoked, must <a href="#exit-fullscreen">exit fullscreen</a> with the
<a href="#context-object">context object</a>.
method, when invoked, must return the result of running <a href="#exit-fullscreen">exit fullscreen</a> with
the <a href="#context-object">context object</a>.
<hr>
@@ -189,14 +189,14 @@ <h2>Model</h2>
<h2>API</h2>
<pre class=idl>partial interface <span data-anolis-spec=dom>Element</span> {
void <span title=dom-Element-requestFullscreen>requestFullscreen</span>();
Promise&lt;void> <span title=dom-Element-requestFullscreen>requestFullscreen</span>();
};
partial interface <span data-anolis-spec=dom>Document</span> {
readonly attribute boolean <span title=dom-Document-fullscreenEnabled>fullscreenEnabled</span>;
readonly attribute <span data-anolis-spec=dom>Element</span>? <span title=dom-Document-fullscreenElement>fullscreenElement</span>;
void <span title=dom-Document-exitFullscreen>exitFullscreen</span>();
Promise&lt;void> <span title=dom-Document-exitFullscreen>exitFullscreen</span>();
attribute <span data-anolis-spec=html>EventHandler</span> <span title=handler-document-onfullscreenchange>onfullscreenchange</span>;
attribute <span data-anolis-spec=html>EventHandler</span> <span title=handler-document-onfullscreenerror>onfullscreenerror</span>;
@@ -263,6 +263,8 @@ <h2>API</h2>
<li><p>Let <var title>error</var> be false.
<li><p>Let <var>promise</var> be a new promise.
<li>
<p>If any of the following conditions are true, set <var title>error</var> to true:
@@ -276,7 +278,8 @@ <h2>API</h2>
<li><p><span title="Fullscreen is supported">Fullscreen is <em>not</em> supported</span>.
</ul>
<li><p>Return, and run the remaining steps asynchronously.
<li><p>Return <var>promise</var>, and run the remaining steps
<span data-anolis-spec=html>in parallel</span>.
<li><p>If <var title>error</var> is false: Resize <var title>pending</var>'s
<span data-anolis-spec=html>top-level browsing context</span>'s
@@ -293,8 +296,9 @@ <h2>API</h2>
<span>fullscreen element ready check</span> for <var title>pending</var> returns false,
<span data-anolis-spec=dom title=concept-event-fire>fire an event</span> named
<code>fullscreenerror</code> on <var title>pending</var>'s
<span data-anolis-spec=dom title=concept-node-document>node document</span> and
terminate these steps.
<span data-anolis-spec=dom title=concept-node-document>node document</span>,
reject <var>promise</var> with a <code>TypeError</code> exception, and terminate these
steps.
<!-- cross-process; check is only needed on pending as it is recursive already -->
<li><p>Let <var title>fullscreenElements</var> be an ordered set initially consisting
@@ -331,6 +335,8 @@ <h2>API</h2>
<li><p>For each <var>doc</var> in <var>eventDocs</var>, in order,
<span data-anolis-spec=dom title=concept-event-fire>fire an event</span> named
<code>fullscreenchange</code> on <var title>doc</var>.
<li><p>Fulfill <var>promise</var> with undefined.
</ol>
<p class=XXX><span>Animation frame task</span> is not really defined yet, including
@@ -380,8 +386,11 @@ <h2>API</h2>
these steps:
<ol>
<li><p>If <var title>doc</var>'s <span>fullscreen element</span> is null, terminate these
steps.
<li><p>Let <var>promise</var> be a new promise.
<li><p>If <var title>doc</var>'s <span>fullscreen element</span> is null, reject
<var>promise</var> with a <code>TypeError</code> exception, and return
<var>promise</var>.
<li><p>Let <var title>resize</var> be false.
@@ -398,7 +407,8 @@ <h2>API</h2>
<li><p>If <var title>topLevelDoc</var> is in <var title>docs</var>, set
<var title>resize</var> to true.
<li><p>Return, and run the remaining steps asynchronously.
<li><p>Return <var>promise</var>, and run the remaining steps
<span data-anolis-spec=html>in parallel</span>.
<li><p>If <var title>resize</var> is true, resize <var title>topLevelDoc</var>'s viewport
to its "normal" dimensions.
@@ -413,8 +423,8 @@ <h2>API</h2>
<!-- cross-process -->
<li><p>If <var title>resize</var> is true and <var title>topLevelDoc</var> is not in
<var title>exitDocs</var>, <span>fully exit fullscreen</span> and terminate these
steps.
<var title>exitDocs</var>, <span>fully exit fullscreen</span>, reject
<var>promise</var> with a <code>TypeError</code> exception, and terminate these steps.
<li><p>If <var>exitDocs</var> is the empty set, append <var>doc</var> to
<var>exitDocs</var>.
@@ -453,6 +463,8 @@ <h2>API</h2>
<span data-anolis-spec=dom title=concept-event-fire>fire an event</span> named
<code>fullscreenchange</code> on <var title>exitDoc</var>.
<!-- cross-process -->
<li><p>Fulfill <var>promise</var> with undefined.
</ol>
<p class=note>This results in events being fired from the innermost to the outermost
@@ -461,8 +473,8 @@ <h2>API</h2>
<p>The
<dfn title=dom-Document-exitFullscreen><code>exitFullscreen()</code></dfn>
method, when invoked, must <span>exit fullscreen</span> with the
<span>context object</span>.
method, when invoked, must return the result of running <span>exit fullscreen</span> with
the <span>context object</span>.
<hr>

0 comments on commit fd19ec7

Please sign in to comment.