Commit Graph

787 Commits

Author SHA1 Message Date
Boris Chiou
1c9da6a517 Bug 1234403 - Part 1: Implement CSSPseudoElement.getAnimations. r=birtles 2016-02-18 02:21:00 +01:00
Brian Birtles
d06f85599d Bug 1239945 part 1 - Drop a number of animation manager/collection-related methods that are unused (and in some cases undefined); r=dholbert 2016-02-24 13:41:16 +09:00
Hiroyuki Ikezoe
606ae12164 Bug 1242872 - Part 6: Trigger a layer update explicitly when copying animation properties. r=birtles
MozReview-Commit-ID: AWL43ypqLPT
2016-02-19 09:16:15 +09:00
Hiroyuki Ikezoe
e80b4bb7b2 Bug 1242872 - Part 5: Change CopyPropertiesFrom to UpdateProperties. r=birtles
Once we don't create any temporary effect, we do not need to pass
the effect to CopyPropertiesFrom.

MozReview-Commit-ID: HczU5IU6Ggp
2016-02-19 09:16:15 +09:00
Cameron McCormack
89cac5abd1 Bug 1248864 - Part 3: Use RestyleManagerHandle instead of concrete restyle manager class. r=dholbert 2016-02-24 18:01:12 +11:00
Cameron McCormack
736a5f47e7 Bug 1248864 - Part 1: Move RestyleManager.h to EXPORTS.mozilla. r=dholbert 2016-02-24 18:01:12 +11:00
Hiroyuki Ikezoe
4e9c9820e9 Bug 1249431 - Need preferences for crash tests using Web Animation APIs. r=birtles
MozReview-Commit-ID: 5ybJUTgy7bW

--HG--
extra : transplant_source : k%7B%3Cz%7C%C8%AE%A8%C4rsks%15f%16%1C%9E%D6%D1
2016-02-19 07:46:42 +09:00
Boris Chiou
54f794359b Bug 1249230 - Prepend an extra colon to the pseudo type string. r=birtles 2016-02-18 19:35:00 +01:00
Boris Chiou
5c37ed6ba0 Bug 1244049 - Part 4: Define CSSPseudoElementTypeBase. r=dbaron
In order to convert CSSPseudoElementType into its underlying type easier,
we define CSSPseudoElementTypeBase. However, keep using uint8_t directly for
forward declarations.
2016-02-18 19:18:00 +01:00
Hiroyuki Ikezoe
c5b7bd9a33 Bug 1216842 - Part 12: Extrapolate bezier function outside [0,1]. r=birtles
We use the tangent at the each boundary points as same as Chrome does.
2016-02-18 14:22:00 +01:00
Hiroyuki Ikezoe
10fdacf755 Bug 1216842 - Part 11: Clamp values of step functions outside [0, 1]. r=birtles 2016-02-18 14:21:00 +01:00
Hiroyuki Ikezoe
bff8c71b2a Bug 1216842 - Part 10: Remove the limit of the computed timing progress. r=birtles
Now we produce computed timing progress outside [0,1] range.
We use the last segment to calculate animation values if the value is greater than 1.
We use the first segment to calculate animation values if the value is lesser than 0.
2016-02-18 14:20:00 +01:00
Brian Birtles
1a43924a8a Bug 1249212 part 7 - Calculate the endTime in GetComputedTimingAt; r=boris
Currently endTime is calculated when getComputedTiming() is called. As a
result, the value returned there doesn't necessarily reflect what we are using
in the model. It would be more simple, consistent and useful if we simply
calculate this as part of GetComputedTimingAt and use it both internally and in
the result to getComputedTiming().
2016-02-19 08:37:32 +09:00
Brian Birtles
54a06996e5 Bug 1249212 part 5 - Remove max() clamping from endTime calculation; r=boris
Based on discussion at: https://github.com/w3c/web-animations/issues/86
2016-02-19 08:37:32 +09:00
Brian Birtles
7f5b1d41f0 Bug 1249212 part 3 - Fix active duration calculation when iteration duration is infinity; r=boris
With the added tests in part 4 we crash without this change because we end up
trying to multiply an infinite iteration duration by a zero iteration count
which trips an assertion in StickyTimeDuration. Hence we fix this behavior
before adding the tests.
2016-02-19 08:37:31 +09:00
Boris Chiou
e436478f26 Bug 1244049 - Part 2: Replace nsCSSPseudoElements::Type with CSSPseudoElementType. r=dbaron
Also, try to use forward declaraions for CSSPseudoElementType;

--HG--
extra : rebase_source : c00eb9753e8f618a33aa711538ac45c0132b353c
2016-02-17 21:37:00 +01:00
Boris Chiou
185a769719 Bug 1244049 - Part 1: Define scoped enum for CSSPseudoElement type. r=dbaron
--HG--
extra : rebase_source : e53dd269e47fa97eb259ebd9295d012eacbdb612
2016-02-16 23:07:00 +01:00
Juan Gomez
8ea937311f Bug 1248581 - Fix build bustage on WakeLock.h and CSSPseudoElement.h. r=khuey
--HG--
extra : rebase_source : 1f6ac7072abea2a610443caee467e7ba191218ae
2016-02-16 15:08:00 +01:00
Martin Thomson
ebd25ddf94 Bug 1248105 - Move CSSPseudoElement::GetParentObject out of header, r=boris
MozReview-Commit-ID: 5vZQlv8q0df

