Граф коммитов

169 Коммитов

Автор SHA1 Сообщение Дата
Brian Birtles 1a43924a8a Bug 1249212 part 7 - Calculate the endTime in GetComputedTimingAt; r=boris
Currently endTime is calculated when getComputedTiming() is called. As a
result, the value returned there doesn't necessarily reflect what we are using
in the model. It would be more simple, consistent and useful if we simply
calculate this as part of GetComputedTimingAt and use it both internally and in
the result to getComputedTiming().
2016-02-19 08:37:32 +09:00
Boris Chiou e436478f26 Bug 1244049 - Part 2: Replace nsCSSPseudoElements::Type with CSSPseudoElementType. r=dbaron
Also, try to use forward declaraions for CSSPseudoElementType;

--HG--
extra : rebase_source : c00eb9753e8f618a33aa711538ac45c0132b353c
2016-02-17 21:37:00 +01:00
Brian Birtles b47411b097 Bug 1240228 - Don't update an effect's timing when tweaking its animation's hold time; r=heycam
In some circumstances when composing style, we tweak the time of the animation
before telling the effect to compose style. This is to avoid visual flicker in
certain situations where the main thread progress is being synchronized with an
animation running on the compositor.

In the past, effects would store their latest sample time locally so when
tweaking the animation time, we would need to call UpdateEffect() after tweaking
the time, and then again after restoring it as otherwise the style composed by
the effect would not reflect the adjusted time.

Now, however, effect's always query their animation for the time so this is no
longer necessary. Furthermore, the actions triggered by UpdateEffect are not
desirable in this case because they can, amongst other things, cause the
associated EffectSet to be destroyed and recreated.

Specifically, Animation::UpdateEffect() calls
KeyframeEffectReadOnly::NotifyAnimationTimingUpdated() which:

  * Calls UpdateTargetRegistration which can trigger EffectSet
    destruction/creation which is undesirable in this case because we intend to
    restore whatever changes we make to the Animation's state and deleting and
    recreating the EffectSet will cause any pointers to it to dangle.

  * Cause us to possibly reset the "is running on compositor" status.
    This too is undesirable since we intend to restore the state of the
    Animation immediately after tweaking the hold time so we don't want to
    act as if any state has changed.

  * Similarly for marking the cascade as possibly needing an update or
    requesting a restyle.

In summary, all the actions performed by NotifyAnimationTimingUpdated are
unnecessary and undesirable in this situation where we are temporarily tweaking
an Animation's current time only to restore it immediately afterwards since the
actions are all involved with recognizing actual changes in state.
2016-01-19 08:05:08 +09:00
Hiroyuki Ikezoe 4c0263a3ed Bug 1096774 - Part 1: Implement Animation Constructor. r=birtles, r=smaug 2016-01-16 19:02:00 -05:00
Boris Chiou deee95a0d8 Bug 1214536 - Part 7: Rename AnimationTiming as TimingParams. r=birtles, r=smaug
1. struct AnimationTiming -> struct TimingParams
2. AnimationEffectReadOnly::TimingAsObject() -> AnimationEffectReadOnly::Timing()
3. KeyframeEffectReadOnly::Timing() -> KeyframeEffectReadOnly::SpecifiedTiming()
2016-01-13 18:41:00 +01:00
Brian Birtles 02e4c93ce9 Bug 1234095 - Rework sorting to handle to script-generated animations; r=heycam 2016-01-14 10:24:24 +09:00
Brian Birtles 2a70c0a477 Bug 1232577 part 12 - Move the remainder of RequestRestyle from AnimationCollection to EffectCompositor; r=heycam
This also allows us to remove all references to AnimationCollection and the
animation managers from Animation.
2016-01-13 07:54:54 +09:00
Brian Birtles b29e0fc6c2 Bug 1232577 part 10 - Remove AnimationCollection::mStyleChanging; r=heycam
This flag is no longer needed because in bug 1232563 we introduced a more
thorough optimization that detects when the animation is not changing by
comparing the progress value between samples and avoids requesting restyles
when it does not change.
2016-01-13 07:54:54 +09:00
Brian Birtles 03057136c3 Bug 1232577 part 3 - Move RestyleType to EffectCompositor; r=heycam
This is in preparation for moving RequestRestyle to EffectCompositor (and
because we'll run into compile issues if we don't since AnimationCommon.h
includes too many interdependent definitions).
2016-01-13 07:54:53 +09:00
N.Shimizu 9c1354440b Bug 1179627 - Part 1: Implement Animation.id. r=smaug, r=birtles 2016-01-08 03:17:00 -05:00
Brian Birtles 55c934a957 Bug 1232563 part 2 - Move RequestRestyle calls to the effect; r=heycam
--HG--
extra : rebase_source : 40d014f1ab978534a172545b33d3f9c7d1a56395
2016-01-06 11:04:06 +09:00
Brian Birtles d0ad270eef Bug 1232563 part 1 - Request a layer update if an animation is newly finished; r=heycam
When requesting restyles we take special care to detect when an animation has
newly finished so we perform the necessary restyle to represent the fill state.
However, we should really explicitly pull the animation off the layer at this
point by requesting a layer update. (That is, when an animation is
newly-finished we should use RestyleType::Layer instead of
RestyleType::Standard. Currently we just use RestyleType::Standard.)

In this bug we plan to move restyle requests down to the effect (since it is
the *effect* that is restyled). However, only the Animation has the notion of
"finished" or not so we detect this particular case in the Animation and
request the layer update there. We already request layer updates in the
Animation for other situations such as pausing so doing *layer* updates in the
Animation and regular restyles in the effect is not inconsistent.

This patch also tweaks test_animations_omta.html since it was previously
erroneously testing that a finished animation was still running on the
compositor.

--HG--
extra : rebase_source : 3cd1abe2a10370e90cde64b4b42b27326082f6f0
2016-01-06 11:04:06 +09:00
Brian Birtles f82ce867cf Bug 1226118 part 12b - Rename CommonAnimationManager::GetAnimations to GetAnimationCollection; r=dholbert
This is to align with the existing GetAnimationCollection method that takes
a frame. Also, by making this name more specific hopefully it will be used less
since we are trying to move as much code as possible over to using EffectSet
instead of AnimationCollection.
2015-12-04 08:34:17 +09:00
Brian Birtles 4f3db8cf45 Bug 1225699 part 3 - Register and unregister effects with elements; r=smaug, r=heycam 2015-11-26 16:53:53 +09:00
Hiroyuki Ikezoe 1e734eff34 Bug 1223255 - Use Animation::AnimationTimeToTimeStamp instead of timeline->ToTimeStamp. r=bbirtles
Otherwise delay value is multiplied by playbackRate twice.

