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

218 Коммитов

Автор SHA1 Сообщение Дата
Brian Birtles bbfbefa427 Bug 1183461 part 6 - Store the generating animation on the event; r=heycam
In order to sort between events that have the same timestamp we use the
sort order of the corresponding animations so we need to store a pointer
to the animation along with the event.

--HG--
extra : rebase_source : 2767157135abd5a094d856410cd9c70e46a33b68
2015-09-15 14:05:44 +09:00
Hiroyuki Ikezoe e66cf160a7 Bug 1151694 - Part 1 - Move CommonAnimationManager::sLayerAnimationInfo into LayerAnimationInfo.(cpp|h). r=bbirtles
--HG--
extra : rebase_source : 1226660e3e42a534d4c8b4f72c00888356a708fb
2015-09-03 22:59:00 +02:00
Brian Birtles 1038c1e99a Bug 1194037 part 4 - Remove ticking from FlushAnimations; r=dholbert
This patch makes FlushAnimations purely responsible for posting restyles. All
ticking behavior is performed in response to an actual refresh driver tick
(currently CommonAnimationManager::WillRefresh).
2015-08-31 16:21:55 +09:00
Daniel Holbert db0b03b6ae Bug 1195523: Use type-safe LinkedList instead of PRCList to manage AnimationCollection objects. r=birtles 2015-08-17 21:13:14 -07:00
Brian Birtles 7f6947284e Bug 1188251 part 12 - Use RestyleType::Layer in UpdateCascade; r=dholbert
When updating the cascade results between transitions and animations, if we
detect a change we force an update by taking the following steps:

 a. Updating the animation generation on the restyle manager
 b. Updating the animation generation on the collection
 c. Iterating over all the properties animated by the collection and, for
    each property that we can animate on the compositor, posting a restyle
    event with the appropriate change hint (nsChangeHint_UpdateTransformLayer
    or nsChangeHint_UpdateTransformOpacity)
 d. Marking the collection as needing refreshes
 e. Clearing the style rule refresh time so we generate a new style rule in
    EnsureStyleRuleFor

As it turns out, the newly-added
AnimationCollection::RequestRestyle(RestyleType::Layer) already performs a, b,
d, and e. It also:

* Ensures we are observing the refresh driver if need be (should have no effect
  in this case)
* Clears the last animation style update time on the pres context so that
  subsequent calls to FlushPendingNotifications will update animation style
  (it seems like we probably should have been doing this for changes to cascade
  results anyway)
* Posts a restyle event with restyle hint eRestyle_CSSTransitions or
  eRestyle_CSSAnimations
* Marks the document as needing a style flush (irrelevant since posting
  a restyle event does this anyway)

The only missing piece that would prevent using RequestRestyle in place of this
code when updating cascade results is (c) from the list above. However, (c)
should not be necessary since ElementRestyler::AddLayerChangesForAnimation()
explicitly checks for out-of-date layer animation generation numbers and adds
the appropriate change hints (nsChangeHint_UpdateTransformLayer etc.) to the
change list.
2015-08-18 16:11:55 +09: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 6e18b672e3 Bug 1188251 part 10 - Remove throttling from EnsureStyleRuleFor; r=dholbert
EnsureStyleRuleFor contains logic for performing throttled updates to the style
rule but it is only used in one case: inside
nsTransitionManager::UpdateCascadeResults to determine what properties are
being animated by CSS animations.

We would like to remove throttling logic from EnsureStyleRuleFor altogether but
if that one case where it is currently used is run on every tick then removing
this logic could effectively mean we end up updating the style rule on every
tick. Fortunately nsTransitionManager::UpdateCascadeResults is only called
in the following cases:

1. From nsTransitionManager::StyleContextChanged (via
   TransitionManager::UpdateCascadeResultsWithTransitions), when we are
   processing style changes for transitions.

2. From AnimationCollection::EnsureStyleRuleFor (via
   nsAnimationManager::MaybeUpdateCascadeResults and
   nsTransitionManager::UpdateCascadeResultsWithAnimations), when we are
   updating the animation style rule from CSS animations.

3. From nsAnimationManager::CheckAnimationRule (via
   TransitionManager::UpdateCascadeResultsWithAnimationsToBeDestroyed), when
   we are processing style changes for CSS animations.

None of these things should be happenning on a regular throttle-able tick so by
removing this logic we shouldn't be causing any additional work.

I have verified, using a test case that combines transitions and animations on
the same property, that we have the same behavior with regard to calling
EnsureStyleRuleFor both before and after this patch (specifically we avoid
calling it altogether while running only the transition but when the animation
starts and clobbers the transition we end up calling EnsureStyleRuleFor once on
each tick).
2015-08-18 16:11:55 +09:00
Brian Birtles d263e17945 Bug 1188251 part 7 - Move WillRefresh to CommonAnimationManager; r=dholbert
nsTransitionManager::WillRefresh and nsAnimationManager::WillRefresh are now
identical and all methods they call exist on CommonAnimationManager so we
can unify them there.
2015-08-17 13:59:44 +09:00
Brian Birtles d65e0109bc Bug 1188251 part 6 - Unify FlushAnimations and FlushTransitions; r=dholbert
The implementations of FlushAnimations and FlushTransitions should now be all
but equivalent so this patch combines them into a single implementation on
CommonAnimationManager.

Regarding some of the minor differences between the two methods:

* The combined implementation drops the check for an empty list of collections
  found only in FlushTransitions. This seems like a very minor optimization
  that could possibly cause us to fail to unregister from the refresh driver
  if we forgot to do so when removing the last collection.

* The combined implementation uses the loop implementation from FlushAnimations
  since it is more compact.

