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

536 Коммитов

Автор SHA1 Сообщение Дата
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
Hiroyuki Ikezoe 6f7b96040d Bug 1216030 - Part 8.5: Animation::CanThrottle() should check that all animation properties are running on compositor. r=bbirtles
If this patch (and part 9) is an overkill to throttle animations having both
of properties, one can be run on compositor and another can not be, a test
case in test_running_on_compositor[1] will fail.
The test case is for an animation which has transform and background-color
properties.

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

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

[1] http://hg.mozilla.org/mozilla-central/file/6c7c983bce46/dom/animation/test/chrome/test_running_on_compositor.html#l77
2015-11-06 02:49:00 +01:00
Hiroyuki Ikezoe 5d5a2aa878 Bug 1216030 - Part 8: Add KeyframeEffectReadOnly::GetAnimationFrame. r=bbirtles
This method will be used in KeyframeEffectReadOnly::CanThrottle to get
appropriate target frame for animation.
2015-11-06 02:42:00 +01:00
Hiroyuki Ikezoe 84322d36f1 Bug 1216030 - Part 6: Add KeyframeEffectReadOnly::IsGeometricProperty. r=bbirtles
This method will be private soon.
2015-11-06 02:38:00 +01:00
Hiroyuki Ikezoe 74c73fa482 Bug 1216030 - Part 5: Add KeyframeEffectReadOnly::CanAnimateTransformOnCompositor. r=bbirtles
This method will be private soon.
2015-11-06 02:38:00 +01:00
Hiroyuki Ikezoe 443e1dfb4b Bug 1197620 - Part 3: Terminate *all* animations if corresponding element style is changed to display:none. r=bbirtles 2015-11-06 07:21:38 +09:00
Boris Chiou 7203e534eb Bug 1208940 - Move ComputedTimingFunction to its own file. r=bbirtles 2015-11-01 22:41:00 +01:00
Boris Chiou 61c4d08674 Bug 1108055 - Part 4: Add ComputedTiming mochitests. r=birtles
Add test_animation-computed-timing.html in css-animations and
css-transitions.

--HG--
extra : rebase_source : 7bfee6909c7d929399cbdb2a2c462000b6215228
2015-11-02 00:37:00 +01:00
Boris Chiou 2c0d38d0d8 Bug 1108055 - Part 3: Implement GetComputedTiming method. r=birtles
Implement KeyframeEffectReadOnly::GetComputedTiming().

--HG--
extra : rebase_source : eae0dc0887bf559924ad96cead438d0e7eab9081
2015-10-23 00:48:00 +02:00
Boris Chiou b2d9321540 Bug 1108055 - Part 2: Refine ComputedTiming. r=birtles
Do some minor revisions in struct ComputedTiming.
1. Use Nullable<double> mProgress, so remove the static const kNullProgress.
   The generated ComputedTimingProperties dictionary uses "Nullable" variable,
   so we replace the origin type in ComputedTiming to make it more consistent
   with that in ComputedTimingProperties dictionary.
2. Use scoped enums for AnimationPhase.

--HG--
extra : rebase_source : 31280c867a30e7bcdcfe831cbc72ca08c8ddc762
2015-10-19 00:38:00 +02:00
Boris Chiou ba5bbe41ce Bug 1108055 - Part 1: Add ComputedTimingProperties dictionary. r=smaug
Add two dictionaries into AnimationEffectReadOnly.webidl:
1. AnimationEffectTimingProperties
2. ComputedTimingProperties
And then re-generate this class.

--HG--
extra : rebase_source : 81b2a3c08453cabcb2ac1334e6d4bde2c1bafeea
2015-10-13 22:17:00 +02:00
Brian Birtles 67a7daaa2f Bug 1216846 - Don't update hold time when completing a pause if it is already set; r=heycam
The Animation.pause() method operates asynchronously since, if the animation is
currently running on the compositor, we should wait for the animation to stop
on the compositor before establishing the pause time. Otherwise, if the
compositor is ahead of the main thread and we use the main thread's notion of
the current time to establish the pause time, the animation will jump backwards
when we take it off the compositor.

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

