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

485 Коммитов

Автор SHA1 Сообщение Дата
Brian Birtles 8bfaf66a58 Bug 1232563 part 4 - Don't perform style updates when the effect progress has not changed; r=heycam
Now that restyle requests are handled by the effect, we can more easily detect
cases where we don't need to trigger a style update by looking for when the
output of the effect could actually differ.

Currently, any changes that require updates where the progress does *not* change
(e.g. pausing) are triggered by the Animation. The exception is when we
update timing properties (e.g. animation-iteration-count) from CSS but
current nsAnimationManager takes care to adjust the animation generation in
this case.

--HG--
extra : rebase_source : ecc0b5c80e52ce17214ab8c6ac9681477e3f80ca
2016-01-06 11:04:06 +09:00
Brian Birtles ba0280fd28 Bug 1232563 part 3 - Drop check for an empty set of properties when requesting restyles from KeyframeEffectReadOnly; r=heycam
This is because rather than simply requesting a throttled restyle when there
were no properties, as of the previous patch, we no longer request a restyle at
all in this case.

We should be able to restore this optimization in bug 1235002 when we properly
encapsulate the properties of a keyframe effect.

--HG--
extra : rebase_source : 1774698e15178cf8f8295160b96adea8ca5a2ed2
2016-01-06 11:04:06 +09: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 0d628b2a55 Bug 1232561 part 4 - Add EffectCompositor::ComposeAnimationRule; r=heycam
This patch just moves a piece of functionality from
AnimationCollection::EnsureStyleRuleFor to the EffectCompositor. In subsequent
bugs we will move more and more of this functionality across until this
logic is fully contained in the EffectCompositor.

--HG--
extra : rebase_source : 7ffe91adb4ca3d57fc8f6ae3f7e5f7bec91f350b
2016-01-06 11:04:06 +09:00
Brian Birtles f4eeb573d0 Bug 1232561 part 3 - Move AnimValuesStyleRule to a separate file; r=heycam
As we gradually move logic from layout/style/AnimationCommon.cpp to
dom/animation/EffectSet and EffectCompositor it makes sense to let this class
live in its own file inside dom/animation where it is used.

--HG--
extra : rebase_source : aed0632a19800e0ef9d8fe1d03d0364bf1ccc4dc
2016-01-06 11:04:06 +09:00
Brian Birtles a736eafacc Bug 1232561 part 2 - Move the animation style rules from AnimationCollection to EffectSet; r=heycam
This is needed in order to support script-generated animations since they do not
belong to any AnimationCollection.

This patch adopts the naming "animation rule" over "style rule". Currently we
are inconsistent about this (e.g. GetAnimationRule vs EnsureStyleRuleFor).
We don't do a mass rename here but just a few places near where we're touching.
Many of the other references to "style rule" will be revised in this bug or
related bugs so we can fix those references when we come to them.

--HG--
extra : rebase_source : e1f824029b39960915e056328447de256b6c1c6d
2016-01-06 11:04:06 +09:00
Brian Birtles cb3f0f2256 Bug 1232561 part 1 - Replace AppliesToTransitionsLevel() with a cascade level enumeration; r=heycam
Introducing an enum will simplify further patches in this series by providing
a common vocabulary for this distinction.

--HG--
extra : rebase_source : 4afbd358a401853df3ad401f2b1c3454ccff26cd
2016-01-06 11:04:05 +09:00
Brian Birtles bf0b758990 Bug 1229280 - Move animation generation from AnimationCollection to EffectSet; r=dbaron
--HG--
extra : rebase_source : 26a942c8c6058e629e7d7ed549eb1fcdf7f6d399
2016-01-06 11:04:05 +09:00
Brian Birtles bf9f389bda Bug 1228229 part 11 - Avoid calling nsRuleNode::ComputePropertiesOverridingAnimation when there are no compositor-animatable properties; r=dbaron
This restores the code removed in part 3 but adjusts it to iterate over
an effect set instead of an AnimationCollection. It also adds an early return
for the case where no compositor-animatable properties are found.