This patch also removes the extra nested scope since it doesn't seem necessary.
2015-08-17 13:59:44 +09:00
Brian Birtles 7c39c22a6b Bug 1188251 part 4 - Move throttling checks to AnimationCollection::RequestRestyle; r=dholbert
This patch moves the additional checks (beyond those of Animation::CanThrottle)
from FlushAnimations/FlushTransitions to AnimationCollection::RequestRestyle.
These checks are on a per-collection basis hence it makes sense for the
collection to perform them. This also moves logic out of the managers which is
needed if we want to support script-based animations without introducing another
manager.
2015-08-17 13:59:44 +09:00
Brian Birtles 0cf13fbef2 Bug 1188251 part 3 - Add AnimationCollection::RequestRestyle; r=dholbert
Ultimately we want to move throttling logic to AnimationCollection and
Animation::Tick (and later to KeyframeEffect::SetParentTime). This is so that
we can support script-generated animations without having to introduce yet
another manager.

To that end this patch introduces a method on AnimationCollection that can be
called from Animation::Tick to perform the necessary notifications needed to
update style.

Later in this patch series we will extend RequestRestyle to incorporate more of
the throttling logic and further extend it to cover some of the other
notifications such as updating layers.

This patch tracks whether or not we have already posted a restyle for animation
to avoid making redundant calls. Calls to nsIDocument::SetNeedStyleFlush are
cheap and more difficult to detect when they have completed so we don't filter
redundant calls in the Restyle::Throttled case.

If mHasPendingAnimationRestyle is set and AnimationCommon::EnsureStyleRuleFor
is *never* called then we could arrive at situation where we fail to make post
further restyles for animation.

I have verified that if we fail to reset mHasPendingAnimationRestyle at the
appropriate point (e.g. resetting it at the end of EnsureStyleRuleFor *after*
the early-returns) then a number of existing tests fail.

Furthermore, I have observed that it is reset by the beginning of each tick
in almost every case except for a few instances of browser mochitests such as
browser/components/customizableui/test/browser_1007336_lwthemes_in_customize_mode.js.
In this case, during the async cleanup of the test, we have an opacity
transition on a vbox element that becomes display:none and appears to be skipped
during restyling. However, even in this case, EnsureStyleRuleFor is called
within one or at most two ticks and mHasPendingAnimationRestyle flag is cleared
(i.e. it does not get stuck).
2015-08-17 13:59:44 +09:00
Brian Birtles 937bc54615 Bug 1181392 part 5 - Remove use of IsFinishedTransition from AnimationCollection::HasAnimationOfProperty; r=dbaron
AnimationCollection::HasAnimationOfProperty uses IsFinishedTransition to filter
out transitions that should otherwise be ignored. This is used in the following
places:

1. nsLayoutUtils::HasAnimations

   The is only used by nsIFrame::BuildDisplayListForStackingContext to see if
   there are any opacity animations

   For this case, simply returning *current* animations would be sufficient
   (since finished but filling animations should have already filled in the
   display opacity)

2. CommonAnimationManager::GetAnimationsForCompositor

   This should really only return *current* animations--that is, animations that
   are running or scheduled to run. Finished animations never run on the
   compositor. Indeed, only *playing* animations run on the compositor but, as
   we will see in some of the cases below, it is sometimes useful to know that
   an animation *will* run on the compositor in the near future (e.g. so we can
   pre-render content).

   The places where GetAnimationsForCompositor is used are:

   - When building layers to add animations to layers in nsDisplayList--in this
     case we skip any animations that aren't playing so if
     GetAnimationsForCompositor only returned current animations that would be
     more than sufficient.

   - In nsLayoutUtils::HasAnimationsForCompositor. This in turn is used:

     - In ChooseScaleAndSetTransform to see if the transform is being animated
       on the compositor. If so, it calls
       nsLayoutUtils::ComputeSuitableScaleForAnimation (which also calls
       GetAnimationsForCompositor) and passes the result to
       GetMinAndMaxScaleForAnimationProperty which we have already adjusted in
       part 4 of this patch series to only deal with *relevant* animations

       Relevant animations include both current animations and in effect
       animations but we don't run forwards-filling animations on the compositor
       so GetAnimationsForCompositor should NOT return them. Current animations
       should be enough. In fact, playing animations should be enough but we
       might want to pre-render layers at a suitable size during their delay
       phase so returning current animations is probably ok.

     - In nsDisplayListBuilder::MarkOutOfFlowFrameForDisplay to add a fuzz
       factor to the overflow rect for frames undergoing a transform animation
       on the compositor. In this case too current animations should be
       sufficient.

     - In nsDisplayOpacity::NeedsActiveLayer to say "yes" if we are animating
       opacity on the compositor. Presumably in this case it would be good to
       say "yes" if the animation is in the delay phase too (as it currently
       does). After the animation is finished, we should drop the layer, i.e.
       current animations should be sufficient.

     - In nsDisplayTransform::ShouldPrerenderTransformedContent. As with
       nsDisplayOpacity::NeedsActiveLayer, we only need to pre-render
       transformed content for animations that are current.

     - In nsDisplayTransform::GetLayerState. As with
       nsDisplayOpacity::NeedsActiveLayer, we only need to return active here
       for current animations.

     - In nsIFrame::IsTransformed. Here we test the display style to see if
       there is a transform and also check if transform is being animated on the
       compositor. As a result, we really only need HasAnimationsForCompositor
       to return true for animations that are playing--otherwise the display
       style will tell us if we're transformed or not. Returning true for all
       current compositor animations (which is a superset of playing), however,
       should not cause problems (we already return true for even more than
       that).

     - In nsIFrame::HasOpacityInternal which is much the same as
       nsIFrame::IsTransformed and hence current should be fine.