--HG--
extra : rebase_source : 42b088e65c2ce3986bc36fa1c41a06e38f1c133a
2015-11-18 01:50:00 +01:00
Olli Pettay f50a8c0983 Bug 1223445 - KeyframeEffectReadOnly objects end up keeping lots of other objects alive too long, r=birtles
--HG--
extra : rebase_source : df6828ce26e22e53b632f25952fd1741a693c36a
2015-11-16 19:44:55 +02:00
Hiroyuki Ikezoe ac66eb2736 Bug 1216030 - Part 14: Add KeyframeEffectReadOnly::GetPresContext and KeyframeEffectReadonly::GetRenderedDocument. r=bbirtles 2015-11-06 02:51:00 +01:00
Hiroyuki Ikezoe 6f7b96040d Bug 1216030 - Part 8.5: Animation::CanThrottle() should check that all animation properties are running on compositor. r=bbirtles
If this patch (and part 9) is an overkill to throttle animations having both
of properties, one can be run on compositor and another can not be, a test
case in test_running_on_compositor[1] will fail.
The test case is for an animation which has transform and background-color
properties.

Animation::CanThrottle() returns true
  (then, AnimationCollection::CanPerformOnCompositorThread() returns false)
  on current trunk in the test case.
Animation::CanThrottle() returns false with this patch in the test case.

If the test passes, it proves the transform animation is running on compositor
in both cases.

[1] http://hg.mozilla.org/mozilla-central/file/6c7c983bce46/dom/animation/test/chrome/test_running_on_compositor.html#l77
2015-11-06 02:49:00 +01:00
Brian Birtles 67a7daaa2f Bug 1216846 - Don't update hold time when completing a pause if it is already set; r=heycam
The Animation.pause() method operates asynchronously since, if the animation is
currently running on the compositor, we should wait for the animation to stop
on the compositor before establishing the pause time. Otherwise, if the
compositor is ahead of the main thread and we use the main thread's notion of
the current time to establish the pause time, the animation will jump backwards
when we take it off the compositor.

This pause time is represented using the "hold time".

However, when we have a finished animation, its current time is not advancing
but rather its current time is fixed to its end time. This too is represented
using the hold time. As a result, if we pause a finished animation we should
not update its hold time (by calculating the current time from the start time)
but just continue to use the existing hold time. This is true of any other
situation where we might have set the hold time before or during pausing.
2015-11-02 08:33:58 +09:00
Brian Birtles b4f581b39f Bug 1194639 part 8 - Report changes from calling pause() to animation mutation observers; r=heycam 2015-10-22 15:16:18 +09:00
Brian Birtles b860019be5 Bug 1194639 part 7 - Report changes from calling play() to animation mutation observers; r=heycam 2015-10-22 15:16:18 +09:00
Brian Birtles dc867a5d59 Bug 1194639 part 6 - Report changes from calling finish() to animation mutation observers; r=heycam 2015-10-22 15:16:18 +09:00
Brian Birtles ea0acf6dda Bug 1194639 part 5 - Report changes from calling reverse() to animation mutation observers; r=heycam 2015-10-22 15:16:18 +09:00
Brian Birtles 1dac94b623 Bug 1194639 part 4 - Report changes to currentTime to animation mutation observers; r=heycam 2015-10-22 15:16:18 +09:00
Brian Birtles 66cb8a4081 Bug 1194639 part 3 - Report changes to startTime to animation mutation observers; r=heycam 2015-10-22 15:16:18 +09:00
Brian Birtles eab83a05b4 Bug 1194639 part 2 - Report changes to playbackRate to animation mutation observers; r=heycam 2015-10-22 15:16:18 +09:00
Brian Birtles 5d800ef88f Bug 1194639 part 1 - Add AutoMutationBatchForAnimation; r=heycam 2015-10-22 15:16:18 +09:00
Nathan Froyd 01583602a9 Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat
The bulk of this commit was generated with a script, executed at the top
level of a typical source code checkout.  The only non-machine-generated
part was modifying MFBT's moz.build to reflect the new naming.

CLOSED TREE makes big refactorings like this a piece of cake.

 # The main substitution.
find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    xargs perl -p -i -e '
 s/nsRefPtr\.h/RefPtr\.h/g; # handle includes
 s/nsRefPtr ?</RefPtr</g;   # handle declarations and variables
'

 # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h.
perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h

 # Handle nsRefPtr.h itself, a couple places that define constructors
 # from nsRefPtr, and code generators specially.  We do this here, rather
 # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename
 # things like nsRefPtrHashtable.
perl -p -i -e 's/nsRefPtr/RefPtr/g' \
     mfbt/nsRefPtr.h \
     xpcom/glue/nsCOMPtr.h \
     xpcom/base/OwningNonNull.h \
     ipc/ipdl/ipdl/lower.py \
     ipc/ipdl/ipdl/builtin.py \
     dom/bindings/Codegen.py \
     python/lldbutils/lldbutils/utils.py

 # In our indiscriminate substitution above, we renamed
 # nsRefPtrGetterAddRefs, the class behind getter_AddRefs.  Fix that up.
find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \
    xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g'

if [ -d .git ]; then
    git mv mfbt/nsRefPtr.h mfbt/RefPtr.h
else
    hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h
fi

--HG--
rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 01:24:48 -04:00
Brian Birtles 6b03b4a52f Bug 1208938 part 3 - Update pending finishing handling; r=heycam
Animation::Tick contains special handling to cope with pending ready times
that are in the future. This was originally introduced to cope with the
situation where we are called multiple times per refresh-driver tick.

As of bug 1195180, Animation::Tick should no longer be called multiple
times per refresh driver tick. It would seem, therefore, that we no longer
need to check for a future time. However, since introducing this check, the
vsync refresh driver timer has been added which means that we can still have
a recorded time from TimeStamp::Now that is ahead of the vsync time used to
update the refresh driver. In that case, however, rather than waiting for the
next tick, we should simply clamp that pending ready time to the refresh driver
time and finish pending immediately.

