<?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>26440</bug_id>
          
          <creation_ts>2014-07-28 09:06:04 +0000</creation_ts>
          <short_desc>Allow fullscreenchange events to be synchronized with animation frames</short_desc>
          <delta_ts>2015-07-28 07:32:52 +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>PC</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>MOVED</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>
          <dependson>28001</dependson>
          <blocked>26516</blocked>
    
    <blocked>27674</blocked>
    
    <blocked>28614</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Philip Jägenstedt">philipj</reporter>
          <assigned_to name="Anne">annevk</assigned_to>
          <cc>bbirtles</cc>
    
    <cc>cam</cc>
    
    <cc>cpearce</cc>
    
    <cc>eoconnor</cc>
    
    <cc>ian</cc>
    
    <cc>jackalmage</cc>
    
    <cc>jamesr</cc>
    
    <cc>jer.noble</cc>
    
    <cc>mike</cc>
    
    <cc>plh</cc>
    
    <cc>public-webapps</cc>
    
    <cc>roc</cc>
    
    <cc>zcorpan</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>109341</commentid>
    <comment_count>0</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-07-28 09:06:04 +0000</bug_when>
    <thetext>http://fullscreen.spec.whatwg.org/#go-fullscreen

Tasks are queued to resize the viewport and fire the fullscreenchange event.

I would like to synchronize changes to the fullscreen element stack and the events with animation frames, so that any scripts will always see a perfectly consistent state. I wrote about this and other messy things on blink-dev recently:
https://groups.google.com/a/chromium.org/d/msg/blink-dev/GLl6aWs9-EM/6Z0IkWgmWJsJ

Unfortunately, the way the spec is phrased doesn&apos;t seem to allow for this. I propose that instead of using the user interaction task source, any script visible changes and events are tied into the requestAnimationFrame() machinery.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109343</commentid>
    <comment_count>1</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-07-28 09:13:17 +0000</bug_when>
    <thetext>That machinery seems to be defined here https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/RequestAnimationFrame/Overview.html#processingmodel and is not extensible at the moment.

This does seem like a good idea. Basically we should replace the &quot;queue a task&quot; bits with something that queues this to happen relative to that &quot;samples all animations&quot; task.

How does web animations deal with this timing model?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109344</commentid>
    <comment_count>2</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-07-28 09:16:47 +0000</bug_when>
    <thetext>http://dev.w3.org/fxtf/web-animations/#event-dispatch says:
&quot;Events are queued whenever sampling regularly occurs&quot;

It looks a bit weird though, because it doesn&apos;t say that the events are ever fired. Maybe the spec authors have treat &quot;queue&quot; as &quot;fire&quot; or something?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109345</commentid>
    <comment_count>3</comment_count>
    <who name="Robert O&apos;Callahan (Mozilla)">roc</who>
    <bug_when>2014-07-28 09:17:33 +0000</bug_when>
    <thetext>The idea sounds good.

I don&apos;t know if Web Animations interacts with this.

Gecko&apos;s &quot;scroll&quot; events are synchronized with animation frames in a similar way.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109349</commentid>
    <comment_count>4</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-07-28 09:28:01 +0000</bug_when>
    <thetext>Blink also has a few things which are synchronized with animation frames already: scroll events, resize events, media query change listeners, events related to CSS Animations and the non-standard overflowchange event.