--HG--
extra : rebase_source : 57a9ab8a5e579b8533e74ab8e6c6ec8d77ef4ea7
2016-02-15 11:51:34 +11:00
Ryo Motozawa
cc127029f8 Bug 1244586 part 1 - Add KeyframeEffect constructor in dom/webidl/KeyframeEffect.webidl. r=smaug,birtles 2016-02-15 09:34:47 +09:00
Ryo Motozawa
e54a74b405 Bug 1226047 - Add AnimationEffectTiming interface in dom/webidl/AnimationEffectTiming.webidl. r=smaug,birtles 2016-02-15 09:34:47 +09:00
Ryo Motozawa
c49b9b29db Bug 1211783 - Add KeyframeEffect interface to dom/webidl/KeyframeEffect.webidl. r=smaug,birtles 2016-02-15 09:34:47 +09:00
Chris Peterson
f6442f17d6 Bug 1247531 - Annotate intentional switch fallthrough to suppress -Wimplicit-fallthrough warning in dom/animations/. r=dholbert
dom/animation/AnimationUtils.cpp:73:9: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
2016-02-10 23:04:28 -08:00
Boris Chiou
bce920d78f Bug 1174575 - Part 6: Implement KeyframeEffectReadOnly Constructor for CSSPseudoElement. r=birtles
Let KeyframeEffectReadOnly::Constructor support both Element and
CSSPseudoElement as the target.
2016-02-09 05:05:00 +01:00
Boris Chiou
8627ee5709 Bug 1174575 - Part 5: Support pseudo-element type in StyleAnimation. r=birtles
Add one more argument, nsCSSPseudoElement::Type, for
StyleAnimation::ComputeValue and StyleAnimation::ComputeValues
2016-02-09 05:04:00 +01:00
Boris Chiou
2a5bfa8330 Bug 1174575 - Part 4: Support CSSPseudoElement for TimingParams. r=birtles 2016-02-05 19:11:00 +01:00
Boris Chiou
84a4a3fe03 Bug 1174575 - Part 3: Implement KeyframeEffectReadOnly::GetTarget(). r=birtles
Implement GetTarget() and functions of CSSPseudoElement.
We use a strong reference from CSSPseudoElement to Element and a non-owning
reference from Element to CSSPseudoElement.
2016-02-01 23:59:00 +01:00
Boris Chiou
2f694d7e1e Bug 1174575 - Part 2: Replace Element in KeyframeEffectReadOnly WebIDL. r=birtles, r=smaug
Use (Element or CSSPseudoElement)? as the first arguement of constructor and
the type of target.
2016-02-05 19:01:00 +01:00
Boris Chiou
8098462872 Bug 1174575 - Part 1: Define CSSPseudoElement interface. r=birtles, r=smaug
Create CSSPseudoElement.webidl, CSSPseudoElement.h, and CSSPseudoElement.cpp.
2016-02-01 23:49:00 +01:00
L. David Baron
4cc8e3dd91 Bug 1245075 patch 2 - Fix EffectSet::GetEffectSet(nsIFrame*) and EffectCompositor::GetAnimationElementAndPseudoForFrame to only return effects when the frame is the style frame for its content. r=birtles
This means that we won't associate animations with additional frames.
In this case, this fixes associating off-main-thread animations with a
table outer frame, when they should have been associated only with the
table frame.

Locally, the test fails without the patch (with opacity in the test
being 0.36 instead of the expected 0.6), and passes with the patch.
(Opacity 0.36 gives a color of rgb(163,163,255), whereas 0.6 gives
rgb(102,102,255).)

--HG--
extra : commitid : 7wtkIDLDHBF
2016-02-07 08:43:49 -08:00
Matt Woodrow
7cd754d8cf Bug 1229317 - Allow preserve-3d and opacity to be combined on the root element of a preserve-3d chain. r=roc 2016-02-07 23:51:11 +13:00
Hiroyuki Ikezoe
8a841d093a Bug 1241692 - Part 2: We should observe stylings only for animations. r=dholbert
We don't need observe restylings other than animations.  If those restylings
happen, it's just noise for this test.  We should drop them.

--HG--
extra : transplant_source : 9%0B%0B%B7O%E5R%86%D4%7F%29%90q%DDQ0%0B%FAuJ
2016-02-06 20:38:24 +09:00
Hiroyuki Ikezoe
f8177694cb Bug 1241692 - Part 1: Ensure that element which is added in each test is removed before subsequent test is processed. r=dholbert
Before this fix, sometimes an element which was removed in a prior test
would still visible when subsequent test starts.
We should wait for paints to complete after the element has been removed.