This patch also updates one of the tests for reversing. With this updated
behavior we can sometimes arrive at a situation where when an Animation starts
and its ready promise resolves, its currentTime is still 0. If we call
reverse() at this point on an animation with an infinite active duration it
should throw an InvalidStateError. To avoid this situation, this test makes
sure we wait an extra frame before calling reverse().
2015-10-07 14:30:28 +09:00
Brian Birtles 0ea5e5c7c8 Bug 1208938 part 2 - Remove Animation::HasEndEventToQueue; r=heycam 2015-10-07 14:30:28 +09:00
Brian Birtles 9590e60a48 Bug 1208938 part 1 - Rename AnimationCollection::mNeedsRefreshes to mStyleChanging; r=heycam
This patch renames AnimationCollection::mNeedsRefreshes to indicate that it
no longer has any relationship to whether or not we observe the refresh driver.
2015-09-17 15:43:15 +09:00
Brian Birtles ad657213b1 Bug 1208385 part 2 - Remove stored parent time from KeyframeEffectReadOnly and get the time directly from the owning animation; r=heycam 2015-10-07 14:30:28 +09:00
Brian Birtles d89f0d836b Bug 1208385 part 1 - Store a pointer to the owning animation on each KeyframeEffect; r=heycam
We need to do this so effects can query their owning animation for the current
time and avoid falling out of sync. Furthermore, this pointer is needed
for a number of other bugs (e.g. bug 1166500 comment 12, or bug 1190235)
anyway.
2015-10-07 14:30:27 +09:00
Brian Birtles 08a8534ec0 Bug 1208385 part 0 - Fix up some references to Web Animations spec; r=heycam 2015-10-07 14:30:27 +09:00
Brian Birtles 16b5c82dc9 Bug 1207951 - Fix buggy logic in ComposeStyle; r=heycam 2015-09-28 12:38:41 +09:00
Brian Birtles ae189d2746 Bug 1195180 part 6 - Lazily remove animations from timelines; r=heycam
Now that DocumentTimeline observes the refresh driver we can use regular
ticks to remove unnecessary animations.

We do this because in a subsequent patch, in order to provide deterministic
enumeration order when ticking animations, we will store animations in an array.
Removing an arbitrary element from an nsTArray is O(n) since we have to search
for the array index first, or O(log n) if we keep the array sorted. If we
destroy a subtree containing n animations, the operation effectively becomes
O(n^2), or, if we keep the array sorted, O(n log n). By destroying during a
tick when we are already iterating over the array, however, we will be able
to do this much more efficiently.

Whether an animation is newly associated with a timeline, or is disassociated
from a timeline, or if it merely has its timing updated, the behavior
implemented in this patch is to simply make sure we are observing the refresh
driver and deal with the animation on the next tick.

It might seem that we could be a lot more clever about this and, for example, if
an animation reports NeedsTicks() == false, not start observing the refresh
driver. There are various edge cases however that need to be taken into account.
For example, if a CSS animation is finished (IsRelevant() == false so that
animation will have been removed from the timeline), and paused
(NeedsTicks() == false), and we seek it back to the point where it is relevant
again, we actually need to observe the refresh driver so that it can dispatch an
animationstart event on the next tick. A test case in a subsequent patch tests
this specific situation.

We could possibly add logic to detect if we need to fire events on the next tick
but the complexity does not seem warranted given that even if we unnecessarily
start observing the refresh driver, we will stop watching it on the next tick.

This patch removes some rather lengthy comments from
AnimationTiming::UpdateTiming. This is, in part, because of the behavior
described above that makes these comments no longer relevant. Other parts are
removed because the Web Animations specification has been updated such that a
timeline becoming inactive now pauses the animation[1] so that the issue
regarding detecting timelines becoming active/inactive no longer applies
since animations attached to an inactive timeline remain "relevant".

[1] https://w3c.github.io/web-animations/#responding-to-a-newly-inactive-timeline
2015-09-28 12:38:41 +09:00
Hiroyuki Ikezoe 41ec8da9f3 Bug 1151694 - Part 3: Manage mIsRunningOnCompositor flags for each properties respectively. r=bbirtles
--HG--
extra : rebase_source : d189d779ef14e8ae5497b03b01e3d4d994803fe1
2015-09-16 16:05:00 +02:00
Brian Birtles 8bf9ca19e0 Bug 1183461 part 3 - Add Animation::AnimationTimeToTimeStamp; r=heycam
This patch adds a utility method to Animation which takes a time in the
same time space as "current time", i.e. "animation time" and convert it to
a TimeStamp. Subsequent patches in this series will use this method to
take the time when an event was scheduled to occur and convert it to a
TimeStamp so it can be compared with other event times. This allows us to
dispatch events in the order they would have fired given an infinitely
frequent sample rate.

--HG--
extra : rebase_source : 0b4f98b932bb2751bac24b4383fe20613176f0c4
2015-09-15 14:04:08 +09:00
Brian Birtles 25e9bf79fe Bug 1203009 part 4 - Implement new composite ordering; r=heycam 2015-09-15 11:20:56 +09:00
Brian Birtles 3d0a063444 Bug 1203009 part 1 - Rename sequence number to animation index; r=heycam
The Web Animations specification has replaced the term "sequence number" with
references to a global animation list. This patch applies similar naming
to our animation structures.
2015-09-15 11:20:26 +09:00
Brian Birtles a362d9f14e Bug 1194037 part 3 - Add Animation::HasEndEventToQueue(); r=dholbert
We currently determine if we need refresh driver ticks when composing style
but sometimes we might not need ticks for composing style but we might need
one more tick in order to queue a final end event. Currently, this doesn't
seem to be a problem because FlushAnimations calls Animation::Tick where we
queue up events. When we remove the call to Animation::Tick from
FlushAnimations in order to make FlushAnimations purely responsible for
posting restyles, however, we will create a situation where we might mark an
animation collection as no longer needing refreshes and not simultaneously
queueing the corresponding event. If another animation collection is deleted in
the meantime we may trigger the code that causes us to disassociate from the
refresh driver and the corresponding event will never be dispatched.

Long-term (bug 1195180) we will check if it we can stop observing the refresh
driver and queue events in the same step. Until then, this patch adds a method
to detect this particular situation and uses it to avoid unregistering from
the refresh driver while we still have end events to queue.
2015-08-31 16:21:55 +09:00
Hiroyuki Ikezoe 56f8274c93 Bug 1194028 - Part 2: Use KeyFrameEffect SetTiming. r=bbirtles
Now KeyframeEffect.SetTiming() updates the owning animation timing and relavance, so
we don't need to call each methods respectively for the animation any more.
2015-08-18 03:57:00 -04:00
Hiroyuki Ikezoe a4077879ac Bug 1194028 - Part 1: Implement Animation NotifyEffectTimingUpdate and KeyframeEffect SetTiming. r=bbirtles 2015-08-17 14:28:00 -04:00
Brian Birtles 3cc3ae622c Bug 1188251 part 11 - Add RestyleType::Layer; r=dholbert
We currently have a series of methods that clobber various bits of animation
state to force animations on layers to be updated. This aligns closely with
the restyle code introduced in this patch series.