However, when we have a finished animation, its current time is not advancing
but rather its current time is fixed to its end time. This too is represented
using the hold time. As a result, if we pause a finished animation we should
not update its hold time (by calculating the current time from the start time)
but just continue to use the existing hold time. This is true of any other
situation where we might have set the hold time before or during pausing.
2015-11-02 08:33:58 +09:00
Cameron McCormack bce3927621 Bug 1216872 - Make 100% Keyframe returned by getFrames() have easing:linear. r=birtles 2015-10-22 19:22:38 +11:00
Cameron McCormack 50e5a35995 Bug 1208951 - Part 11: Tests. r=birtles 2015-10-22 19:22:38 +11:00
Cameron McCormack 44142b120c Bug 1208951 - Part 10: Make GetFrames aware of initial/final zero-length segments and discontinuities between segments. r=birtles 2015-10-22 19:22:38 +11:00
Cameron McCormack 235db06383 Bug 1208951 - Part 9: Implement KeyframeEffectReadOnly constructor. r=bzbarsky r=birtles 2015-10-22 19:22:38 +11:00
Cameron McCormack 50c4eb3b78 Bug 1208951 - Part 2: Use a comparator object instead of operator< on KeyframeValueEntry. r=birtles 2015-10-22 19:22:37 +11:00
Cameron McCormack b746909966 Bug 1208951 - Part 1: Split half of KeyframeValueEntry into a base class. r=birtles
In a subsequent patch, we will have another struct like
KeyframeValueEntry, but storing an StyleAnimationValue and an
ComputingTimingFunction object (not a pointer).  So we split
KeyframeValueEntry into two, retaining the KeyframeValueEntry name for
the base class and naming the current one KeyframeStringValueEntry.
2015-10-22 19:22:37 +11:00
Brian Birtles b4f581b39f Bug 1194639 part 8 - Report changes from calling pause() to animation mutation observers; r=heycam 2015-10-22 15:16:18 +09:00
Brian Birtles b860019be5 Bug 1194639 part 7 - Report changes from calling play() to animation mutation observers; r=heycam 2015-10-22 15:16:18 +09:00
Brian Birtles dc867a5d59 Bug 1194639 part 6 - Report changes from calling finish() to animation mutation observers; r=heycam 2015-10-22 15:16:18 +09:00
Brian Birtles ea0acf6dda Bug 1194639 part 5 - Report changes from calling reverse() to animation mutation observers; r=heycam 2015-10-22 15:16:18 +09:00
Brian Birtles 1dac94b623 Bug 1194639 part 4 - Report changes to currentTime to animation mutation observers; r=heycam 2015-10-22 15:16:18 +09:00
Brian Birtles 66cb8a4081 Bug 1194639 part 3 - Report changes to startTime to animation mutation observers; r=heycam 2015-10-22 15:16:18 +09:00
Brian Birtles eab83a05b4 Bug 1194639 part 2 - Report changes to playbackRate to animation mutation observers; r=heycam 2015-10-22 15:16:18 +09:00
Brian Birtles 5d800ef88f Bug 1194639 part 1 - Add AutoMutationBatchForAnimation; r=heycam 2015-10-22 15:16:18 +09:00
Nathan Froyd 01583602a9 Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat
The bulk of this commit was generated with a script, executed at the top
level of a typical source code checkout.  The only non-machine-generated
part was modifying MFBT's moz.build to reflect the new naming.

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

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

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

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

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

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

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

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

This patch also updates one of the tests for reversing. With this updated
behavior we can sometimes arrive at a situation where when an Animation starts
and its ready promise resolves, its currentTime is still 0. If we call
reverse() at this point on an animation with an infinite active duration it
should throw an InvalidStateError. To avoid this situation, this test makes
sure we wait an extra frame before calling reverse().
2015-10-07 14:30:28 +09:00
Brian Birtles 0ea5e5c7c8 Bug 1208938 part 2 - Remove Animation::HasEndEventToQueue; r=heycam 2015-10-07 14:30:28 +09:00
Brian Birtles 9590e60a48 Bug 1208938 part 1 - Rename AnimationCollection::mNeedsRefreshes to mStyleChanging; r=heycam
This patch renames AnimationCollection::mNeedsRefreshes to indicate that it
no longer has any relationship to whether or not we observe the refresh driver.
2015-09-17 15:43:15 +09:00
Brian Birtles ad657213b1 Bug 1208385 part 2 - Remove stored parent time from KeyframeEffectReadOnly and get the time directly from the owning animation; r=heycam 2015-10-07 14:30:28 +09:00
Brian Birtles d89f0d836b Bug 1208385 part 1 - Store a pointer to the owning animation on each KeyframeEffect; r=heycam
We need to do this so effects can query their owning animation for the current
time and avoid falling out of sync. Furthermore, this pointer is needed
for a number of other bugs (e.g. bug 1166500 comment 12, or bug 1190235)
anyway.
2015-10-07 14:30:27 +09:00
Brian Birtles 08a8534ec0 Bug 1208385 part 0 - Fix up some references to Web Animations spec; r=heycam 2015-10-07 14:30:27 +09:00
Ryan VanderMeulen 5c1905cbf4 Bug 1209519 - Undef GetCurrentTime in DocumentTimeline.h to fix --disable-accessibility bustage. r=birtles
--HG--
extra : rebase_source : cec795042cf8b6e47209395ff18925d3d9e8d03c
2015-09-29 10:04:30 -04:00
Brian Birtles 9621365cd2 Bug 1208929 - Turn on -Wshadow for dom/animation; r=glandium
This patch also shuffles the order of LOCAL_INCLUDES and FINAL_LIBRARY to match
what most other moz.build files seem to do.
2015-09-29 13:22:24 +09:00
Cameron McCormack 260625c5e6 Bug 1198708 - Part 7: Tests. r=birtles 2015-09-29 12:20:14 +10:00
Cameron McCormack c2e4c54592 Bug 1198708 - Part 6: Implement KeyframeEffectReadOnly.getFrames(). r=birtles,bzbarsky
Since getFrames() must gather all properties set at a given keyframe
offset time for a given easing function, we need to provide a total
ordering for ComputedTimingFunction objects.  Until the spec defines how
to do this, we sort first by NS_STYLE_TRANSITION_TIMING_FUNCTION_*
value, then second by the four values in a cubic-bezier() function (in
order) or the integer and optional keyword in a steps() function.