3. AnimationCollection::CanThrottleAnimation

   Here, HasAnimationOfProperty is used when looking for animations that would
   disqualify us from throttling the animation by having an out-of-date layer
   generation or being a transform animation that affects scroll and so requires
   that we do the occasional main thread sample to update scrollbars.

   It would seem like current animations are enough here too. One interesting
   case is where we *had* a compositor animation but it has finished or been
   cancelled. In that case, the animation won't be current and we should not
   throttle the animation since we need to take it off its layer.

   It turns out checking for current animations is still ok in this case too.
   The reasoning is as follows:

   - If the animation is newly-finished, we'll pick that up in
     Animation::CanThrottle and return false then.

   - If the animation is newly-idle then there are two cases:

     If the cancelled animation was the only compositor animation then
     AnimationCollection::CanPerformOnCompositorThread will notice that there
     are no playing compositor animations and return false and
     AnimationCollection::CanThrottleAnimation will never be called.

     If there are other compositor animations running, then
     AnimationCollection::CanThrottleAnimation will still return false because
     whatever cancelled the animation will update the animation generation and
     we'll notice the mismatch between the layer animation generation and the
     animation generation on the collection.

Based on the above analysis it appears that making
AnimationCollection::HasAnimationOfProperty return only current animations (and
simulatneously renaming it to HasCurrentAnimationOfProperty) is safe. Indeed, in
effect, we already do this for transitions but not for animations. This patch
generalizes this behavior to all animations.

This patch also updates test_animations_omta.html since it was incorrectly
testing that a finished opacity animation was still running on the compositor.
Finished animations should not run on the compositor and the changes in this
patch cause that to happen. The reason we don't just update this test to check
for RunningOn.MainThread is that for opacity animations, unlike transform
animations, we can't detect if an opacity on a layer was set by animation or
not. As a result, for opacity animations we typically test the opacity on
either the main thread or compositor in order to allow for the case where an
animation-set opacity is still lingering on the compositor.
2015-08-07 12:29:36 +09:00
Brian Birtles a229140582 Bug 1180125 part 4 - Move PseudoTypeAsString to AnimationCollection and reuse; r=dbaron
Prior to this patch, CSSAnimation defined a method for converting an
nsCSSPseudoElements::Type to a nsString (but only for the set of
pseudo-elements that can have animations). We would like to re-use this
when setting up transition events so this patch moves it to
AnimationCollection. Re-using this method more widely means we can make
a few further simplifications to the code.
2015-07-29 10:57:40 +09:00
Brian Birtles cd380ce4a3 Bug 1180125 part 3 - Extract DelayedEventDispatcher; r=dbaron
This patch extracts a utility class for queueing up a series of EventInfo
objects (of templated type) and then dispatching them. This covers the event
queuing behavior in nsAnimationManager so that we can reuse it in
nsTransitionManager.
2015-07-29 10:57:39 +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
Brian Birtles c2a72bf2cd Bug 1180125 part 1b - Hook nsAnimationManager's list of events up to the cycle collector; r=dbaron 2015-07-29 10:57:39 +09:00
Brian Birtles 0d79f0c537 Bug 1180125 part 1 - Queue and dispatch CSS animation events as a separate step; r=dbaron
This patch prepares the way for script-generated events by making
event dispatch a separate process that happens after sampling animations.
This will allow us to sample animations from their associated timeline
(removing the need for a further manager to tracker script-generated
animations).

Furthermore, once we sample animations from timelines the order in which they
are sampled is likely to be more or less random so by making event dispatch at
separate step, we have an opportunity to sort the events and dispatch in
a consistent and sensible order. It also ensures that event callbacks will
not be run until all animations (including transitions) have been updated
ensuring they see a consistent view of timing properties.