--HG--
extra : transplant_source : %C7%7F%03%0F%DA%05A%C1%CE%F0m%DA1%C5%1D%FA%06%FA%FE%CA
2016-02-06 20:38:12 +09:00
Cameron McCormack
02cfaf41a1 Bug 1244595 - Don't check whether shorthands are non-animatable when parsing JS keyframe objects. r=birtles 2016-02-05 08:56:11 +11:00
Hiroyuki Ikezoe
c35622c465 Bug 1239889 part 2 - Test for an animation target without a current document; r=birtles 2016-02-05 14:11:04 +11:00
Brian Birtles
73e4706ab3 Bug 1239889 part 1 - Throw if the animation target does not have a current document; r=heycam
This is just a temporary measure to avoid a failed assertion / crash until we
fix bug 1245748.
2016-02-05 14:11:04 +11:00
Birunthan Mohanathas
d7371d07d0 Bug 1235261 - Part 1: Rename nsAutoTArray to AutoTArray. r=froydnj 2016-02-02 17:36:30 +02:00
Hiroyuki Ikezoe
f03d398a98 Bug 1244080 - Part 1: Test that setting duration in the middle of the animation causes only once a restyling. r=bbirtles 2016-02-01 00:46:00 +01:00
Hiroyuki Ikezoe
05a9e1b0ad Bug 1244080 - Part 0: Remove unnecessary argument for remove(). r=bbirtles 2016-02-01 00:46:00 +01:00
Hiroyuki Ikezoe
1f0f8d7a93 Bug 1216842 - Part 8: Calculate transformed progress using animation effect's timing function. r=cam
http://w3c.github.io/web-animations/#calculating-the-transformed-time
2016-01-29 14:48:00 +01:00
Hiroyuki Ikezoe
15210ae758 Bug 1216842 - Part 6: Make mTimingFunction in OrderedKeyframeValueEntry const Maybe<>*. r=cam 2016-01-29 14:47:00 +01:00
Hiroyuki Ikezoe
c3619f4a48 Bug 1216842 - Part 5: Store ComputedTimingFunction in TimingParams. r=cam
The reason why we use Maybe<> to store the function is that CSS
animations/transitions do not have the function property.
2016-01-29 14:45:00 +01:00
Hiroyuki Ikezoe
03409db313 Bug 1216842 - Part 4: Move ParseEasing into AnimationUtils. r=cam
ParseEasing will be also used in AnimationEffectTimingReadOnly class.
2016-01-27 02:08:00 +01:00
Hiroyuki Ikezoe
ba1bb81b2e Bug 1216842 - Part 3: Change ComputedTimingFunction* to Maybe<ComputedTimingFunction>. r=cam
Nothing() represents linear function, i.e. skip calculation.
ParseEasing is changed to return a Maybe<ComputedTimingFunction>,
if timing function is linear function, ParseEasing returns Nothing().
2016-01-29 14:44:00 +01:00
Hiroyuki Ikezoe
409715935c Bug 1216842 - Part 2: Add LayerAnimationUtils. r=cam
This is also for compositor side.
we need a new class to share the function which converts TimingFunction
to ComputedTimingFunction for either keyframe's timing function or keyframe
effect's timing function.
2016-01-29 14:44:00 +01:00
Phil Ringnalda
d381b4bca6 Back out 7 changesets (bug 1235261) for cpptest failures in TestTArray
CLOSED TREE

Backed out changeset d66c3f19a210 (bug 1235261)
Backed out changeset 467d945426bb (bug 1235261)
Backed out changeset 32b61df13142 (bug 1235261)
Backed out changeset c50bb8ed4196 (bug 1235261)
Backed out changeset 0ff0fa6fe81f (bug 1235261)
Backed out changeset df70e89669da (bug 1235261)
Backed out changeset 064969357fc9 (bug 1235261)
2016-01-31 10:10:57 -08:00
Birunthan Mohanathas
373593275e Bug 1235261 - Part 1: Rename nsAutoTArray to AutoTArray. r=froydnj 2016-01-31 17:12:12 +02:00
Brian Birtles
ef5aaf9e4c Bug 1096773 part 4 - Add tests for Animatable.animate(); r=bz 2016-01-29 12:37:52 +11:00
Brian Birtles
5358a5c81e Bug 1096773 part 3 - Implement Animatable.animate(); r=bz 2016-01-29 12:37:52 +11:00
Brian Birtles
5dbcb5013b Bug 1096773 part 2 - Add a KeyframeEffectReadOnly constructor that takes a TimingParams argument; r=boris
This will allow us to re-use the constructor from Animatable.animate() since the
existing type, UnrestrictedDoubleOrKeyframeEffectOptions, is not compatible with
UnrestrictedDoubleOrKeyframeAnimationOptions (introduced in the next patch in
this series), as used by Animatable.animate()
2016-01-29 12:37:52 +11:00
Brian Birtles
d9fb138530 Bug 1096773 part 1 - Make the frames argument to the KeyframeEffectReadOnly constructor NOT optional; r=bz
This is to line up with the spec as discussed in:

  https://bugzilla.mozilla.org/show_bug.cgi?id=1096773#c6
2016-01-29 12:37:52 +11:00
Hiroyuki Ikezoe
2e4a107162 Bug 1235286 - Part 3: Comment out some compositor animations tests. r=birtles
In current our implemantation, animations which can run on compositor
in invisible element can not run on compositor on all desktop platforms.
*BUT* both on Android and B2G the animations still run on compositor somehow.

And one more thing.  Animations can run on compositor in elements which are
scrolled out in the parent element *RUN* on compositor as well.

mochitest does not allow us to disable each test on specific platforms respectively.
One we have mozinfo in mochitest (bug 1150818), we can skip the tests on specific platforms.
2016-01-20 02:31:00 +01:00
Hiroyuki Ikezoe
7d7693b812 Bug 1235286 - Part 2: Tests for animation optimizations. r=birtles
--HG--
extra : transplant_source : %05%087%F1%8En%C5V%F5%D9ds%7D%C8%5CsB%02%87%EC
2015-12-25 19:37:34 +09:00
Hiroyuki Ikezoe
cf03d3bfaf Bug 1235286 - Part 1: Add an argument to waitForAnimationFrames to run a task in each requestAnimationFrame callback. r=birtles
--HG--
extra : transplant_source : %AF%A0%20%B8%D7%3A%7F%C2_y%0A%82%88w%5E%95%8D%17%EA%EF
2016-01-08 09:49:04 +09:00
Hiroyuki Ikezoe
33ce2fba3e Bug 1240646 - Do not unthrottle animations if RestyleType::Throttled is specified. r=bbirtles 2016-01-18 20:54:00 +01:00
Brian Birtles
b47411b097 Bug 1240228 - Don't update an effect's timing when tweaking its animation's hold time; r=heycam
In some circumstances when composing style, we tweak the time of the animation
before telling the effect to compose style. This is to avoid visual flicker in
certain situations where the main thread progress is being synchronized with an
animation running on the compositor.