Because we don't support automatic spacing of keyframes yet,
ComputedKeyFrame.computedOffset is always the same as Keyframe.offset.

Another assumption made is that the value of easing for a Keyframe
object at 100% should be the same as the value from the previous
Keyframe for the same property.  An alternative would be to leave off
easing from that Keyframe, which would need the default value for that
IDL dictionary member removed (otherwise it would always be set to
"linear").
2015-09-29 12:20:14 +10:00
Cameron McCormack 45eb434b3e Bug 1198708 - Part 5: Add method to serialize a ComputedTimingFunction. r=birtles 2015-09-29 12:20:14 +10:00
Cameron McCormack 9293060eef Bug 1198708 - Part 1: Store exact timing-function type on nsTimingFunction and ComputedTimingFunction. r=birtles
Since Keyframe.easing should reflect the {transition,animation}-timing-
function value relevant to each keyframe, we'll need to store on
nsTimingFunction the specific timing function value that was used, and
copy it down into ComputedTimingFunction for
KeyframeEffectReadOnly.getFrames() to access.  This includes storing
whether the optional start/end keyword in a steps() function was
specified.
2015-09-29 12:20:13 +10:00
Brian Birtles 16b5c82dc9 Bug 1207951 - Fix buggy logic in ComposeStyle; r=heycam 2015-09-28 12:38:41 +09:00
Brian Birtles 820618158a Bug 1195180 part 9 - Add test for seeking finished -> paused; r=heycam
This patch adds a test that even when we seek from being irrelevant to another
state where we no longer need ticks that we still spin the refresh driver
in order to queue and dispatch an animationstart event.
2015-09-28 12:38:41 +09:00
Brian Birtles 36c16f7957 Bug 1195180 part 8 - Tick animations from their timeline; r=heycam 2015-09-28 12:38:41 +09:00
Brian Birtles 68cafe83b4 Bug 1195180 part 7 - Store animations in an array; r=heycam
Currently AnimationTimeline stores animations in a hashmap which means that
when we go to iterate over those animations to tick them we will visit them
in an order that is non-deterministic.

Although many of the observable effects of ticking an animation (e.g. CSS
animation/transition events, mutation observer events) are later sorted so that
the result does not depend on the order in which animations are ticked, this is
not true for in all cases. In particular, the order in which Animation.finished
promises are resolved will vary depending on the order in which animations are
ticked. Likewise, for Animation finish events.

Furthermore, it seems generally desirable to have a deterministic order for
visiting animations in order to aid reproducing bugs.

To achieve this, this patch switches the storage of animations in
AnimationTimeline to use an array instead. However, when adding animations
we need to determine if the animation to add already exists. To this end we
also maintain a hashmap of the animations so we can quickly determine if
the animation to add is a duplicate or not.
2015-09-28 12:38:41 +09:00
Brian Birtles ae189d2746 Bug 1195180 part 6 - Lazily remove animations from timelines; r=heycam
Now that DocumentTimeline observes the refresh driver we can use regular
ticks to remove unnecessary animations.

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

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

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

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

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

[1] https://w3c.github.io/web-animations/#responding-to-a-newly-inactive-timeline
2015-09-28 12:38:41 +09:00
Brian Birtles 4ba3abb7d3 Bug 1195180 part 5 - Synchronize refresh driver observing with presshell creation/teardown; r=heycam 2015-09-28 12:38:40 +09:00
Brian Birtles 615fb3a648 Bug 1195180 part 4 - Unregister from refresh observer when there are no animations needing ticks; r=heycam 2015-09-28 12:38:40 +09:00
Brian Birtles 5e9be9d40a Bug 1195180 part 3 - Add flag to record if DocumentTimeline is observing the refresh driver; r=heycam 2015-09-28 12:38:40 +09:00
Brian Birtles a12e08d26e Bug 1195180 part 2 - Make DocumentTimeline inherit from nsARefreshObserver; r=heycam 2015-09-28 12:38:40 +09:00
Brian Birtles 534ef7e86c Bug 1195180 part 1 - Add Animation::NeedsTicks; r=heycam
Adds a method to determine if an animation requires refresh driver ticks.
We will use this function later to determine when it is safe to stop
observing the refresh driver.
2015-09-28 12:38:40 +09:00
Hiroyuki Ikezoe 2c827fa03a Bug 1151694 - Part 6 - A test case of Animation.isRunningOnCompositor for transition. r=bbirtles
--HG--
extra : rebase_source : f5f8b6641d16ff3330139fe5b496f9982e00f69f
2015-09-15 16:50:00 +02:00
Hiroyuki Ikezoe b71bdc2f2a Bug 1151694 - Part 5 - Additional tests for Animation.IsRunningOnCompositor. r=bbirtles
--HG--
extra : rebase_source : 04a43de598784076de58b3520297602cfbd48223
2015-09-15 16:49:00 +02:00
Hiroyuki Ikezoe d1899602ba Bug 1151694 - Part 4 - Able to use testcommon.js in the window which has no opener. r=bbirtles
--HG--
extra : rebase_source : abfc9c175114d35e328568e73227064b8895b78d
2015-09-10 19:17:00 +02:00
Hiroyuki Ikezoe 41ec8da9f3 Bug 1151694 - Part 3: Manage mIsRunningOnCompositor flags for each properties respectively. r=bbirtles
--HG--
extra : rebase_source : d189d779ef14e8ae5497b03b01e3d4d994803fe1
2015-09-16 16:05:00 +02:00
Brian Birtles 8bf9ca19e0 Bug 1183461 part 3 - Add Animation::AnimationTimeToTimeStamp; r=heycam
This patch adds a utility method to Animation which takes a time in the
same time space as "current time", i.e. "animation time" and convert it to
a TimeStamp. Subsequent patches in this series will use this method to
take the time when an event was scheduled to occur and convert it to a
TimeStamp so it can be compared with other event times. This allows us to
dispatch events in the order they would have fired given an infinitely
frequent sample rate.