This patch only affects event handling for CSS animations. Transitions will
be dealt with in a subsequent patch.
2015-07-29 10:57:39 +09:00
Cameron McCormack 9ae3b05332 Bug 1180118 - Part 5: Add a RestyleHintData outparam to HasAttributeDependentStyle for use with eRestyle_SomeDescendants. r=bzbarsky 2015-08-05 22:42:21 +10:00
Carsten "Tomcat" Book 94b10d301f Backed out 13 changesets (bug 1180118) for crashes on a CLOSED TREE
Backed out changeset c65d298d7cfa (bug 1180118)
Backed out changeset 7c5ebadc3fc9 (bug 1180118)
Backed out changeset 91a3e2205388 (bug 1180118)
Backed out changeset 15ad6049b940 (bug 1180118)
Backed out changeset 9b41cd9f2bc5 (bug 1180118)
Backed out changeset 37493f6eef20 (bug 1180118)
Backed out changeset b7ec8d4d2d7e (bug 1180118)
Backed out changeset cfeeae42d514 (bug 1180118)
Backed out changeset 9bcc3233f3c8 (bug 1180118)
Backed out changeset b99c358a6fea (bug 1180118)
Backed out changeset 4a7b79980353 (bug 1180118)
Backed out changeset 20984dfa4302 (bug 1180118)
Backed out changeset ef165b896cf4 (bug 1180118)
2015-08-04 12:20:20 +02:00
Cameron McCormack 18f6b81597 Bug 1180118 - Part 5: Add a RestyleHintData outparam to HasAttributeDependentStyle for use with eRestyle_SomeDescendants. r=bzbarsky 2015-08-04 17:27:53 +10:00
Carsten "Tomcat" Book 61664e5c9a Backed out changeset 79bcd4f744c0 (bug 1180125) 2015-07-29 17:32:24 +02:00
Carsten "Tomcat" Book df8e4f8d18 Backed out changeset 41d45871d805 (bug 1180125) 2015-07-29 17:32:21 +02:00
Carsten "Tomcat" Book c86b8ab1b4 Backed out changeset a4fb4e4b1c8b (bug 1180125) 2015-07-29 17:32:19 +02:00
Carsten "Tomcat" Book 132cd4706c Backed out changeset 5996d0e410a7 (bug 1180125) 2015-07-29 17:32:17 +02:00
Carsten "Tomcat" Book d986598600 Backed out changeset 587b33b52ee0 (bug 1180125) 2015-07-29 17:32:15 +02:00
Brian Birtles 321316dbee Bug 1180125 part 4 - Move PseudoTypeAsString to AnimationCollection and reuse; r=dbaron
Prior to this patch, CSSAnimation defined a method for converting an
nsCSSPseudoElements::Type to a nsString (but only for the set of
pseudo-elements that can have animations). We would like to re-use this
when setting up transition events so this patch moves it to
AnimationCollection. Re-using this method more widely means we can make
a few further simplifications to the code.
2015-07-29 10:57:40 +09:00
Brian Birtles 6f36a11791 Bug 1180125 part 3 - Extract DelayedEventDispatcher; r=dbaron
This patch extracts a utility class for queueing up a series of EventInfo
objects (of templated type) and then dispatching them. This covers the event
queuing behavior in nsAnimationManager so that we can reuse it in
nsTransitionManager.
2015-07-29 10:57:39 +09: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
Brian Birtles d0c83dbfa2 Bug 1180125 part 1b - Hook nsAnimationManager's list of events up to the cycle collector; r=dbaron 2015-07-29 10:57:39 +09:00
Brian Birtles 880fd89013 Bug 1180125 part 1 - Queue and dispatch CSS animation events as a separate step; r=dbaron
This patch prepares the way for script-generated events by making
event dispatch a separate process that happens after sampling animations.
This will allow us to sample animations from their associated timeline
(removing the need for a further manager to tracker script-generated
animations).

Furthermore, once we sample animations from timelines the order in which they
are sampled is likely to be more or less random so by making event dispatch at
separate step, we have an opportunity to sort the events and dispatch in
a consistent and sensible order. It also ensures that event callbacks will
not be run until all animations (including transitions) have been updated
ensuring they see a consistent view of timing properties.

This patch only affects event handling for CSS animations. Transitions will
be dealt with in a subsequent patch.
2015-07-29 10:57:39 +09:00
Birunthan Mohanathas a8939590de Bug 1182996 - Fix and add missing namespace comments. rs=ehsan
The bulk of this commit was generated by running:

  run-clang-tidy.py \
    -checks='-*,llvm-namespace-comment' \
    -header-filter=^/.../mozilla-central/.* \
    -fix
2015-07-13 08:25:42 -07:00
Brian Birtles 5fd77720f9 Bug 1171817 part 15 - Factor out common code for comparing owning elements into a separate class; r=dbaron
--HG--
extra : commitid : 2j2k4UORffU
extra : rebase_source : ab639c3c163670bc3a291f20d657bf2aef015d95
2015-06-09 11:13:54 +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
Lee Salzman 55553857ba Bug 771367 - Refactor GetAnimationContent and GetAnimationCollection into CommonAnimationManager to hide atom and pseudo-element voodoo. r=bbirtles
--HG--
extra : rebase_source : 4dd7ccea70aeb26850055388e6a8ec1aa90e5347
2015-07-01 14:43:13 -04:00
Lee Salzman 1201a3f336 Bug 771367 - Support compositor animation for pseudo-elements. r=dbaron
--HG--
extra : rebase_source : 9276e835dbc75aaaab718a871ed4eaa7c8389867
2015-07-01 11:55:51 -04:00
L. David Baron aeb644fc87 Bug 1161049 patch 2 - Add comments reflecting what CanPerformOnCompositorThread doesn't check. r=birtles 2015-05-08 15:56:36 +02: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
Andrea Marchesini 085da9302a Bug 1156632 - Remove unused forward class declarations - patch 5 - rdf, parser, layout and something else, r=ehsan 2015-04-22 08:29:22 +02: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 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
L. David Baron d82c7d2130 Bug 1149848 patch 2 - Remove no-longer-needed flags to GetAnimationsForCompositor. r=birtles
This reverts all of bug 1109390 part 20 (except for a whitespace change
and a comment removal that patch 1 made irrelevant) and some of part 21.
2015-04-06 18:13:48 -07: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
Brian Birtles 564d5464c7 Bug 1117603 part 2 - Don't unregister from the refresh driver unless we are also queueing events; r=dbaron 2015-03-24 09:06:06 +09:00
Brian Birtles 6aae9afebc Bug 1109390 part 20 - Add an options flag to GetAnimationsForCompositor to control; r=jwatt
This patch adds an options flag to GetAnimationsForCompositor for two reasons.

a) We want to reuse this functionality in nsLayoutUtils.cpp rather than
   duplicating the same logic. To do that and maintain the existing behavior,
   however, we need to *not* update the active layer tracker when calling this
   from nsLayoutUtils.cpp.

b) It's surprising that GetAnimationsForCompositor also has this side effect of
   updating the active layer tracker. Adding this as an option makes it clear at
   the call site that this is what will happen.
2015-04-01 12:23:24 +09:00
L. David Baron a7bdf3d859 Bug 847287 patch 6 - Set mWinsInCascade for CSS Animations. r=birtles
This is the main patch for the bug; it makes us use the mechanism added
in bug 1125455 to avoid sending animations that aren't currently
applying to the compositor.