In the past, effects would store their latest sample time locally so when
tweaking the animation time, we would need to call UpdateEffect() after tweaking
the time, and then again after restoring it as otherwise the style composed by
the effect would not reflect the adjusted time.

Now, however, effect's always query their animation for the time so this is no
longer necessary. Furthermore, the actions triggered by UpdateEffect are not
desirable in this case because they can, amongst other things, cause the
associated EffectSet to be destroyed and recreated.

Specifically, Animation::UpdateEffect() calls
KeyframeEffectReadOnly::NotifyAnimationTimingUpdated() which:

  * Calls UpdateTargetRegistration which can trigger EffectSet
    destruction/creation which is undesirable in this case because we intend to
    restore whatever changes we make to the Animation's state and deleting and
    recreating the EffectSet will cause any pointers to it to dangle.

  * Cause us to possibly reset the "is running on compositor" status.
    This too is undesirable since we intend to restore the state of the
    Animation immediately after tweaking the hold time so we don't want to
    act as if any state has changed.

  * Similarly for marking the cascade as possibly needing an update or
    requesting a restyle.

In summary, all the actions performed by NotifyAnimationTimingUpdated are
unnecessary and undesirable in this situation where we are temporarily tweaking
an Animation's current time only to restore it immediately afterwards since the
actions are all involved with recognizing actual changes in state.
2016-01-19 08:05:08 +09:00
Brian Birtles
54283ba569 Bug 1226091 - Use MayHaveAnimations flag for animations on pseudo elements too; r=smaug 2016-01-18 13:40:12 +09:00
Hiroyuki Ikezoe
54e83307e3 Bug 1096774 - Part 2: Fix crash if animation has no timeline. r=birtles 2016-01-14 19:27:00 -05:00
Hiroyuki Ikezoe
4c0263a3ed Bug 1096774 - Part 1: Implement Animation Constructor. r=birtles, r=smaug 2016-01-16 19:02:00 -05:00
Brian Birtles
6fb8992111 Bug 1235112 - Move animation style rule processors to EffectCompositor; r=heycam 2016-01-15 15:15:47 +09:00
Brian Birtles
b324d8ff0d Bug 1237467 part 4 - Delete the EffectSet when it becomes empty; r=heycam 2016-01-15 15:15:47 +09:00
Brian Birtles
a44af735dd Bug 1237467 part 3 - Add debug methods to determine if an EffectSet is currently being enumerated; r=heycam 2016-01-15 15:15:47 +09:00
Brian Birtles
15169cd872 Bug 1237467 part 2 - Clear mProgressOnLastCompose when the effect is no longer relevant; r=heycam 2016-01-15 15:15:47 +09:00
Brian Birtles
a22e719c48 Bug 1237467 part 1 - No longer mark element as needing an animation restyle if we go to restyle it and it no longer has an effect set; r=heycam 2016-01-15 15:15:47 +09:00
Boris Chiou
86a80f4228 Bug 1214536 - Part 8: Add an operator=() for TimingParams. r=birtles
Overload TimingParams::operator=() for AnimationEffectTimingProperties objects,
so we can assign an AnimationEffectTimingProperties/KeyframeEffectOption object
to a TimingParams object.

We also keep the uninitialized state of KeyframeEffectOptions::mDuration while
converting a KeyframeEffectOptions object into a TimingParams object.
2016-01-13 18:42:00 +01:00
Boris Chiou
deee95a0d8 Bug 1214536 - Part 7: Rename AnimationTiming as TimingParams. r=birtles, r=smaug
1. struct AnimationTiming -> struct TimingParams
2. AnimationEffectReadOnly::TimingAsObject() -> AnimationEffectReadOnly::Timing()
3. KeyframeEffectReadOnly::Timing() -> KeyframeEffectReadOnly::SpecifiedTiming()
2016-01-13 18:41:00 +01:00
Boris Chiou
d03ac9c993 Bug 1214536 - Part 6: Revise AnimationTiming::operator==. r=birtles 2016-01-13 18:38:00 +01:00
Boris Chiou
fa79443f12 Bug 1214536 - Part 5: Add AnimationEffectTimingReadOnly interface. r=birtles, r=smaug
1. Add AnimationEffectTimingReadOnly.webidl.
2. Add AnimationEffectTimingReadOnly cpp files.
3. Use AnimationEffectTimingReadOnly as KeyframeEffectReadOnly::mTiming.

--HG--
extra : rebase_source : 0e9c112b70ae56f2bcdf162374388857518fc124
extra : amend_source : 0aebf0e9daac77542d913e4ad6a07c75e21a93b5
2016-01-13 18:37:00 +01:00
Boris Chiou
71cff999e0 Bug 1214536 - Part 4: Use OwingUnrestrictedDoubleOrString for duration. r=birtles
We store the original value of duration in AnimationTiming, and add
computed duration in ComputedTiming, so both the Timing model and
AnimationEffectTimingReadOnly can get what they want.

By the way, replace mIterationDuration with mDuration.