--HG--
extra : rebase_source : 5e73374c8fb7df4e946f73512337a55f5dae94f2
2016-01-06 11:04:05 +09:00
Brian Birtles 741d976ea1 Bug 1228229 part 10 - Remove no-longer-used cascade functions; r=dbaron
--HG--
extra : rebase_source : 3cdff84fefbc24796abf2d765f6f40062dd7941f
2016-01-06 11:04:05 +09:00
Brian Birtles 96f4a19af3 Bug 1228229 part 9 - Use EffectCompositor::UpdateCascadeResults; r=dbaron
--HG--
extra : rebase_source : c294befb9b57564f17c9c22d8fc0f37e7792eaed
2016-01-06 11:04:05 +09:00
Brian Birtles f14f3a2be8 Bug 1228229 part 8 - Add EffectCompositor::(Maybe)UpdateCascadeResults; r=dbaron
--HG--
extra : rebase_source : 7f87c5a33e153e0815d39b7eb21917f3c034c0d3
2016-01-06 11:04:05 +09:00
Brian Birtles 144a09f431 Bug 1228229 part 7 - Add a method to Animation to indicate if it applies to the transitions level of the cascade; r=dbaron
For transitions, this method returns true so long as the transition is
bound to markup. This is based on the below discussion,

  https://github.com/w3c/web-animations/issues/97
  https://github.com/w3c/web-animations/issues/62#issuecomment-117357703
  https://github.com/w3c/web-animations/issues/62#issuecomment-117374689

We will likely reuse this method when we come to implement animation style rule
generation in a more generic manner.

--HG--
extra : rebase_source : fe8a3d09296d7f74cabd59c605cf568d200bb240
2016-01-06 11:04:05 +09:00
Brian Birtles 265cbb47a5 Bug 1228229 part 6 - Mark the animation cascade results as dirty when an effect goes in or out of being "in effect"; r=dbaron
This patch implements "case 2" described in the commit message from part 4 of
this patch series.

--HG--
extra : rebase_source : 805f24376fa4648f094fb04247d48d075a73400c
2016-01-06 11:04:05 +09:00
Brian Birtles 5331e1fa91 Bug 1228229 part 5 - Separate target element registration in NotifyAnimationTimingUpdated; r=dbaron
KeyframeEffectReadOnly::NotifyAnimationTimingUpdated currently just acts as an
alias for UpdateTargetRegistration. However, bug 1226118 added logic to
UpdateTargetRegistration which is not strictly related to updating the target
element registration. This patch tidies this up so that UpdateTargetRegistration
only does what its name suggests. This is in preparation for adding more
logic to NotifyAnimationTimingUpdated.

--HG--
extra : rebase_source : c6162e8415613d7ec16744228d7cf498b4c19e2c
2016-01-06 11:04:04 +09:00
Brian Birtles c773cf7551 Bug 1228229 part 4 - Add a flag to EffectSet to mark when the cascade needs to be updated; r=dbaron
There are three situations when the cascade results of effects needs to be
updated.

1. The sets of effects (animations) has changed.

2. One or more effects have changed their "in effect" status.

3. Other style properties affecting the element have changing meaning that
   animations applied at the animations-level of the cascade may now be
   overridden or become active again.

We want to detect these situations so we can avoid updating the cascade when
none of these possibilities exist.

Currently we handle case 1 by calling UpdateCascadeResults at the appropriate
point in nsAnimationManager and nsTransitionManager when we build
animations/transtiions.

