Skip to content

Commit

Permalink
Update fullscreen spec to be Shadow DOM compliant
Browse files Browse the repository at this point in the history
Spec discussion at WICG/webcomponents#180.

The rough consensus was:
WICG/webcomponents#180 (comment)

This resolves whatwg#42
  • Loading branch information
TakayoshiKochi committed Sep 28, 2016
1 parent c1a9238 commit 4f802ea
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 29 deletions.
51 changes: 35 additions & 16 deletions fullscreen.bs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,8 @@ and <a>add</a> it to its <a>node document</a>'s <a>top layer</a>.
<p>Whenever the <a>removing steps</a> run with an <var>oldNode</var>, run these steps:

<ol>
<li><p>Let <var>nodes</var> be <var>oldNode</var>'s <a>inclusive descendants</a> that have their
<a>fullscreen flag</a> set, in <a>tree order</a>.
<li><p>Let <var>nodes</var> be <var>oldNode</var>'s <a>shadow-including inclusive descendants</a>
that have their <a>fullscreen flag</a> set, in <a>shadow-including tree order</a>.

<li>
<p>For each <var>node</var> in <var>nodes</var>, run these substeps:
Expand Down Expand Up @@ -153,14 +153,17 @@ partial interface Element {

partial interface Document {
[LenientSetter] readonly attribute boolean fullscreenEnabled;
[LenientSetter] readonly attribute Element? fullscreenElement;
[LenientSetter] readonly attribute boolean fullscreen; // historical

Promise&lt;void> exitFullscreen();

attribute EventHandler onfullscreenchange;
attribute EventHandler onfullscreenerror;
};

partial interface DocumentOrShadowRoot {
[LenientSetter] readonly attribute Element? fullscreenElement;
};
</pre>

<dl class=domintro>
Expand All @@ -171,12 +174,15 @@ partial interface Document {
<dd><p>Returns true if <var>document</var> has the ability to display <a>elements</a> fullscreen
and <a>fullscreen is supported</a>, or false otherwise.

<dt><code><var>document</var> . {{Document/fullscreenElement}}</code>
<dd><p>Returns <var>document</var>'s <a>fullscreen element</a>.

<dt><code><var>promise</var> = <var>document</var> . {{Document/exitFullscreen()}}</code>
<dd><p>Stops <var>document</var>'s <a>fullscreen element</a> from being displayed fullscreen and
fulfills <var>promise</var> when done.

<dt><code><var>document</var> . {{DocumentOrShadowRoot/fullscreenElement}}</code>
<dd><p>Returns <var>document</var>'s <a>fullscreen element</a>.

<dt><code><var>shadowroot</var> . {{DocumentOrShadowRoot/fullscreenElement}}</code>
<dd><p>Returns <var>shadowroot</var>'s <a>fullscreen element</a>.
</dl>

<p>A <dfn>fullscreen element ready check</dfn> for an <a>element</a> <var>element</var> returns true
Expand All @@ -190,7 +196,7 @@ if all of the following are true, and false otherwise:
<a href=https://www.w3.org/Math/draft-spec/chapter2.html#interf.toplevel>MathML <code>math</code></a>
element. [[!SVG]] [[!MATHML]]

<li><p><var>element</var> is <a>in a document</a>.
<li><p><var>element</var> is <a>connected</a>.

<li><p><var>element</var>'s <a>node document</a> is <a>allowed to use</a> the feature indicated by
attribute name <code>allowfullscreen</code>.
Expand Down Expand Up @@ -283,14 +289,21 @@ these steps:
return true if the <a>context object</a> is <a>allowed to use</a> the feature indicated by attribute
name <code>allowfullscreen</code> and <a>fullscreen is supported</a>, and false otherwise.

<p>The <dfn attribute for=Document><code>fullscreenElement</code></dfn> attribute's getter must
return <a>context object</a>'s <a>fullscreen element</a>.

<p>The <dfn attribute for=Document><code>fullscreen</code></dfn> attribute's getter must return
false if <a>context object</a>'s <a>fullscreen element</a> is null, and true otherwise.

<p class=note>Use
<a attribute for=Document lt=fullscreenElement><code>document.fullscreenElement</code></a> instead.
<p class=note>Use {{DocumentOrShadowRoot/fullscreenElement}} instead.

<p>The
<dfn attribute for=DocumentOrShadowRoot id=dom-document-fullscreenelement><code>fullscreenElement</code></dfn>
attribute's getter must run the following steps and return the result accordingly.
<ol>
<li>If the <a>context object</a> is a <a>shadow root</a> and its <a for=DocumentFragment>host</a>
is not <a>connected</a>, return null.</li>
<li>Run <a>retargeting</a> <a>fullscreen element</a> against the <a>context object</a>.
<li>If the result of the previous step and the <a>context object</a> are in the same tree,
return the result, otherwise return null.
</ol>

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

Expand Down Expand Up @@ -461,8 +474,8 @@ following characteristics:
is the viewport, and the initial containing block otherwise.

<li><p>If it is an element, it and its <a><code>::backdrop</code></a> pseudo-element are not
rendered if its <a>inclusive ancestor</a> has the <code>display</code> property set to
<code>none</code>.
rendered if its <a>shadow-including inclusive ancestor</a> has the <code>display</code> property
set to <code>none</code>.

<li><p>If its specified <code>display</code> property is <code>contents</code>, it computes to
<code>block</code>.
Expand Down Expand Up @@ -505,9 +518,15 @@ properties apply to this pseudo-element either.
<p>The <dfn id=css-pc-fullscreen><code>:fullscreen</code></dfn> pseudo-class must match any
<a>element</a> that has its <a>fullscreen flag</a> set.

<p class="note no-backref">This makes it different from the {{Document/fullscreenElement}} API,
which returns a <a>document</a>'s <a>fullscreen element</a>.
<p class="note no-backref">This makes it different from the fullscreenElement API, which returns
returns the topmost fullscreen element..

For each <a>node tree</a>, if the result of <a>retargeting</a> its <a>shadow-including root</a>'s
<a>fullscreen element</a> against the <a for="tree">root</a> of the <a>node tree</a> is not null and
the result is in the same <a>tree</a>, <a>:fullscreen</a> pseudo-class must match the result.

<p class="note no-backref">In other words, <a>:fullscreen</a> matches all the non-null results of
{{DocumentOrShadowRoot/fullscreenElement}} API for each <a>node tree</a>.

<h3 id=user-agent-level-style-sheet-defaults>User-agent level style sheet defaults</h3>
<!-- HTML's "The CSS user agent style sheet and presentational hints" section uses this term -->
Expand Down

0 comments on commit 4f802ea

Please sign in to comment.