Re: [AnimationRequestFrame] Initial editor's draft of AnimationRequestFrame spec available

On 5/3/11 2:05 AM, Robert O'Callahan wrote:
> Then we can improve the iterative algorithm a bit by running callbacks
> as soon as we think they are likely to be needed, like so:
> 1) Resample declarative animations
> 2) Run all animation callbacks with no associated element (we know these
> need to run, best to run them first)
> 3) While there are callbacks that have not run yet:
>    a) Flush restyles and layout
>    b) Compute the set of callbacks that have not run yet whose elements
> are currently visible in the viewport
>    c) If that set is empty, go to step 4
>    d) Otherwise, run all those callbacks
> 4) Flush restyles and layout
> 5) Paint

That's precisely what I was proposing.  ;)

> Unfired callbacks need to stay in the list so that if the element
> becomes visible, a callback fires. However, we can avoid wakeups by
> observing that we only need to reschedule a scan of the list if a reflow
> or scroll operation has occurred. Then for a page that's quiescent apart
> from an animation callback for an element outside the viewport, we
> wouldn't wake up.

Excellent.  Sold.

-Boris

Received on Tuesday, 3 May 2011 13:44:59 UTC