From 2376fedc49132731b7f99f266271ba5598b66e7a Mon Sep 17 00:00:00 2001 From: Takayoshi Kochi Date: Tue, 20 Sep 2016 10:24:38 +0100 Subject: [PATCH] Update fullscreen spec to be Shadow DOM compliant Spec discussion at https://github.com/w3c/webcomponents/issues/180. The rough consensus was: https://github.com/w3c/webcomponents/issues/180#issuecomment-224244250 This resolves #42 --- fullscreen.bs | 46 ++++++++++++++++++++++++++++++++-------------- fullscreen.html | 37 ++++++++++++++++++++++++------------- 2 files changed, 56 insertions(+), 27 deletions(-) diff --git a/fullscreen.bs b/fullscreen.bs index 70c585f..3169492 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -110,8 +110,8 @@ and add it to its node document's top layer.

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: @@ -153,7 +153,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(); @@ -161,6 +160,10 @@ partial interface Document { attribute EventHandler onfullscreenchange; attribute EventHandler onfullscreenerror; }; + +partial interface DocumentOrShadowRoot { + [LenientSetter] readonly attribute Element? fullscreenElement; +};

    @@ -171,12 +174,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 @@ -190,7 +198,7 @@ if all of the following are true, and false otherwise: MathML math element. [[!SVG]] [[!MATHML]] -

  4. element is in a document. +

  5. element is connected.

  6. element's node document is allowed to use the feature indicated by attribute name allowfullscreen. @@ -283,14 +291,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 the 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: @@ -461,8 +472,8 @@ following characteristics: is the viewport, and the initial containing block otherwise.

  7. 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.

  8. If its specified display property is contents, it computes to block. @@ -505,9 +516,16 @@ 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. +For each node tree, if the result of retargeting its shadow-including root's +fullscreen element against the root of the node tree is not null and +the result is in the same tree, :fullscreen pseudo-class must match the result. + +

    In other words, :fullscreen matches all the non-null results of +{{DocumentOrShadowRoot/fullscreenElement}} API for each node tree.

    User-agent level style sheet defaults

    diff --git a/fullscreen.html b/fullscreen.html index 1a16222..298b1c0 100644 --- a/fullscreen.html +++ b/fullscreen.html @@ -71,7 +71,7 @@

    Fullscreen API

    -

    Living Standard — Last Updated

    +

    Living Standard — Last Updated

    @@ -152,7 +152,7 @@

    3. 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.

      +

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

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

        @@ -180,7 +180,6 @@

        4. partial interface Document { [LenientSetter] readonly attribute boolean fullscreenEnabled; - [LenientSetter] readonly attribute Element? fullscreenElement; [LenientSetter] readonly attribute boolean fullscreen; // historical Promise<void> exitFullscreen(); @@ -188,6 +187,10 @@

        4. attribute EventHandler onfullscreenchange; attribute EventHandler onfullscreenerror; }; + +partial interface DocumentOrShadowRoot { + [LenientSetter] readonly attribute Element? fullscreenElement; +};
        promise = element . requestFullscreen() @@ -197,13 +200,16 @@

        4.

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

        -
        document . fullscreenElement -
        -

        Returns document’s fullscreen element.

        promise = document . exitFullscreen()

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

        +
        document . fullscreenElement +
        +

        Returns the result of retargeting document’s fullscreen element against document.

        +
        shadowroot . 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 if all of the following are true, and false otherwise:

        @@ -211,7 +217,7 @@

        4.

        element’s namespace is the HTML namespace or element is an SVG svg or MathML math element. [SVG] [MATHML]

      1. -

        element is in a document.

        +

        element is connected.

      2. element’s node document is allowed to use the feature indicated by attribute name allowfullscreen.

        @@ -281,11 +287,12 @@

        4. The fullscreenEnabled attribute’s getter must 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.

        +

        Use document.fullscreenElement instead.

        +

        The fullscreenElement attribute’s +getter must return the result of retargeting context object’s shadow-including root’s fullscreen element against the 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:

        1. @@ -398,7 +405,8 @@

        2. 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.

        3. If its specified display property is contents, it computes to block.

        4. @@ -422,8 +430,11 @@

          6.3. :fullscreen pseudo-class

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

          -

          This makes it different from the fullscreenElement API, +

          This makes it different from the fullscreenElement API, which returns a document’s fullscreen element.

          +

          For each node tree, if the result of retargeting its shadow-including root’s fullscreen element against the root of the node tree is not null and +the result is in the same tree, :fullscreen pseudo-class must match the result.

          +

          In other words, :fullscreen matches all the non-null results of fullscreenElement API for each node tree.

          6.4. User-agent level style sheet defaults

          @namespace "http://www.w3.org/1999/xhtml";
           
          @@ -483,7 +494,7 @@ 

          N
          [SVG]
          Jon Ferraiolo. Scalable Vector Graphics (SVG) 1.0 Specification. 4 September 2001. REC. URL: https://www.w3.org/TR/SVG/
          [WEBIDL] -
          Cameron McCormack; Boris Zbarsky. WebIDL Level 1. 8 March 2016. CR. URL: https://heycam.github.io/webidl/ +
          Cameron McCormack; Boris Zbarsky. WebIDL Level 1. 15 September 2016. PR. URL: https://heycam.github.io/webidl/

    Acknowledgments