Re: [css3-transitions] [css3-animations] API for testing transitions and animations

On 2/13/12 2:33 PM, Aryeh Gregor wrote:
> WebKit seems to use
> layoutTestController.pauseAnimationAtTimeOnElementWithId; Gecko seems
> to use SpecialPowers.DOMWindowUtils.advanceTimeAndRefresh.  As a
> starting point for possibly working out a format for standard
> transition/animation tests, could Gecko and WebKit people perhaps give
> an outline of how their internal tests work, so we could figure out if
> the approach of one or the other would be suitable for standardizing?
> Ideally, we'd want to be able to test both computed style and
> rendering at arbitrary and reasonably precise times.

What Gecko basically does is that we have two functions:

    void advanceTimeAndRefresh(in long long aMilliseconds);
    void restoreNormalRefresh();

These are not allowed to be called by content script for now.

The second one, when called, just puts the document into the "normal" 
state (undoing the effects of the first one, basically).

The first one does three things:

1)  Advances the document timeline by aMilliseconds milliseconds (which
     can be negative).
2)  Pauses the document timeline so that it won't change anymore until
     restoreNormalRefresh is called or another advanceTimeAndRefresh
     call happens.
3)  Triggers a "document time changed" notification (of the same sort
     that would normally happen when the timeline timer fires).

After a call to advanceTimeAndRefresh, more such calls can be made to 
move along the document timeline as desired.  Each call will do #1-#3 
above (though #2 will be a no-op at that point).

#3 updates the state of CSS transitions/animations as well as SMIL 
animations and anything else triggering off the document timeline.  It 
also fires any pending requestAnimationFrame callbacks.

#2 makes sure that you can then examine that state at your leisure 
without worrying about it changing under you.

#1 allows you to control the exact point in time you want to examine 
state for.

-Boris

Received on Monday, 13 February 2012 20:43:13 UTC