<?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>28460</bug_id>
          
          <creation_ts>2015-04-10 05:03:27 +0000</creation_ts>
          <short_desc>Request fullscreen on both iframe and elements inside it could cause undesired result</short_desc>
          <delta_ts>2015-10-07 11:52:09 +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>bugs</cc>
    
    <cc>mike</cc>
    
    <cc>philipj</cc>
    
    <cc>public-webapps</cc>
    
    <cc>r12f.code</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>119420</commentid>
    <comment_count>0</comment_count>
    <who name="Xidorn Quan">xidorn+w3c</who>
    <bug_when>2015-04-10 05:03:27 +0000</bug_when>
    <thetext>In the current spec, the &quot;collect ancestors&quot; function returns a list of documents whose fullscreen element stack consist of one element, and then those documents exit from fullscreen in the last step of exitFullscreen() method.

I know it is defined this way so that iframes outside automatically exit when we exit the only fullscreen element in it, just like how they were automatically pushed to the stack.

But this could cause undesired problem if author explicitly calls requestFullscreen() on an iframe element, then call the same method on some element inside.

For example, if we have tree like:

iframe #a
|
+- div #b

and follow the steps:
1. call a.requestFullscreen()
2. call b.requestFullscreen()
3. call a.contentDocument.exitFullscreen()

This will cause the fullscreen be fully exited, because the only element in the fullscreen element stack of document inside #a is being popped.

This could really surprise author, as they could sometimes want to make iframe itself fullscreen.


To fix this issue, I propose we change the first step of requestFullscreen() to: If the context object has nested browsing context, let pending be the documentElement of the nested document, otherwise, let pending be the context object.

This could make things a little surprising that calling requestFullscreen() on an iframe then calling exitFullscreen() on its contentDocument could exit fullscreen. But I think it should be fine as it doesn&apos;t add much complexity while fixes a more significant undesired behavior.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122061</commentid>
    <comment_count>1</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-07-15 12:55:26 +0000</bug_when>
    <thetext>Is this problem big enough to try fixing? For my own part, if it is fixed, I think it ought to be by having a flag on iframe elements in the top layer stack which means &quot;this was added explicitly, don&apos;t exit implicitly&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122199</commentid>
    <comment_count>2</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-07-18 06:16:14 +0000</bug_when>
    <thetext>Xidorn, is Philip&apos;s approach okay with you? I&apos;m also not entirely sure this warrants fixing, but I guess it makes the whole setup slightly more consistent.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122201</commentid>
    <comment_count>3</comment_count>
    <who name="Xidorn Quan">xidorn+w3c</who>
    <bug_when>2015-07-18 06:31:28 +0000</bug_when>
    <thetext>That approach probably makes the most sense. I don&apos;t know whether it is worth solving, but it seems to me Trident does it in a more sensible way than the spec on this issue.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122202</commentid>
    <comment_count>4</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-07-18 07:13:00 +0000</bug_when>
    <thetext>(In reply to Xidorn Quan from comment #3)
&gt; That approach probably makes the most sense. I don&apos;t know whether it is
&gt; worth solving, but it seems to me Trident does it in a more sensible way
&gt; than the spec on this issue.

Huh, Trident already does something clever here? Better ask them precisely what it is and use that if it&apos;s good enough.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122203</commentid>
    <comment_count>5</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-07-18 07:16:15 +0000</bug_when>
    <thetext>I&apos;ve emailed Ali Alabbas at Microsoft about this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122286</commentid>
    <comment_count>6</comment_count>
    <who name="Riff Jiang">r12f.code</who>
    <bug_when>2015-07-24 23:09:36 +0000</bug_when>
    <thetext>Hi Xidorn and Philip,

I am a dev from Microsoft IE team and now working on fullscreen area. Nice to you meet you guys.

Philip’s approach looks good to me. Trident is now doing something very similar to avoid this issue. The explicitly added elements are marked differently in trident. 

Thanks,
Riff</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122292</commentid>
    <comment_count>7</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-07-27 07:04:22 +0000</bug_when>
    <thetext>https://github.com/whatwg/fullscreen/commit/079dcf4bacd976359b412522dd8e5f75b7ac4a1e

Thanks Riff!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122451</commentid>
    <comment_count>8</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-08-04 12:02:02 +0000</bug_when>
    <thetext>(In reply to Anne from comment #7)
&gt; https://github.com/whatwg/fullscreen/commit/
&gt; 079dcf4bacd976359b412522dd8e5f75b7ac4a1e
&gt; 
&gt; Thanks Riff!

These changes look good to me. Do they pedantically match the implementation in Edge, Riff? (That would be surprising, but any differences are worth knowing.)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122476</commentid>
    <comment_count>9</comment_count>
    <who name="Riff Jiang">r12f.code</who>
    <bug_when>2015-08-06 00:06:14 +0000</bug_when>
    <thetext>(In reply to Philip Jägenstedt from comment #8)
&gt; (In reply to Anne from comment #7)
&gt; &gt; https://github.com/whatwg/fullscreen/commit/
&gt; &gt; 079dcf4bacd976359b412522dd8e5f75b7ac4a1e
&gt; &gt; 
&gt; &gt; Thanks Riff!
&gt; 
&gt; These changes look good to me. Do they pedantically match the implementation
&gt; in Edge, Riff? (That would be surprising, but any differences are worth
&gt; knowing.)

Yes, Philip. No surprises here. The way we track the explicitly added elements in Trident and Edge are exactly the same.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123591</commentid>
    <comment_count>10</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2015-10-07 11:37:50 +0000</bug_when>
    <thetext>So this deals with iframes only. Should also &lt;object&gt; and &lt;frame&gt; be handled the same way (though, &lt;frame&gt; is rather deprecated.)
Feels odd if &lt;iframe&gt; and &lt;object&gt; behave differently.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123593</commentid>
    <comment_count>11</comment_count>
    <who name="Xidorn Quan">xidorn+w3c</who>
    <bug_when>2015-10-07 11:47:50 +0000</bug_when>
    <thetext>(In reply to Olli Pettay from comment #10)
&gt; So this deals with iframes only. Should also &lt;object&gt; and &lt;frame&gt; be handled
&gt; the same way (though, &lt;frame&gt; is rather deprecated.)
&gt; Feels odd if &lt;iframe&gt; and &lt;object&gt; behave differently.

It doesn&apos;t seem to me any document inside &lt;frame&gt; or &lt;object&gt; should ever be able to enter fullscreen.

According to the spec, an element can enter fullscreen only when its document has &quot;fullscreen enabled flag&quot; set [1], however that flag is only set for the topmost document and document inside &lt;iframe&gt; with allowfullscreen attribute set [2].


[1] https://fullscreen.spec.whatwg.org/#fullscreen-element-ready-check
[2] https://fullscreen.spec.whatwg.org/#fullscreen-enabled-flag</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123594</commentid>
    <comment_count>12</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-10-07 11:52:09 +0000</bug_when>
    <thetext>(In reply to Xidorn Quan from comment #11)
&gt; It doesn&apos;t seem to me any document inside &lt;frame&gt; or &lt;object&gt; should ever be
&gt; able to enter fullscreen.

That is correct, and I&apos;ve previously even removed some support for &lt;frame&gt; from Blink.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>