By re-using RequestRestyle when updating animations on layers, not only should
we be able to simplify the code somewhat but, in future, we should also be able
to have Animation objects use the same mechanism to update layers during
a regular tick.

For example, currently we have a bug where when an animation starts after
a delay with the same value as the backwards fill then we don't send the
animation to the compositor right away (see
https://dxr.mozilla.org/mozilla-central/rev/d6ea652c579992daa9041cc9718bb7c6abefbc91/layout/style/test/test_animations_omta.html#287).
By adding this Restyle::Layer value we should be able to fix that in future.
2015-08-18 16:11:55 +09:00
Brian Birtles 5715bb1092 Bug 1188251 part 9 - Request restyles from Animation::Tick; r=dholbert
In preparation for ultimately being able to run animations without a manager,
this patch moves the request restyle code from FlushAnimations to
Animation::Tick. (Ultimately most of this functionality should move to the
KeyframeEffect but for now Animation is fine.)
2015-08-18 16:11:55 +09:00
Brian Birtles 8ab108c3be Bug 1188251 part 8 - Remove call to Animation::Tick from CheckAnimationRule; r=dholbert
We want to move the newly-introduced RequestRestyle call from FlushAnimations
to Animation::Tick. However, nsAnimationManager::CheckAnimationRule calls
Animation::Tick so this would cause us to start posting animation restyles
within a restyle.

Typically, Animations have an effect (currently there is only one type of
effect: KeyframeEffectReadOnly) and when there is any change in timing they
pass it down to their effect. However, the Animation is dependent on the
duration of the effect for determining if it is "finished" or not. As a result,
when an effect's timing changes, the owning Animation needs to know.

(The way this *should* work is that effects should tell their animation or
trigger some chain of events that causes animation's to update themselves.
However, the current implementation of effects is fairly primitive and does
not do this or even have a reference to the owning Animation. When we
implement the script API for updating the timing properties of effects we will
have to fix this but for now it is up to code in layout/style to update the
Animation when it touches the corresponding effect's timing.)

nsAnimationManager::CheckAnimationRule currently does this by calling
Animation::Tick() which ensures the Animation's finished state is updated
accordingly.

Ultimately we want to ensure that Animation::Tick is called exactly once per
frame (and at the appropriate point in that frame) so we'd like to remove this
call from CheckAnimationRule.

This patch achieves that by:

* Making Animation::SetEffect update the animation's timing - this is necessary
  for animations that are created by CheckAnimationRule and will be
  necessary when once we make Animation.effect writeable from script anyway.

* Calling Animation::SetEffect even for the case when we are updating the
  existing effect.

Another side-effect of calling Animation::Tick within
nsAnimationManager::CheckAnimationRule is that CSSAnimation::Tick queues
events. There are some tests (e.g. layout/style/test/test_animations.html) that
assume that animationstart events are dispatched immediately when new
animations are created. That will change with bug 1134163 but for now we
should maintain this existing behavior since changing this might introduce
compatibility issues that are best dealt with as a separate bug rather than
blocking this refactoring. To that end, this patch also explicitly queues
animationstart events for newly-created animations.
2015-08-17 13:59:45 +09:00
Brian Birtles 1b304dcec6 Bug 1181392 part 10 - Remove KeyframeEffect::IsFinishedTransition; r=dbaron 2015-08-07 12:29:36 +09:00
Brian Birtles 4561c8eda3 Bug 1181392 part 2 - Remove use of IsFinishedTransition from Animation::ComposeStyle; r=dbaron
Animation::ComposeStyle uses IsFinishedTransition to skip doing work for
transitions that have run their course. We can, however, generalize this to
cover all animations that are not currently contributing to the animated
style--that is animations that are not "in effect".

We need to add this check *after* we update aNeedsRefreshes since an animation
that is not "in effect" because it has a delay and no backwards fill (in this
case it will have a play state of "running") still needs refreshes.
2015-08-07 12:29:35 +09:00
Brian Birtles 78f8287b7d Bug 1181392 part 1 - Remove use of IsFinishedTransition from Animation::CanThrottle; r=dbaron
Previously we used IsFinishedTransition so that if the only animations present
are finished transitions we could throttle the tick. In fact, this probably
shouldn't even be necessary since we shouldn't be calling CanThrottle if
AnimationCollection::mNeedsRefreshes is false. However, so long as we're
performing this test it turns out we can generalize this further and throttle
ticks for all finished animations that are not newly finished, regardless of
whether they are running on the compositor or not (although this method won't
be called unless the animation property could be run on the compositor anyway).

This method is somewhat confusing. For one, it is not strictly limited to
animations that are running on the compositor. It appears to only return true
when the animation is running on the compositor but the mIsRunningOnCompositor
flag doesn't get cleared when the animation finishes (bug 1151694). As a result
this method also deals with animations that are now running on the main thread.
This patch makes us deal with such animations more consistently.

This patch also reworks this method so that it's hopefully a little easier to
follow and a little more consistent since I spent several hours trying to
understand the different combinations of inputs this method could take and what
question it was trying to answer.
2015-08-07 12:29:35 +09:00
Brian Birtles 774abfc8fe Bug 1180125 part 2 - Move AnimationCommon classes out of CSS namespace; r=dbaron
The long-term plan is to drop the mozilla::css namespace altogether. Before we
go to much further with refactoring code in AnimationCommon, we should drop
usage of the mozilla::css namespace. Specifically, this patch moves the
CommonAnimationManager and AnimValuesStyleRule classes to the mozilla namespace.
2015-07-29 10:57:39 +09:00
Hiroyuki Ikezoe 5119cec74f Bug 1178664 - Part 4 -Implement Animation.oncancel event. r=bbirtles, r=smaug
--HG--
extra : rebase_source : 2885fc984f652ecd086b9ec4f9b57190375c965c
2015-07-30 23:26:00 +02:00
Hiroyuki Ikezoe 189c64b196 Bug 1178664 - Part 3 - Implement Animation.onfinish event. r=bbirtles, r=smaug
--HG--
extra : rebase_source : d78f3a6d58f26a46dfdd726f30590bc8a4e9137d
2015-07-30 23:25:00 +02:00
Hiroyuki Ikezoe d2e5ec96d8 Bug 1178664 - Part 1 - Make Animation interface EventTarget inheritance. r=smaug
--HG--
extra : rebase_source : e182dc4757a19ec4e55e4e3d9d7a893a190929cf
2015-07-30 23:23:00 +02:00
Hiroyuki Ikezoe 77aabfc80f Bug 1178665 - Part 3: Make finish notifications asynchronously in most cases. r=bbirtles, r=smaug 2015-07-29 23:21:00 +02:00
Hiroyuki Ikezoe 95ecbd9979 Bug 1178665 - Part 2 - Adapt to latest Animation.finish procedure changes. r=bbirtles
ee99cc4db5
2015-07-14 21:45:00 +02:00
Carsten "Tomcat" Book c86b8ab1b4 Backed out changeset a4fb4e4b1c8b (bug 1180125) 2015-07-29 17:32:19 +02:00
Brian Birtles 9b391b0177 Bug 1180125 part 2 - Move AnimationCommon classes out of CSS namespace; r=dbaron
The long-term plan is to drop the mozilla::css namespace altogether. Before we
go to much further with refactoring code in AnimationCommon, we should drop
usage of the mozilla::css namespace. Specifically, this patch moves the
CommonAnimationManager and AnimValuesStyleRule classes to the mozilla namespace.
2015-07-29 10:57:39 +09:00
Hiroyuki Ikezoe 3c7a785930 Bug 1186684 - Remove unused ErrorResult in Animation::SetPlaybackRate/SilentlySetPlaybackRate. r=bbirtles 2015-07-23 02:55:00 -04:00
Hiroyuki Ikezoe d097a2d673 Bug 1150808 - Implement Animation.reverse(). r=smaug r=birtles
--HG--
extra : rebase_source : 593ef5ed090d016260f6ca07008ff036effe7fd6
2015-07-09 22:54:00 +02:00
Brian Birtles 918f55389f Bug 1150810 part 15 - Add a comment about need to store more than just relevant animations; r=jwatt
We'll likely address this as part of bug 1151731 when we sample animations from
their timeline.

--HG--
extra : commitid : 9g00bBtDIue
extra : rebase_source : 12d9de2524eb3133bef5a5bcf4c84d4759ccbbca
2015-06-15 11:05:43 +09:00
Brian Birtles e725d9bdb4 Bug 1150810 part 9 - Add relevant animations to timeline; r=jwatt
We only store relevant animations on the timeline. Relevant animations are
any animations that are running or yet to run ("current animations") or
which have finished but are still applying a fill mode ("in effect animations").

AnimationTimeline.getAnimations() only ever returns relevant animations so
this is the minimum set we need to keep track of. Keeping track of any more
than this would prevent us from garbage-collecting any no longer relevant
animations since we keep a strong reference to this animations.

The reason we keep a strong reference is that if an animation is attached to
a timeline, even if there are no references to it from script or markup it
needs to be kept alive in order to dispatch events or resolve promises. An
irrelevant animation however is not going to do either of these things without
outside intervention so we don't need to keep it alive.

--HG--
extra : commitid : WLEUccOqAk
extra : rebase_source : 5c3c987d6c95ca7072c6178349dc113d2f1e5053
2015-06-15 11:05:43 +09:00
Brian Birtles 5550db670f Bug 1150810 part 7 - Add Animation::SetTimeline; r=jwatt
--HG--
extra : commitid : 3QENfb2DzCC
extra : rebase_source : 4928061558e689ae40d0976b9dd13e480279c2d1
2015-04-28 17:21:58 +09:00
Brian Birtles 4159c4a595 Bug 1150810 part 5 - Handle Timeline() returning null; r=jwatt
--HG--
extra : commitid : K6pABHL7QRC
extra : rebase_source : ba96781d897d28db1d2db83f73ce8c31b89638cd
2015-04-28 12:49:12 +09:00
Brian Birtles 6d3dd1a595 Bug 1150810 part 4 - Store global on Animation; r=smaug, jwatt
The connection between an Animation and an AnimationTimeline is optional. That
is, it is possible to have an Animation without an AnimationTimeline. Until now
we have often just assumed the timeline will be set but eventually we need to
support the possibility of the timeline being null. Indeed, later in this patch
series we will set the timeline out-of-band (i.e. not in the constructor) using
SetTimeline which opens up the possibility that timeline will be null for
a period of time.

This patch paves the way for having an optional timeline by storing the global
used for, e.g. creating promises, on the Animation object itself.

--HG--
extra : commitid : Ew9Zp4t36lV
extra : rebase_source : 16c9de9525a3562ff10e41fdf1602384a4e366e3
2015-04-28 15:48:35 +09:00
Brian Birtles 05e324909f Bug 1150810 part 3 - Make IsPossiblyOrphanedPendingAnimation return true when there is no rendered doc; r=jwatt
This appears to be an existing bug.

--HG--
extra : commitid : J01Q6OEDc4a
extra : rebase_source : 7909db0844890e151a0e440a030cf95a6d00a1f9
2015-04-28 15:47:45 +09:00
Brian Birtles cd770f1b4b Bug 1150810 part 2 - Replace references to DocumentTimeline with AnimationTimeline; r=jwatt
This is needed not only for supporting other kinds of timelines, but also for
when we come to implement SetTimeline(AnimationTimeline* aTimeline).

--HG--
extra : commitid : B836jCSbgNL
extra : rebase_source : 2592e66b2a9009f85ec0189ebecf5dba3c9bf8e0
2015-04-28 11:29:13 +09:00
Brian Birtles 1926b13212 Bug 1150810 part 1 - Move DocumentTimeline methods up to AnimationTimeline; r=jwatt
This is not strictly necessary yet but we will want to implement methods
like GetAnimations() on the base class, AnimationTimeline, so we may as well do
that now rather than adding that code to DocumentTimeline and moving it later.

--HG--
extra : commitid : 7GU6Dr9lnPO
extra : rebase_source : d5e788874c72c422b57efbdb81404c79df6d505b
2015-04-28 11:17:10 +09:00
Brian Birtles 855752164f Bug 1171817 part 8 - Override sequence numbers for CSS animations; r=dbaron
This patch re-uses Animation::mSequenceNum to store the index of CSS animations
within their corresponding animation-name property. When the animation is
removed from an animation-name property it reverts to using the default
animation composite order.

This patch also updates Animation::DoCancel to call UpdateTiming instead of
UpdateEffect. This is because UpdateTiming is responsible for updating the
sequence number (when custom composite order is not in effect). When we remove
an animation from animation-name it will be cancelled and at that point we
expect its sequence number to be cleared which will only happen if
UpdateTiming gets called.

--HG--
extra : commitid : 2KrTezItH3q
extra : rebase_source : 50de87465deef85558ca50de5e6286f7b5603051
2015-06-09 11:13:54 +09:00
Brian Birtles 9836323890 Bug 1171817 part 7 - Add Animation::IsUsingCustomCompositeOrder; r=dbaron
Add a virtual method we can use to determine when an animation is having its
sequence number set by some other mechanism than the general logic
defined for animations.

This allows CSS animations and transitions to re-use the sequence number for
their own purposes. Typically what will happen is something like this:

1. A CSSAnimation is created corresponding to an item in the animation-name
   property.

   At this point CSSAnimation::IsUsingCustomCompositeOrder() will return true
   and nsAnimationManager will set the sequence number based on the position of
   the animation in animation-name.

2. If at a later point the animation is removed from the animation-name but kept
   alive by script, CSSAnimation::CancelFromStyle will be called which will
   clear the custom sequence number (i.e. set it to kUnsequenced) and also
   update the CSSAnimation's state such as
   CSSAnimation::IsUsingCustomCompositeOrder() returns false.

3. Then, then the CSSAnimation next transitions out of the idle state it will
   have its sequence number set just like any other Animation and be ordered
   like any other Animation (since we can no longer use animation-name to
   determine its composite order).

This behavior is added in subsequent patches in this series (and likewise for
CSS transitions too).

--HG--
extra : commitid : B8nPFXzQMfF
extra : rebase_source : 42439fb1dd32a789e270dc0c51af2c660f4593eb
2015-06-09 11:13:54 +09:00
Brian Birtles ddc1552c4a Bug 1171817 part 6 - Add Animation::HasLowerCompositeOrderThan; r=dbaron
This patch introduces a method that will be used for sorting animations based on
their composite order. The method is based on the API for Comparator objects (as
used by nsTArray and co.) which have a LessThan method. (For the
Comparator::Equals method we can used pointer equality since no two independent
objects should have equal composite order.)

--HG--
extra : commitid : 88oD4UFx5to
extra : rebase_source : 1b30272451c189161a08efac3da48d72e10d8e52
2015-06-09 11:13:53 +09:00
Brian Birtles f4bdb4f46c Bug 1171817 part 5 - Add a sequence number member to Animations; r=dbaron
Web Animations defines Animations as having a globally unique sequence number
for the purpose of prioritization:

  http://w3c.github.io/web-animations/#animation-sequence-number

As of the writing of this patch, the spec says the sequence number is updated
when the Animation is created. This is problematic and I have proposed that
actually this should be updated from each transition from idle:

  https://lists.w3.org/Archives/Public/public-fx/2015AprJun/0054.html

This doesn't seem to have met any opposition so I will update the spec to
reflect this soon.

This patch implements the behavior of updating the sequence number on each
transition from idle.

To make sure we perform this on each change to timing this patch removes
a couple of instances of early returns to ensure that UpdateTiming is called.

The current maximum sequence number is simply a class static and we make no
attempt to deal with wraparound. This is because we only update this number when
an animation transitions from idle which only happens when an animation is
created or script calls cancel() followed by play() on the animation. Supposing
that across all content this happenned an unlikely 1 billion times a second we
still wouldn't exhaust the range of the unsigned 64-bit int for about 585 years.

We'd like to make kUnsequenced be zero and make the static represent the
current maximum. This would probably be easier to understand and recognize in
a debugger. However, later in this patch series we will make CSS animations and
CSS transitions override this sequencing behavior. If we define kUnsequenced
to be zero and they accidentally assign zero as an actual sequence number then
they'll run into trouble. To avoid that we set kUnsequenced to UINT64_MAX.

--HG--
extra : commitid : DMw8uKjg4Hz
extra : rebase_source : 9e98b3346f0297efce3ecfa0b2dd8a9c13075dca
2015-06-09 11:13:53 +09:00
Brian Birtles e1ae8c1a56 Bug 1171817 part 1 - Cancel animations when destroying the property holding them; r=dbaron
Prior to this patch we cancel animations in AnimationCollection::Destroy but
this is not called automatically when the property holding the collection is
destroyed via its destructor. When an element is unbound from the tree we
destroy its animation properties but don't call AnimationCollection::Destroy.
This means, that in such circumstances:

* We won't create animation mutation records for the removed animations
* Once we start registering animations with a timeline they won't have a
  chance to remove themselves from the timeline (meaning
  document.timeline.getAnimations()) will keep returning them
* Once we go to implement the animationcancel and transitioncancel events we
  won't fire them in this case (assuming we implement the queueing/dispatch of
  those events as part of the cancel code)

This patch addresses this by moving the call to cancel each animations to the
property destructor for the animation properties.

We do this first so we can land this change separately to ease bisecting any
regressions it might trigger.

--HG--
extra : commitid : KzukSO91RMH
extra : rebase_source : 54ed2aeb69d8bceca424c70c7f33d4bf92d54546
2015-06-09 11:13:53 +09:00
Brian Birtles e293c228f5 Bug 1166164 part 6 - Make pausing from idle set the current time; r=jwatt, r=smaug
As proposed:

  https://lists.w3.org/Archives/Public/public-fx/2015AprJun/0013.html (item g)

And agreed upon here:

  https://lists.w3.org/Archives/Public/public-fx/2015AprJun/0031.html

--HG--
extra : rebase_source : baca2fa6b9ba94afb1bb3e072e33729774a34f19
extra : histedit_source : 8348f3e8029017dbe380e30dbfc2f66b201beaf0
2015-05-19 14:55:26 +09:00
Brian Birtles f73f30be29 Bug 1166164 part 5 - Make play() throw when it should seek to the end of an infinite effect; r=jwatt, r=smaug
--HG--
extra : rebase_source : dade110e0d071727ed5bfdb694415ae7980f4467
extra : histedit_source : 1d87ee7db7fd0ec9670fff546e4654fa07bf4f31
2015-05-19 14:00:48 +09:00
Brian Birtles 6198ebeea8 Bug 1166164 part 4 - Make finished promise not resolve when paused; r=jwatt
As resolved, https://lists.w3.org/Archives/Public/public-fx/2015AprJun/0038.html
item 2.

--HG--
extra : rebase_source : 9f321446c9cd9ac4dcdefa4ca441ac8f3e76fc8f
2015-05-19 08:51:13 +09:00
Brian Birtles 152d424f77 Bug 1166164 part 3 - Resolve start time on finish(); r=jwatt
We have already resolved to make calling Finish() clear the pause state (see
https://lists.w3.org/Archives/Public/public-fx/2015AprJun/0038.html, item 2).
Doing that involves resolving the start time when the animation is paused.

Furthermore, as a separate change, we resolved to make the finished promise not
resolve when the animation is paused. That suggests making UpdateFinishedState()
only resolve the finished promise when PlayState() == Finished rather than using
IsFinished() which returns true even if the animation is paused.

However, if we compare PlayState() == Finished in UpdateFinishedState() then we
will *not* resolve the finished promise when the animation is play-pending since
PlayState() == Pending in that case (pause-pending is ok since the call to
SetCurrentTime will cause a transition to the Paused state). Furthermore, the
existing call to cancel the pending play task will effectively leave this
animation forever pending. Hence, in this patch we unconditionally fill in the
start time.

--HG--
extra : rebase_source : 499ad0530eac0ee62c8ed2df41360c45abc34816
2015-05-19 10:08:46 +09:00
Brian Birtles f28d7941d9 Bug 1166164 part 2 - Make UpdateFinishedState take a non-defaulted enum; r=jwatt
This is much easier to read at call sites and prevents accidentally using the
default value when another value might be more suitable.

--HG--
extra : rebase_source : b1c05d8bf7b97744e53f2ecc676561f3a4a80888
2015-05-11 17:17:06 +09:00
Brian Birtles cd4f9730c1 Bug 1166164 part 1 - Make setting the current time complete a pending pause, not abort it; r=jwatt
The point of making pausing async is to allow time to sync up the current time
with the compositor. Setting the current time manually should simply force it to
the specified time and complete the pause action, not abort it. (We do a similar
thing for a pending play. For a pending play we're waiting to establish
a suitable start time. Manually setting the start time in that case simply
forces the start time to the specified time and completes the play operation.)

--HG--
extra : rebase_source : 614ed9ef01204e4137783c0d48e975eb8febbe2a
2015-05-18 11:41:19 +09:00
Brian Birtles 3947001236 Bug 1161320 - Fix conflict between finishing and aborting a pause; r=jwatt
Animation::ResumeAt contains an assertion that, when we exit the play-pending
state, checks we either have a resolved start time or a resolved hold time.

That's normally true but if we are aborting a pause on animation that is
finished we can end up with a resolved start time (since we don't clear the
start time when we're aborting a pause) and a resolved hold time (either
because the regular finishing behavior set one, or, because play() applied
auto-rewinding behavior and set it).

In that case we should actually respect the hold time and update the start time
when resuming the animation. However, ResumeAt won't update the start time if it
is already set.

This patch fixes that by clearing the start time in DoPlay in the case where we
are aborting a pause and have a hold time.

--HG--
extra : rebase_source : 83f980d6cbc34375274f30f6527992b4fec7f639
2015-05-08 16:17:13 +09:00
Andrew McCreight 023db96fd8 Bug 1152551, part 3 - Fix more mode lines in dom/. r=jst 2015-05-03 15:32:37 -04:00
Brian Birtles a606228cd8 Bug 1159082 - Rename *Readonly animation interfaces to *ReadOnly. r=smaug 2015-04-30 09:06:43 -04:00
Carsten "Tomcat" Book b05d97c166 Backed out changeset 1b5fc672f0d4 (bug 1159082) for B2G ICS Emulator opt R6 test failures on a CLOSED TREE
--HG--
rename : dom/animation/AnimationEffectReadOnly.cpp => dom/animation/AnimationEffectReadonly.cpp
rename : dom/animation/AnimationEffectReadOnly.h => dom/animation/AnimationEffectReadonly.h
rename : dom/webidl/AnimationEffectReadOnly.webidl => dom/webidl/AnimationEffectReadonly.webidl
2015-04-30 13:15:04 +02:00
Brian Birtles 4fb166f6b2 Bug 1159082 - Rename *Readonly animation interfaces to *ReadOnly; r=smaug
--HG--
rename : dom/animation/AnimationEffectReadonly.cpp => dom/animation/AnimationEffectReadOnly.cpp
rename : dom/animation/AnimationEffectReadonly.h => dom/animation/AnimationEffectReadOnly.h
rename : dom/webidl/AnimationEffectReadonly.webidl => dom/webidl/AnimationEffectReadOnly.webidl
extra : rebase_source : 5fb31684bf494a57e208d0cfbbc76f65b502fc0e
2015-04-28 10:16:45 +09:00
Brian Birtles fb3e1108d4 Bug 1157989 part 2 - Make Silently* methods protected; r=jwatt
These methods aren't part of the public API.
2015-04-27 10:05:46 +09:00
Brian Birtles 9104378d5d Bug 1157989 part 1 - Line up methods in dom/animation/Animation with the API; r=jwatt 2015-04-27 10:05:46 +09:00
Brian Birtles 219be8ace6 Bug 1157111 - Remove comment from SilentlySetCurrentTime; r=jwatt
The commented-out step has now been removed from the spec:

  34c2bc9272
2015-04-27 08:53:19 +09:00
Brian Birtles 012ebba32c Bug 1150807 part 3 - Call PostUpdate from Cancel; r=jwatt
This patch makes Cancel() call PostUpdate which clobbers certain state in style
so that animated style is correctly flushed when an animation is cancelled.

The main difficulty with this is that we *don't* want to call this when we're
cancelling an animation as a result of a style update or else we'll trigger
needless work. The pattern elsewhere has been to define a *FromStyle() method
for this case (e.g. CSSAnimation::PlayFromStyle, PauseFromStyle). This isn't
ideal because there's always the danger we will forget to call the appropriate
*FromStyle method. It is, however, consistent. Hopefully in bug 1151731 we'll
find a better way of expressing this.
2015-04-27 08:53:19 +09:00
Brian Birtles a4696386d6 Bug 1150807 part 1 - Fix SilentlySetCurrentTime to not set the start time when it is unresolved; r=jwatt
The reasoning for this change is described here:

  https://lists.w3.org/Archives/Public/public-fx/2015AprJun/0027.html

Furthermore, subsequent tests introduced in this bug for the animation playState
depend on this change.
2015-04-27 08:53:18 +09:00
Jonathan Watt 7646a6a26c Bug 1150064, part 1 - Implement the Animation.finish() method. r=birtles, r=smaug 2015-04-16 17:15:20 +01:00
Brian Birtles 13834006d7 Bug 1154615 part 6 - Rename references to players within layout/; r=jwatt
We will rename CSSAnimationPlayer/CSSTransitionPlayer in a separate patch
2015-04-21 10:22:10 +09:00
Brian Birtles 8f5fbac8a9 Bug 1154615 part 5 - Rename AnimationPlayerCollection to AnimationCollection; r=jwatt 2015-04-21 10:22:10 +09:00
Brian Birtles bd4c87f07a Bug 1154615 part 4 - Rename references to players in dom/animation; r=jwatt
This patch does not, however,  update references to
AnimationPlayerCollection/CSSTransitionPlayer etc. which we will fix when we get
to layout/style.
2015-04-21 10:22:09 +09:00
Brian Birtles 4f7bf25c27 Bug 1154615 part 2 - Rename PendingPlayerTracker to PendingAnimationTracker; r=jwatt
This patch also updates the method names on PendingAnimationTracker but leaves
a number of local variables which will be fixed in a subsequent patch.

--HG--
rename : dom/animation/PendingPlayerTracker.cpp => dom/animation/PendingAnimationTracker.cpp
rename : dom/animation/PendingPlayerTracker.h => dom/animation/PendingAnimationTracker.h
2015-04-21 10:22:09 +09:00
Brian Birtles 5c7929fd2a Bug 1154615 part 1 - Rename AnimationPlayer to Animation in WebIDL; r=smaug
This patch is a fairly minimal rename of the AnimationPlayer interface. It
leaves a bunch of local variables and helper classes still using the word
"player". These will be addressed in subsequent patches that don't require DOM
peer review.

--HG--
rename : dom/animation/AnimationPlayer.cpp => dom/animation/Animation.cpp
rename : dom/animation/AnimationPlayer.h => dom/animation/Animation.h
rename : dom/webidl/AnimationPlayer.webidl => dom/webidl/Animation.webidl
2015-04-21 10:22:09 +09:00
Brian Birtles 63e2382338 Bug 1153734 part 2 - Rename Animation to KeyframeEffectReadonly; r=smaug
We define KeyframeEffectReadonly in KeyframeEffect.cpp since Web Animations also
defines KeyframeEffect and when we come to implement that I expect we'll define
it in the same class, maybe even using the same object.

This patch also adds a few missing includes in places where
KeyframeEffectReadonly is used so that we're not just cargo-culting it in.

--HG--
rename : dom/animation/Animation.cpp => dom/animation/KeyframeEffect.cpp
rename : dom/animation/Animation.h => dom/animation/KeyframeEffect.h
rename : dom/animation/test/css-animations/test_animation-name.html => dom/animation/test/css-animations/test_effect-name.html
rename : dom/animation/test/css-animations/test_animation-target.html => dom/animation/test/css-animations/test_effect-target.html
rename : dom/animation/test/css-transitions/test_animation-name.html => dom/animation/test/css-transitions/test_effect-name.html
rename : dom/animation/test/css-transitions/test_animation-target.html => dom/animation/test/css-transitions/test_effect-target.html
rename : dom/webidl/Animation.webidl => dom/webidl/KeyframeEffect.webidl
2015-04-15 08:48:21 +09:00
Brian Birtles d5b5205359 Bug 1153734 part 1 - Remove AnimationEffect; r=smaug
Most of this is fairly obvious. However, the addition of 'override' to
ElementPropertyTransition::Name() is not strictly necessary. It was simply added
because while making these changes I accidentally dropped the 'virtual' keyword
from the method in the superclass and the compiler didn't complain. Adding this
will hopefully make it harder to create the same bug in the future.

--HG--
rename : dom/animation/test/css-animations/test_animation-effect-name.html => dom/animation/test/css-animations/test_animation-name.html
rename : dom/animation/test/css-transitions/test_animation-effect-name.html => dom/animation/test/css-transitions/test_animation-name.html
2015-04-15 08:48:20 +09:00
Markus Stange ab28a4f0c8 Bug 1151346 - Make ActiveLayerTracker::IsOffsetOrMarginStyleAnimated respect CSS animations. r=roc
--HG--
extra : rebase_source : a3594dcb2d8733b6f545c6cf713178ea0d953889
2015-04-05 22:53:51 -04:00
L. David Baron 1fe6a61ae9 Bug 847287 patch 12 - Check mWinsInCascade for all callers of GetAnimationOfProperty/HasAnimationOfProperty. r=birtles
This patch (after stepping through the call graph) affects the following
places:
 * CommonAnimationManager::GetAnimationsForCompositor, which is used
   only by nsDisplayListBuilder::AddAnimationsAndTransitionsToLayer,
   which already checks the individual animations (so really no change)
 * AnimationPlayerCollection::CanThrottleAnimation
 * ActiveLayerTracker::IsStyleAnimated
 * nsLayoutUtils::HasAnimationsForCompositor
 * nsLayoutUtils::HasAnimations (which is used only to check whether we
   can make the 0-opacity optimization)
I believe it makes sense to change all of these locations (although in
the long term we want to throttle (or similar) more animations).

Without this patch, I believe we're forcing the creation of an opacity
layer because we think we have animations to send to it.
2015-03-31 15:05:55 -07:00
Brian Birtles 43d8f02ab6 Bug 1109390 part 17 - Add Animation::IsInPlay(); r=jwatt
This patch adds a method for testing if an animation is "in play" which is
a term defined in the Web Animations spec. This is in preparation for removing
some slightly redundant code in IsRunning and aligning better with the spec.
2015-03-27 17:54:39 +09:00
Brian Birtles a7e4fac5e7 Bug 1109390 part 16 - Update IsCurrent to take a player parameter; r=jwatt
In preparation for introducing IsInPlay (where "in play" is a term in the Web
Animations spec), this patch aligns the existing IsCurrent with the definition
in the spec that says an animation effect is only current if it is attached
to an animation (player in our current naming) that is not finished. In order
to ensure that we need to pass the animation/player into the method.

This actually changes the behavior of IsCurrent since now we will return false
for animations that are finished. As far as I can tell, all the call sites that
are requesting current animations should only be concerned with animations that
are actually running. If not, they need to be adjusted to look for animations
that are either current or in effect.
2015-03-27 17:44:38 +09:00