--HG--
extra : rebase_source : 0b4f98b932bb2751bac24b4383fe20613176f0c4
2015-09-15 14:04:08 +09:00
Brian Birtles d135283802 Bug 1183461 part 1 - Move InitialAdvance to CSSAnimation; r=heycam
Currently we define a helper method, InitialAdvance, on KeyframeEffectReadOnly.
However, this method is only used for filling out the elapsedTime member of
AnimationEvents (which are generated by CSS animations). This patch moves this
method to CSSAnimation since it is unneeded for other types of Animations.

--HG--
extra : rebase_source : 9ab3b81a8272c004aabf26fea557c9a2f5d76caf
2015-09-15 14:03:24 +09:00
Brian Birtles c49da97499 Bug 1203009 part 6 - Add tests for new composite order; r=heycam 2015-09-15 13:58:17 +09:00
Brian Birtles 1bb17c4634 Bug 1203009 part 5 - Remove IsUsingCustomCompositeOrder; r=heycam 2015-09-15 13:32:12 +09:00
Brian Birtles 25e9bf79fe Bug 1203009 part 4 - Implement new composite ordering; r=heycam 2015-09-15 11:20:56 +09:00
Brian Birtles 3d0a063444 Bug 1203009 part 1 - Rename sequence number to animation index; r=heycam
The Web Animations specification has replaced the term "sequence number" with
references to a global animation list. This patch applies similar naming
to our animation structures.
2015-09-15 11:20:26 +09:00
Hiroyuki Ikezoe b3c78a8f5d Bug 1197620 - Part 2 tests that animation stop playing when its element is not displayed. r=bbirtles
This tests cover that the element is 'display:none' and its parent element is
'display:none' cases.
2015-09-10 20:06:00 +02:00
Brian Birtles fa52a070ee Bug 1194037 part 6 - Add test for order of mutation observer records; r=heycam 2015-09-11 15:02:04 +09:00
Brian Birtles 5452d490a2 Bug 1194037 part 5 - Make AnimationProperty::operator== ignore mWinsInCascade; r=heycam 2015-09-10 14:03:46 +09:00
Hiroyuki Ikezoe 89fd88d557 Bug 1151694 - Part 0: Rewrite test_running_on_compositor.html with add_task(). r=bbirtles
Now we can add other test cases there.

--HG--
extra : rebase_source : 90231bfada02a60c8240f28a5164dfb867399d2f
2015-08-27 04:00:00 +02:00
Brian Birtles a362d9f14e Bug 1194037 part 3 - Add Animation::HasEndEventToQueue(); r=dholbert
We currently determine if we need refresh driver ticks when composing style
but sometimes we might not need ticks for composing style but we might need
one more tick in order to queue a final end event. Currently, this doesn't
seem to be a problem because FlushAnimations calls Animation::Tick where we
queue up events. When we remove the call to Animation::Tick from
FlushAnimations in order to make FlushAnimations purely responsible for
posting restyles, however, we will create a situation where we might mark an
animation collection as no longer needing refreshes and not simultaneously
queueing the corresponding event. If another animation collection is deleted in
the meantime we may trigger the code that causes us to disassociate from the
refresh driver and the corresponding event will never be dispatched.

Long-term (bug 1195180) we will check if it we can stop observing the refresh
driver and queue events in the same step. Until then, this patch adds a method
to detect this particular situation and uses it to avoid unregistering from
the refresh driver while we still have end events to queue.
2015-08-31 16:21:55 +09:00
Nicholas Nethercote f44287005f Bug 1198334 (part 1) - Replace the opt-in FAIL_ON_WARNINGS with the opt-out ALLOW_COMPILER_WARNINGS. r=glandium.
The patch removes 455 occurrences of FAIL_ON_WARNINGS from moz.build files, and
adds 78 instances of ALLOW_COMPILER_WARNINGS. About half of those 78 are in
code we control and which should be removable with a little effort.

--HG--
extra : rebase_source : 82e3387abfbd5f1471e953961d301d3d97ed2973
2015-08-27 20:44:53 -07:00
Hiroyuki Ikezoe 56f8274c93 Bug 1194028 - Part 2: Use KeyFrameEffect SetTiming. r=bbirtles
Now KeyframeEffect.SetTiming() updates the owning animation timing and relavance, so
we don't need to call each methods respectively for the animation any more.
2015-08-18 03:57:00 -04:00
Hiroyuki Ikezoe a4077879ac Bug 1194028 - Part 1: Implement Animation NotifyEffectTimingUpdate and KeyframeEffect SetTiming. r=bbirtles 2015-08-17 14:28:00 -04:00
Brian Birtles 3cc3ae622c Bug 1188251 part 11 - Add RestyleType::Layer; r=dholbert
We currently have a series of methods that clobber various bits of animation
state to force animations on layers to be updated. This aligns closely with
the restyle code introduced in this patch series.

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

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

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

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

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

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

