Bug 1039924 part 1 - Separate platform-dependent parts of TimeDuration into TimeDurationPlatformUtils; r=froydnj

In order to have different templated versions of TimeDuration we first split out
the platform-specific code so that this code doesn't need to concern itself with
templates (and because putting template code in .cpp files is messy).
Bug 1039924 part 2 - Convert between Forever and Infinity when converting TimeDurations; r=froydnj

Now that the implementation of a number of TimeDuration methods have been
delegated to a separate TimeDurationPlatformUtils class, it is easier to add
consistent handling to the parameters passed to and from those methods.

This patch adds checks when converting between TimeDurations and doubles so that
Forever (represented by a tick count of INT64_MAX) is paired with
PositiveInfinity, and INT64_MIN is paired with NegativeInfinity.
Bug 1039924 part 3 - Templatize TimeDuration so it can support different behaviors with regards to tick count arithmetic; r=froydnj

This patch prepares the way for having a separate StickyTimeDuration class
by factoring TimeDuration into a templated base class: BaseTimeDuration.
BaseTimeDuration takes a templated parameter, ValueCalculator, which is a helper
object that defines how various arithmetic operations are performed on its
mValue member (an int64_t count of ticks).

This patch does not actually define or use the ValueCalculator parameter yet but
simply performs the renaming and templatization.

With regards to the templatization, arithmetic operators are defined to take
objects with the same ValueCalculator template parameter (so that we don't, for
example, apply non-safe arithmetic to a StickyTimeDuration).
However, comparison operators are defined to also operate on objects with
a different ValueCalculator template parameter since comparison should be
independent of the type of arithmetic used.

Likewise, the constructor and assignment operator are defined to operate on
objects with a different ValueCalculator template parameter so that objects can
be converted from TimeDuration to StickyTimeDuration and vice-versa.
The constructor is marked as explicit, however, so that we don't silently
convert a StickyTimeDuration to a TimeDuration and unwittingly apply
non-safe arithmetic to a StickyTimeDuration.

TimeDuration is defined as a specialization of BaseTimeDuration that uses
TimeDurationValueCalculator as its ValueCalculator type.
TimeDurationValueCalculator is filled-in in a subsequent patch.
Bug 1039924 part 4 - Fill out TimeDurationValueCalculator and use it; r=froydnj

This patch builds on the templatization from the previous patch to move
arithmetic on the mValue member of BaseTimeDuration to the ValueCalculator
template parameter.
Bug 1039924 part 5 - Add StickyTimeDuration; r=froydnj

This patch adds another implementation of BaseTimeDuration's ValueCalculator
template parameter that is careful to preserve Forever/-Forever values when
performing arithmetic.

It also defines a typedef for a specialization of BaseTimeDuration that uses
this new ValueCalculator definition.
Bug 1039924 part 6 - Use StickyTimeDuration for timing calculations; r=dholbert

This patch takes the StickyTimeDuration defined in the previous patch and
uses it within the calculation of animation timing for parameters that are
expected to be +/- Forever.
Bug 1039924 part 7 - Add unary minus operator to BaseTimeDuration; r=froydnj

This patch adds the unary minus operator so, for example, we can write:

  TimeDuration sinceBeforeYourSunBurnedHot = -TimeDuration::Forever();