Case 2 only affects animations (since whether transitions are in effect or not
makes no difference to the cascade--they have a lower "composite order" than
animations and never overlap with each other so they can't override anything).
As a result, we handle it by adding a flag to CSSAnimation to track when an
animation was in effect last time we checked or not.

For case 3, we take care to call UpdateCascadeResults when the style context
changed in nsAnimationManager::CheckAnimationRule (called from
nsStyleSet::GetContext).

We want to generalize this detection to handle script-generated animations too.
In order to do that this patch introduces a flag to EffectSet that we will use
to mark when the cascade needs to be updated in cases 1 and 2. This patch also
sets the flag when we detect case 1. A subsequent patch sets the flag for
case 2.

Case 3 is more difficult to detect and so we simply maintain the existing
behavior of making nsAnimationManager::CheckAnimationRule unconditionally
update the cascade without checking if the "needs update" flag is set.

--HG--
extra : rebase_source : fc56b1bb5a98ae78b93a179c7a3b8af4724a06a1
2016-01-06 11:04:04 +09:00
Brian Birtles 114b1e3ebd Bug 1228229 part 3 - Factor out a method to get compositor-animatable overridden properties; r=dbaron
This patch also simplifies this logic by simply always looking for overrides of
'transform' and 'opacity'.

--HG--
extra : rebase_source : d1e432e629e2b97651f14c784f97c03f55d217be
2016-01-06 11:04:04 +09:00
Brian Birtles 5d5fb26344 Bug 1228229 part 2 - Add a helper to get the appropriate (pseudo-)element for a frame; r=dbaron
We will use similar logic later in this patch series so we separate it out into
a separate helper function here.

--HG--
extra : rebase_source : 00cb49e7829bdef7a6084059b31fe2ef4b921af5
2016-01-06 11:04:04 +09:00
Hiroyuki Ikezoe 14a9ac51e5 Bug 1218646 - Skip to check whether property can run on compositor or not if mWinsInCascade is false. r=birtles
--HG--
extra : commitid : EEO5SsbNCyo
2015-12-25 07:14:02 +09:00
Brian Birtles 98bde3e131 Bug 1232829 - Detach obsolete DocumentTimeline from refresh driver when the document is reset; r=smaug 2015-12-22 10:08:19 +09:00
Hiroyuki Ikezoe f36ff3beb0 Bug 1219543 - Part 3: MutationObserver should disconnect when the test is finished. r=bbirtles 2015-12-20 14:18:00 +01:00
Hiroyuki Ikezoe 1ffc0c63ea Bug 1219543 - Part 1: isRunningOnCompositor flag is now a member of AnimationProperty. r=bbirtles 2015-12-20 14:16:00 +01:00
Brian Birtles c70be15294 Bug 1230056 part 1 - Add EffectCompositor::HasAnimationsForCompositor; r=dholbert 2015-12-09 16:28:10 -05:00
Bogdan Postelnicu a32d8ac57a Bug 1231107 - add an assert on animationProperty. r=heycam 2015-12-08 05:13:00 +01:00
Brian Birtles 3cd1347f35 Bug 1226118 part 15 - Remove no-longer-necessary delays from test_running_on_compositor.html; r=hiro
Since part 3 in this patch series updated the way we clear the "running on
compositor" flag, we can update these tests so they no longer wait for this
flag (see bug 1226118 comment 21).
2015-12-04 08:34:18 +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 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
Brian Birtles 40c6c207b0 Bug 1226118 part 7 - Rename and rework KeyframeEffectReadOnly::CanAnimatePropertyOnCompositor to ShouldBlockCompositorAnimations; r=hiro
KeyframeEffectReadOnly::CanAnimatePropertyOnCompositor has a comment that says
it, "Returns true |aProperty| can be run on compositor for |aFrame|" but it
does nothing of the sort.

What it *does* do is check answer the question, "If there happened to be an
animation of |aProperty| on |aFrame|, should we still run animations on the
compositor for this element?".

This patch renames the method accordingly and moves the step where we iterate
over a given effect's animated properties from
AnimationCollection::CanPerformOnCompositor to inside this method, making this
method a class method rather than a static method at the same time.

As noted in the expanded comment, the approach of blocking opacity animations
in these situations seems unnecessary but for now this patch just preserves the
existing behavior.
2015-12-04 08:32:53 +09:00
Brian Birtles fd98de719c Bug 1226118 part 5 - Move LogAsyncAnimationFailure to AnimationUtils; r=dholbert
This patch also moves AnimationUtils out of the dom namespace since it seems
unnecessary. We typically only put actual DOM interfaces in the dom namespace.
2015-12-04 08:32:53 +09:00
Brian Birtles a92b5ec6ab Bug 1226118 part 3 - Use EffectSet in CommonAnimationManager::ClearIsRunningOnCompositor; r=hiro, r=dholbert 2015-12-04 08:32:53 +09:00
Brian Birtles 5ea3caedb7 Bug 1226118 part 1 - Add EffectSet::GetEffectSet(const nsIFrame*); r=dholbert 2015-12-04 08:32:52 +09:00
Brian Birtles cf420be127 Bug 1225699 part 7 - Keep effect properties when the ownerDocument of the element changes; r=smaug 2015-11-26 16:53:54 +09:00
Brian Birtles 4a1f1632e9 Bug 1225699 part 6 - Use strong refs to store effects on their target elements; r=smaug
This is so that when we have code like:

  elem.animate({ opacity: 0 }, 1000)

the resulting Animation object is kept alive by |elem| based on the following
ownership chain:

  elem --(strong)--> KeyframeEffectReadOnly --(strong)--> Animation

Now, there is an ownership cycle introduced here because KeyframeEffectReadOnly
objects also store owning references to their target elements. This is broken
when the Animation finishes (if it does not fill forwards) or is cancelled
since either event will trigger a call to
KeyframeEffectReadOnly::UpdateTargetRegistration.

If the Animation fills forwards, the resource will not be released until
it is cancelled. For Animations corresponding to CSS Animations / CSS
Transitions this happens when the Element is unbound or when the corresponding
style property is updated causing the animation to be replaced or removed.

For the general case of script-generated animations, however, this cycle won't
be broken until the Element is unbound and all external references to the
Animation or KeyframeEffectReadOnly are dropped.

It's unfortunate that we can't more aggressively prune these objects but it's
what the spec currently says. I've posted to the mailing list[1] about this but
have yet to find a good solution.

[1] https://lists.w3.org/Archives/Public/public-fx/2015OctDec/0029.html
2015-11-26 16:53:54 +09:00
Brian Birtles fd320ec088 Bug 1225699 part 5 - Use EffectSet in Element::GetAnimations; r=heycam 2015-11-26 16:53:53 +09:00
Brian Birtles 0d264e1081 Bug 1225699 part 4 - Add iterator to EffectSet; r=heycam 2015-11-26 16:53:53 +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
Brian Birtles ac5c423799 Bug 1225699 part 2 - Add Add/RemoveEffect to EffectSet; r=smaug 2015-11-26 16:53:53 +09:00
Brian Birtles 9400c59793 Bug 1225699 part 1 - Add EffectSet class; r=smaug 2015-11-26 16:53:53 +09:00
Boris Chiou af6590f3dd Bug 1215406 - Part 5: Implement KeyframeEffectOptions in KeyframeEffectReadOnly constructor. r=birtles
Implement KeyframeEffectOptions in KeyframeEffectReadOnly constructor and other
related APIs.
2015-11-19 19:48:00 +01:00
Boris Chiou fe6df692e1 Bug 1215406 - Part 3: Change the types of direction and fillmode in AnimationTiming. r=heycam
Use mozilla::dom::FillMode and mozilla::dom::PlaybackDirection
in AnimationTiming.

--HG--
extra : rebase_source : 8210d002d6f116793f439d88b0325ab6fb880048
2015-11-20 06:12:00 +01:00
Randall Barker 3fbfbb9aeb Bug 1226193 - Fix test_animation_observers.html timing out on Fennec with C++APZ enabled. r=heycam
Fix: INFO TEST-UNEXPECTED-FAIL | dom/animation/test/chrome/test_animation_observers.html | Test timed out.
By extending animation observer timeout.

--HG--
extra : commitid : GEfsdBOqqsu
2015-11-19 23:06:43 -05: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 194d123d2a Bug 1216030 - Part 18: Remove IsCurrent() check in assertion in CanThrottle. r=bbirtles
The behavior of unthrottling in case of not current animations there is the
same as on current trunk.
There are two cases to reach there I can think of:

a) 0s duration time and fill-forwards animation
b) Calling pause() after fill-forwards animation finished.