--HG--
extra : rebase_source : f8e1fd648572e6d7b1cbecc2ac1888a2f74bbc7e
2016-01-13 18:36:00 +01:00
Boris Chiou
76f7e5a44e Bug 1214536 - Part 3: Store the original value of fill. r=birtles
FillMode could be 'auto', and we should treat it as 'none' in the timing model.
However, AnimationEffectTimingReadOnly should get its original value.

By the way, replace mFillMode with mFill.

--HG--
extra : rebase_source : 5a397dd7fbb22ac76fe96003d82d097e398852c7
2016-01-13 18:36:00 +01:00
Boris Chiou
44cb5bee0a Bug 1214536 - Part 1: Use unrestricted double for iterations. r=birtles
We want to store the original value from KeyframeEffectOptions whose
iterations is unrestricted double. Therefore, we can get the original value
of iterations by AnimationEffectTimingReadOnly.

By the way, replace mIterationCount with mIterations.

--HG--
extra : rebase_source : da2953056031079c41273ed977545dc926e1b83c
2016-01-10 18:41:00 +01:00
Nigel Babu
0ce7a5f39e Backed out 5 changesets (bug 1235112, bug 1237467) for nsRuleNode::Transition crashes
Backed out changeset ac21baf87df2 (bug 1235112)
Backed out changeset c47a6e0a6d95 (bug 1237467)
Backed out changeset 7609ca218902 (bug 1237467)
Backed out changeset d63ca2677bd5 (bug 1237467)
Backed out changeset 5a3d7e16b1e0 (bug 1237467)

--HG--
extra : commitid : LONozKsGtli
2016-01-14 11:35:06 +05:30
Brian Birtles
02e4c93ce9 Bug 1234095 - Rework sorting to handle to script-generated animations; r=heycam 2016-01-14 10:24:24 +09:00
Brian Birtles
32bf08d255 Bug 1235112 - Move animation style rule processors to EffectCompositor; r=heycam 2016-01-14 08:02:39 +09:00
Brian Birtles
35e610c8ad Bug 1237467 part 4 - Delete the EffectSet when it becomes empty; r=heycam 2016-01-14 08:02:39 +09:00
Brian Birtles
0653a5b314 Bug 1237467 part 3 - Add debug methods to determine if an EffectSet is currently being enumerated; r=heycam 2016-01-14 08:02:39 +09:00
Brian Birtles
dcc43d48af Bug 1237467 part 2 - Clear mProgressOnLastCompose when the effect is no longer relevant; r=heycam 2016-01-14 08:02:39 +09:00
Brian Birtles
cf3c7d444e Bug 1237467 part 1 - No longer mark element as needing an animation restyle if we go to restyle it and it no longer has an effect set; r=heycam 2016-01-14 08:02:39 +09:00
Brian Birtles
8cc58f3707 Bug 1238660 part 2 - Preserve "wins in cascade" state when updating animations; r=hiro
When updating animations, we shouldn't unnecessarily clobber the "wins in
cascade" state of their properties since this can lead to unnecessary restyles
when we then decide we need to update the cascade.
2016-01-13 13:38:16 +09:00
Brian Birtles
7f1681beaa Bug 1238660 part 1 - Make mWinsInCascade initially false; r=hiro
As of bug 1228229, the mWinsInCascade member of animation properties is set
consistently for both animations and transitions such that we only set this
to true if an animation is "in effect".

When an effect is initially created it is not "in effect" until it is attached
to a non-idle animation. We should, therefore, initialize this to false and,
when we become in effect, mark the cascade as needing an update.
2016-01-13 13:38:16 +09:00
Brian Birtles
d549991eb2 Bug 1232577 part 19 - Move ClearIsRunningOnCompositor to EffectCompositor; r=heycam 2016-01-13 07:54:56 +09:00
Brian Birtles
7236a7fdbd Bug 1232577 part 18 - Drop RestyleManager::mLastUpdateForThrottledAnimations; r=heycam
RestyleManager currently has a piece of state for tracking if throttled
animations are up-to-date or not. Actually, it's not so much about throttled
animations but really about outstanding changes to animation styles (which
is typically expected to be due to throttling animations but there are
other cases that invalidate the animation style rule that we should be
considering here).

We now have that same information stored in the EffectCompositor so we can
remove the redundant state from RestyleManager. Furthermore, the state stored
in EffectCompositor is more accurate since it captures the case when animation
style needs to be updated twice within a tick, or when nothing needs to be
updated within a tick.

This patch, therefore, introduces EffectCompositor::HasPendingStyleUpdates in
place of setting RestyleManager::mLastUpdateForThrottledAnimations.

