Bug 1104435 part 2 - Make AnimationPlayer derive from nsISupports; r=smaug

Web Animations defines the AnimationPlayer.ready Promise as type
Promise<AnimationPlayer>. This promise resolves to the AnimationPlayer object on
which it is defined. However, in order to be able to pass AnimationPlayer as
a resolution value it needs to implement nsISupports.

This patch makes AnimationPlayer derive from nsISupports.
Bug 1104435 part 3 - Add AnimationPlayer.ready promise; r=smaug

This patch simply adds the ready promise to AnimationPlayer. Creating new
promises and resolving them is added in a subsequent patch.
Bug 1104435 part 4 - Create and resolve new ready promises on play(); r=heycam

Every time we call play() (and in future pause()) we should create a new Promise
object and then fulfill it when we complete the play() operation.

This patch adds that step. This allows us to tweak test cases that currently
expect animations to start immediately so that by waiting on this promise they
will continue to work when we introduce the delayed start behavior in bug
927349.

We should also resolve the ready promise when we are in the pending state and
pause() is called. However, since we currently never enter the pending state we
don't need to add this just yet.
Bug 1104435 part 5 - Factor out common animation test methods into testcommon.js; r=heycam

This patch moves commonly used addDiv and waitForFrame test methods to
a separate testcommon.js support file.

It also takes advantage of the updates to testharness.js from bug 1104433 to
rework addDiv such that it automatically removes the created div at the end of
the test.
Bug 1104435 part 6 - Use step_func inside Promise callbacks; r=heycam

Since bug 1104433, step_func now passes on the return value of its callback.
That means we can use it directly as a Promise callback function in Promise
chains where the return value of the function is another Promise.

This patch updates existing tests to eliminate the awkward handling we had
around wrapping some parts of Promise callbacks in step() but leaving the return
statement outside it.
Bug 1104435 part 7 - Update AnimationPlayer tests to wait on ready promise; r=heycam

AnimationPlayer.ready will currently always be resolved but by updating these
tests to wait on it anyway they should continue to work once we introduce the
delayed animation start behavior.
Bug 1104435 part 8 - Add tests for AnimationPlayer.ready; r=heycam
Bug 1104435 part 9 - Make getting AnimationPlayer.ready flush for CSS Animation players; r=heycam
Bug 927349 part 1 - Add PendingPlayerTracker; r=jwatt

This patch adds a hashtable to nsDocument that stores all the animation players
that are currently waiting to start. In the future it may also be used to store
players that are waiting to pause which is why the methods are called
AddPlayPending/RemovePlayPending instead of just AddPlayer/RemovePlayer.
Bug 927349 part 2 - Add AnimationPlayer::mIsPending and return "pending" from AnimationPlayer::PlayState(); r=jwatt

This patch adds a member for tracking if a player is currently pending or not
and uses this to return the "pending" state from PlayState(). We don't currently
set mIsPending to true yet, however.

Additionally, this patch updates AnimationPlayer::ComposeStyle to set
aNeedsRefreshes to true when the player is pending. This is used by the
appropriate animation/transition manager to determine if it should continue to
observe the refresh driver or not.
Bug 927349 part 3 - Cancel a pending play when pause is called; r=jwatt

This patch updates the pause procedure for AnimationPlayer so that if there is
a pending play it will be cancelled.

At the same it removes the existing check for a redundant call to Pause when we
are already paused. This check is not necessary since if we are already paused
the method will have no effect anyway.

Finally, this patch updates the comment about going to the pending state while
pausing since this will happen in bug 1109390.
Bug 927349 part 4 - Make the ready Promise be created lazily; r=heycam

In Bug 1104435 we made the initial ready promise be created lazily. This patch
takes this a step further and makes sure we don't create the promise at all
unless it is explicitly requested.
Bug 927349 part 5 - Cancel players that are no longer used; r=jwatt

This patch adds a means of terminating an animation so that is has no effect.
The procedure is defined by Web Animations:

  http://w3c.github.io/web-animations/#cancelling-a-player-section

We don't implement all of this, however, since we don't currently support the
finished promise or custom effects.

In a later bug we will expose this as the cancel() method on AnimationPlayer.

We call this method for terminated animations in nsAnimationManager and
nsTransitionManager to ensure they get removed from the pending player tracker
and so that, for example, the ready promise of CSS Animation player objects is
rejected when the corresponding item is removed from animation-name.
Bug 927349 part 6 - Rename AnimationPlayer::ResolveStartTime to AnimationPlayer::StartNow; r=jwatt

ResolveStartTime is a bit hard to understand. Eventually, once we implement
SetStartTime, we can probably remove this method altogether and just use that.
This renaming moves us closer to that direction.

This patch also adjusts a comment about the preconditions for calling StartNow.
This is because in a subsequent patch in this series we will update the
assertion at the beginning of StartNow to simply check that the player is
pending.
Bug 927349 part 7 - Factor out AnimationTimeline::GetRefreshDriver into a separate method; r=jwatt

This is in preparation for adding AnimationTimeline::FastForward in the next
patch which will reuse this code.
Allow containerless scrolling for root scroll frames, too. (bug 1076192, r=tn)

--HG--
extra : rebase_source : 29d74a8734aabc0e583ad5e372f7b04bcc9e2b8f
Bug 1112782 - Update Redirect handling for CSP (r=sstamm)
Bug 1109907 - Add missing OOM check, r=nmatsakis.
Bug 1109610 - Remove unnecessary MOZ_CRASH, r=nmatsakis.
Bug 1111194 - Fix write barrier triggering for TypeObject addendum changes, r=nmatsakis.