Commit Graph

46 Commits

Author SHA1 Message Date
Peter Van der Beken
9254096129 Bug 1078744 - Replace SetIsDOMBinding with SetIsNonDOMBinding, remove nsWrapperCache::SetIsDOMBinding. r=bz.
--HG--
extra : rebase_source : 89c476cd9436530b2df5acc903909e34188417a0
2014-10-07 11:44:49 +02:00
David Zbarsky
7546b0c638 Bug 1067701 - Implement Animation.target; r=birtles, r=bz 2014-10-02 15:14:15 +09:00
Brian Birtles
0d80e67ebf Bug 1074054 part 2 - Make Element::GetAnimationPlayers return in-effect animations too; r=dbaron
This patch makes Element::GetAnimationPlayers return not only current animations
but also animations that have finished but are filling forwards. This brings the
implementation into line with recent changes to the Web Animations spec and
allows querying all the animations that are currently affecting an element or
which are scheduled to do so in the future.
2014-10-02 15:14:14 +09:00
Brian Birtles
865c83d47d Bug 1074054 part 1 - Add Animation::IsInEffect; r=dbaron
This patch adds a utility method to return if an animation is "in effect" or not
as defined by Web Animations:

  http://w3c.github.io/web-animations/#in-effect

It also moves the utility method for querying if an animation is "current"
(IsCurrent) to the .cpp file since it is fairly long. (Bug 1046055 makes one of
the callers of IsCurrent inline-able which should offset any cost introduced by
this no longer being inline-able.)
2014-10-02 15:14:14 +09:00
Brian Birtles
2349318ce3 Bug 1046055 part 2 - Rename AnimationPlayer::IsCurrent to HasCurrentSource; r=dbaron
It's not the player that's "current" (a Web Animations term for an animation
that hasn't yet finished), but its source content, if any. This patch renames
the method on AnimationPlayer accordingly.

At the same time this patch moves the method to the header file since it's
quite simple and could possibly benefit from inlining.
2014-10-02 15:14:13 +09:00
Brian Birtles
4059c60799 Bug 1073396 - Make Element.getAnimationPlayers flush style; r=dbaron 2014-10-02 15:14:13 +09:00
Ehsan Akhgari
c03db1bf0f Bug 1072299 - Build dom/animation in unified mode; r=baku
--HG--
extra : rebase_source : 2119739c119fddb1204f6941b19a9a3f68d49cf8
2014-09-25 10:11:43 -04:00
Brian Birtles
6673d589fa Bug 1039924 part 6 - Use StickyTimeDuration for timing calculations; r=dholbert
This patch takes the StickyTimeDuration defined in the previous patch and
uses it within the calculation of animation timing for parameters that are
expected to be +/- Forever.
2014-09-25 14:25:50 +09:00
Ehsan Akhgari
bc7cc3893c Bug 1061023 - Fix more bad implicit constructors in DOM; r=baku
--HG--
extra : rebase_source : c80c5f9d7ae28286513cdb52ad76b46c240bdd5d
2014-09-01 18:26:43 -04:00
David Zbarsky
447962fe79 Bug 1033114 Part 4: Make mStartTime a nullable TimeDuration r=birtles 2014-08-30 02:11:57 -04:00
David Zbarsky
7276fd8572 Bug 1033114 Part 3: Make mStartTime a nullable TimeDuration r=birtles 2014-08-30 02:11:57 -04:00
David Zbarsky
55dff76341 Bug 1033114 Part 2: Rename mPauseStart to mHoldTime to match spec r=birtles 2014-08-30 02:11:56 -04:00
David Zbarsky
9f3b471024 Bug 1033114 Part 1: Update AnimationPlayer to spec changes r=birtles, r=bz 2014-08-30 02:11:56 -04:00
Brian Birtles
b2ae0e90c8 Bug 1045993 part 4 - Add tests for Animation.effect.name; r=dbaron 2014-08-22 13:42:48 +01:00
Brian Birtles
07f814acdf Bug 1045993 part 3 - Add AnimationEffect.name; r=dbaron, r=bz 2014-08-22 13:42:48 +01:00
Brian Birtles
5dd17adb88 Bug 1045993 part 2 - Move the animation name from AnimationPlayer to Animation; r=dbaron
This patch stores the animation name on the Animation object rather than its
AnimationPlayer. This is because Animation objects don't have a reference to
their AnimationPlayer but their AnimationEffect needs access to the animation
name.

This patch also adds an accessor for AnimationPlayer to get the name from its
Animation (since players *do* have a reference to their source animation
content).
2014-08-22 13:42:48 +01:00
Brian Birtles
aa863b8144 Bug 1045993 part 1 - Add AnimationEffect interface and Animation.effect member; r=dbaron, r=bz 2014-08-22 13:42:47 +01:00
Brian Birtles
50b24c51fd Bug 1045994 - Add a chrome-only property to AnimationPlayer to indicate if an animation is running on the compositor; r=dbaron, r=bz 2014-08-22 13:42:47 +01:00
Brian Birtles
51fed648c3 Bug 1052147 - Initialize AnimationPlayer::mPlayState to running state; r=dbaron
The assertion in nsTimeStamp::operator >= occasionally fails due to a null RHS
timestamp when called from AnimationPlayer::GetCurrentTimeDuration, which, in
turn, is called from AnimationPlayer::SetSource.

The issue appears to be that we're not correctly initializing
AnimationPlayer.mPlayState. This value can be running (0) or paused (1) but we
only ever compare against the paused state (i.e. every other value is
effectively treated as running). If we don't initialize this we can end
up in the paused state but with mPauseStart not set to a valid (non-null)
TimeStamp. This creates an inconsistent state since we assume that when we're
paused mPauseStart is non-null, hence the assertion fails.

This gets tickled because, since bug 1040543, we call
AnimationPlayer::SetSource from nsAnimationManager::BuildAnimations *before* we
set mPlayState and mPauseStart.

This patch initializes mPlayState to the running state so we don't accidentally
end up in an inconsistent state.

It also removes some (now unnecessary) initialization of mPlayState and
mPauseStart from nsTransitionManager::ConsiderStartingTransition.

In future we could also consider reworking nsAnimationManager::BuildAnimations
so that we call SetSource on the new animation player *after* setting up its
play state. That may be more correct and would further avoid this problem but
may not be necessary since all that code is likely to change in the near future.
2014-08-13 18:21:45 +09:00
Brian Birtles
813855dd9b Bug 1040543 part 11 - Make ElementPropertyTransition inherit from Animation instead of AnimationPlayer; r=bz
This patch changes the inheritance of ElementPropertyTransition so that it is
a subclass of Animation not AnimationPlayer.

The only thing special about ElementPropertyTransition is it stores some extra
state for reversing transitions and an extra ValuePortionFor convenience method.
This reversing behavior is implemented by the transition manager by creating
a new AnimationPlayer (i.e. it is *not* a property of the AnimationPlayer). As
a result this extra state can be pushed down to Animation which simplifies the
code significantly.

In future if we implement KeyframeEffect as a separate object we may be able to
push transition-specific state down to KeyframeEffect instead.
2014-08-10 17:06:52 +10:00
Brian Birtles
435e24f424 Bug 1040543 part 10 - Move mIsLastNotification from AnimationPlayer to Animation; r=bz
In this fourth step of dividing functionality between AnimationPlayer and
Animation, we move the mIsLastNotification and related methods/enums from
AnimationPlayer to Animation.

It is somewhat unclear where this belongs. This member is used to determine
which event to send for CSS Animations. The thinking behind moving this to
Animation is that if an animation that has already dispatched its animationstart
event was transferred to a new animation player with a similar current time then
I think it is expected that such an animation would *not* dispatch another
animationstart event. That suggests that event-state is a property of the
Animation not the AnimationPlayer.

Obviously, this needs to be defined somewhere (namely, the CSS Animations <->
Web Animations integration spec likely to become "CSS Animations Level 4"). Once
that behavior is agreed upon, if AnimationPlayer proves to be the more suitable
home for this member then it should be relatively straightforward to move the
member back at that time.
2014-08-10 17:06:51 +10:00
Brian Birtles
7cc2fe6201 Bug 1040543 part 9 - Move IsFinishedTransition from AnimationPlayer to Animation; r=bz
As the third step in dividing functionality between AnimationPlayer and
Animation this patch moves the mIsFinishedTransition member and related methods
from AnimationPlayer to Animation.

At the same time we rename SetFinishedTransition to SetIsFinishedTransition.
2014-08-10 17:06:51 +10:00
Brian Birtles
eee37dc2bd Bug 1040543 part 8 - Move timing parameters from AnimationPlayer to Animation; r=bz
As the second step in dividing functionality between AnimationPlayer and
Animation, this patch moves the AnimationTiming member from AnimationPlayer to
Animation.

Most of this patch is simply moving code around. However, one significant
functional difference is that Animation::GetLocalTime() uses the mParentTime
member which is set when the Animation is updated by the player it is attached
to.

Other less significant differences are:

* AnimationPlayer::GetLocalTime is renamed to GetCurrentTimeDuration
  In Web Animations, animation players have a (writeable) "current time" and
  animations have a (read-only) "local time".
  We would call the method simply "GetCurrentTime" (instead of
  "GetCurrentTimeDuration") but GetCurrentTime is the name of the method used in
  the content-facing API where it returns a double.

* "IsCurrent" is defined on both AnimationPlayer and Animation with the version
  in AnimationPlayer serving mostly as a convenience shortcut to the version on
  Animation.

* Animation::GetComputedTiming (previously on AnimationPlayer) now makes the
  timing parameter optional since most of the time it is not needed.
2014-08-10 17:06:50 +10:00
Brian Birtles
a66a1ea7b5 Bug 1040543 part 7 - Move keyframe properties from AnimationPlayer to Animation; r=bz
As the first step in dividing the functionality currently contained in
AnimationPlayer between AnimationPlayer and Animation this patch moves the set
of keyframe properties to the Animation.

These properties are returned from the Animation by a couple of Properties()
methods that provide direct access to the member variable. In future it is
anticipated that the non-const version will be replaced with an appropriate
setter function. This will likely happen when we implement a separate
KeyframeEffect object as defined by the Web Animations API.

With regards to error checking, nsAnimationManager checks the result of
AnimationPlayer::GetSource() and handles the case where it is nullptr.
nsTransitionManager, however, simply asserts that GetSource() is never null much
like it also asserts that there is only one property with one segment in the
animation. Eventually this code should be made more generic which will probably
happen in bug 999927.
2014-08-10 17:06:49 +10:00
Brian Birtles
9403f55c91 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
fd89e49012 Bug 1040543 part 4 - Create Animation objects and set on AnimationPlayer; r=bz 2014-08-10 17:06:47 +10:00
Brian Birtles
ff9dbee0c4 Bug 1040543 part 3 - Add Animation interface; r=bz
This patch adds the Animation interface and adds a 'source' attribute to
AnimationPlayer that refers to this class.
2014-08-10 17:06:46 +10:00
Brian Birtles
b1759d304e 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
Ehsan Akhgari
3925065702 Bug 1050611 - Fix more bad implicit constructors in dom and docshell; r=smaug 2014-08-08 09:49:39 -04:00
Brian Birtles
532c1e8eff Bug 1002332 - Make AnimationTimeline record the last refresh time and use that when there is no refresh driver; r=bz
A document that belongs to an iframe that is display:none as no associated pres
context from which to get a refresh driver. However, in this case
document.timeline.currentTime should still never go backwards (since document
timelines are supposed to be monotonically increasing).

This patch makes AnimationTimeline record the last value returned for the
current time so that if the document becomes display:none we can still return
the most recently used time.
2014-07-24 13:37:38 +09:00
Alexandre Poirot
5a3800bc64 Bug 1027242 - Blacklist mulet's failing tests + expose 'mulet' to ini files; fix previous bustage on a CLOSED TREE, r=ahal 2014-07-02 15:40:56 -07:00
Brian Birtles
b784c29a93 Bug 1037316 part 2 - When updating animations, match existing animations one-by-one starting from the beginning of each list; r=dbaron
This patch changes the order in which we look for matches when updating existing
animations. Previously we would iterate through new animations in a forwards
direction but match old animations by going through the list of animations
backwards.

This patch makes us iterate through both lists in a backwards direction. That
means that if we have:

  animation: anim 100s

and later we make it

  animation: anim 100s, anim 100s

Then the new animation will be added to the *start* of the list, i.e. prepended,
and the resulting animation will not restart.
2014-07-23 10:51:12 +09:00
Brian Birtles
699a8025c6 Bug 1037316 part 1 - Return the same object when updating animations; r=dbaron
Previously when updating animations we'd generate a new list of animation
objects then try to match up animations from the existing list and copy across
state such as start times and notification flags. However, this means that from
the API we end up returning different objects.

This patch makes us maintain the same object identity when updating an existing
animation. It does this by looking for matching animations in both lists. If it
finds a match it copies the necessary information from the *new* animation to
the *existing* animation (but preserving the start time, last notification
etc.). Then, finally, it puts the *existing* animation in the list of *new*
animations and removes the corresponding *new* animation. The existing
animation is also removed from the list of existing animations so that it only
matches once.

The method used for matching is probably not intuitive but this is addressed in
a subsequent patch in this series.
2014-07-23 10:51:12 +09:00
Jonathan Griffin
efbbf73c27 Backed out changeset 64586374a208 on a CLOSED TREE 2014-07-22 18:29:57 -07:00
Alexandre Poirot
09c66c2ebd Bug 1027242 - Blacklist mulet's failing tests + expose 'mulet' to ini files; fix previous bustage on a CLOSED TREE, r=ahal 2014-07-02 15:40:56 -07:00
Jonathan Griffin
0cd20a2c49 Backout 4f6d9db92389 for bustage on a CLOSED TREE 2014-07-22 17:55:50 -07:00
Mike Hommey
d10b15b035 Bug 1041860 - Avoid setting FINAL_LIBRARY to libraries that further use a FINAL_LIBRARY. r=mshal 2014-07-23 08:37:51 +09:00
Alexandre Poirot
c044256760 Bug 1027242 - Blacklist mulet's failing tests + expose 'mulet' to ini files. r=ahal 2014-07-02 15:40:56 -07:00
Brian Birtles
5ebdbe214d Bug 1033881 part 2 - Add tests to test_element-get-animation-players.html which checks for animation-name: missing; r=dbaron 2014-07-17 10:04:56 +09:00
Brian Birtles
7e24d06e5e Bug 1032573 part 6 - Add tests for Element.getAnimationPlayers; r=dbaron 2014-07-16 09:02:31 +09:00
Brian Birtles
10fd3a5994 Bug 1032573 part 4 - Add AnimationTimeline::ToTimelineTime helper method; r=dbaron
This patch simply factors out the conversion from a TimeStamp value to
a nullable-double value relative to the start of the timeline. This is so that,
in a subsequent patch, this functionality can be reused by ElementAnimation
when it reports its start time (which is currently recorded as a TimeStamp).
2014-07-16 09:02:30 +09:00
Brian Birtles
320ac1d2de Bug 1032573 part 3 - Add AnimationTimeline::GetCurrentTimeStamp; r=dbaron
AnimationTimeline::GetCurrentTime returns the time value of the timeline as
a double. For internal calculations however it is more useful to get this as
a mozilla::TimeStamp.

This patch splits the calculation of the current time into two stages:
calculation as a timestamp then conversion to a double.
2014-07-16 09:02:30 +09:00
Benoit Jacob
747dcfc8a0 Bug 1028588 - Fix dangerous public destructors in the rest of dom/ - r=ehsan 2014-06-23 15:56:07 -04:00
Brian Birtles
5324fa6296 Bug 998246 part 5 - Add tests for AnimationTimeline; r=dholbert 2014-05-13 16:22:13 +09:00
Brian Birtles
8343e66e73 Bug 998246 part 4 - Add currentTime member to AnimationTimeline; r=bz 2014-05-13 16:22:12 +09:00
Brian Birtles
bc16925f39 Bug 998246 part 2 - Add AnimationTimeline interface; r=bz, r=glandium 2014-05-13 16:22:12 +09:00