-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathfullscreen.html
546 lines (537 loc) · 51.9 KB
/
fullscreen.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
<!doctype html><html lang="en">
<head>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1, shrink-to-fit=no" name="viewport">
<meta content="#3c790a" name="theme-color">
<title>Fullscreen API Standard</title>
<link href="https://resources.whatwg.org/standard.css" rel="stylesheet">
<link href="https://resources.whatwg.org/bikeshed.css" rel="stylesheet">
<link href="https://resources.whatwg.org/logo-fullscreen.svg" rel="icon">
<meta content="Bikeshed 1.0.0" name="generator">
<style>/* style-syntax-highlighting */
pre.idl.highlight { color: #708090; }
.highlight:not(.idl) { background: hsl(24, 20%, 95%); }
code.highlight { padding: .1em; border-radius: .3em; }
pre.highlight, pre > code.highlight { display: block; padding: 1em; margin: .5em 0; overflow: auto; border-radius: 0; }
.highlight .c { color: #708090 } /* Comment */
.highlight .k { color: #990055 } /* Keyword */
.highlight .l { color: #000000 } /* Literal */
.highlight .n { color: #0077aa } /* Name */
.highlight .o { color: #999999 } /* Operator */
.highlight .p { color: #999999 } /* Punctuation */
.highlight .cm { color: #708090 } /* Comment.Multiline */
.highlight .cp { color: #708090 } /* Comment.Preproc */
.highlight .c1 { color: #708090 } /* Comment.Single */
.highlight .cs { color: #708090 } /* Comment.Special */
.highlight .kc { color: #990055 } /* Keyword.Constant */
.highlight .kd { color: #990055 } /* Keyword.Declaration */
.highlight .kn { color: #990055 } /* Keyword.Namespace */
.highlight .kp { color: #990055 } /* Keyword.Pseudo */
.highlight .kr { color: #990055 } /* Keyword.Reserved */
.highlight .kt { color: #990055 } /* Keyword.Type */
.highlight .ld { color: #000000 } /* Literal.Date */
.highlight .m { color: #000000 } /* Literal.Number */
.highlight .s { color: #a67f59 } /* Literal.String */
.highlight .na { color: #0077aa } /* Name.Attribute */
.highlight .nc { color: #0077aa } /* Name.Class */
.highlight .no { color: #0077aa } /* Name.Constant */
.highlight .nd { color: #0077aa } /* Name.Decorator */
.highlight .ni { color: #0077aa } /* Name.Entity */
.highlight .ne { color: #0077aa } /* Name.Exception */
.highlight .nf { color: #0077aa } /* Name.Function */
.highlight .nl { color: #0077aa } /* Name.Label */
.highlight .nn { color: #0077aa } /* Name.Namespace */
.highlight .py { color: #0077aa } /* Name.Property */
.highlight .nt { color: #669900 } /* Name.Tag */
.highlight .nv { color: #222222 } /* Name.Variable */
.highlight .ow { color: #999999 } /* Operator.Word */
.highlight .mb { color: #000000 } /* Literal.Number.Bin */
.highlight .mf { color: #000000 } /* Literal.Number.Float */
.highlight .mh { color: #000000 } /* Literal.Number.Hex */
.highlight .mi { color: #000000 } /* Literal.Number.Integer */
.highlight .mo { color: #000000 } /* Literal.Number.Oct */
.highlight .sb { color: #a67f59 } /* Literal.String.Backtick */
.highlight .sc { color: #a67f59 } /* Literal.String.Char */
.highlight .sd { color: #a67f59 } /* Literal.String.Doc */
.highlight .s2 { color: #a67f59 } /* Literal.String.Double */
.highlight .se { color: #a67f59 } /* Literal.String.Escape */
.highlight .sh { color: #a67f59 } /* Literal.String.Heredoc */
.highlight .si { color: #a67f59 } /* Literal.String.Interpol */
.highlight .sx { color: #a67f59 } /* Literal.String.Other */
.highlight .sr { color: #a67f59 } /* Literal.String.Regex */
.highlight .s1 { color: #a67f59 } /* Literal.String.Single */
.highlight .ss { color: #a67f59 } /* Literal.String.Symbol */
.highlight .vc { color: #0077aa } /* Name.Variable.Class */
.highlight .vg { color: #0077aa } /* Name.Variable.Global */
.highlight .vi { color: #0077aa } /* Name.Variable.Instance */
.highlight .il { color: #000000 } /* Literal.Number.Integer.Long */
</style>
<body class="h-entry status-LS">
<div class="head">
<p data-fill-with="logo"><a class="logo" href="https://whatwg.org/"> <img alt="WHATWG" height="100" src="https://resources.whatwg.org/logo-fullscreen.svg"> </a> </p>
<hgroup>
<h1 class="p-name no-ref" id="title">Fullscreen API</h1>
<h2 class="no-num no-toc no-ref heading settled" id="subtitle"><span class="content">Living Standard — Last Updated <time class="dt-updated" datetime="2016-10-24">24 October 2016</time></span></h2>
</hgroup>
<div data-fill-with="spec-metadata">
<dl>
<dt>Participate:
<dd><span><a href="https://github.com/whatwg/fullscreen">GitHub whatwg/fullscreen</a> (<a href="https://github.com/whatwg/fullscreen/issues/new">file an issue</a>, <a href="https://github.com/whatwg/fullscreen/issues">open issues</a>)</span>
<dd><span><a href="https://wiki.whatwg.org/wiki/IRC">IRC: #whatwg on Freenode</a></span>
<dt>Commits:
<dd><span><a href="https://github.com/whatwg/fullscreen/commits">GitHub whatwg/fullscreen/commits</a></span>
<dd><span><a href="https://twitter.com/fullscreenapi">@fullscreenapi</a></span>
</dl>
</div>
<div data-fill-with="warning"></div>
</div>
<h2 class="no-num no-toc no-ref heading settled" id="abstract"><span class="content">Abstract</span></h2>
<div class="p-summary" data-fill-with="abstract">
<p>The Fullscreen API standard defines an API for elements to display themselves fullscreen.</p>
</div>
<nav data-fill-with="table-of-contents" id="toc">
<h2 class="no-num no-toc no-ref" id="contents">Table of Contents</h2>
<ol class="toc" role="directory">
<li><a href="#conformance"><span class="secno">1</span> <span class="content">Conformance</span></a>
<li><a href="#terminology"><span class="secno">2</span> <span class="content">Terminology</span></a>
<li><a href="#model"><span class="secno">3</span> <span class="content">Model</span></a>
<li><a href="#api"><span class="secno">4</span> <span class="content">API</span></a>
<li><a href="#ui"><span class="secno">5</span> <span class="content">UI</span></a>
<li>
<a href="#rendering"><span class="secno">6</span> <span class="content">Rendering</span></a>
<ol class="toc">
<li><a href="#new-stacking-layer"><span class="secno">6.1</span> <span class="content">New stacking layer</span></a>
<li><a href="#::backdrop-pseudo-element"><span class="secno">6.2</span> <span class="content"><code>::backdrop</code> pseudo-element</span></a>
<li><a href="#:fullscreen-pseudo-class"><span class="secno">6.3</span> <span class="content"><code>:fullscreen</code> pseudo-class</span></a>
<li><a href="#user-agent-level-style-sheet-defaults"><span class="secno">6.4</span> <span class="content">User-agent level style sheet defaults</span></a>
</ol>
<li><a href="#security-and-privacy-considerations"><span class="secno">7</span> <span class="content">Security and Privacy Considerations</span></a>
<li>
<a href="#references"><span class="secno"></span> <span class="content">References</span></a>
<ol class="toc">
<li><a href="#normative"><span class="secno"></span> <span class="content">Normative References</span></a>
</ol>
<li><a href="#acknowledgments"><span class="secno"></span> <span class="content">Acknowledgments</span></a>
</ol>
</nav>
<main>
<script async="" src="https://resources.whatwg.org/file-issue.js"></script>
<script defer="" id="head" src="https://resources.whatwg.org/dfn.js"></script>
<h2 class="heading settled" data-level="1" id="conformance"><span class="secno">1. </span><span class="content">Conformance</span><a class="self-link" href="#conformance"></a></h2>
<p>All diagrams, examples, and notes in this specification are non-normative, as are all sections
explicitly marked non-normative. Everything else in this specification is normative. </p>
<p>The key words "MUST", "MUST NOT", "REQUIRED", "SHOULD", "SHOULD
NOT", "RECOMMENDED", "MAY", and "OPTIONAL" in the normative parts of this specification are to be
interpreted as described in RFC2119. For readability, these words do not appear in all uppercase
letters in this specification. <a data-link-type="biblio" href="#biblio-rfc2119">[RFC2119]</a> </p>
<h2 class="heading settled" data-level="2" id="terminology"><span class="secno">2. </span><span class="content">Terminology</span><a class="self-link" href="#terminology"></a></h2>
<p>Most terminology used in this specification is from CSS, DOM, HTML, and Web IDL. <a data-link-type="biblio" href="#biblio-css">[CSS]</a> <a data-link-type="biblio" href="#biblio-dom">[DOM]</a> <a data-link-type="biblio" href="#biblio-html">[HTML]</a> <a data-link-type="biblio" href="#biblio-webidl">[WEBIDL]</a> </p>
<p>The term <dfn data-dfn-type="dfn" data-noexport="" id="context-object">context object<a class="self-link" href="#context-object"></a></dfn> means the object on which the method or attribute being
discussed was called. When the <a data-link-type="dfn" href="#context-object">context object</a> is unambiguous, the term can be omitted. </p>
<p>A <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/browsers.html#browsing-context">browsing context</a> <var>A</var> is called a <dfn data-dfn-type="dfn" data-noexport="" id="descendant-browsing-context">descendant browsing context<a class="self-link" href="#descendant-browsing-context"></a></dfn> of a <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/browsers.html#browsing-context">browsing context</a> <var>B</var> if and only if <var>B</var> is an <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/browsers.html#ancestor-browsing-context">ancestor browsing context</a> of <var>A</var>. </p>
<h2 class="heading settled" data-level="3" id="model"><span class="secno">3. </span><span class="content">Model</span><a class="self-link" href="#model"></a></h2>
<p>All <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-element">elements</a> have an associated <dfn data-dfn-type="dfn" data-noexport="" id="fullscreen-flag">fullscreen flag<a class="self-link" href="#fullscreen-flag"></a></dfn>. Unless stated otherwise it is
unset. </p>
<p>All <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/embedded-content.html#the-iframe-element">iframe</a></code> <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-element">elements</a> have an associated <dfn data-dfn-type="dfn" data-noexport="" id="iframe-fullscreen-flag">iframe fullscreen flag<a class="self-link" href="#iframe-fullscreen-flag"></a></dfn>. Unless
stated otherwise it is unset. </p>
<p>All <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-document">documents</a> have an associated <dfn data-dfn-type="dfn" data-noexport="" id="fullscreen-element">fullscreen element<a class="self-link" href="#fullscreen-element"></a></dfn>. The <a data-link-type="dfn" href="#fullscreen-element">fullscreen element</a> is the topmost <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-element">element</a> in the <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-document">document</a>’s <a data-link-type="dfn" href="#top-layer">top layer</a> whose <a data-link-type="dfn" href="#fullscreen-flag">fullscreen flag</a> is set, if any, and null otherwise. </p>
<p>To <dfn data-dfn-type="dfn" data-noexport="" id="fullscreen-an-element">fullscreen an <var>element</var><a class="self-link" href="#fullscreen-an-element"></a></dfn>, set <var>element</var>’s <a data-link-type="dfn" href="#fullscreen-flag">fullscreen flag</a> and <a data-link-type="dfn" href="#top-layer-add">add</a> it to its <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-node-document">node document</a>’s <a data-link-type="dfn" href="#top-layer">top layer</a>. </p>
<p>To <dfn data-dfn-type="dfn" data-noexport="" id="unfullscreen-an-element">unfullscreen an <var>element</var><a class="self-link" href="#unfullscreen-an-element"></a></dfn>, unset <var>element</var>’s <a data-link-type="dfn" href="#fullscreen-flag">fullscreen flag</a> and <a data-link-type="dfn" href="#iframe-fullscreen-flag">iframe fullscreen flag</a> (if any), and <a data-link-type="dfn" href="#top-layer-remove">remove</a> it from its <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-node-document">node document</a>’s <a data-link-type="dfn" href="#top-layer">top layer</a>. </p>
<p>To <dfn data-dfn-type="dfn" data-noexport="" id="unfullscreen-a-document">unfullscreen a <var>document</var><a class="self-link" href="#unfullscreen-a-document"></a></dfn>, <a data-link-type="dfn" href="#unfullscreen-an-element">unfullscreen</a> all <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-element">elements</a>, within <var>document</var>’s <a data-link-type="dfn" href="#top-layer">top layer</a>, whose <a data-link-type="dfn" href="#fullscreen-flag">fullscreen flag</a> is set. </p>
<hr>
<p>To <dfn data-dfn-type="dfn" data-noexport="" id="fully-exit-fullscreen">fully exit fullscreen<a class="self-link" href="#fully-exit-fullscreen"></a></dfn> a <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-document">document</a> <var>document</var>, run these steps: </p>
<ol>
<li>
<p>If <var>document</var>’s <a data-link-type="dfn" href="#fullscreen-element">fullscreen element</a> is null, terminate these steps. </p>
<li>
<p><a data-link-type="dfn" href="#unfullscreen-an-element">Unfullscreen elements</a> whose <a data-link-type="dfn" href="#fullscreen-flag">fullscreen flag</a> is
set, within <var>document</var>’s <a data-link-type="dfn" href="#top-layer">top layer</a>, except for <var>document</var>’s <a data-link-type="dfn" href="#fullscreen-element">fullscreen element</a>. </p>
<li>
<p><a data-link-type="dfn" href="#exit-fullscreen">Exit fullscreen</a> <var>document</var>. </p>
</ol>
<p>Whenever the <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-node-remove-ext">removing steps</a> run with an <var>oldNode</var>, run these steps: </p>
<ol>
<li>
<p>Let <var>nodes</var> be <var>oldNode</var>’s <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-shadow-including-inclusive-descendant">shadow-including inclusive descendants</a> that have their <a data-link-type="dfn" href="#fullscreen-flag">fullscreen flag</a> set, in <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-shadow-including-tree-order">shadow-including tree order</a>. </p>
<li>
<p>For each <var>node</var> in <var>nodes</var>, run these substeps: </p>
<ol>
<li>
<p>If <var>node</var> is its <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-node-document">node document</a>’s <a data-link-type="dfn" href="#fullscreen-element">fullscreen element</a>, <a data-link-type="dfn" href="#exit-fullscreen">exit fullscreen</a> that <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-document">document</a>. </p>
<li>
<p>Otherwise, <a data-link-type="dfn" href="#unfullscreen-an-element">unfullscreen <var>node</var></a> within its <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-node-document">node document</a>. </p>
</ol>
</ol>
<p>Whenever the <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/browsers.html#unloading-document-cleanup-steps">unloading document cleanup steps</a> run with a <var>document</var>, <a data-link-type="dfn" href="#fully-exit-fullscreen">fully exit fullscreen</a> <var>document</var>. </p>
<hr>
<p><dfn data-dfn-type="dfn" data-noexport="" id="fullscreen-is-supported">Fullscreen is supported<a class="self-link" href="#fullscreen-is-supported"></a></dfn> if there is no previously-established user preference,
security risk, or platform limitation. </p>
<p>An algorithm is <dfn data-dfn-type="dfn" data-noexport="" id="allowed-to-request-fullscreen">allowed to request fullscreen<a class="self-link" href="#allowed-to-request-fullscreen"></a></dfn> if one of the following is true: </p>
<ul>
<li>
<p>The algorithm is <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/interaction.html#triggered-by-user-activation">triggered by user activation</a>. </p>
<li>
<p>The algorithm is <a data-link-type="dfn" href="https://w3c.github.io/screen-orientation/#dfn-triggered-by-a-user-generated-orientation-change">triggered by a user generated orientation change</a>. </p>
</ul>
<h2 class="heading settled" data-level="4" id="api"><span class="secno">4. </span><span class="content">API</span><a class="self-link" href="#api"></a></h2>
<pre class="idl highlight def"><span class="kt">partial</span> <span class="kt">interface</span> <a class="nv idl-code" data-link-type="interface" href="https://dom.spec.whatwg.org/#element">Element</a> {
<span class="kt">Promise</span><<span class="kt">void</span>> <a class="nv idl-code" data-link-type="method" href="#dom-element-requestfullscreen">requestFullscreen</a>();
};
<span class="kt">partial</span> <span class="kt">interface</span> <a class="nv idl-code" data-link-type="interface" href="https://dom.spec.whatwg.org/#document">Document</a> {
[<a class="nv idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#LenientSetter">LenientSetter</a>] <span class="kt">readonly</span> <span class="kt">attribute</span> <span class="kt">boolean</span> <a class="nv idl-code" data-link-type="attribute" data-readonly="" data-type="boolean" href="#dom-document-fullscreenenabled">fullscreenEnabled</a>;
[<a class="nv idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#LenientSetter">LenientSetter</a>] <span class="kt">readonly</span> <span class="kt">attribute</span> <span class="kt">boolean</span> <a class="nv idl-code" data-link-type="attribute" data-readonly="" data-type="boolean" href="#dom-document-fullscreen">fullscreen</a>; // historical
<span class="kt">Promise</span><<span class="kt">void</span>> <a class="nv idl-code" data-link-type="method" href="#dom-document-exitfullscreen">exitFullscreen</a>();
<span class="kt">attribute</span> <a class="n" data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler">EventHandler</a> <a class="nv idl-code" data-link-type="attribute" data-type="EventHandler" href="#handler-document-onfullscreenchange">onfullscreenchange</a>;
<span class="kt">attribute</span> <a class="n" data-link-type="idl-name" href="https://html.spec.whatwg.org/multipage/webappapis.html#eventhandler">EventHandler</a> <a class="nv idl-code" data-link-type="attribute" data-type="EventHandler" href="#handler-document-onfullscreenerror">onfullscreenerror</a>;
};
<span class="kt">partial</span> <span class="kt">interface</span> <a class="nv idl-code" data-link-type="interface" href="https://dom.spec.whatwg.org/#documentorshadowroot">DocumentOrShadowRoot</a> {
[<a class="nv idl-code" data-link-type="extended-attribute" href="https://heycam.github.io/webidl/#LenientSetter">LenientSetter</a>] <span class="kt">readonly</span> <span class="kt">attribute</span> <a class="n" data-link-type="idl-name" href="https://dom.spec.whatwg.org/#element">Element</a>? <a class="nv idl-code" data-link-type="attribute" data-readonly="" data-type="Element?" href="#dom-document-fullscreenelement">fullscreenElement</a>;
};
</pre>
<dl class="domintro">
<dt><code><var>promise</var> = <var>element</var> . <code class="idl"><a data-link-type="idl" href="#dom-element-requestfullscreen">requestFullscreen()</a></code></code>
<dd>
<p>Displays <var>element</var> fullscreen and fulfills <var>promise</var> when done. </p>
<dt><code><var>document</var> . <code class="idl"><a data-link-type="idl" href="#dom-document-fullscreenenabled">fullscreenEnabled</a></code></code>
<dd>
<p>Returns true if <var>document</var> has the ability to display <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-element">elements</a> fullscreen
and <a data-link-type="dfn" href="#fullscreen-is-supported">fullscreen is supported</a>, or false otherwise. </p>
<dt><code><var>promise</var> = <var>document</var> . <code class="idl"><a data-link-type="idl" href="#dom-document-exitfullscreen">exitFullscreen()</a></code></code>
<dd>
<p>Stops <var>document</var>’s <a data-link-type="dfn" href="#fullscreen-element">fullscreen element</a> from being displayed fullscreen and
fulfills <var>promise</var> when done. </p>
<dt><code><var>document</var> . <code class="idl"><a data-link-type="idl" href="#dom-document-fullscreenelement">fullscreenElement</a></code></code>
<dd>
<p>Returns <var>document</var>’s <a data-link-type="dfn" href="#fullscreen-element">fullscreen element</a>. </p>
<dt><code><var>shadowroot</var> . <code class="idl"><a data-link-type="idl" href="#dom-document-fullscreenelement">fullscreenElement</a></code></code>
<dd>
<p>Returns <var>shadowroot</var>’s <a data-link-type="dfn" href="#fullscreen-element">fullscreen element</a>. </p>
</dl>
<p>A <dfn data-dfn-type="dfn" data-noexport="" id="fullscreen-element-ready-check">fullscreen element ready check<a class="self-link" href="#fullscreen-element-ready-check"></a></dfn> for an <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-element">element</a> <var>element</var> returns true
if all of the following are true, and false otherwise: </p>
<ul>
<li>
<p><var>element</var> is <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#connected">connected</a>. </p>
<li>
<p><var>element</var>’s <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-node-document">node document</a> is <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/embedded-content.html#allowed-to-use">allowed to use</a> the feature indicated by
attribute name <code>allowfullscreen</code>. </p>
<li>
<p><var>element</var>’s <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-node-document">node document</a>’s <a data-link-type="dfn">hidden</a> attribute returns false. </p>
</ul>
<p>The <dfn class="idl-code" data-dfn-for="Element" data-dfn-type="method" data-export="" id="dom-element-requestfullscreen"><code>requestFullscreen()</code><a class="self-link" href="#dom-element-requestfullscreen"></a></dfn> method, when invoked, must run
these steps: </p>
<ol>
<li>
<p>Let <var>pending</var> be the <a data-link-type="dfn" href="#context-object">context object</a>. </p>
<li>
<p>Let <var>error</var> be false. </p>
<li>
<p>Let <var>promise</var> be a new promise. </p>
<li>
<p>If any of the following conditions are false, then set <var>error</var> to true: </p>
<ul>
<li>
<p><var>pending</var>’s <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-element-namespace">namespace</a> is the <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#html-namespace">HTML namespace</a> or <var>pending</var> is an <a href="https://www.w3.org/TR/SVG11/struct.html#SVGElement">SVG <code>svg</code></a> or <a href="https://www.w3.org/Math/draft-spec/chapter2.html#interf.toplevel">MathML <code>math</code></a> element. <a data-link-type="biblio" href="#biblio-svg">[SVG]</a> <a data-link-type="biblio" href="#biblio-mathml">[MATHML]</a> </p>
<li>
<p>The <a data-link-type="dfn" href="#fullscreen-element-ready-check">fullscreen element ready check</a> for <var>pending</var> returns true. </p>
<li>
<p><a data-link-type="dfn" href="#fullscreen-is-supported">Fullscreen is supported</a>. </p>
<li>
<p>This algorithm is <a data-link-type="dfn" href="#allowed-to-request-fullscreen">allowed to request fullscreen</a>. </p>
</ul>
<li>
<p>Return <var>promise</var>, and run the remaining steps <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel">in parallel</a>. </p>
<li>
<p>If <var>error</var> is false: Resize <var>pending</var>’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/browsers.html#top-level-browsing-context">top-level browsing context</a>’s <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-document">document</a>’s viewport’s dimensions to match the dimensions
of the screen of the output device. Optionally display a message how the end user can revert this. </p>
<li>
<p>As part of the next <a data-link-type="dfn" href="#animation-frame-task">animation frame task</a>, run these substeps: </p>
<ol>
<li>
<p>If either <var>error</var> is true or the <a data-link-type="dfn" href="#fullscreen-element-ready-check">fullscreen element ready check</a> for <var>pending</var> returns false, <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <code>fullscreenerror</code> on <var>pending</var>’s <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-node-document">node document</a>, reject <var>promise</var> with a <code>TypeError</code> exception, and terminate these steps. </p>
<li>
<p>Let <var>fullscreenElements</var> be an ordered set initially consisting of <var>pending</var>. </p>
<li>
<p>While the first element in <var>fullscreenElements</var> is in a <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/browsers.html#nested-browsing-context">nested browsing context</a>, prepend its <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/browsers.html#browsing-context-container">browsing context container</a> to <var>fullscreenElements</var>. </p>
<li>
<p>Let <var>eventDocs</var> be an empty list. </p>
<li>
<p>For each <var>element</var> in <var>fullscreenElements</var>, in order, run these
subsubsteps: </p>
<ol>
<li>
<p>Let <var>doc</var> be <var>element</var>’s <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-node-document">node document</a>. </p>
<li>
<p>If <var>element</var> is <var>doc</var>’s <a data-link-type="dfn" href="#fullscreen-element">fullscreen element</a>, terminate these
subsubsteps. </p>
<p class="note" role="note">No need to notify observers when nothing has changed. </p>
<li>
<p>Otherwise, append <var>doc</var> to <var>eventDocs</var>. </p>
<li>
<p>If <var>element</var> is <var>pending</var> and <var>pending</var> is an <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/embedded-content.html#the-iframe-element">iframe</a></code> <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-element">element</a>, then set <var>element</var>’s <a data-link-type="dfn" href="#iframe-fullscreen-flag">iframe fullscreen flag</a>. </p>
<li>
<p><a data-link-type="dfn" href="#fullscreen-an-element">Fullscreen <var>element</var></a> within <var>doc</var>. </p>
</ol>
<li>
<p>For each <var>doc</var> in <var>eventDocs</var>, in order, <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <code>fullscreenchange</code> on <var>doc</var>. </p>
<li>
<p>Fulfill <var>promise</var> with undefined. </p>
</ol>
<p class="XXX"><dfn data-dfn-type="dfn" data-noexport="" id="animation-frame-task">Animation frame task<a class="self-link" href="#animation-frame-task"></a></dfn> is not really defined yet, including relative order
within that task, see <a href="https://www.w3.org/Bugs/Public/show_bug.cgi?id=26440">bug 26440</a>. </p>
<p class="note" role="note">Implementations with out-of-process <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/browsers.html#browsing-context">browsing contexts</a> are left as an exercise
to the reader. Input welcome on potential improvements. </p>
</ol>
<p>The <dfn class="idl-code" data-dfn-for="Document" data-dfn-type="attribute" data-export="" id="dom-document-fullscreenenabled"><code>fullscreenEnabled</code><a class="self-link" href="#dom-document-fullscreenenabled"></a></dfn> attribute’s getter must
return true if the <a data-link-type="dfn" href="#context-object">context object</a> is <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/embedded-content.html#allowed-to-use">allowed to use</a> the feature indicated by attribute
name <code>allowfullscreen</code> and <a data-link-type="dfn" href="#fullscreen-is-supported">fullscreen is supported</a>, and false otherwise. </p>
<p>The <dfn class="idl-code" data-dfn-for="Document" data-dfn-type="attribute" data-export="" id="dom-document-fullscreen"><code>fullscreen</code><a class="self-link" href="#dom-document-fullscreen"></a></dfn> attribute’s getter must return
false if <a data-link-type="dfn" href="#context-object">context object</a>’s <a data-link-type="dfn" href="#fullscreen-element">fullscreen element</a> is null, and true otherwise. </p>
<p class="note" role="note">Use the <code class="idl"><a data-link-type="idl" href="#dom-document-fullscreenelement">fullscreenElement</a></code> attribute instead. </p>
<p>The <dfn class="idl-code" data-dfn-for="DocumentOrShadowRoot" data-dfn-type="attribute" data-export="" id="dom-document-fullscreenelement"><code>fullscreenElement</code><a class="self-link" href="#dom-document-fullscreenelement"></a></dfn> attribute’s getter must run these steps: </p>
<ol>
<li>
<p>If the <a data-link-type="dfn" href="#context-object">context object</a> is a <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-shadow-root">shadow root</a> and its <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-documentfragment-host">host</a> is not <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#connected">connected</a>, then return null.</p>
<li>
<p>Let <var>candidate</var> be the result of <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#retarget">retargeting</a> <a data-link-type="dfn" href="#fullscreen-element">fullscreen element</a> against the <a data-link-type="dfn" href="#context-object">context object</a>. </p>
<li>
<p>If <var>candidate</var> and the <a data-link-type="dfn" href="#context-object">context object</a> are in the same <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-tree">tree</a>, then
return <var>candidate</var>. </p>
<li>
<p>Return null. </p>
</ol>
<p>To <dfn data-dfn-type="dfn" data-noexport="" id="collect-documents-to-unfullscreen">collect documents to unfullscreen<a class="self-link" href="#collect-documents-to-unfullscreen"></a></dfn> given <var>doc</var>, run these steps: </p>
<ol>
<li>
<p>If <var>doc</var>’s <a data-link-type="dfn" href="#top-layer">top layer</a> consists of more than a single <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-element">element</a> that has
its <a data-link-type="dfn" href="#fullscreen-flag">fullscreen flag</a> set, return the empty set. </p>
<li>
<p>Let <var>docs</var> be an ordered set consisting of <var>doc</var>. </p>
<li>
<p>While <var>docs</var>’s last <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-document">document</a> has a <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/browsers.html#browsing-context-container">browsing context container</a> whose <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-node-document">node document</a>’s <a data-link-type="dfn" href="#top-layer">top layer</a> consists of a single <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-element">element</a> that has its <a data-link-type="dfn" href="#fullscreen-flag">fullscreen flag</a> set and does not have its <a data-link-type="dfn" href="#iframe-fullscreen-flag">iframe fullscreen flag</a> set (if any), append
that <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-node-document">node document</a> to <var>docs</var>. </p>
<li>
<p>Return <var>docs</var>. </p>
</ol>
<p>To <dfn data-dfn-type="dfn" data-noexport="" id="exit-fullscreen">exit fullscreen<a class="self-link" href="#exit-fullscreen"></a></dfn> a <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-document">document</a> <var>doc</var>, run these steps: </p>
<ol>
<li>
<p>Let <var>promise</var> be a new promise. </p>
<li>
<p>If <var>doc</var>’s <a data-link-type="dfn" href="#fullscreen-element">fullscreen element</a> is null, reject <var>promise</var> with a <code>TypeError</code> exception, and return <var>promise</var>. </p>
<li>
<p>Let <var>resize</var> be false. </p>
<li>
<p>Let <var>docs</var> be the result of <a data-link-type="dfn" href="#collect-documents-to-unfullscreen">collecting documents to unfullscreen</a> given <var>doc</var>. </p>
<li>
<p>Let <var>topLevelDoc</var> be <var>doc</var>’s <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/browsers.html#top-level-browsing-context">top-level browsing context</a>’s <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-document">document</a>. </p>
<li>
<p>If <var>topLevelDoc</var> is in <var>docs</var>, then set <var>resize</var> to true. </p>
<li>
<p>Return <var>promise</var>, and run the remaining steps <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/infrastructure.html#in-parallel">in parallel</a>. </p>
<li>
<p>If <var>resize</var> is true, resize <var>topLevelDoc</var>’s viewport to its "normal"
dimensions. </p>
<li>
<p>As part of the next <a data-link-type="dfn" href="#animation-frame-task">animation frame task</a>, run these substeps: </p>
<ol>
<li>
<p>Let <var>exitDocs</var> be the result of <a data-link-type="dfn" href="#collect-documents-to-unfullscreen">collecting documents to unfullscreen</a> given <var>doc</var>. </p>
<li>
<p>If <var>resize</var> is true and <var>topLevelDoc</var> is not in <var>exitDocs</var>, <a data-link-type="dfn" href="#fully-exit-fullscreen">fully exit fullscreen</a> <var>topLevelDoc</var>, reject <var>promise</var> with a <code>TypeError</code> exception, and terminate these steps. </p>
<li>
<p>If <var>exitDocs</var> is the empty set, append <var>doc</var> to <var>exitDocs</var>. </p>
<li>
<p>If <var>exitDocs</var>’s last <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-document">document</a> has a <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/browsers.html#browsing-context-container">browsing context container</a>,
append that <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/browsers.html#browsing-context-container">browsing context container</a>’s <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-node-document">node document</a> to <var>exitDocs</var>. </p>
<li>
<p>Let <var>descendantDocs</var> be an ordered set consisting of <var>doc</var>’s <a data-link-type="dfn" href="#descendant-browsing-context">descendant browsing contexts</a>' <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-document">documents</a> whose <a data-link-type="dfn" href="#fullscreen-element">fullscreen element</a> is
non-null, if any, in <em>reverse</em> <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-tree-order">tree order</a>. </p>
<li>
<p>For each <var>descendantDoc</var> in <var>descendantDocs</var>, in order, <a data-link-type="dfn" href="#unfullscreen-a-document">unfullscreen <var>descendantDoc</var></a>. </p>
<li>
<p>For each <var>exitDoc</var> in <var>exitDocs</var>, in order, <a data-link-type="dfn" href="#unfullscreen-an-element">unfullscreen</a> <var>exitDoc</var>’s <a data-link-type="dfn" href="#fullscreen-element">fullscreen element</a>. </p>
<li>
<p>For each <var>descendantDoc</var> in <var>descendantDocs</var>, in order, <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <code>fullscreenchange</code> on <var>descendantDoc</var>. </p>
<li>
<p>For each <var>exitDoc</var> in <var>exitDocs</var>, in order, <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-event-fire">fire an event</a> named <code>fullscreenchange</code> on <var>exitDoc</var>. </p>
<li>
<p>Fulfill <var>promise</var> with undefined. </p>
</ol>
<p class="note" role="note">This results in events being fired from the innermost to the outermost document. </p>
</ol>
<p>The <dfn class="idl-code" data-dfn-for="Document" data-dfn-type="method" data-export="" id="dom-document-exitfullscreen"><code>exitFullscreen()</code><a class="self-link" href="#dom-document-exitfullscreen"></a></dfn> method, when invoked, must
return the result of running <a data-link-type="dfn" href="#exit-fullscreen">exit fullscreen</a> on the <a data-link-type="dfn" href="#context-object">context object</a>. </p>
<hr>
<p>The following are the <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handlers">event handlers</a> (and their corresponding <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-event-type">event handler event types</a>) that must be supported on <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-document">documents</a> as attributes: </p>
<table>
<thead>
<tr>
<th><a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handlers">event handler</a>
<th><a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/webappapis.html#event-handler-event-type">event handler event type</a>
<tbody>
<tr>
<td><dfn class="idl-code" data-dfn-for="Document" data-dfn-type="attribute" data-export="" id="handler-document-onfullscreenchange"><code>onfullscreenchange</code><a class="self-link" href="#handler-document-onfullscreenchange"></a></dfn>
<td><code>fullscreenchange</code>
<tr>
<td><dfn class="idl-code" data-dfn-for="Document" data-dfn-type="attribute" data-export="" id="handler-document-onfullscreenerror"><code>onfullscreenerror</code><a class="self-link" href="#handler-document-onfullscreenerror"></a></dfn>
<td><code>fullscreenerror</code>
</table>
<h2 class="heading settled" data-level="5" id="ui"><span class="secno">5. </span><span class="content">UI</span><a class="self-link" href="#ui"></a></h2>
<p>User agents are encouraged to implement native media fullscreen controls in terms of <code class="idl"><a data-link-type="idl" href="#dom-element-requestfullscreen">requestFullscreen()</a></code> and <code class="idl"><a data-link-type="idl" href="#dom-document-exitfullscreen">exitFullscreen()</a></code>. </p>
<p>If the end user instructs the user agent to end a fullscreen session initiated via <code class="idl"><a data-link-type="idl" href="#dom-element-requestfullscreen">requestFullscreen()</a></code>, <a data-link-type="dfn" href="#fully-exit-fullscreen">fully exit fullscreen</a> the <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/browsers.html#top-level-browsing-context">top-level browsing context</a>’s <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-document">document</a>. </p>
<h2 class="heading settled" data-level="6" id="rendering"><span class="secno">6. </span><span class="content">Rendering</span><a class="self-link" href="#rendering"></a></h2>
<p>This section is to be interpreted equivalently to the Rendering section of HTML. <a data-link-type="biblio" href="#biblio-html">[HTML]</a> </p>
<p class="XXX">Long term CSS will define the <a data-link-type="dfn" href="#top-layer">top layer</a> concept and its associated <a class="css" data-link-type="selector" href="#css-pe-backdrop"><code>::backdrop</code></a> pseudo-element as part of CSS' stacking context model. Patching CSS
as done here is sketchy as hell. </p>
<h3 class="heading settled" data-level="6.1" id="new-stacking-layer"><span class="secno">6.1. </span><span class="content">New stacking layer</span><a class="self-link" href="#new-stacking-layer"></a></h3>
<p>This specification introduces a new stacking layer to the <a href="http://www.w3.org/TR/CSS21/zindex.html">Elaborate description of Stacking Contexts</a> of CSS
2.1. It is called the <dfn data-dfn-type="dfn" data-export="" id="top-layer">top layer<a class="self-link" href="#top-layer"></a></dfn>, comes after step 10 in the painting order, and is
therefore rendered closest to the user within a viewport. Each <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-document">document</a> has one associated
viewport and therefore also one <a data-link-type="dfn" href="#top-layer">top layer</a>. <a data-link-type="biblio" href="#biblio-css">[CSS]</a> </p>
<p class="note" role="note">The terminology used in this and following subsection attempts to match CSS 2.1
Appendix E. </p>
<p>The <a data-link-type="dfn" href="#top-layer">top layer</a> consists of an ordered set of elements, rendered in the order they have been
added to the set. The last element added is rendered closest to the user. </p>
<p class="note" role="note">The <code>z-index</code> property has no effect in the <a data-link-type="dfn" href="#top-layer">top layer</a>. </p>
<p>Each element and <a class="css" data-link-type="selector" href="#css-pe-backdrop"><code>::backdrop</code></a> pseudo-element in a <a data-link-type="dfn" href="#top-layer">top layer</a> has the
following characteristics: </p>
<ul>
<li>
<p>It generates a new stacking context. </p>
<li>
<p>Its parent stacking context is the root stacking context. </p>
<li>
<p>If it consists of multiple layout boxes, the first box is used. </p>
<li>
<p>It is rendered as an atomic unit as if it were a sibling of its <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-tree-root">root</a>. </p>
<p class="note" role="note"><a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-tree-ancestor">Ancestor</a> elements with overflow, opacity, masks, etc. cannot affect
it. </p>
<li>
<p>If its <code>position</code> property computes to <code>fixed</code>, its containing block
is the viewport, and the initial containing block otherwise. </p>
<li>
<p>If it is an element, it and its <a class="css" data-link-type="selector" href="#css-pe-backdrop"><code>::backdrop</code></a> pseudo-element are not
rendered if its <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-shadow-including-inclusive-ancestor">shadow-including inclusive ancestor</a> has the <code>display</code> property
set to <code>none</code>. </p>
<li>
<p>If its specified <code>display</code> property is <code>contents</code>, it computes to <code>block</code>. </p>
<li>
<p>If its specified <code>position</code> property is not <code>absolute</code> or <code>fixed</code>, it computes to <code>absolute</code>. </p>
<li>
<p>Its outline, if any, is to be rendered before step 10 in the painting order. </p>
<li>
<p>Unless overridden by another specification, its static position for <code>left</code>, <code>right</code>, and <code>top</code> is zero. </p>
</ul>
<p>To <dfn data-dfn-for="top layer" data-dfn-type="dfn" data-export="" id="top-layer-add">add<a class="self-link" href="#top-layer-add"></a></dfn> an <var>element</var> to a <var>top layer</var>, add, or
move if already present, <var>element</var> on top of <var>top layer</var>. </p>
<p>To <dfn data-dfn-for="top layer" data-dfn-type="dfn" data-export="" id="top-layer-remove">remove<a class="self-link" href="#top-layer-remove"></a></dfn> an <var>element</var> from a <var>top layer</var>,
remove <var>element</var> from <var>top layer</var>. </p>
<h3 class="heading settled" data-level="6.2" id="::backdrop-pseudo-element"><span class="secno">6.2. </span><span class="content"><code>::backdrop</code> pseudo-element</span><a class="self-link" href="#%3A%3Abackdrop-pseudo-element"></a></h3>
<p>Each element in a <a data-link-type="dfn" href="#top-layer">top layer</a> has a <dfn class="css" data-dfn-type="selector" data-export="" id="css-pe-backdrop"><code>::backdrop</code><a class="self-link" href="#css-pe-backdrop"></a></dfn> pseudo-element. This pseudo-element is a box rendered immediately below the element (and above the
element before the element in the set, if any), within the same <a data-link-type="dfn" href="#top-layer">top layer</a>. </p>
<p class="note" role="note">The <a class="css" data-link-type="selector" href="#css-pe-backdrop"><code>::backdrop</code></a> pseudo-element can be used to create a backdrop
that hides the underlying document for an element in a <a data-link-type="dfn" href="#top-layer">top layer</a> (such as an element that is
displayed fullscreen). </p>
<p>It does not inherit from any element and is not inherited from. No restrictions are made on what
properties apply to this pseudo-element either. </p>
<h3 class="heading settled" data-level="6.3" id=":fullscreen-pseudo-class"><span class="secno">6.3. </span><span class="content"><code>:fullscreen</code> pseudo-class</span><a class="self-link" href="#%3Afullscreen-pseudo-class"></a></h3>
<p>The <dfn class="css" data-dfn-type="selector" data-export="" id="css-pc-fullscreen"><code>:fullscreen</code><a class="self-link" href="#css-pc-fullscreen"></a></dfn> pseudo-class must match any <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-element">element</a> <var>element</var> for which one of the following conditions is true: </p>
<ul>
<li>
<p><var>element</var>’s <a data-link-type="dfn" href="#fullscreen-flag">fullscreen flag</a> is set. </p>
<li>
<p><var>element</var> is a <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#element-shadow-host">shadow host</a> and the result of <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#retarget">retargeting</a> its <a data-link-type="dfn" href="https://dom.spec.whatwg.org/#concept-node-document">node document</a>’s <a data-link-type="dfn" href="#fullscreen-element">fullscreen element</a> against <var>element</var> is <var>element</var>. </p>
</ul>
<p class="note no-backref" role="note">This makes it different from the <code class="idl"><a data-link-type="idl" href="#dom-document-fullscreenelement">fullscreenElement</a></code> API, which returns the topmost <a data-link-type="dfn" href="#fullscreen-element">fullscreen element</a>. </p>
<h3 class="heading settled" data-level="6.4" id="user-agent-level-style-sheet-defaults"><span class="secno">6.4. </span><span class="content">User-agent level style sheet defaults</span><a class="self-link" href="#user-agent-level-style-sheet-defaults"></a></h3>
<pre class="css">@namespace "http://www.w3.org/1999/xhtml";
*|*:not(:root):fullscreen {
position:fixed !important;
top:0 !important; right:0 !important; bottom:0 !important; left:0 !important;
margin:0 !important;
box-sizing:border-box !important;
min-width:0 !important;
max-width:none !important;
min-height:0 !important;
max-height:none !important;
width:100% !important;
height:100% !important;
transform:none !important;
/* intentionally not !important */
object-fit:contain;
}
iframe:fullscreen {
border:none !important;
padding:0 !important;
}
::backdrop {
position:fixed;
top:0; right:0; bottom:0; left:0;
}
*|*:not(:root):fullscreen::backdrop {
background:black;
}
</pre>
<h2 class="heading settled" data-level="7" id="security-and-privacy-considerations"><span class="secno">7. </span><span class="content">Security and Privacy Considerations</span><a class="self-link" href="#security-and-privacy-considerations"></a></h2>
<p>User agents should ensure, e.g. by means of an overlay, that the end user is aware something is
displayed fullscreen. User agents should provide a means of exiting fullscreen that always works and
advertise this to the user. This is to prevent a site from spoofing the end user by recreating the
user agent or even operating system environment when fullscreen. See also the definition of <code class="idl"><a data-link-type="idl" href="#dom-element-requestfullscreen">requestFullscreen()</a></code>. </p>
<p>To enable content in a <a data-link-type="dfn" href="https://html.spec.whatwg.org/multipage/browsers.html#nested-browsing-context">nested browsing context</a> to go fullscreen, it needs to be
specifically allowed via the <code>allowfullscreen</code> attribute of the HTML <code><a data-link-type="element" href="https://html.spec.whatwg.org/multipage/embedded-content.html#the-iframe-element">iframe</a></code> element.
This prevents e.g. content from third parties to go fullscreen without explicit permission. </p>
<div data-fill-with="references">
<h2 class="no-num no-ref heading settled" id="references"><span class="content">References</span><a class="self-link" href="#references"></a></h2>
<h3 class="no-num no-ref heading settled" id="normative"><span class="content">Normative References</span><a class="self-link" href="#normative"></a></h3>
<dl>
<dt id="biblio-css">[CSS]
<dd>Bert Bos; et al. <a href="https://www.w3.org/TR/CSS2">Cascading Style Sheets Level 2 Revision 1 (CSS 2.1) Specification</a>. 7 June 2011. REC. URL: <a href="https://www.w3.org/TR/CSS2">https://www.w3.org/TR/CSS2</a>
<dt id="biblio-dom">[DOM]
<dd>Anne van Kesteren. <a href="https://dom.spec.whatwg.org/">DOM Standard</a>. Living Standard. URL: <a href="https://dom.spec.whatwg.org/">https://dom.spec.whatwg.org/</a>
<dt id="biblio-html">[HTML]
<dd>Ian Hickson. <a href="https://html.spec.whatwg.org/multipage/">HTML Standard</a>. Living Standard. URL: <a href="https://html.spec.whatwg.org/multipage/">https://html.spec.whatwg.org/multipage/</a>
<dt id="biblio-mathml">[MATHML]
<dd>Patrick D F Ion; Robert R Miner. <a href="https://www.w3.org/TR/MathML/">Mathematical Markup Language (MathML) 1.01 Specification</a>. 7 July 1999. REC. URL: <a href="https://www.w3.org/TR/MathML/">https://www.w3.org/TR/MathML/</a>
<dt id="biblio-rfc2119">[RFC2119]
<dd>S. Bradner. <a href="https://tools.ietf.org/html/rfc2119">Key words for use in RFCs to Indicate Requirement Levels</a>. March 1997. Best Current Practice. URL: <a href="https://tools.ietf.org/html/rfc2119">https://tools.ietf.org/html/rfc2119</a>
<dt id="biblio-svg">[SVG]
<dd>Jon Ferraiolo. <a href="https://www.w3.org/TR/SVG/">Scalable Vector Graphics (SVG) 1.0 Specification</a>. 4 September 2001. REC. URL: <a href="https://www.w3.org/TR/SVG/">https://www.w3.org/TR/SVG/</a>
<dt id="biblio-webidl">[WEBIDL]
<dd>Cameron McCormack; Boris Zbarsky. <a href="https://heycam.github.io/webidl/">WebIDL Level 1</a>. 15 September 2016. PR. URL: <a href="https://heycam.github.io/webidl/">https://heycam.github.io/webidl/</a>
</dl>
</div>
<h2 class="no-num heading settled" id="acknowledgments"><span class="content">Acknowledgments</span><a class="self-link" href="#acknowledgments"></a></h2>
<p>Many thanks to Robert O’Callahan for designing the initial model and being awesome. </p>
<p>Thanks to
Andy Earnshaw,
Chris Pearce,
Darin Fisher, <i>fantasai</i>,
Giuseppe Pascale,
Glenn Maynard,
Ian Hickson,
Ignacio Solla,
João Eiras,
Josh Soref,
Matt Falkenhagen,
Mihai Balan,
Mounir Lamouri,
Øyvind Stenhaug,
Pat Ladd,
Philip Jägenstedt,
Rafał Chłodnicki,
Riff Jiang,
Rune Lillesveen,
Sigbjørn Vik,
Simon Pieters,
Tab Atkins,
Takayoshi Kochi,
Theresa O’Connor,
Vincent Scheib, and
Xidorn Quan
for also being awesome. </p>
<p>This standard is written by <a href="https://annevankesteren.nl/" lang="nl">Anne van Kesteren</a> (<a href="https://www.mozilla.org/">Mozilla</a>, <a href="mailto:[email protected]">[email protected]</a>). <a href="http://tantek.com/" lang="tr">Tantek Çelik</a> (<a class="p-org org h-org h-card" href="https://www.mozilla.org/">Mozilla</a>, <a href="mailto:[email protected]">[email protected]</a>) sorted out legal hassles. </p>
<p>Per <a href="https://creativecommons.org/publicdomain/zero/1.0/" rel="license">CC0</a>, to the extent
possible under law, the editor has waived all copyright and related or neighboring rights to this
work. </p>
</main>