I can provide these automation tests once bug 1222326 is fixed.
2015-11-06 02:57:00 +01:00
Hiroyuki Ikezoe 383ef0ab14 Bug 1216030 - Part 17: Do not calculate unthrottle interval for transform animation every time. r=bbirtles 2015-11-06 02:55:00 +01:00
Hiroyuki Ikezoe 325530125c Bug 1216030 - Part 16: Move CanThrottleAnimation and CanThrottleTransformChanges from AnimationCollection into KeyframeEffectReadOnly::CanThrottle. r=bbirtles
The preference check has been removed from CanThrottleTransformChanges
because we already perform that check that when deciding if we should run
an animation on the compositor (in CanPerformOnCompositorThread, as called
by GetAnimationsForCompositor). Hence if the "is running on compositor" flag
is true, we can assume the preference is set (or was set when we decided to
put the animation on the compositor-- we don't worry about pulling the
animation off the compositor immediately if the preference changes while
it is running)
2015-11-06 02:53:00 +01:00
Hiroyuki Ikezoe 6e809a002a Bug 1216030 - Part 15: Add KeyframeEffectReadOnly::GetCollection. r=bbirtles 2015-11-06 02:53:00 +01: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 d1085f09b0 Bug 1216030 - Part 11: Add KeyframeEffect::CanAnimatePropertyOnCompositor. r=bbirtles
Based on AnimationCollection::CanAnimatePropertyOnCompositor.
The first argument has been changed to nsIFrame* so that we don't need to
get style frame for CanAnimateTransformOnCompositor again.
2015-11-06 02:45:00 +01:00