nsTransitionManager also uses mLastUpdateForThrottledAnimations to warn if we
have not processed throttled animations. We can't use HasPendingStyleUpdates
here however, since it will return true in the case where we have triggered new
transitions in the process of restyling. However, any new transitions will
trigger "standard" (i.e. not throttled) restyles so we introduce another
method, HasThrottledStyleUpdates, that returns true only if we have outstanding
throttled updates and use this for the warning inside nsTransitionManager.
2016-01-13 07:54:55 +09:00
Brian Birtles
dab2f9c064 Bug 1232577 part 17 - Move AddStyleUpdatesTo to EffectCompositor; r=heycam 2016-01-13 07:54:55 +09:00
Brian Birtles
309027bbe9 Bug 1232577 part 16 - Move GetAnimationRule to EffectCompositor; r=heycam 2016-01-13 07:54:55 +09:00
Brian Birtles
7a8bb45336 Bug 1232577 part 15 - Drop LastStyleUpdateForAllAnimations flag from pres context; r=heycam
nsPresContext contains a mLastStyleUpdateForAllAnimations flag which is simply
used to prevent unnecessarily posting restyles when throttled animations are
already up to date. Since part 13 we now accurately record whether we have
posted a restyle for each throttled animation and only post a restyle if we
have not done so already. As a result, this flag is no longer needed since
calling PostRestyleForThrottledAnimations is effectively a noop when throttled
animations are up-to-date.
2016-01-13 07:54:55 +09:00
Brian Birtles
b65c8d2610 Bug 1232577 part 14 - Move FlushAnimations to EffectCompositor; r=heycam 2016-01-13 07:54:55 +09:00
Brian Birtles
c54edbe389 Bug 1232577 part 13 - Move EnsureStyleRuleFor from AnimationCollection to EffectCompositor 2016-01-13 07:54:55 +09:00
Brian Birtles
2a70c0a477 Bug 1232577 part 12 - Move the remainder of RequestRestyle from AnimationCollection to EffectCompositor; r=heycam
This also allows us to remove all references to AnimationCollection and the
animation managers from Animation.
2016-01-13 07:54:54 +09:00
Brian Birtles
b29e0fc6c2 Bug 1232577 part 10 - Remove AnimationCollection::mStyleChanging; r=heycam
This flag is no longer needed because in bug 1232563 we introduced a more
thorough optimization that detects when the animation is not changing by
comparing the progress value between samples and avoids requesting restyles
when it does not change.
2016-01-13 07:54:54 +09:00
Brian Birtles
71a9cf43cb Bug 1232577 part 9 - Remove AnimationCollection::mStyleRuleRefreshTime; r=heycam
Now that we track whether or not animations are up to date using the hashset in
EffectCompositor, we can remove the mStyleRuleRefreshTime flag that is, as of
part 5 of this patch series, now only used for detecting whether or not
animations are up to date.

In order to preserve the existing behavior of FlushAnimations, however, this
patch temporarily introduces a method to indicate if there are throttled
animations or not.

It might not be obvious that FlushAnimations is only concerned with throttled
animations due to its name. FlushAnimations is simply intended to post
animation restyles for out-of-date animations. Any animations that are *not*
throttled will either be up to date, or we will have already posted an
animation restyle so we only need to consider throttled animations in this case.
2016-01-13 07:54:54 +09:00
Brian Birtles
cf26e7b69b Bug 1232577 part 8 - Move call to PostRestyleForAnimation to EffectCompositor; r=heycam
This patch continues to migrate functionality from
AnimationCollection::RequestRestyle to EffectCompositor::RequestRestyle.

In order to post the animation restyle from the EffectCompositor, this patch
also moves the PostRestyleForAnimation method to EffectCompositor.
The GetElementToRestyle method is temporarily duplicated in both
EffectCompositor and AnimationCollection however we will remove the version in
AnimationCollection later in this patch series.
2016-01-13 07:54:54 +09:00
Brian Birtles
21108e5e2e Bug 1232577 part 7 - Move call to SetNeedStyleFlush() to EffectCompositor::RequestRestyle; r=heycam
In this patch series we are gradually migrating style rule updating
functionality from AnimationCollection to EffectCompositor. This patch moves
part of the RequestRestyle method from one class to the other.

Note that in both cases we only call SetNeedsStyleFlush if we haven't already
posted an animation restyle. (In the case of AnimationCollection we check this
using the mHasPendingAnimationRestyle flag, and in EffectCompositor case we
simply check if the element is already in the "needs restyle" hashmap. If it is,
either we already have a throttled restyle and have called SetNeedsStyleFlush or
we have a standard restyle and have posted an animation restyle.)

The added check for a null pres context matches the behavior of
AnimationCollection::RequestRestyle which has an equivalent early return at the
beginning of the function.
2016-01-13 07:54:54 +09:00
Brian Birtles
464b5fb4b7 Bug 1232577 part 6 - Add animation rule refresh time to EffectSet; r=heycam
AnimationCollection keeps a TimeStamp that records the refresh driver time when
the animation style rule was last updated. This is used for two purposes:

1. To determine when the style rule is out of date.

2. For animations that are partially throttled on the main thread, e.g.
   transform animations that affect the scrollable region which we update every
   200ms on the main thread.

In this bug we are removing all the overlapping bits of state used to track if
animations are up-to-date or not and replacing them with the hashmap stored on
the EffectCompositor which tracks which animations are currently in need of an
update. As a result, we would like to remove this style rule refresh time.
However, we will need something for case (2) from above.