Patch 7 is needed to make this code rerun in all the cases where we need
to rerun it, though.
2015-03-31 15:05:54 -07:00
L. David Baron 538784230b Bug 847287 patch 5 - Add method to update animations on layer. r=birtles
This does somewhat less work than PostRestyleForAnimation, although I
believe PostRestyleForAnimation would be a sufficient alternative.

This is used in patch 6.
2015-03-31 15:05:54 -07:00
L. David Baron 320d6fe7aa Bug 847287 patch 3 - Add assertions about consistency of the flags for animating on the compositor. r=birtles
These flags were added in patch 2.
2015-03-31 15:05:54 -07:00
Jonathan Watt 2b22106122 Bug 1145246, part 3 - Update layout code for the rename of Animatable.getAnimationPlayers() to Animatable.getAnimations(). r=birtles 2015-03-20 18:20:49 +00:00
Ehsan Akhgari 883849ee32 Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj
This patch was automatically generated using the following script:

function convert() {
echo "Converting $1 to $2..."
find . \
       ! -wholename "*/.git*" \
       ! -wholename "obj-ff-dbg*" \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.c" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert MOZ_OVERRIDE override
convert MOZ_FINAL final
2015-03-21 12:28:04 -04:00
Carsten "Tomcat" Book 9457f417cb Backed out changeset 9590d9ed9e76 (bug 1117603)
--HG--
extra : rebase_source : f6374403f0f620e6edf06d34b8283ef54e750753
2015-03-20 10:22:27 +01:00
Brian Birtles d2405f9465 Bug 1117603 part 2 - Don't unregister from the refresh driver unless we are also queueing events; r=dbaron 2015-03-20 13:10:38 +09:00
L. David Baron f93a10293b Bug 1125455 patch 2 - Set mWinsInCascade for transitions based on whether there are animations. r=birtles 2015-03-19 21:10:00 -07:00
Carsten "Tomcat" Book 47fe95d629 Backed out 7 changesets (bug 1125455) for test failures in m1 test_animation-player-ready.html on a CLOSED TREE
Backed out changeset 8a316064caff (bug 1125455)
Backed out changeset ad326dbcbd03 (bug 1125455)
Backed out changeset 83dab9578e23 (bug 1125455)
Backed out changeset 5bd86c20cd02 (bug 1125455)
Backed out changeset 751177025dcb (bug 1125455)
Backed out changeset f60c5b4adf84 (bug 1125455)
Backed out changeset 326ef9a86c85 (bug 1125455)
2015-03-18 16:32:54 +01:00
L. David Baron 3be5178484 Bug 1125455 patch 2 - Set mWinsInCascade for transitions based on whether there are animations. r=birtles 2015-03-18 07:35:30 -07:00
L. David Baron 82ec6020a1 Bug 960465 patch 19 - Remove users of eRestyle_ChangeAnimationPhase. r=birtles 2015-02-17 11:15:05 +13:00
L. David Baron 38c8f0feac Bug 960465 patch 11 - nsTransitionManager should skip style changes that it posted while starting transitions. r=birtles
This will be needed when (in later patches) we stop separating animation
phases.
2015-02-17 11:15:03 +13:00
Nicholas Nethercote 242708cf72 Bug 1127201 (attempt 2, part 1) - Replace most NS_ABORT_IF_FALSE calls with MOZ_ASSERT. r=Waldo.
--HG--
extra : rebase_source : 488e401ff87e31a2074c4108c4df0572d9536667
2015-02-09 14:34:50 -08:00
Andrew McCreight d3826daa16 Back out Bug 1127201 (part 2) for various problems. 2015-02-06 15:04:32 -08:00
Nicholas Nethercote d34f0301b8 Bug 1127201 (part 2) - Convert all NS_ABORT_IF_FALSE calls to MOZ_ASSERT. r=Waldo.
--HG--
extra : rebase_source : 99182e70335d2b5ff95f8c528ae992d37294be3a
2015-02-04 20:05:36 -08:00
Brian Birtles 9fdafb68a4 Bug 927349 part 5 - Cancel players that are no longer used; r=jwatt
This patch adds a means of terminating an animation so that is has no effect.
The procedure is defined by Web Animations:

  http://w3c.github.io/web-animations/#cancelling-a-player-section

We don't implement all of this, however, since we don't currently support the
finished promise or custom effects.

In a later bug we will expose this as the cancel() method on AnimationPlayer.

We call this method for terminated animations in nsAnimationManager and
nsTransitionManager to ensure they get removed from the pending player tracker
and so that, for example, the ready promise of CSS Animation player objects is
rejected when the corresponding item is removed from animation-name.
2014-12-18 08:42:41 +09:00
David Zbarsky 7e217619a6 Bug 1085769: Merge ContentOrAncestorHasAnimation/Transition r=birtles 2014-11-19 21:48:42 -05:00
David Zbarsky 8498454656 Bug 1085769: Merge RulesMatching, GetAnimationPlayers, and GetAnimationRule r=birtles 2014-11-19 21:48:41 -05:00
L. David Baron 670f12a2d1 Bug 1087536 patch 3 - Use new no-selector-matching hints for animation restyles. r=birtles
This depends on bug 1086937 patch 1 because it requires that
ResolveStyleWithReplacement support eRestyle_ChangeAnimationPhase on
::before and ::after pseudo-elements.

It also depends on patch 1 of this bug for the reasons described in
patch 1's commit message.

This is needed for bug 960465 so that we can use these hints to detect
whether pending restyles include restyles other than those for
animations.  In other words, patches for bug 960465 (or perhaps a
dependent bug that lands before it) will require that all animation
restyles use an animation-specific nsRestyleHint.

It is also, on its own, a performance improvement for animations and
transitions, since we will stop rerunning selector matching on the
animating element during the progress of the animations or transitions.
Once we remove eRestyle_ChangeAnimationPhase the performance improvement
will even become slightly better.

Note that the eRestyle_ChangeAnimationPhase is needed in some cases
because we use PostRestyleForAnimation in the non-animation-restyle
phase when we have a style rule that we need to add during the animation
restyle phase.  (It's not needed during the progress of the animation,
though.  But hopefully both eRestyle_ChangeAnimationPhase will go away
soon, after bug 960465.  And hopefully the way we tick animations will
also change to look more like the animation-only restyle, but without
the main-thread-suppressed (throttled) animations.)
2014-11-17 11:39:14 -08:00
Brian Birtles 18c294458c Bug 1073336 part 16 - Factor out animation-layer related information to a common database; r=dbaron 2014-11-17 13:46:00 +09:00
Brian Birtles 9acbbb6122 Bug 1073336 part 11 - Move GetAnimationPlayers to base CommonAnimationManager class; r=dbaron
nsAnimationManager provides GetAnimationPlayers while nsTransitionManager
provides GetElementTransitions. Both perform the same function, namely, fetching
(and optionally creating if it does not exist) the AnimationPlayerCollection for
the specified element/pseudo. Furthermore, both take the same arguments.

This patch aligns the method names and makes this a virtual method on the base
class CommonAnimationManager so that it can be used generically from a pointer
to a CommonAnimationManager.
2014-11-17 13:45:59 +09:00
Brian Birtles 371d30ed6a Bug 1073336 part 5 - Add AnimationPlayerCollection::PlayerUpdated; r=dbaron 2014-11-17 13:45:57 +09:00
Brian Birtles e8b261ac02 Bug 1073336 part 4 - Add CommonAnimationManager::CollectionUpdated; r=dbaron
Adds a method to the animation manager base class to handle changes to one of
its associated collections.
2014-11-17 13:45:57 +09:00
Brian Birtles 3ba1306512 Bug 1073336 part 2 - Call CheckNeedsRefresh from within EnsureStyleRuleFor; r=dbaron
Now that CheckNeedsRefresh is a member of the base class,
CommonAnimationManager, we no longer need to rely on callers of
AnimationPlayerCollection::EnsureStyleRuleFor to remember to call this method
but can do it automatically.
2014-11-17 13:45:56 +09:00
Brian Birtles 6435d45744 Bug 1073336 part 1 - Move CheckNeedsRefreshes to CommonAnimationManager; r=dbaron
In order to add AnimationPlayerCollection::NotifyPlayerUpdated, collections
need a way of updating their managers to inform them that their mNeedsRefreshes
flag has changed and hence the manager may need to resume observing the refresh
driver.

Currently, only nsAnimationManager makes use of mNeedsRefreshes and provides
a CheckNeedsRefresh method. In order to allow AnimationPlayerCollection to
operate independently of the type of manager it is attached to (and because
there's a lot of similar code here that we eventually want to move to a common
manager anyway), this patch moves CheckNeedsRefreshes and associated
machinery to CommonAnimationManager.
2014-11-17 13:45:56 +09:00
Daniel Holbert d1eae13c7d Bug 1084039: Clean up AnimationPlayerCollection::PseudoElement(). r=birtles 2014-10-16 22:14:02 -07:00
Mihaita Ghiorghe 2521531768 Bug 1081013 - Removed unused parameter in AnimationPlayerCollection constructor. r=dholbert 2014-10-12 00:37:22 -07:00
Brian Birtles 139a4e3a73 Bug 1046055 part 3 - Add AnimationPlayerCollection::HasCurrentAnimationsForProperty; r=dbaron
This patch adds another method to AnimationPlayerCollection alongside
HasCurrentAnimations that returns true if there is a player in the collection
with current source content that targets the specified property.

At the same time it also makes the original HasCurrentAnimations a const method.
2014-10-02 15:14:13 +09:00
L. David Baron 50ba17c1ca Bug 1057129 patch 2 - Post all animation restyles directly to pseudo-elements. r=birtles
This (like patch 1) posts restyles directly to the pseudo-element
content nodes, which is a new thing as of this bug.  Previously we'd
have posted eRestyle_Subtree restyles to the pseudo element's real
element (i.e., the parent of the pseudo-element content node).

This changes the way we post animation restyles for ::before and ::after
pseudo-elements with animations on them.
2014-08-24 21:48:22 -07:00
L. David Baron 26e0764f33 Bug 1057129 patch 1 - Make AddStyleUpdatesTo handle pseudo-elements. r=birtles
This (like patch 2) posts restyles directly to the pseudo-element
content nodes, which is a new thing.

This isn't needed right now since AddStyleUpdatesTo is currently only
used when updating main-thread-suppressed animations running on the
compositor.  However, it will be needed once we depend on
AddStyleUpdatesTo for bug 960465.  And it will have an effect now since
AddStyleUpdatesTo actually adds all animations rather than only the ones
that are suppressed from running on the main thread.
2014-08-24 21:48:22 -07:00
Ehsan Akhgari 5833657423 Bug 1055519 - Fix some more bad implicit constructors in layout and widget; r=roc 2014-08-20 00:58:22 -04:00
Brian Birtles b57ec6a9c0 Bug 1040543 part 6 - Rename mAnimations to mPlayers and likewise for similar local variables; r=bz
Now that we have both AnimationPlayer and Animation in use we need to clarify
which object we are referring to. This patch renames a number of member and
local variables to better reflect whether they point to an AnimationPlayer or an
Animation.

This patch is mostly renaming only with one exception. Since we are touching
a number of local variables used in loops (for looping over the array of
animation players) we take the opportunity to replace a number of instances of
uint32_t with size_t since that is the preferred type for array indices now.
2014-08-10 17:06:48 +10:00
Brian Birtles 249039905a Bug 1040543 part 5 - Pass down time from AnimationPlayer to Animation; r=bz
This patch makes AnimationPlayers pass their current time down to the Animation
they are playing.

Since all Animations need from their players is their time, this avoids adding
a pointer back to their AnimationPlayer.
2014-08-10 17:06:48 +10:00
Brian Birtles d3002fb8dd Bug 1040543 part 2 - Rename ElementAnimationCollection to AnimationPlayerCollection; r=bz 2014-08-10 17:06:46 +10:00
Brian Birtles 0c90999575 Bug 1040543 part 1 - Move/Rename ElementAnimations to dom::AnimationPlayer; r=bz
This patch renames mozilla::ElementAnimations to mozilla::dom::AnimationPlayer
and moves the code from layout/style/AnimationCommon.cpp to
dom/animation/AnimationPlayer.cpp.

It also moves various helper classes needed by AnimationPlayer to
AnimationPlayer.cpp and moves them from the mozilla::css namespace to the
mozilla namespace.

Beyond that, there are no functional changes contained in this patch.

The renaming of various members and variables that used to refer to
ElementAnimation objects but now refer to AnimationPlayer objects--to give them
a more appropriate name--is performed in a subsequent patch.

--HG--
rename : layout/style/AnimationCommon.cpp => dom/animation/AnimationPlayer.cpp
rename : layout/style/AnimationCommon.h => dom/animation/AnimationPlayer.h
2014-08-10 17:06:44 +10:00
L. David Baron 57a0eac1db Bug 996796 patch 25 - Remove the old (now-unused) miniflush code (preserving one of the header comments). r=heycam 2014-08-06 22:58:44 -07:00
L. David Baron 79e9b7336f Bug 996796 patch 24 - Use a RestyleTracker for the coalescing in the animation-only style flush (miniflush). r=heycam
This changes the coalescing behavior during the animation-only style
flush by doing tree-based coalescing between the style updates required
by animations and those required by transitions, rather than doing
animations and transitions separately.

Note that both the old and the new code update all
animating/transitioning styles rather than only the throttled styles,
though we should fix that eventually as noted in the FIXME comment in
the code (but only for the existing caller, and not for the new one to
be introduced in bug 960465).

Note that this depends for its correctness on the previous patches to
make the restyling process exact.

The test changes are because the effects of bug 1031688 are changed by
the change in coalescing.  In the old code, we updated transition styles
before animation styles; in the new code we do a single pass over the
tree, which for the relevant test means updating animations on the
parent before transitions on the child, which changes the effects of the
bug.
2014-08-06 22:58:44 -07:00
Brian Birtles 59bf2039e1 Bug 1036300 - Expose AnimationPlayer.timeline; r=bz 2014-07-16 09:02:33 +09:00
Brian Birtles a7a1177af7 Bug 1036287 part 6 - Add a GetComputedTiming shortcut that uses the current animation timeline time; r=dholbert
This patch introduces a method GetComputedTiming that calls GetComputedTimingAt
supplying the current time of the animation's timeline.

We still keep the GetComputedTimingAt static method since it is used for
off-main thread animation. Furthermore, we keep the second argument to
GetComputedTiming--the animation's timing properties--since on some occasions we
want to override those properties (ElementPropertyTransition::ValuePortionFor
does this). We could also add another overload that also supplies the
animation's timing properties but that can happen as a separate step.
2014-07-16 09:02:33 +09:00
Brian Birtles 7aff661646 Bug 1036287 part 5 - Drop aTime param from IsRunning(At) and IsCurrent(At), since they now use the current timeline time; r=dholbert 2014-07-16 09:02:33 +09:00
Brian Birtles f7c2a452ed Bug 1036287 part 4 - Make GetLocalTime(At) get the current time automatically from the timeline; r=dholbert
This patch changes ElementAnimation::GetLocalTimeAt so that instead of taking
the current time as input, it uses the animation's mTimeline member to look up
the current time of the associated timeline. As a result of this, it is possible
to remove a few instances of querying the refresh driver for the current time.
Further instances are removed in subsequent patches.

Furthermore, in order to keep the use of time sources consistent, the mStartTime
of new transitions and animations is initialized with the current time from the
animation's timeline rather than with the latest refresh driver tick.
Since this time could, in future, be null, GetLocalTime(At) is updated to check
for a null start time.

GetLocalTimeAt is also renamed to GetLocalTime in the process.
2014-07-16 09:02:32 +09:00
Brian Birtles 8a61f8ccfa Bug 1036287 part 3 - Make GetLocalTimeAt return a nullable time duration; r=dholbert
Once we support arbitrary timelines which can return null current time values,
the local time of an animation can also become null so this patch updates
ElementAnimation::GetLocalTimeAt to return a Nullable<TimeDuration>.
Doing this also allows us to pass the result of GetLocalTimeAt directly to
GetComputedTimingAt.
2014-07-16 09:02:32 +09:00
Brian Birtles a3a8900375 Bug 1036287 part 2 - Make GetComputedTimingAt take a nullable local time; r=dholbert
As part of supporting arbitrary timelines, we'd like to pass null times to the
function that calculates computed timing. Incidentally, this also provides
a means for evaluating calculating timing parameters that are independent of the
current time (currently only the active duration) without requiring a valid
time.

This patch updates the signature of ElementAnimation::GetComputedTimingAt to
take a nullable time duration.

We use the Nullable wrapper to represent null TimeDurations since, unlike,
TimeStamp, TimeDuration does not include a null state.
2014-07-16 09:02:32 +09:00
Brian Birtles 34ac24b42a Bug 1036287 part 1 - Add a null animation phase; r=dholbert
In order to support arbitrary timelines which may provide a "null" current time,
we need a suitable value to return from GetComputedTimingAt for the animation's
phase when the timeline time is null.

This patch introduces a null animation phase for this purpose.
2014-07-16 09:02:32 +09:00
Brian Birtles 4a5b988a87 Bug 1032573 part 5 - Add GetAnimationPlayers to Element; r=bz
This patch adds the WebIDL definitions and implementation of
getAnimationPlayers on Element.

It does not include the full definition of AnimationPlayer but only readonly
versions of the currentTime and startTime attributes since these are easy
to implement and enable identifying the different animations that are returned
for the sake of testing.

Web Animations defines getAnimationPlayers as only returning the animations that
are either running or will run in the future (known as "current" animations).
This will likely change since it seems desirable to be able query animations
that have finished but are applying a forwards fill. For now, however, this
patch makes us only return animations that have not finished.

This patch also removes an assertion in ElementAnimation::GetLocalTime that
would fail if called on a finished transition. This assertion is no longer
necessary since an earlier patch in this series removed the overloading of
the animation start time that meant calling this on a finished transition
was unsafe. Furthermore, this assertion, if it were not removed, would fail
if script holds onto a transition and queries its start time after it
completed.
2014-07-16 09:02:31 +09:00
Brian Birtles 9454e09015 Bug 1032573 part 2 - Add a timeline member to ElementAnimations; r=dbaron
When we expose ElementAnimation objects to script they need to have a parent
object so they can be associated with a Window.

This patch adds a pointer from an ElementAnimation to its AnimationTimeline.
2014-07-16 09:02:30 +09:00
Brian Birtles 881f90e9a2 Bug 1032573 part 1 - Don't overload start time for marking finished transitions; r=dbaron
When transitions finish, we keep them around for one additional throttle-able
tick to provide correct behavior for subsequent transitions that may be
triggered. Prior to this patch we did this by overloading the start time of the
animation and setting it to null in this case.

However, if we begin returning ElementAnimation objects to script, script can
hold on to those objects and query their start time even after they are
finished. Therefore we need another means of marking finished transitions that
doesn't clobber the start time field.

This patch introduces a new boolean member for marking such transitions.

While we're touching IsFinishedTransition we also take the chance to tidy up one
of the call sites, namely IsCurrentAt, to make the logic a little easier to
follow.
2014-07-16 09:02:29 +09:00
Brian Birtles a2d236894b Bug 1031319 part 1 - Don't generate element animations when animation-name is "none"; r=dbaron
This patch causes animations whose corresponding animation-name is "none" to be
dropped from the list of generated ElementAnimation objects. This means we avoid
generating events for these animations.
2014-07-03 09:04:16 +09:00
Brian Birtles 25fb32b91e Bug 1010067 part 8 - Rename ElementData methods and members in CommonAnimationManager to ElementCollection; r=dbaron 2014-06-27 08:57:13 +09:00
Brian Birtles 19d210c918 Bug 1010067 part 7 - Rename instances of ElementAnimationCollection; r=dbaron 2014-06-27 08:57:13 +09:00
Brian Birtles d8a8a8df73 Bug 1010067 part 6 - Rename mozilla::css::CommonElementAnimationData to mozilla::ElementAnimationCollection; r=dbaron 2014-06-27 08:57:12 +09:00
Brian Birtles ed3adcf998 Bug 1010067 part 5 - Move ElementPropertyTransition to mozilla namespace; r=dbaron 2014-06-27 08:57:12 +09:00
Brian Birtles f81da87711 Bug 1029370 part 3 - Add a comment explaining the relationship between ComputedTiming and GetComputedTimingAt; r=dholbert
Review for this patch granted as part of bug 1029370 comment 4 (at the end).
2014-06-25 09:42:19 +09:00
Brian Birtles c5a2510c5f Bug 1029370 part 1 - Move active duration calculation to GetComputedTimingAt; r=dholbert
This patch makes the active duration a property of the ComputedTiming struct and
returns this as part of calculating GetComputedTimingAt. GetComputedTimingAt was
already calling the method to calculate the ActiveDuration and the only other
callers of ActiveDuration() were also calling GetComputedTimingAt so this
doesn't make us do any unnecessary calculation.

I've left ActiveDuration as a public method on ElementAnimation for now since
it's a struct and just about everything there is public. At some point in the
future we'll probably make this more class-like to hide some details but that
can happen as a separate step. This patch does, however, move the definition of
ActiveDuration inside the .cpp file.

In tidying up GetComputedTimingAt we also replace all the references to
TimeDuration() and TimeDuration(0) with a single local variable representing
zero duration. This should be easier to read and possibly a little faster.

We don't use a function static variable since this method is called from
different threads and the initialization of function statics is not guaranteed
to be thread-safe until C++0x.
2014-06-25 09:42:19 +09:00
Brian Birtles 6bc9caf270 Bug 1010067 part 2 - Rename nsStyleAnimation.{h,cpp} to StyleAnimationValue.{h,cpp}; r=dbaron
--HG--
rename : layout/style/nsStyleAnimation.cpp => layout/style/StyleAnimationValue.cpp
rename : layout/style/nsStyleAnimation.h => layout/style/StyleAnimationValue.h
2014-06-24 15:29:54 +09:00