<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>28459</bug_id>
          
          <creation_ts>2015-04-10 04:45:37 +0000</creation_ts>
          <short_desc>Algorithm of exitFullscreen() doesn&apos;t work correctly when there are nested fullscreen element</short_desc>
          <delta_ts>2015-07-18 07:21:10 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>Fullscreen</component>
          <version>unspecified</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Xidorn Quan">xidorn+w3c</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>mike</cc>
    
    <cc>philipj</cc>
    
    <cc>public-webapps</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>119419</commentid>
    <comment_count>0</comment_count>
    <who name="Xidorn Quan">xidorn+w3c</who>
    <bug_when>2015-04-10 04:45:37 +0000</bug_when>
    <thetext>It seems to me that the algorithm fails even on very simple cases.

Given the following tree: div#a &gt; div#b
and do the following steps:
1. call a.requestFullscreen()
2. call b.requestFullscreen()
3. call document.exitFullscreen()

The expected result is, #a, as well as the viewport, is still fullscreen. Is it correct?


However, it seems to me that the current spec will cause very strange result. When document.exitFullscreen() is called:

In step 4, the &quot;collect ancestors&quot; returns [document] to docs, and since |document| is the topLevelDoc, so in step 6, resize is set to true, which cause the viewport be restored to normal dimensions in step 8.

In step 9.1, the &quot;collect ancestors&quot; again returns [document] to docs, and finally in step 9.6, #b is removed from the fullscreen element stack of the document.

Finally, #a is still in fullscreen element stack, while the viewport is no longer fullscreen.


To fix this, I think we should add a step at the start of &quot;collect ancestors&quot;: If fullscreen element stack of doc consists of more than one element, return an empty set.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122060</commentid>
    <comment_count>1</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-07-15 12:53:54 +0000</bug_when>
    <thetext>Has this been resolved by the recent refactoring?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122168</commentid>
    <comment_count>2</comment_count>
    <who name="Xidorn Quan">xidorn+w3c</who>
    <bug_when>2015-07-17 02:44:45 +0000</bug_when>
    <thetext>No, it hasn&apos;t. The algorithm still doesn&apos;t look correct to me.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122171</commentid>
    <comment_count>3</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-07-17 07:26:09 +0000</bug_when>
    <thetext>Yeah, you&apos;re right. Either collect ancestors should include doc if that has more than a single element in the top layer stack, or the exit fullscreen algorithm needs to handle doc separate somehow.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122205</commentid>
    <comment_count>4</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-07-18 07:21:10 +0000</bug_when>
    <thetext>https://github.com/whatwg/fullscreen/commit/67fb879087d646178857fd5fc7312b662b9a8999</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>