Commit Graph

376 Commits

Author SHA1 Message Date
Brian Birtles
921c2042a5 Bug 1194037 part 6 - Add test for order of mutation observer records; r=heycam 2015-09-11 15:02:04 +09:00
Brian Birtles
89ee1f892f Bug 1194037 part 5 - Make AnimationProperty::operator== ignore mWinsInCascade; r=heycam 2015-09-10 14:03:46 +09:00
Hiroyuki Ikezoe
ea655dfca3 Bug 1151694 - Part 0: Rewrite test_running_on_compositor.html with add_task(). r=bbirtles
Now we can add other test cases there.
2015-08-27 04:00:00 +02:00
Brian Birtles
90902ba897 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
10d95cca57 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.
2015-08-27 20:44:53 -07:00
Hiroyuki Ikezoe
5141a8fe39 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
dfb210a817 Bug 1194028 - Part 1: Implement Animation NotifyEffectTimingUpdate and KeyframeEffect SetTiming. r=bbirtles 2015-08-17 14:28:00 -04:00
Brian Birtles
735ff9144b 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
0959beed1d 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
3801a43ea4 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
3181a27423 Bug 1181392 part 10 - Remove KeyframeEffect::IsFinishedTransition; r=dbaron 2015-08-07 12:29:36 +09:00
Brian Birtles
4c037e0122 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
c74fcc3c54 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
c9bbacc6bb 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
e4cb3c7353 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
4b7b196882 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
8e84ad1433 Bug 1178664 - Part 4 -Implement Animation.oncancel event. r=bbirtles, r=smaug 2015-07-30 23:26:00 +02:00
Hiroyuki Ikezoe
df3f6a345b Bug 1178664 - Part 3 - Implement Animation.onfinish event. r=bbirtles, r=smaug 2015-07-30 23:25:00 +02:00
Hiroyuki Ikezoe
4b19a7af6c Bug 1178664 - Part 1 - Make Animation interface EventTarget inheritance. r=smaug 2015-07-30 23:23:00 +02:00
Hiroyuki Ikezoe
2a1d28c96d 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
a264b3d06d 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
0aead8cf1c Backed out changeset 79bcd4f744c0 (bug 1180125) 2015-07-29 17:32:24 +02:00
Carsten "Tomcat" Book
8a8dda54b2 Backed out changeset a4fb4e4b1c8b (bug 1180125) 2015-07-29 17:32:19 +02:00
Brian Birtles
010c24e700 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
d78ef3ed78 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
b42820456a Bug 1186684 - Remove unused ErrorResult in Animation::SetPlaybackRate/SilentlySetPlaybackRate. r=bbirtles 2015-07-23 02:55:00 -04:00
Brian Birtles
8ea5b02209 Bug 1182981 part 2 - Use nsTHashtable::Iterator in AnimationTimeline; r=njn 2015-07-21 10:47:23 +09:00
Brian Birtles
9a4df31364 Bug 1182981 part 1 - Use nsTHashtable::Iterator in PendingAnimationTracker; r=njn 2015-07-21 10:47:13 +09:00
Brian Birtles
dc0e1274e7 Bug 1168759 - Disable test_deferred_start.html on B2G debug emulator; r=ryanvm 2015-07-21 10:47:02 +09:00
Birunthan Mohanathas
e52329c788 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
b1c987adff Bug 1182931 - Expose assert_unreached in subwindows. r=bbirtles 2015-07-12 17:04:00 +02:00
Ehsan Akhgari
988febd399 Bug 1113086 follow-up: Add a forward declaration to fix build bustage 2015-07-10 20:49:32 -04:00
Carsten "Tomcat" Book
0eeb1ca3f5 Backed out changeset 91846db1056c (bug 1113086) 2015-07-11 14:13:36 +02:00
Ehsan Akhgari
00054da590 Bug 1113086 follow-up: Add a forward declaration to fix build bustage 2015-07-10 21:09:08 -04:00
Hiroyuki Ikezoe
07d5954a67 Bug 1150808 - Implement Animation.reverse(). r=smaug r=birtles 2015-07-09 22:54:00 +02:00
Hiroyuki Ikezoe
59df058305 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
df99d6e31d Bug 1150810 part 16 - Add tests for AnimationTimeline.getAnimations(); r=jwatt 2015-06-15 11:05:43 +09:00
Brian Birtles
728332e869 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.
2015-06-15 11:05:43 +09:00
Brian Birtles
b3b286bc91 Bug 1150810 part 14 - Don't return animations targetting pseudo-elements; r=jwatt 2015-06-15 11:05:43 +09:00
Brian Birtles
8e773aba10 Bug 1150810 part 13 - Sort the result of AnimationTimeline::GetAnimations; r=jwatt 2015-06-15 11:05:43 +09:00
Brian Birtles
1044b8c708 Bug 1150810 part 12 - Flush styles in AnimationTimeline::GetAnimations(); r=jwatt 2015-06-15 11:05:43 +09:00
Brian Birtles
b6e612666f Bug 1150810 part 11 - Add some assertions to AnimationTimeline::GetAnimations; r=jwatt 2015-06-15 11:05:43 +09:00
Brian Birtles
f967d3dad9 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.
2015-06-15 11:05:43 +09:00
Brian Birtles
b28f292a64 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.
2015-06-15 11:05:43 +09:00
Brian Birtles
986793f780 Bug 1150810 part 8 - Add AnimationTimeline::AddAnimations/RemoveAnimations; r=jwatt 2015-04-28 16:41:09 +09:00
Brian Birtles
12879b1348 Bug 1150810 part 7 - Add Animation::SetTimeline; r=jwatt 2015-04-28 17:21:58 +09:00
Brian Birtles
ad5ac012b2 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.
2015-04-28 16:25:07 +09:00
Brian Birtles
d3efa42100 Bug 1150810 part 5 - Handle Timeline() returning null; r=jwatt 2015-04-28 12:49:12 +09:00
Brian Birtles
cd630f438e 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.
2015-04-28 15:48:35 +09:00
Brian Birtles
70ca5ce014 Bug 1150810 part 3 - Make IsPossiblyOrphanedPendingAnimation return true when there is no rendered doc; r=jwatt
This appears to be an existing bug.
2015-04-28 15:47:45 +09:00