From 40c89470f0b3e5acf675b56578491a5c2ea2d2fe Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Fri, 24 Feb 2017 22:31:14 +1100 Subject: [PATCH] Change algorithm of "collect documents to unfullscreen" There are two issues with the previous algorithm of "collect documents to unfullscreen" with "exit fullscreen": 1. If the current document has more than a single fullscreen element, its browsing context container will be accidentally unfullscreened because in algorithm of "exit fullscreen", "doc" is added to "exitDocs" if "doc" has more than a single fullscreen element, and in that case, the document of the browsing context container of "doc" will be added to "exitDocs" in the next step. 2. A browsing context container can be unfullscreened accidentally by its child document even if its "iframe fullscreen flag" is set, because the steps of "exit fullscreen" doesn't check it. Tests: https://codereview.chromium.org/2706293013/. --- fullscreen.bs | 41 ++++++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 15 deletions(-) diff --git a/fullscreen.bs b/fullscreen.bs index 538d446..735c229 100644 --- a/fullscreen.bs +++ b/fullscreen.bs @@ -296,18 +296,33 @@ attribute's getter must run these steps:
  • Return null. +

    A document is said to be a simple fullscreen document if there is exactly one +element in its top layer that has its fullscreen flag set. + +

    A document with two elements in its top layer can be a +simple fullscreen document. For example, in addition to the fullscreen element there +could be an open <{dialog}> element. +

    To collect documents to unfullscreen given doc, run these steps:

      -
    1. If doc's top layer consists of more than a single element that has - its fullscreen flag set, return the empty set. -

    2. Let docs be an ordered set consisting of doc. -

    3. While docs's last document has a browsing context container - whose node document's top layer consists of a single element that has its - fullscreen flag set and does not have its iframe fullscreen flag set (if any), append - that node document to docs. +

    4. +

      While true: + +

        +
      1. Let lastDoc be docs's last document. + +

      2. If lastDoc is not a simple fullscreen document, break. + +

      3. Let container be lastDoc's browsing context container, if + any, and otherwise break. + +

      4. If container's iframe fullscreen flag is set, break. + +

      5. Append container's node document to docs. +

    5. Return docs.

    @@ -332,7 +347,8 @@ attribute's getter must run these steps: active document. -
  • If topLevelDoc is in docs, then set resize to true. +

  • If topLevelDoc is in docs, and it is a + simple fullscreen document, then set resize to true.

  • Return promise, and run the remaining steps in parallel. @@ -349,15 +365,10 @@ attribute's getter must run these steps: doc. -

  • If resize is true and topLevelDoc is not in exitDocs, +

  • If resize is true and topLevelDoc is either not in + exitDocs, or not a simple fullscreen document, fully exit fullscreen topLevelDoc, reject promise with a TypeError exception, and terminate these steps. - -

  • If exitDocs is the empty set, append doc to exitDocs. - -

  • If exitDocs's last document has a - browsing context container, append that browsing context container's - node document to exitDocs.

  • Let descendantDocs be an ordered set consisting of doc's