This patch achieves that by:

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

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

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

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

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

This patch also reworks this method so that it's hopefully a little easier to
follow and a little more consistent since I spent several hours trying to
understand the different combinations of inputs this method could take and what
question it was trying to answer.
2015-08-07 12:29:35 +09:00
Brian Birtles 774abfc8fe Bug 1180125 part 2 - Move AnimationCommon classes out of CSS namespace; r=dbaron
The long-term plan is to drop the mozilla::css namespace altogether. Before we
go to much further with refactoring code in AnimationCommon, we should drop
usage of the mozilla::css namespace. Specifically, this patch moves the
CommonAnimationManager and AnimValuesStyleRule classes to the mozilla namespace.
2015-07-29 10:57:39 +09:00
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
Hiroyuki Ikezoe 5119cec74f Bug 1178664 - Part 4 -Implement Animation.oncancel event. r=bbirtles, r=smaug
--HG--
extra : rebase_source : 2885fc984f652ecd086b9ec4f9b57190375c965c
2015-07-30 23:26:00 +02:00
Hiroyuki Ikezoe 189c64b196 Bug 1178664 - Part 3 - Implement Animation.onfinish event. r=bbirtles, r=smaug
--HG--
extra : rebase_source : d78f3a6d58f26a46dfdd726f30590bc8a4e9137d
2015-07-30 23:25:00 +02:00
Hiroyuki Ikezoe d2e5ec96d8 Bug 1178664 - Part 1 - Make Animation interface EventTarget inheritance. r=smaug
--HG--
extra : rebase_source : e182dc4757a19ec4e55e4e3d9d7a893a190929cf
2015-07-30 23:23:00 +02:00
Hiroyuki Ikezoe 77aabfc80f Bug 1178665 - Part 3: Make finish notifications asynchronously in most cases. r=bbirtles, r=smaug 2015-07-29 23:21:00 +02:00
Hiroyuki Ikezoe 95ecbd9979 Bug 1178665 - Part 2 - Adapt to latest Animation.finish procedure changes. r=bbirtles
ee99cc4db5
2015-07-14 21:45:00 +02:00
Carsten "Tomcat" Book 61664e5c9a Backed out changeset 79bcd4f744c0 (bug 1180125) 2015-07-29 17:32:24 +02:00
Carsten "Tomcat" Book c86b8ab1b4 Backed out changeset a4fb4e4b1c8b (bug 1180125) 2015-07-29 17:32:19 +02:00
Brian Birtles 9b391b0177 Bug 1180125 part 2 - Move AnimationCommon classes out of CSS namespace; r=dbaron
The long-term plan is to drop the mozilla::css namespace altogether. Before we
go to much further with refactoring code in AnimationCommon, we should drop
usage of the mozilla::css namespace. Specifically, this patch moves the
CommonAnimationManager and AnimValuesStyleRule classes to the mozilla namespace.
2015-07-29 10:57:39 +09:00
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
Hiroyuki Ikezoe 3c7a785930 Bug 1186684 - Remove unused ErrorResult in Animation::SetPlaybackRate/SilentlySetPlaybackRate. r=bbirtles 2015-07-23 02:55:00 -04:00
Brian Birtles bc2fc9b22c Bug 1182981 part 2 - Use nsTHashtable::Iterator in AnimationTimeline; r=njn
--HG--
extra : commitid : AiFiSUN1lz0
2015-07-21 10:47:23 +09:00
Brian Birtles 21f9c85801 Bug 1182981 part 1 - Use nsTHashtable::Iterator in PendingAnimationTracker; r=njn
--HG--
extra : commitid : 5gJ232PxuKn
2015-07-21 10:47:13 +09:00
Brian Birtles b9bba5ced7 Bug 1168759 - Disable test_deferred_start.html on B2G debug emulator; r=ryanvm
--HG--
extra : commitid : KEeVnf78RFT
2015-07-21 10:47:02 +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
Hiroyuki Ikezoe 2dbe94e81f Bug 1182931 - Expose assert_unreached in subwindows. r=bbirtles 2015-07-12 17:04:00 +02:00
Ehsan Akhgari 210879a004 Bug 1113086 follow-up: Add a forward declaration to fix build bustage 2015-07-10 20:49:32 -04:00
Carsten "Tomcat" Book 72634f3fbc Backed out changeset 91846db1056c (bug 1113086) 2015-07-11 14:13:36 +02:00
Ehsan Akhgari 3a8e01586f Bug 1113086 follow-up: Add a forward declaration to fix build bustage 2015-07-10 21:09:08 -04:00
Hiroyuki Ikezoe d097a2d673 Bug 1150808 - Implement Animation.reverse(). r=smaug r=birtles
--HG--
extra : rebase_source : 593ef5ed090d016260f6ca07008ff036effe7fd6
2015-07-09 22:54:00 +02:00
Hiroyuki Ikezoe 56a826cd0a Bug 1181905 - Animation::IsPlaying should check playbackRate != 0 to stop playing on compositor animation. r=bbirtles 2015-07-09 20:54:00 +02:00
Brian Birtles 94eb7765f0 Bug 1150810 part 16 - Add tests for AnimationTimeline.getAnimations(); r=jwatt
--HG--
extra : commitid : 1yoDYMuUdQr
extra : rebase_source : 8afb92e3c65b819951249f491c026fe24b761315
2015-06-15 11:05:43 +09:00
Brian Birtles 918f55389f Bug 1150810 part 15 - Add a comment about need to store more than just relevant animations; r=jwatt
We'll likely address this as part of bug 1151731 when we sample animations from
their timeline.

