gecko-dev/dom/animation
Brian Birtles 7806ce3d5d Bug 1226118 part 8 - Add EffectCompositor::GetAnimationsForCompositor that uses the EffectSet rather than AnimationCollection; r=dholbert
This added method should behave in an equivalent manner to the existing
CommonAnimationManager::GetAnimationsForCompositor except for the following
differences:

* It uses the EffectSet attached to a target element rather than one of the
  AnimationCollection object on the owning element.

* It returns an array of Animation objects consisting of only those Animations
  that actually have the specified property as opposed to the
  AnimationCollection consisting of *all* CSS animations or *all* CSS
  transitions for the element regardless of whether they run on the compositor
  or not.

It may not be obvious why these two methods otherwise behave in an equivalent
fashion so the following explains how the existing code is mirrored in the new
method.

The existing code is as follows:

> AnimationCollection*
> CommonAnimationManager::GetAnimationsForCompositor(const nsIFrame* aFrame,
>                                                    nsCSSProperty aProperty)
> {
>   AnimationCollection* collection = GetAnimationCollection(aFrame);
>   if (!collection ||
>       !collection->HasCurrentAnimationOfProperty(aProperty) ||
>       !collection->CanPerformOnCompositorThread(aFrame)) {
>     return nullptr;
>   }
>
>   // This animation can be done on the compositor.
>   return collection;
> }

The new EffectCompositor::GetAnimationsForCompositor begins with two checks
performed at the beginning of CanPerformOnCompositorThread: the checks for
whether async animations are enabled or not and whether the frame has refused
async animations since these are cheap and it makes sense to check them first.

The next part of EffectCompositor::GetAnimationsForCompositor checks if there is
an EffectSet associated with the frame. This is equivalent to the check whether
|collection| is null or not above.

Following, we iterate through the effects in the EffectSet.

We first check if each effect is playing or not. In the above code,
HasCurrentAnimationOfProperty only checks if the effect is *current* or not.
However, CanPerformOnCompositorThread will only return true if it finds an
animation that can run on the compositor that is *playing*. Since playing is
a strict subset of current we only need to perform the more restrictive test.

Next we check if the effect should block running other animations on the
compositor. This is equivalent to the remainder of CanPerformOnCompositorThread.
Note that the order is important here. Only playing animations should block
other animations from running on the compositor. Furthermore, this needs to
happen before the following step since animations of property other than
|aProperty| can still block animations from running on the compositor.

Finally, we check if the effect has an animation of |aProperty|. This is
equivalent to the remainder of HasCurrentAnimationOfProperty.

If all these checks succeed, we add the effect's animation to the result to
return.
2015-12-04 08:34:12 +09:00
..
test Bug 1226193 - Fix test_animation_observers.html timing out on Fennec with C++APZ enabled. r=heycam 2015-11-19 23:06:43 -05:00
Animation.cpp Bug 1225699 part 3 - Register and unregister effects with elements; r=smaug, r=heycam 2015-11-26 16:53:53 +09:00
Animation.h Bug 1223255 - Use Animation::AnimationTimeToTimeStamp instead of timeline->ToTimeStamp. r=bbirtles 2015-11-18 01:50:00 +01:00
AnimationComparator.h Bug 1171817 part 14 - Add AnimationPtrComparator class; r=dbaron 2015-06-09 11:13:54 +09:00
AnimationEffectReadOnly.cpp Bug 1152551, part 2 - Fix mode lines in dom/. r=jst 2015-05-03 15:32:37 -04:00
AnimationEffectReadOnly.h Bug 1108055 - Part 1: Add ComputedTimingProperties dictionary. r=smaug 2015-10-13 22:17:00 +02:00
AnimationTimeline.cpp Bug 1223445 - KeyframeEffectReadOnly objects end up keeping lots of other objects alive too long, r=birtles 2015-11-16 19:44:55 +02:00
AnimationTimeline.h Bug 1223445 - KeyframeEffectReadOnly objects end up keeping lots of other objects alive too long, r=birtles 2015-11-16 19:44:55 +02:00
AnimationUtils.cpp Bug 1226118 part 5 - Move LogAsyncAnimationFailure to AnimationUtils; r=dholbert 2015-12-04 08:32:53 +09:00
AnimationUtils.h Bug 1226118 part 5 - Move LogAsyncAnimationFailure to AnimationUtils; r=dholbert 2015-12-04 08:32:53 +09:00
ComputedTimingFunction.cpp Bug 1208940 - Move ComputedTimingFunction to its own file. r=bbirtles 2015-11-01 22:41:00 +01:00
ComputedTimingFunction.h Bug 1208940 - Move ComputedTimingFunction to its own file. r=bbirtles 2015-11-01 22:41:00 +01:00
DocumentTimeline.cpp Bug 1223445 - KeyframeEffectReadOnly objects end up keeping lots of other objects alive too long, r=birtles 2015-11-16 19:44:55 +02:00
DocumentTimeline.h Bug 1209519 - Undef GetCurrentTime in DocumentTimeline.h to fix --disable-accessibility bustage. r=birtles 2015-09-29 10:04:30 -04:00
EffectCompositor.cpp Bug 1226118 part 8 - Add EffectCompositor::GetAnimationsForCompositor that uses the EffectSet rather than AnimationCollection; r=dholbert 2015-12-04 08:34:12 +09:00
EffectCompositor.h Bug 1226118 part 8 - Add EffectCompositor::GetAnimationsForCompositor that uses the EffectSet rather than AnimationCollection; r=dholbert 2015-12-04 08:34:12 +09:00
EffectSet.cpp Bug 1226118 part 1 - Add EffectSet::GetEffectSet(const nsIFrame*); r=dholbert 2015-12-04 08:32:52 +09:00
EffectSet.h Bug 1226118 part 1 - Add EffectSet::GetEffectSet(const nsIFrame*); r=dholbert 2015-12-04 08:32:52 +09:00
KeyframeEffect.cpp Bug 1226118 part 7 - Rename and rework KeyframeEffectReadOnly::CanAnimatePropertyOnCompositor to ShouldBlockCompositorAnimations; r=hiro 2015-12-04 08:32:53 +09:00
KeyframeEffect.h Bug 1226118 part 7 - Rename and rework KeyframeEffectReadOnly::CanAnimatePropertyOnCompositor to ShouldBlockCompositorAnimations; r=hiro 2015-12-04 08:32:53 +09:00
moz.build Bug 1226118 part 8 - Add EffectCompositor::GetAnimationsForCompositor that uses the EffectSet rather than AnimationCollection; r=dholbert 2015-12-04 08:34:12 +09:00
PendingAnimationTracker.cpp Bug 1182981 part 1 - Use nsTHashtable::Iterator in PendingAnimationTracker; r=njn 2015-07-21 10:47:13 +09:00
PendingAnimationTracker.h Bug 1152551, part 3 - Fix more mode lines in dom/. r=jst 2015-05-03 15:32:37 -04:00