Re: Semantics of the time argument on rAF's FrameRequestCallback

On 5/9/12 1:22 PM, Nat Duca wrote:
> In a future rev of rAF, if we ever need to provide *both* begin and
> present time, as CVDisplayLink

I'm not familiar with CVDisplayLink.  What do "begin" and "present" time 
actually mean in that context?

> As a matter of education, what do other browsers provide for "time"?
> Safari gives present time
> All other webkit ports give begin time
> What about FF/IE/Opera?

What Firefox does right this second (and it's not quite correct and will 
change if/when we switch the argument to the rAF callback to using the 
monotonic clock) is the following, in order:

1)  An internal "time to do a frame" notification fires for a tab.
2)  The value that would be returned by JS is recorded.
3)  The value of the monotonic clock is recorded.

And then in some order (spanning across documents in the tab), 
declarative animations are resampled based on the value recorded in step 
3 and rAF callbacks are called with the value recorded in step 2.

Moving to the monotonic clock for rAF would allow us to get rid of step 
2 and just use the difference between navigation start and the monotonic 
clock value used to resample declarative animations as the argument to 
rAF callbacks.

Note that we have considered trying to adjust the time recorded from the 
monotonic clock by some sort of "fudge factor" to make it better match 
when the result will be painted to the screen.  We haven't done it so 
far because of the complexity involved in trying to guess how long 
updating declarative animations + calling rAF callbacks + whatever 
latency is in the painting pipeline will take...


Received on Wednesday, 9 May 2012 17:40:53 UTC