diff --git a/fullscreen.bs b/fullscreen.bs index ba608ed..d2e4646 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -78,25 +78,27 @@ unset.

All <{iframe}> elements have an associated iframe fullscreen flag. Unless stated otherwise it is unset. -

All documents have an associated fullscreen element. The -fullscreen element is the topmost element in the document's top layer -whose fullscreen flag is set, if any, and null otherwise. +

All document trees have an associated fullscreen element. The +fullscreen element is the topmost element in the document tree's +top layer whose fullscreen flag is set, if any, and null otherwise. -

To fullscreen an element within a document, set the -element's fullscreen flag and add it to document's -top layer. +

To fullscreen an element within a document tree whose root is +document, set the element's fullscreen flag and add it to +document's top layer. -

To unfullscreen an element within a document, unset the -element's fullscreen flag and iframe fullscreen flag (if any), and -remove it from document's top layer. +

To unfullscreen an element within a document tree whose root is +document, unset the element's fullscreen flag and +iframe fullscreen flag (if any), and remove it from document's +top layer. -

To unfullscreen a document, +

To unfullscreen a document tree whose root is document, unfullscreen all elements, within document's top layer, whose fullscreen flag is set.


-

To fully exit fullscreen a document document, run these steps: +

To fully exit fullscreen a document tree whose root is document, +run these steps:

  1. If document's fullscreen element is null, terminate these steps. @@ -111,15 +113,15 @@ whose fullscreen flag is set, if any, and null otherwise.

    Whenever the removing steps run with an oldNode, run these steps:

      -
    1. Let nodes be oldNode's inclusive descendants that have their - fullscreen flag set, in tree order. +

    2. Let nodes be oldNode's shadow-including inclusive descendants + that have their fullscreen flag set, in shadow-including tree order.

    3. For each node in nodes, run these substeps:

      1. If node is its node document's fullscreen element, - exit fullscreen that document. + exit fullscreen that document tree.

      2. Otherwise, unfullscreen node within its node document. @@ -154,7 +156,6 @@ partial interface Element { partial interface Document { [LenientSetter] readonly attribute boolean fullscreenEnabled; - [LenientSetter] readonly attribute Element? fullscreenElement; [LenientSetter] readonly attribute boolean fullscreen; // historical Promise<void> exitFullscreen(); @@ -162,6 +163,10 @@ partial interface Document { attribute EventHandler onfullscreenchange; attribute EventHandler onfullscreenerror; }; + +partial interface DocumentOrShadowRoot { + [LenientSetter] readonly attribute Element? fullscreenElement; +};

        @@ -172,12 +177,17 @@ partial interface Document {

        Returns true if document has the ability to display elements fullscreen and fullscreen is supported, or false otherwise. -

        document . {{Document/fullscreenElement}} -

        Returns document's fullscreen element. -

        promise = document . {{Document/exitFullscreen()}}

        Stops document's fullscreen element from being displayed fullscreen and fulfills promise when done. + +

        document . {{DocumentOrShadowRoot/fullscreenElement}} +

        Returns the result of retargeting document's fullscreen element against + document. + +

        shadowroot . {{DocumentOrShadowRoot/fullscreenElement}} +

        Returns the result of retargeting document's fullscreen element against + shadowroot if the result is in the same tree as shadowroot.

        A fullscreen element ready check for an element element returns true @@ -191,7 +201,7 @@ if all of the following are true, and false otherwise: MathML math element. [[!SVG]] [[!MATHML]] -

      3. element is in a document. +

      4. element is in a document tree.

      5. element's node document is allowed to use the feature indicated by attribute name allowfullscreen. @@ -289,14 +299,17 @@ these steps: return true if the context object is allowed to use the feature indicated by attribute name allowfullscreen and fullscreen is supported, and false otherwise. -

        The fullscreenElement attribute's getter must -return context object's fullscreen element. -

        The fullscreen attribute's getter must return false if context object's fullscreen element is null, and true otherwise.

        Use -document.fullscreenElement instead. +document.fullscreenElement +instead. + +

        The fullscreenElement attribute's +getter must return the result of retargeting context object's +shadow-including root's fullscreen element against context object if the +result and the context object are in the same tree, otherwise return null.

        To collect documents to unfullscreen given doc, run these steps: @@ -314,7 +327,7 @@ false if context object's fullscreen element is null, and true oth

      6. Return docs.

      -

      To exit fullscreen a document doc, run these steps: +

      To exit fullscreen a document tree doc, run these steps:

      1. Let promise be a new promise. @@ -366,7 +379,7 @@ false if context object's fullscreen element is null, and true oth

      2. For each descendantDoc in descendantDocs, in order, - unfullscreen descendantDoc. + unfullscreen descendantDoc.

      3. For each exitDoc in exitDocs, in order, @@ -467,8 +480,8 @@ following characteristics: is the viewport, and the initial containing block otherwise.

      4. If it is an element, it and its ::backdrop pseudo-element are not - rendered if its inclusive ancestor has the display property set to - none. + rendered if its shadow-including inclusive ancestor has the display property + set to none.

      5. If its specified display property is contents, it computes to block. @@ -512,7 +525,8 @@ properties apply to this pseudo-element either.

        The :fullscreen pseudo-class must match any element that has its fullscreen flag set. -

        This makes it different from the {{Document/fullscreenElement}} API, +

        This makes it different from the +{{DocumentOrShadowRoot/fullscreenElement}} API, which returns a document's fullscreen element.