If the spec hooks to make this work don&apos;t already exist, then at least there is something to reverse engineer.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109353</commentid>
    <comment_count>5</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-07-28 09:55:03 +0000</bug_when>
    <thetext>Simon, Tab, Cameron, it seems this is largely your task to sort this out and define it, perhaps together with Ian. Can you guys file the appropriate bugs and make them block this bug?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109438</commentid>
    <comment_count>6</comment_count>
    <who name="Brian Birtles">bbirtles</who>
    <bug_when>2014-07-28 23:22:10 +0000</bug_when>
    <thetext>(In reply to Philip Jägenstedt from comment #2)
&gt; http://dev.w3.org/fxtf/web-animations/#event-dispatch says:
&gt; &quot;Events are queued whenever sampling regularly occurs&quot;
&gt; 
&gt; It looks a bit weird though, because it doesn&apos;t say that the events are ever
&gt; fired. Maybe the spec authors have treat &quot;queue&quot; as &quot;fire&quot; or something?

That section of the spec is being completely rewritten. Events will be dropped. I still don&apos;t think Web Animations will address this yet but hopefully in the next few days it will get closer.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109566</commentid>
    <comment_count>7</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-07-30 12:59:34 +0000</bug_when>
    <thetext>Animation frame tasks still need to be defined. Including the order of events and other code running within that task (are those microtasks again?).

Meanwhile, I have brought Fullscreen a bit closer to them with this commit I hope: https://github.com/whatwg/fullscreen/commit/5187282e5fd24a1c4ff0164d444e1bfc2bdf44ef</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109631</commentid>
    <comment_count>8</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-07-31 08:32:22 +0000</bug_when>
    <thetext>http://lists.w3.org/Archives/Public/www-style/2014Jul/0586.html has a plan for animation frame tasks btw.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109713</commentid>
    <comment_count>9</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-07-31 22:06:25 +0000</bug_when>
    <thetext>Looks good, let&apos;s hope someone bites.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109738</commentid>
    <comment_count>10</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-08-01 07:12:16 +0000</bug_when>
    <thetext>exitFullscreen() still needs some work:
http://krijnhoetmer.nl/irc-logs/whatwg/20140801#l-194</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109740</commentid>
    <comment_count>11</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-08-01 07:33:09 +0000</bug_when>
    <thetext>How about this:

1. Let exitDocuments be the set of documents with exactly 1 element on its stack.

2. Return and continue async.

3. If the top-level document is in exitDocuments, resize.

4. In the animation frame task, empty the stacks of all exitDocuments and pop one element from the next one up, if any. If anything is out-of-sync now, fully exit fullscreen.

Kinda works?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109743</commentid>
    <comment_count>12</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-08-01 10:03:05 +0000</bug_when>
    <thetext>https://github.com/whatwg/fullscreen/commit/d8b9e4474cbef536fee6daaa5885eed8e73fc5de</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109748</commentid>
    <comment_count>13</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-08-01 10:59:38 +0000</bug_when>
    <thetext>(In reply to Anne from comment #12)
&gt; https://github.com/whatwg/fullscreen/commit/
&gt; d8b9e4474cbef536fee6daaa5885eed8e73fc5de

This reversed the event order in exitFullscreen(). The events should be fired in the opposite order compared to requestFullscreen(), so that the deepest document gets it first and the top-level document last. Maybe not necessary for site compat, but why risk it?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109749</commentid>
    <comment_count>14</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-08-01 11:07:21 +0000</bug_when>
    <thetext>It looks like topDoc is used uninitialized, I guess &quot;Remove the top element from topDoc&apos;s fullscreen element stack&quot; was meant to be conditional.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109752</commentid>
    <comment_count>15</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-08-01 12:18:58 +0000</bug_when>
    <thetext>https://github.com/whatwg/fullscreen/commit/0e4ac69d37903289d7633e393ab104325c6e5cfd
https://github.com/whatwg/fullscreen/commit/4e930868afa0d1b67a569087155ddab85ec19b49</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109811</commentid>
    <comment_count>16</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-08-03 21:04:57 +0000</bug_when>
    <thetext>With those changes I&apos;m happy with requestFullscreen() or exitFullscreen(), they look ready to implement.

When implementing exitFullscreen(), this is how I&apos;d actually do it.

3. Let topLevelDoc be doc&apos;s top-level browsing context&apos;s document.

4. Set resize to true if topLevelDoc has a fullscreen element stack consisting of one element, and false otherwise.

Since I like to paste the spec steps into the code it would be *nice* if it matched, if there&apos;s no particular reason for the parentDocs overhead.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109812</commentid>
    <comment_count>17</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-08-03 21:13:15 +0000</bug_when>
    <thetext>Now that all events are fired in the same task, what happens when one event handler rearranges the document tree? It looks like it&apos;s all in order, but maybe for extra clarity a descendantDocs set could be populated and iterated in two separate steps? It would be easy to overlook when implementing step 9.4, and could in the worst case lead to documents with a non-empty fullscreen element stack being left behind.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109813</commentid>
    <comment_count>18</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-08-04 07:39:18 +0000</bug_when>
    <thetext>(In reply to Philip Jägenstedt from comment #16)
&gt; 3. Let topLevelDoc be doc&apos;s top-level browsing context&apos;s document.
&gt; 
&gt; 4. Set resize to true if topLevelDoc has a fullscreen element stack
&gt; consisting of one element, and false otherwise.

If you have A &gt; B with A being topLevelDoc. If B&apos;s fullscreen element stack contains two elements, A&apos;s stack will not be popped.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>109816</commentid>
    <comment_count>19</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2014-08-04 08:38:53 +0000</bug_when>
    <thetext>(In reply to Anne from comment #18)
&gt; (In reply to Philip Jägenstedt from comment #16)
&gt; &gt; 3. Let topLevelDoc be doc&apos;s top-level browsing context&apos;s document.
&gt; &gt; 
&gt; &gt; 4. Set resize to true if topLevelDoc has a fullscreen element stack
&gt; &gt; consisting of one element, and false otherwise.
&gt; 
&gt; If you have A &gt; B with A being topLevelDoc. If B&apos;s fullscreen element stack
&gt; contains two elements, A&apos;s stack will not be popped.

Um, right :) I&apos;ll make a note to test that case so that no one tries my &quot;optimization&quot;...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>114957</commentid>
    <comment_count>20</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2014-11-14 23:59:16 +0000</bug_when>
    <thetext>Do we want to support animating from non-full-screen to full-screen?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>114965</commentid>
    <comment_count>21</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-11-15 11:52:20 +0000</bug_when>
    <thetext>Yes.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>116230</commentid>
    <comment_count>22</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2014-12-12 17:58:33 +0000</bug_when>
    <thetext>Study http://lists.w3.org/Archives/Public/public-whatwg-archive/2014Dec/0039.html while fixing this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>118048</commentid>
    <comment_count>23</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-02-20 09:46:14 +0000</bug_when>
    <thetext>For animating between non-fullscreen and fullscreen, are we talking about making it possible for scripts to control every animation frame in that transition, or something else?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>118049</commentid>
    <comment_count>24</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-02-20 09:57:14 +0000</bug_when>
    <thetext>Do UAs hand out multiple animation frames for those transitions now? I would expect not... I would expect one before and one after or something like that.

Perhaps with a future compositor API more detailed control can be given though there&apos;s some potential security issues with that too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>118051</commentid>
    <comment_count>25</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-02-20 10:04:07 +0000</bug_when>
    <thetext>No, there&apos;s ideally just one animation frame before and one animation frame after.

Note that on both desktop and mobile Chrome, however, there may be status bars and things that get animated away and actually the Web content is resized for every step of this animation. However, I consider this a bug to be fixed as it&apos;s very sluggish and it doesn&apos;t actually allow one to control the animation into and out of fullscreen.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122062</commentid>
    <comment_count>26</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-07-15 12:56:01 +0000</bug_when>
    <thetext>This has been fixed, are there any remaining issues?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122065</commentid>
    <comment_count>27</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-07-15 13:29:09 +0000</bug_when>
    <thetext>Well, the dependency listed is an integration issue with HTML. That needs to be sorted somehow.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122067</commentid>
    <comment_count>28</comment_count>
    <who name="Philip Jägenstedt">philipj</who>
    <bug_when>2015-07-15 13:45:57 +0000</bug_when>
    <thetext>Ah, sorry for the noise then :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>122305</commentid>
    <comment_count>29</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-07-28 07:32:52 +0000</bug_when>
    <thetext>Let&apos;s close this in favor of https://github.com/whatwg/fullscreen/issues/16

Any new issues should be filed on GitHub.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>