This patch adds an animation rule refresh time to the EffectSet purely for the
purposes of partially-throttled animations so that we can later remove the style
rule refresh time from AnimationCollection.
2016-01-13 07:54:54 +09:00
Brian Birtles
815e0c4b64 Bug 1232577 part 4 - Add and remove (pseudo-)elements needing an animation style rule update to the EffectCompositor; r=heycam
This patch uses the presence/absence of (pseudo-)elements in the "needs
animation rule update" hashmap on EffectCompositor to detect if a style update
is required. The various flags in AnimationCollection that do a similar job
still remain so that we can remove them one-by-one in subsequent patches in
this series.
2016-01-13 07:54:53 +09:00
Brian Birtles
03057136c3 Bug 1232577 part 3 - Move RestyleType to EffectCompositor; r=heycam
This is in preparation for moving RequestRestyle to EffectCompositor (and
because we'll run into compile issues if we don't since AnimationCommon.h
includes too many interdependent definitions).
2016-01-13 07:54:53 +09:00
Brian Birtles
a0f05d7d7e Bug 1232577 part 2 - Add a hashmap to ElementCompositor to track which (pseudo-) elements need to have their animation style rule updated; r=heycam
We will eventually use this in place of the various state flags stored on
AnimationCollection (e.g. mStyleRuleRefreshTime, mStyleChanging,
mHasPendingAnimationRestyle) as well as to do a more targetted update in
FlushAnimations and AddStyleUpdatesTo.
2016-01-13 07:54:53 +09:00
Brian Birtles
641025e212 Bug 1232577 part 1 - Add EffectCompositor as a member of nsPresContext; r=heycam
Since we want to track elements needing a restyle on EffectCompositor we need
to scope it to an nsPresContext rather than just making if a collection of
static methods.
2016-01-13 07:54:53 +09:00
Shirotaka_Pro
f271c4587b Bug 1179627 - Part 2: Add animation.id for CSS animations test files. r=bbirtles, r=hiikezoe 2015-12-21 11:02:21 +09:00
N.Shimizu
9c1354440b Bug 1179627 - Part 1: Implement Animation.id. r=smaug, r=birtles 2016-01-08 03:17:00 -05:00
Hiroyuki Ikezoe
4d993b1ed3 Bug 1212720 - Part 4: Remove all cancelAllAnimationsOnEnd. It is not needed any more. r=bbirtles
--HG--
extra : histedit_source : 1470ef2dfe10559b5761c6eb6a384a610d883718
2015-12-22 00:50:00 -05:00
Hiroyuki Ikezoe
c1f10eb765 Bug 1212720 - Part 3: Remove AnimationTimeline.getAnimations. r=heycam, r=smaug
--HG--
extra : histedit_source : 3b036799886ebcc8498d495346eae963a5b5863d
2015-12-21 20:39:00 -05:00
Hiroyuki Ikezoe
cd2f747a36 Bug 1212720 - Part 2: Tests for document.getAnimations. r=heycam
--HG--
rename : dom/animation/test/css-animations/file_timeline-get-animations.html => dom/animation/test/css-animations/file_document-get-animations.html
rename : dom/animation/test/css-animations/test_timeline-get-animations.html => dom/animation/test/css-animations/test_document-get-animations.html
rename : dom/animation/test/css-transitions/file_timeline-get-animations.html => dom/animation/test/css-transitions/file_document-get-animations.html
rename : dom/animation/test/css-transitions/test_timeline-get-animations.html => dom/animation/test/css-transitions/test_document-get-animations.html
2016-01-06 14:22:00 -05:00
Brian Birtles
8bfaf66a58 Bug 1232563 part 4 - Don't perform style updates when the effect progress has not changed; r=heycam
Now that restyle requests are handled by the effect, we can more easily detect
cases where we don't need to trigger a style update by looking for when the
output of the effect could actually differ.

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

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

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

--HG--
extra : rebase_source : 1774698e15178cf8f8295160b96adea8ca5a2ed2
2016-01-06 11:04:06 +09:00
Brian Birtles
55c934a957 Bug 1232563 part 2 - Move RequestRestyle calls to the effect; r=heycam
--HG--
extra : rebase_source : 40d014f1ab978534a172545b33d3f9c7d1a56395
2016-01-06 11:04:06 +09:00
Brian Birtles
d0ad270eef Bug 1232563 part 1 - Request a layer update if an animation is newly finished; r=heycam
When requesting restyles we take special care to detect when an animation has
newly finished so we perform the necessary restyle to represent the fill state.
However, we should really explicitly pull the animation off the layer at this
point by requesting a layer update. (That is, when an animation is
newly-finished we should use RestyleType::Layer instead of
RestyleType::Standard. Currently we just use RestyleType::Standard.)

In this bug we plan to move restyle requests down to the effect (since it is
the *effect* that is restyled). However, only the Animation has the notion of
"finished" or not so we detect this particular case in the Animation and
request the layer update there. We already request layer updates in the
Animation for other situations such as pausing so doing *layer* updates in the
Animation and regular restyles in the effect is not inconsistent.

This patch also tweaks test_animations_omta.html since it was previously
erroneously testing that a finished animation was still running on the
compositor.

--HG--
extra : rebase_source : 3cd1abe2a10370e90cde64b4b42b27326082f6f0
2016-01-06 11:04:06 +09:00
Brian Birtles
0d628b2a55 Bug 1232561 part 4 - Add EffectCompositor::ComposeAnimationRule; r=heycam
This patch just moves a piece of functionality from
AnimationCollection::EnsureStyleRuleFor to the EffectCompositor. In subsequent
bugs we will move more and more of this functionality across until this
logic is fully contained in the EffectCompositor.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

