Skip to content

Commit

Permalink
Give "exit fullscreen" a fully flag to replace "fully exit fullscreen"
Browse files Browse the repository at this point in the history
The previous definition of fully exit fullscreen could unfullscreen
elements in top layer synchronously. If those elements were iframes,
the contentDocument would get handled in a following animation frame
task, leaving everything in an odd state in the interim.

Exposing the concept of fully exiting to scripts is a separate issue:
#70
  • Loading branch information
foolip committed Jan 4, 2017
1 parent 59574a4 commit d12a7a7
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 53 deletions.
60 changes: 31 additions & 29 deletions fullscreen.bs
Original file line number Diff line number Diff line change
Expand Up @@ -77,18 +77,6 @@ it from its <a>node document</a>'s <a>top layer</a>.

<hr>

<p>To <dfn>fully exit fullscreen</dfn> a <a for=/>document</a> <var>document</var>, run these steps:

<ol>
<li><p>If <var>document</var>'s <a>fullscreen element</a> is null, terminate these steps.

<li><p><a lt="Unfullscreen an element">Unfullscreen elements</a> whose <a>fullscreen flag</a> is
set, within <var>document</var>'s <a>top layer</a>, except for <var>document</var>'s
<a>fullscreen element</a>.

<li><p><a>Exit fullscreen</a> <var>document</var>.
</ol>

<p>Whenever the <a>removing steps</a> run with an <var>oldNode</var>, run these steps:

<ol>
Expand All @@ -100,15 +88,15 @@ it from its <a>node document</a>'s <a>top layer</a>.

<ol>
<li><p>If <var>node</var> is its <a>node document</a>'s <a>fullscreen element</a>,
<a>exit fullscreen</a> that <a for=/>document</a>.
<a>exit fullscreen</a> that <a for=/>document</a> with the <var>fully flag</var> unset.

<li><p>Otherwise, <a lt="unfullscreen an element">unfullscreen <var>node</var></a> within its
<a>node document</a>.
</ol>
</ol>

<p>Whenever the <a>unloading document cleanup steps</a> run with a <var>document</var>,
<a>fully exit fullscreen</a> <var>document</var>.
<a>exit fullscreen</a> <var>document</var> with the <var>fully flag</var> set.

<hr>

Expand Down Expand Up @@ -293,11 +281,12 @@ attribute's getter must run these steps:
<li><p>Return null.
</ol>

<p>To <dfn>collect documents to unfullscreen</dfn> given <var>doc</var>, run these steps:
<p>To <dfn>collect documents to unfullscreen</dfn> given <var>doc</var> and a <var>fully flag</var>,
run these steps:

<ol>
<li><p>If <var>doc</var>'s <a>top layer</a> consists of more than a single <a>element</a> that has
its <a>fullscreen flag</a> set, return the empty set.
<li><p>If the <var>fully flag</var> is unset and <var>doc</var>'s <a>top layer</a> consists of more
than a single <a>element</a> that has its <a>fullscreen flag</a> set, then return the empty set.

<li><p>Let <var>docs</var> be an ordered set consisting of <var>doc</var>.

Expand All @@ -309,7 +298,8 @@ attribute's getter must run these steps:
<li><p>Return <var>docs</var>.
</ol>

<p>To <dfn>exit fullscreen</dfn> a <a for=/>document</a> <var>doc</var>, run these steps:
<p>To <dfn>exit fullscreen</dfn> a <a for=/>document</a> <var>doc</var> with a
<var>fully flag</var>, run these steps:

<ol>
<li><p>Let <var>promise</var> be a new promise.
Expand All @@ -322,7 +312,7 @@ attribute's getter must run these steps:

<li><p>Let <var>docs</var> be the result of
<a lt="collect documents to unfullscreen">collecting documents to unfullscreen</a> given
<var>doc</var>.
<var>doc</var> and the <var>fully flag</var>.
<!-- cross-process -->

<li><p>Let <var>topLevelDoc</var> be <var>doc</var>'s <a>top-level browsing context</a>'s
Expand All @@ -340,23 +330,26 @@ attribute's getter must run these steps:
<p>As part of the next <a>animation frame task</a>, run these substeps:

<ol>
<li><p>If <var>doc</var>'s <a>fullscreen element</a> is null, then resolve <var>promise</var>
with undefined and terminate these steps.

<li><p>Let <var>exitDocs</var> be the result of
<a lt="collect documents to unfullscreen">collecting documents to unfullscreen</a> given
<var>doc</var>.
<var>doc</var> and the <var>fully flag</var>.
<!-- cross-process -->

<li><p>If <var>resize</var> is true and <var>topLevelDoc</var> is not in <var>exitDocs</var>,
<a>fully exit fullscreen</a> <var>topLevelDoc</var>, 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>.

<li><p>If <var>exitDocs</var>'s last <a for=/>document</a> has a
<a>browsing context container</a>, append that <a>browsing context container</a>'s
<a>node document</a> to <var>exitDocs</var>.
<!-- cross-process -->

<li><p>If <var>resize</var> is true, then: while <var>exitDocs</var>'s last <a for=/>document</a>
has a <a>browsing context container</a>, append that <a>browsing context container</a>'s
<a>node document</a> to <var>exitDocs</var>.
<!-- cross-process -->

<li><p>Let <var>descendantDocs</var> be an ordered set consisting of <var>doc</var>'s
<a>descendant browsing contexts</a>' <a>active documents</a> whose <a>fullscreen element</a> is
non-null, if any, in <em>reverse</em> <a>tree order</a>.
Expand All @@ -366,8 +359,16 @@ attribute's getter must run these steps:
<a lt="unfullscreen a document">unfullscreen <var>descendantDoc</var></a>.
<!-- cross-process -->

<li><p>For each <var>exitDoc</var> in <var>exitDocs</var>, in order,
<a lt="unfullscreen an element">unfullscreen</a> <var>exitDoc</var>'s <a>fullscreen element</a>.
<li>
<p>For each <var>exitDoc</var> in <var>exitDocs</var>, in order:

<ol>
<li><p>If <var>exitDoc</var> is <var>doc</var> and the <var>fully flag</var> is set, then
<a lt="unfullscreen a document">unfullscreen <var>doc</var></a>.

<li><p>Otherwise, <a lt="unfullscreen an element">unfullscreen</a> <var>exitDoc</var>'s
<a>fullscreen element</a>.
</ol>

<li><p>For each <var>descendantDoc</var> in <var>descendantDocs</var>, in order,
<a>fire an event</a> named <code>fullscreenchange</code> on <var>descendantDoc</var>.
Expand All @@ -384,7 +385,8 @@ attribute's getter must run these steps:
</ol>

<p>The <dfn method for=Document><code>exitFullscreen()</code></dfn> method, when invoked, must
return the result of running <a>exit fullscreen</a> on the <a>context object</a>.
return the result of running <a>exit fullscreen</a> on the <a>context object</a> with the
<var>fully flag</var> unset.

<hr>

Expand Down Expand Up @@ -413,8 +415,8 @@ return the result of running <a>exit fullscreen</a> on the <a>context object</a>
{{Element/requestFullscreen()}} and {{Document/exitFullscreen()}}.

<p>If the end user instructs the user agent to end a fullscreen session initiated via
{{Element/requestFullscreen()}}, <a>fully exit fullscreen</a> the
<a>top-level browsing context</a>'s <a>active document</a>.
{{Element/requestFullscreen()}}, <a>exit fullscreen</a> the
<a>top-level browsing context</a>'s <a>active document</a> with the <var>fully flag</var> set.



Expand Down
Loading

0 comments on commit d12a7a7

Please sign in to comment.