--HG--
extra : commitid : 9g00bBtDIue
extra : rebase_source : 12d9de2524eb3133bef5a5bcf4c84d4759ccbbca
2015-06-15 11:05:43 +09:00
Brian Birtles 0c7ff86e21 Bug 1150810 part 14 - Don't return animations targetting pseudo-elements; r=jwatt
--HG--
extra : commitid : 6C1duOkCm8p
extra : rebase_source : f9de21040b31b3e782cf32c34f372dce673cbc7f
2015-06-15 11:05:43 +09:00
Brian Birtles 94b9aa43ad Bug 1150810 part 13 - Sort the result of AnimationTimeline::GetAnimations; r=jwatt
--HG--
extra : commitid : GIotO0kmYd4
extra : rebase_source : 8e3455474b1738f83d9213ae71de5378ce11d571
2015-06-15 11:05:43 +09:00
Brian Birtles 9c37212704 Bug 1150810 part 12 - Flush styles in AnimationTimeline::GetAnimations(); r=jwatt
--HG--
extra : commitid : D6bak0hxV05
extra : rebase_source : 7fb7f1fe9d00b46a4bbc32881886f9e23b2cf3d0
2015-06-15 11:05:43 +09:00
Brian Birtles 0983c8cc10 Bug 1150810 part 11 - Add some assertions to AnimationTimeline::GetAnimations; r=jwatt
--HG--
extra : commitid : 6HV2S292DtE
extra : rebase_source : 02cf7f8b0fddb3a859e1d854caf6611c1485e5d9
2015-06-15 11:05:43 +09:00
Brian Birtles 6434e79a4b Bug 1150810 part 10 - Add AnimationTimeline::GetAnimations; r=jwatt; r=smaug
This patch also removes the (commented-out) play() method from the
AnimationTimeline.webidl since it has been removed from the spec.

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

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

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

--HG--
extra : commitid : WLEUccOqAk
extra : rebase_source : 5c3c987d6c95ca7072c6178349dc113d2f1e5053
2015-06-15 11:05:43 +09:00
Brian Birtles 6bb747268e Bug 1150810 part 8 - Add AnimationTimeline::AddAnimations/RemoveAnimations; r=jwatt
--HG--
extra : commitid : 2zvcGrXcqJR
extra : rebase_source : 791f417a3688cbdd9bd4c9cd24c46551b0d775f5
2015-04-28 16:41:09 +09:00
Brian Birtles 5550db670f Bug 1150810 part 7 - Add Animation::SetTimeline; r=jwatt
--HG--
extra : commitid : 3QENfb2DzCC
extra : rebase_source : 4928061558e689ae40d0976b9dd13e480279c2d1
2015-04-28 17:21:58 +09:00
Brian Birtles 37506d5652 Bug 1150810 part 6 - Rename Timeline() to GetTimeline(); r=smaug
This is in anticipation of adding Animation::SetTimeline(). Once we set the
timeline out of band, there's a chance that getting it could return null so
this patch makes the WebIDL and method name reflect that.

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

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

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

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

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

--HG--
extra : commitid : 7GU6Dr9lnPO
extra : rebase_source : d5e788874c72c422b57efbdb81404c79df6d505b
2015-04-28 11:17:10 +09:00
Brian Birtles 6fbabd8dad Bug 1171817 part 14 - Add AnimationPtrComparator class; r=dbaron
Having created composite ordering methods for the different kinds of animations
this patch adds a Comparator class so that they can be used to sort an
array of such animations.

This patch uses this Comparator object to sort the results returned by
Element.getAnimations. For this case, the order in which we create animations
and transitions happens to almost perfectly correspond with the composite
ordering defined so that no sorting is necessary.

One exception is that some -moz-* transitions may be created after transitions
that they should sort before when sorting by transition property. In this
case the sorting added in this patch should ensure they are returned in the
correct sequence.