--HG--
extra : rebase_source : 00cb49e7829bdef7a6084059b31fe2ef4b921af5
2016-01-06 11:04:04 +09:00
Hiroyuki Ikezoe
14a9ac51e5 Bug 1218646 - Skip to check whether property can run on compositor or not if mWinsInCascade is false. r=birtles
--HG--
extra : commitid : EEO5SsbNCyo
2015-12-25 07:14:02 +09:00
Brian Birtles
98bde3e131 Bug 1232829 - Detach obsolete DocumentTimeline from refresh driver when the document is reset; r=smaug 2015-12-22 10:08:19 +09:00
Hiroyuki Ikezoe
f36ff3beb0 Bug 1219543 - Part 3: MutationObserver should disconnect when the test is finished. r=bbirtles 2015-12-20 14:18:00 +01:00
Hiroyuki Ikezoe
1ffc0c63ea Bug 1219543 - Part 1: isRunningOnCompositor flag is now a member of AnimationProperty. r=bbirtles 2015-12-20 14:16:00 +01:00
Brian Birtles
c70be15294 Bug 1230056 part 1 - Add EffectCompositor::HasAnimationsForCompositor; r=dholbert 2015-12-09 16:28:10 -05:00
Bogdan Postelnicu
a32d8ac57a Bug 1231107 - add an assert on animationProperty. r=heycam 2015-12-08 05:13:00 +01:00
Brian Birtles
3cd1347f35 Bug 1226118 part 15 - Remove no-longer-necessary delays from test_running_on_compositor.html; r=hiro
Since part 3 in this patch series updated the way we clear the "running on
compositor" flag, we can update these tests so they no longer wait for this
flag (see bug 1226118 comment 21).
2015-12-04 08:34:18 +09:00
Brian Birtles
f82ce867cf Bug 1226118 part 12b - Rename CommonAnimationManager::GetAnimations to GetAnimationCollection; r=dholbert
This is to align with the existing GetAnimationCollection method that takes
a frame. Also, by making this name more specific hopefully it will be used less
since we are trying to move as much code as possible over to using EffectSet
instead of AnimationCollection.
2015-12-04 08:34:17 +09:00
Brian Birtles
7806ce3d5d Bug 1226118 part 8 - Add EffectCompositor::GetAnimationsForCompositor that uses the EffectSet rather than AnimationCollection; r=dholbert
This added method should behave in an equivalent manner to the existing
CommonAnimationManager::GetAnimationsForCompositor except for the following
differences:

* It uses the EffectSet attached to a target element rather than one of the
  AnimationCollection object on the owning element.

* It returns an array of Animation objects consisting of only those Animations
  that actually have the specified property as opposed to the
  AnimationCollection consisting of *all* CSS animations or *all* CSS
  transitions for the element regardless of whether they run on the compositor
  or not.

It may not be obvious why these two methods otherwise behave in an equivalent
fashion so the following explains how the existing code is mirrored in the new
method.

The existing code is as follows:

> AnimationCollection*
> CommonAnimationManager::GetAnimationsForCompositor(const nsIFrame* aFrame,
>                                                    nsCSSProperty aProperty)
> {
>   AnimationCollection* collection = GetAnimationCollection(aFrame);
>   if (!collection ||
>       !collection->HasCurrentAnimationOfProperty(aProperty) ||
>       !collection->CanPerformOnCompositorThread(aFrame)) {
>     return nullptr;
>   }
>
>   // This animation can be done on the compositor.
>   return collection;
> }

The new EffectCompositor::GetAnimationsForCompositor begins with two checks
performed at the beginning of CanPerformOnCompositorThread: the checks for
whether async animations are enabled or not and whether the frame has refused
async animations since these are cheap and it makes sense to check them first.

The next part of EffectCompositor::GetAnimationsForCompositor checks if there is
an EffectSet associated with the frame. This is equivalent to the check whether
|collection| is null or not above.

Following, we iterate through the effects in the EffectSet.

We first check if each effect is playing or not. In the above code,
HasCurrentAnimationOfProperty only checks if the effect is *current* or not.
However, CanPerformOnCompositorThread will only return true if it finds an
animation that can run on the compositor that is *playing*. Since playing is
a strict subset of current we only need to perform the more restrictive test.

Next we check if the effect should block running other animations on the
compositor. This is equivalent to the remainder of CanPerformOnCompositorThread.
Note that the order is important here. Only playing animations should block
other animations from running on the compositor. Furthermore, this needs to
happen before the following step since animations of property other than
|aProperty| can still block animations from running on the compositor.

Finally, we check if the effect has an animation of |aProperty|. This is
equivalent to the remainder of HasCurrentAnimationOfProperty.

If all these checks succeed, we add the effect's animation to the result to
return.
2015-12-04 08:34:12 +09:00
Brian Birtles
40c6c207b0 Bug 1226118 part 7 - Rename and rework KeyframeEffectReadOnly::CanAnimatePropertyOnCompositor to ShouldBlockCompositorAnimations; r=hiro
KeyframeEffectReadOnly::CanAnimatePropertyOnCompositor has a comment that says
it, "Returns true |aProperty| can be run on compositor for |aFrame|" but it
does nothing of the sort.

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

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

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

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

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

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

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

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

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

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

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

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

--HG--
extra : commitid : GEfsdBOqqsu
2015-11-19 23:06:43 -05:00
Hiroyuki Ikezoe
1e734eff34 Bug 1223255 - Use Animation::AnimationTimeToTimeStamp instead of timeline->ToTimeStamp. r=bbirtles
Otherwise delay value is multiplied by playbackRate twice.

--HG--
extra : rebase_source : 42b088e65c2ce3986bc36fa1c41a06e38f1c133a
2015-11-18 01:50:00 +01:00
Olli Pettay
f50a8c0983 Bug 1223445 - KeyframeEffectReadOnly objects end up keeping lots of other objects alive too long, r=birtles
--HG--
extra : rebase_source : df6828ce26e22e53b632f25952fd1741a693c36a
2015-11-16 19:44:55 +02:00
Hiroyuki Ikezoe
194d123d2a Bug 1216030 - Part 18: Remove IsCurrent() check in assertion in CanThrottle. r=bbirtles
The behavior of unthrottling in case of not current animations there is the
same as on current trunk.
There are two cases to reach there I can think of:

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

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