If error is false: Resize pendingDoc’s top-level browsing context’s active document’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.

The user agent may end any fullscreen session without instruction from the end user
or call to exitFullscreen() whenever the user agent deems it necessary.

5. Rendering

This section is to be interpreted equivalently to the Rendering section of HTML. [HTML]

Long term CSS will define the top layer concept and its associated ::backdrop pseudo-element as part of CSS' stacking context model. Patching CSS
as done here is sketchy as hell.

5.1. New stacking layer

This specification introduces a new stacking layer to the Elaborate description of Stacking Contexts of CSS
2.1. It is called the top layer, comes after step 10 in the painting order, and is
therefore rendered closest to the user within a viewport. Each document has one
associated viewport and therefore also one top layer. [CSS]

The terminology used in this and following subsection attempts to match CSS 2.1
Appendix E.

The top layer is an ordered set of elements, rendered in the order they appear in
the set. The last element in the set is rendered last, and thus appears on top.

If its specified position property is not absolute or fixed, it computes to absolute.

Its outline, if any, is to be rendered before step 10 in the painting order.

Unless overridden by another specification, its static position for left, right, and top is zero.

To add an element to a top layer, remove it from top layer and then append it to top layer.

In other words, element is moved to the end of top layer if it
is already present.

5.2. ::backdrop pseudo-element

Each element in a top layer has a ::backdrop 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 top layer.

The ::backdrop pseudo-element can be used to create a backdrop
that hides the underlying document for an element in a top layer (such as an element that is
displayed fullscreen).

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.

5.3. :fullscreen pseudo-class

The :fullscreen pseudo-class must match any elementelement for which one of the following conditions is true:

6. Security and Privacy Considerations

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 requestFullscreen().

To enable content in a nested browsing context to go fullscreen, it needs to be
specifically allowed via the allowfullscreen attribute of the HTML iframe element.
This prevents e.g. content from third parties to go fullscreen without explicit permission.