Unfortunately, we can't easily test this since the test files we have are
intended to be cross-browser (where -moz-* properties won't be supported).

Once we implement AnimationTimeline.getAnimations (bug 1150810) we'll have
a better opportunity to test this sorting. For now, the added tests in this
patch just serve as a regression test that the sorting hasn't upset the
already correct order (and an interop test in future once we move them to
web-platform-tests).

--HG--
extra : commitid : KkfoSE69B0F
extra : rebase_source : ee4e47f44281504eb4d35e0f6cc3392ee0cffb94
2015-06-09 11:13:54 +09:00
Brian Birtles 4ac9e57a4f Bug 1171817 part 9 - Add override of HasLowerCompositeOrderThan for CSS animations; r=dbaron
This patch also extends the tests for Element.getAnimations(). It doesn't
actually exercise the code added (it's not actually called yet since it doesn't
need to be for Element.getAnimations) but simply provides a useful regression
and interop test.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

--HG--
extra : commitid : DMw8uKjg4Hz
extra : rebase_source : 9e98b3346f0297efce3ecfa0b2dd8a9c13075dca
2015-06-09 11:13:53 +09:00
Brian Birtles 2378ae7083 Bug 1171817 part 4 - Add const version of AsCSSAnimation/AsCSSTransition methods; r=dbaron
These will be needed for sorting animations and transitions in a const-correct
fashion.

--HG--
extra : commitid : BhuFfkAvse7
extra : rebase_source : a97039f06b9f257ccb9b6aa206653d6b5d5d43d4
2015-06-09 11:13:53 +09:00
Brian Birtles 916a2b1a0e Bug 1171817 part 2 - Add CSSAnimation::GetOwningElement; r=dbaron
In order to sort CSS animation objects correctly, we need to know which
element's animation-name property they appear in, if any. Normally that's
simply the target element of the animation's keyframe effect but it can differ
in the following cases:

1) When script modifies a CSSAnimation's effect to target a different element
   (or simply removes the effect altogether). In this case we use the
   *owning* element to determine the priority of the animation, not the target
   element.

   This scenario does not yet occur (bug 1049975).

2) When script creates a CSSAnimation object using the CSSAnimation constructor.
   In this case, the owning element should be empty (null) and we should
   determine the priority of the animation in the same way as any other
   Animation object.

   Again, this is not yet supported (or even specced) but will be eventually.

3) When script holds a reference to a CSSAnimation object but then updates the
   animation-name property such that the animation object is cancelled. In this
   case the owning element should be cleared (null) so we know to not to try and
   sort this with regard to any animation-name property.

   This is possible using code such as the following:

     elem.style.animation = 'a 5s';
     var a = elem.getAnimations()[0];
     elem.style.animation = 'b 5s';
     a.play(); // Bring a back to life
     document.timeline.getAnimations();
     // ^ At this point we need to know how to sort 'a' and 'b' which depends
     // on recognizing that a is no longer part of an animation-name list.

Until we implement bug 1049975, we could support sorting animations without
adding the reference to the owning element by setting a flag on the CSSAnimation
object but (having tried this) it turns out to be cleaner to just introduce this
reference now, particularly since we know we will need it later.

Note that we will also need this information in future to dispatch events to the
correct element in circumstances such as (1) once we separate updating timing
information (including events) from applying animation values.

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

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

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

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

