Bug 1078122 part 3 - Move animation value building down to the Animation objects; r=dholbert

This patch extracts the logic for calculating animation styles from
AnimationPlayerCollection and puts the bulk of it into the Animation objects.
Some of the initial logic surrounding the animation player state (e.g. is it
paused or not, etc.) is put into AnimationPlayer.

In future we may shift this logic even further down to the AnimationEffect
objects but currently we don't create such objects unless necessary.
Bug 1078122 part 4 - Make the mSource and mTimeline members of AnimationPlayer protected; r=dholbert
Bug 1078122 part 5 - Move CSSAnimationPlayer to nsAnimationManager; r=dholbert

This patch takes the CSSAnimationPlayer object, currently defined in
dom/animation/AnimationPlayer.{cpp,h}, and moves it to
layout/style/nsAnimationManager.{cpp,h} where the rest of the CSS
Animations-specific code lives.

At the same time it extends the scope of the mozilla namespace block in
nsAnimationManager.h to also include the AnimationEventInfo and EventArray types
since these classes, which don't have an ns* prefix, probably should be in the
mozilla namespace anyway.
Bug 1078122 part 6 - Store the previous finished state; r=dholbert

AnimationPlayer::CanThrottle determines if an animation player has just finished
by inspecting the value of mLastNotification. This is problematic for two
reasons:

1. mLastNotification is intended to be used for events (as the XXX comment
   notes)
2. mLastNotification is specific to CSS Animations and should be moved to
   CSSAnimationPlayer.

To address this, this patch adds an extra member mIsPreviousStateFinished. The
Web Animations spec already defines animation players as having such a member:

  http://w3c.github.io/web-animations/#previous-finished-state

We set it to true when we calculate the style for an animation that has
finished. This differs slightly from the code it is replacing as explained
below.

In the case of CSS Animations we perform the following sequence of steps on each
sample.

  1. EnsureStyleRuleFor (calls CanThrottle, and maybe ComposeStyle)
  2. GetEventsForCurrentTime

In the existing code, we update mLastNotification in (2) which happens on every
sample, even throttled samples.

In this patch, however, we update mIsPreviousStateFinished in (1) during the
ComposeStyle step which only happens for unthrottled samples. So, as of this
patch, in CanThrottle, we ask "have we newly entered the finished state since
the last *unthrottled* sample?", whereas previously we simply looked for
a change since the last sample, throttled or not. However, if the answer to the
question is "yes", then we'll run an unthrottled sample and update
mIsPreviousStateFinished so these should be functionally equivalent.

Another subtle difference is that this patch looks at the player's finished
state rather than the animation phase of its source content, and these will
produce different results in the case where the player is paused. However, since
paused animations are not run on the compositor, this should not matter.

In the case of CSS Transitions, AnimationPlayer::CanThrottle() is not currently
used and so mIsPreviousStateFinished is irrelevant.

Ultimately, both the existing and the new code is somewhat fragile but hopefully
this will be addressed by:
* Replacing mIsPreviousStateFinished with inspecting whether the finished
  promise is settled (bug 1074630),
* Merging more of the code in nsAnimationManager and nsTransitionManager and
  applying a unified approach to sampling that better accommodates these
  considerations.
Bug 1078122 part 7 - Add method to Animation to get the target element and pseudo; r=dholbert
Bug 1078122 part 8 - Use the new GetTarget overload in AnimationPlayer; r=dholbert
Bug 1078122 part 9 - Move queuing of CSS animation events to CSSAnimationPlayer; r=dholbert

This patch moves the code for queuing CSS animation events from
nsAnimationManager to CSSAnimationPlayer. In doing so, it also moves the
mLastNotification member and associated enum values.
Bug 622859 - Tests for bug 622859. r=briansmith,keeler
Bug 622859 - Reject EV certificates with key sizes below RSA 2048. r=briansmith
Bug 670334 - Set a minimum size for mfence's fences and separators. r=karlt
Bug 932698 - hold a wakelock when we receive key events. r=mwu
Bug 1069037 - Prevent touch events from piling up on the main thread. r=mwu
Bug 1078327 - Add check for correct detecting capturing content. r=smaug
Bug 1078327 - Test for correct detecting capturing content. r=smaug
Bug 1082199 - Recompute stats in jemalloc_stats when using jemalloc3. r=glandium
Bug 1082486 - Part 1 - Clean up for Mozilla coding style. r=roc

Also, check mVisible before calling UpdatePosition() in
SyncVisibilityWithCaret().
Bug 1082486 - Part 2 - Make GetCanvasFrame() returns nsCanvasFrame*. r=roc

PresShell::GetCanvasFrame() already returns nsCanvasFrame*, and it's
needed to access nsCanvasFrame's method in a later patch.
Bug 1082486 - Part 3 - Refactor UpdatePosition(). r=roc

GetTouchCaretPosition() is needed in a later patch.
Bug 1082486 - Part 5 - Hide touch caret when PresShell is suppressing painting. r=roc

When loading an html, painting is suppressed in PresShell. Therefore the
rect of nsCaret or the rect of nearest ancestor scroll frames will not
be correct. Touch caret will hide incorrectly because it cannot get the
necessary rect to calculate its position.

I added a condition in IsDisplayable() to skip when painting is
suppressed. Touch caret should sync its visibility with nsCaret again
when painting is unsuppressed, and those rects needed by touch caret
should be ready then.
Bug 1082486 - Part 4 - Check whether nsCaret shows in the scroll frame. r=roc

This patch check whether nsCaret shows in scroll frame. If yes, touch
caret will show, and its position will be clamp to scroll frame as
before. Otherwise, we hide it since the nsCaret will not be seen in this
case.