<?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>28644</bug_id>
          
          <creation_ts>2015-05-15 14:02:05 +0000</creation_ts>
          <short_desc>Add an optional parameter to requestAnimationFrame to indicate when the callback should be called</short_desc>
          <delta_ts>2019-03-29 19:13:52 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</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>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Olli Pettay">bugs</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>annevk</cc>
    
    <cc>d</cc>
    
    <cc>igrigorik</cc>
    
    <cc>mike</cc>
    
    <cc>ojan</cc>
    
    <cc>rbyers</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>120320</commentid>
    <comment_count>0</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2015-05-15 14:02:05 +0000</bug_when>
    <thetext>I&apos;ve seen rather often in various tests that one wants to actually get a callback
called right after the normal animation frame stuff, usually even async.
So something like
requestAnimationFrame(function(now) {}, { async: true }); might work pretty well.
Not sure what the /now/ passed to the callback should be in that case.
I guess it shouldn&apos;t be the /now/ defined in 
https://html.spec.whatwg.org/multipage/webappapis.html#processing-model-9:run-the-animation-frame-callbacks, but the value should be updated just before calling such async callbacks.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123492</commentid>
    <comment_count>1</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2015-10-06 06:53:16 +0000</bug_when>
    <thetext>Do you mean this would be invoked as part of a new substep 11 of the overall rendering update step? In that case { postRendering: true } might be more appropriate.

Rick, Ilya, any thoughts on this?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123524</commentid>
    <comment_count>2</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2015-10-06 16:47:33 +0000</bug_when>
    <thetext>Either step 11 could call them
or step 9 would have a substep to take the current &quot;late-callbacks&quot; and queue a task to call them.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123526</commentid>
    <comment_count>3</comment_count>
    <who name="Ilya Grigorik">igrigorik</who>
    <bug_when>2015-10-06 16:53:59 +0000</bug_when>
    <thetext>Isn&apos;t requestIdleCallback already filling in this gap, and in a better and more flexible way? See: https://w3c.github.io/requestidlecallback/

p.s. available in Chrome Canary and shipping in M48.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123529</commentid>
    <comment_count>4</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2015-10-06 17:16:06 +0000</bug_when>
    <thetext>This has very little to do with requestIdleCallback.
The issue is that we currently put too much pressure to animation frame tick time, yet there are things which could run right after the tick.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>123530</commentid>
    <comment_count>5</comment_count>
    <who name="Rick Byers">rbyers</who>
    <bug_when>2015-10-06 17:20:45 +0000</bug_when>
    <thetext>How does this relate to setImmediate (https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/setImmediate/Overview.html)?

I don&apos;t fully understand the use cases here, /cc ojan@ who is probably a better blink contact.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>124694</commentid>
    <comment_count>6</comment_count>
    <who name="Domenic Denicola">d</who>
    <bug_when>2016-01-24 05:45:21 +0000</bug_when>
    <thetext>(In reply to Rick Byers from comment #5)
&gt; How does this relate to setImmediate
&gt; (https://dvcs.w3.org/hg/webperf/raw-file/tip/specs/setImmediate/Overview.
&gt; html)?

setImmediate is unaware of the animation lifecycle and just queues a task as soon as possible (but on the task queue, so it might happen after other tasks, input, even rendering if you manage to catch it on the 16 ms boundary). So, also pretty unrelated.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128781</commentid>
    <comment_count>7</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2017-07-24 13:26:54 +0000</bug_when>
    <thetext>Olli, is this still something you want?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128782</commentid>
    <comment_count>8</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2017-07-24 15:06:49 +0000</bug_when>
    <thetext>I&apos;m pretty sure yes. I&apos;ve seen this often at least in tests doing something like
requestAnimationFrame(function() { setTimeout(function() { /* do something*/}); })</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128783</commentid>
    <comment_count>9</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2017-07-24 15:09:59 +0000</bug_when>
    <thetext>But there&apos;s no guarantee there&apos;s no other animation frame in between in that case, right? If there&apos;s already some tasks queued, you won&apos;t run directly after the frame.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>128784</commentid>
    <comment_count>10</comment_count>
    <who name="Olli Pettay">bugs</who>
    <bug_when>2017-07-24 15:18:23 +0000</bug_when>
    <thetext>Sure. I don&apos;t have strong opinion whether it should be right after next tick, or async task after next tick.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>129647</commentid>
    <comment_count>11</comment_count>
    <who name="Domenic Denicola">d</who>
    <bug_when>2019-03-29 19:13:52 +0000</bug_when>
    <thetext>https://github.com/szager-chromium/requestPostAnimationFrame</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>