--HG--
extra : commitid : KzukSO91RMH
extra : rebase_source : 54ed2aeb69d8bceca424c70c7f33d4bf92d54546
2015-06-09 11:13:53 +09:00
Brian Birtles 3c2d6db2da Bug 1179111 part 5 - Remove Name() methods; r=jwatt
--HG--
extra : source : 22cafa2fd162a3cbe9af7fd13a92fd82cd3a2315
2015-07-01 15:19:04 +09:00
Brian Birtles f6547354f0 Bug 1179111 part 2 - Implement CSSTransition.transitionProperty; r=smaug, r=jwatt
--HG--
rename : dom/animation/test/css-transitions/file_effect-name.html => dom/animation/test/css-transitions/file_csstransition-transitionproperty.html
rename : dom/animation/test/css-transitions/test_effect-name.html => dom/animation/test/css-transitions/test_csstransition-transitionproperty.html
extra : source : 4eb184faf92c77013d5f8ce8968cff837910b6cf
2015-07-01 12:27:48 +09:00
Brian Birtles 6d8dd99dd0 Bug 1179111 part 1 - Implement CSSAnimation.animationName; r=smaug, r=jwatt
--HG--
rename : dom/animation/test/css-animations/file_effect-name.html => dom/animation/test/css-animations/file_cssanimation-animationname.html
rename : dom/animation/test/css-animations/test_effect-name.html => dom/animation/test/css-animations/test_cssanimation-animationname.html
extra : source : 144276fd40a14a560991baa2f5e7c45ce0e25042
2015-07-01 12:15:42 +09:00
Brian Birtles dd122c2a3d Bug 1178186 part 2 - Add tests for CSSAnimation and CSSTransition interfaces; r=jwatt
--HG--
extra : source : 1027311cd1bb6889104339dd87116036beb3421f
2015-06-30 10:00:56 +09:00
Brian Birtles cc59f02cc9 Bug 1178186 part 1 - Add CSSAnimation and CSSTransition interfaces; r=smaug
--HG--
extra : source : 1e1ccffd51b824fb6b229def4ddb7cb1d8889bb6
2015-06-30 10:00:39 +09:00
Carsten "Tomcat" Book 0a19d00b4f Backed out changeset 1e1ccffd51b8 (bug 1178186) for suspicion of causing bc2 test failures on OSX browser_bug427559.js 2015-07-07 14:22:33 +02:00
Carsten "Tomcat" Book d89c01824a Backed out changeset 1027311cd1bb (bug 1178186) 2015-07-07 14:21:49 +02:00
Carsten "Tomcat" Book e059e2e009 Backed out changeset 144276fd40a1 (bug 1179111)
--HG--
rename : dom/animation/test/css-animations/file_cssanimation-animationname.html => dom/animation/test/css-animations/file_effect-name.html
rename : dom/animation/test/css-animations/test_cssanimation-animationname.html => dom/animation/test/css-animations/test_effect-name.html
2015-07-07 14:21:46 +02:00
Carsten "Tomcat" Book e24e15fa2a Backed out changeset 4eb184faf92c (bug 1179111)
--HG--
rename : dom/animation/test/css-transitions/file_csstransition-transitionproperty.html => dom/animation/test/css-transitions/file_effect-name.html
rename : dom/animation/test/css-transitions/test_csstransition-transitionproperty.html => dom/animation/test/css-transitions/test_effect-name.html
2015-07-07 14:21:42 +02:00
Carsten "Tomcat" Book 297c2b6a58 Backed out changeset 22cafa2fd162 (bug 1179111) 2015-07-07 14:21:33 +02:00
Jonathan Watt 71682687a8 Bug 1127380 - Tests for Animation.playbackRate. r=bbirtles
--HG--
extra : rebase_source : 8a5ea3ebadf92b202450c5090bc83dfb70c80b4c
2015-07-06 22:11:00 +02:00
Brian Birtles cd06229252 Bug 1179111 part 5 - Remove Name() methods; r=jwatt
--HG--
extra : commitid : JT0oaGODGja
extra : rebase_source : e0ff11f1f482599e5e2b7b0eac6cfbb71fd0e34b
2015-07-01 15:19:04 +09:00
Brian Birtles 9785afa349 Bug 1179111 part 2 - Implement CSSTransition.transitionProperty; r=smaug, r=jwatt
--HG--
rename : dom/animation/test/css-transitions/file_effect-name.html => dom/animation/test/css-transitions/file_csstransition-transitionproperty.html
rename : dom/animation/test/css-transitions/test_effect-name.html => dom/animation/test/css-transitions/test_csstransition-transitionproperty.html
extra : commitid : KNo4iwHLjhE
extra : rebase_source : 822b3be05ae47e34812d2df5e5ece11aa87d66a8
2015-07-01 12:27:48 +09:00
Brian Birtles 32835b13f5 Bug 1179111 part 1 - Implement CSSAnimation.animationName; r=smaug, r=jwatt
--HG--
rename : dom/animation/test/css-animations/file_effect-name.html => dom/animation/test/css-animations/file_cssanimation-animationname.html
rename : dom/animation/test/css-animations/test_effect-name.html => dom/animation/test/css-animations/test_cssanimation-animationname.html
extra : commitid : 76TxEcxKHRn
extra : rebase_source : d9a582b36112a18854cd291915329a6325754056
2015-07-01 12:15:42 +09:00
Brian Birtles 0aa6deec0b Bug 1178186 part 2 - Add tests for CSSAnimation and CSSTransition interfaces; r=jwatt
--HG--
extra : commitid : HPBvU8HtFyk
extra : rebase_source : 438b23a4009675d000aaa9ff74334ad5d341831a
2015-06-30 10:00:56 +09:00
Brian Birtles e298fe6b44 Bug 1178186 part 1 - Add CSSAnimation and CSSTransition interfaces; r=smaug
--HG--
extra : commitid : K0U17zTMtAz
extra : rebase_source : e3b2dc3c503144763efe41ef71b9dc3793b3172f
2015-06-30 10:00:39 +09:00
Carsten "Tomcat" Book 15f7f98688 Backed out changeset 04420ed3c036 (bug 1127380) for test failures in test_animation-playbackrate.html
--HG--
extra : rebase_source : 45857c89e13300e619084dfac4dd16d73e9984e9
2015-07-06 15:40:14 +02:00
Jonathan Watt c2b0b02204 Bug 1127380 - Tests for Animation.playbackRate. r=hiro
--HG--
extra : rebase_source : d7f039a8a7166fabe9da87beb35b07cfb0fc7d4c
2015-07-06 00:22:00 +02:00
Brian Birtles 4a42d8ea1f Bug 1166164 part 8 - Drop a few references to players; r=jwatt
--HG--
extra : rebase_source : 70886cf54de0f76080d49f82c57f5795a6a87e28
extra : histedit_source : 6fcf7c7f44929bf5bd1c163c5cf83a1112d573dc
2015-05-19 15:37:39 +09:00
Brian Birtles e293c228f5 Bug 1166164 part 6 - Make pausing from idle set the current time; r=jwatt, r=smaug
As proposed:

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

And agreed upon here:

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

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

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

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

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

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

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

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

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

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

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

--HG--
extra : rebase_source : 83f980d6cbc34375274f30f6527992b4fec7f639
2015-05-08 16:17:13 +09:00
Andrew McCreight 023db96fd8 Bug 1152551, part 3 - Fix more mode lines in dom/. r=jst 2015-05-03 15:32:37 -04:00
Andrew McCreight 9e8f4b219e Bug 1152551, part 2 - Fix mode lines in dom/. r=jst 2015-05-03 15:32:37 -04:00