Commit Graph

164 Commits

Author SHA1 Message Date
Brian Birtles
a76160a0d6 Bug 1010067 - Whitespace fix to nsTransitionManager::FlushTransitions. No review.
This change was suggested in bug 1010067 comment 22 but somehow ended up in the
wrong patch when pushing.
2014-07-03 09:04:35 +09:00
Brian Birtles
9b3dd393c0 Bug 1010067 part 8 - Rename ElementData methods and members in CommonAnimationManager to ElementCollection; r=dbaron 2014-06-27 08:57:13 +09:00
Brian Birtles
0b0d7d26e7 Bug 1010067 part 7 - Rename instances of ElementAnimationCollection; r=dbaron 2014-06-27 08:57:13 +09:00
Brian Birtles
f4086b4a09 Bug 1010067 part 6 - Rename mozilla::css::CommonElementAnimationData to mozilla::ElementAnimationCollection; r=dbaron 2014-06-27 08:57:12 +09:00
Brian Birtles
b5472a63e1 Bug 1010067 part 4 - Rename nsTransition to mozilla::StyleTransition; r=dbaron 2014-06-27 08:57:12 +09:00
Brian Birtles
92359b2948 Bug 1029370 part 2 - Make nsTransitionManager::FlushTransitions reuse GetComputedTimingAt; r=dholbert
This patch removes some redundant calculation of timing phases in
FlushTransitions by calling GetComputedTiming and using the definitions there.
2014-06-25 09:42:19 +09:00
Brian Birtles
e17455d50f Bug 1010067 part 2 - Rename nsStyleAnimation.{h,cpp} to StyleAnimationValue.{h,cpp}; r=dbaron
--HG--
rename : layout/style/nsStyleAnimation.cpp => layout/style/StyleAnimationValue.cpp
rename : layout/style/nsStyleAnimation.h => layout/style/StyleAnimationValue.h
2014-06-24 15:29:54 +09:00
Brian Birtles
9fe1178360 Bug 1010067 part 1 - Rename nsStyleAnimation::Value to mozilla::StyleAnimationValue; r=dbaron
This patch also moves the static methods defined on nsStyleAnimation so that
they are part of StyleAnimationValue class.

Renaming nsStyleAnimation.h to StyleAnimationValue.h is performed in a separate
patch to simplify the diff (since some tools may not handle file renames
elegantly).
2014-06-24 15:29:54 +09:00
Brian Birtles
c171a38d22 Bug 1026302 part 5 - Make a common property dtor for CommonElementAnimationData; r=dbaron
This patch takes the two static methods ElementAnimationsPropertyDtor and
ElementTransitionsPropertyDtor and replaces them with a class static on
CommonElementAnimationData.
2014-06-24 15:29:53 +09:00
Brian Birtles
b5e5abcde5 Bug 1026302 part 2 - Move PostRestyleForAnimation to CommonElementAnimationData; r=dbaron
This patch moves PostRestyleForAnimation from ElementAnimations to the base
class CommonElementAnimationData and makes use of it within nsTransitionManager.
2014-06-23 14:10:19 +09:00
Brian Birtles
0251d1dcf6 Bug 1026302 part 1 - Move IsForElement and PseudoElement from ElementAnimations to CommonElementAnimationData; r=dbaron
IsForElement and PseudoElement are currently only defined on ElementAnimations
but could be used for transitions. This patch moves these methods to the common
base class CommonElementAnimationData and also makes use of PseudoElement within
nsTransitionManager.
2014-06-23 14:10:18 +09:00
Brian Birtles
047fdcf8f2 Backing out bug 1026302 for build bustage changesets 3e719e2cc1bd and 7a2b642bf77a 2014-06-23 11:26:59 +09:00
Brian Birtles
79f05db7a3 Bug 1026302 part 2 - Move PostRestyleForAnimation to CommonElementAnimationData; r=dbaron
This patch moves PostRestyleForAnimation from ElementAnimations to the base
class CommonElementAnimationData and makes use of it within nsTransitionManager.
2014-06-23 10:48:01 +09:00
Brian Birtles
09c9b39802 Bug 1026302 part 1 - Move IsForElement and PseudoElement from ElementAnimations to CommonElementAnimationData; r=dbaron
IsForElement and PseudoElement are currently only defined on ElementAnimations
but could be used for transitions. This patch moves these methods to the common
base class CommonElementAnimationData and also makes use of PseudoElement within
nsTransitionManager.
2014-06-23 10:48:01 +09:00
Brian Birtles
e9db0d2d0c Bug 1025709 part 12 - Remove ElementTransitions; r=heycam
This patch replaces all references to ElementTransitions (now that it is empty)
with references to the base class, CommonElementAnimationData. It also takes the
opportunity to tidy up some of the call sites in nsLayoutUtils since they no
longer need to differentiate between animations and transitions.
2014-06-20 12:39:26 +09:00
Brian Birtles
cebc2e9de9 Bug 1025709 part 11 - Make ElementPropertyTransition::ValuePortionFor reuse GetComputedTimingAt; r=heycam
In order to remove redundant code and generally make transitions less special,
this patch reworks ValuePortionFor to reuse the existing code for calculation
the fractional distance of within the animation interval.
2014-06-20 12:39:26 +09:00
Brian Birtles
87bf388035 Bug 1025709 part 8 - Move CanPerformOnCompositorThread from ElementAnimations/ElementTransitions to the base class; r=heycam 2014-06-20 12:39:25 +09:00
Brian Birtles
e0cfc89409 Bug 1025709 part 7 - Move HasAnimationOfProperty from ElementAnimations/ElementTransitions to base class; r=heycam
This patch moves HasAnimationOfProperty to CommonElementAnimationData. It also
takes the chance to start removing some redundancy from nsLayoutUtils
/ ActiveLayerTracker. Some of this should never have been added in the first
place and some could have been removed earlier on but while we're fixing up
HasAnimationOfProperty it seems like an appropriate time to fix up its call
sites too.

Also, since HasAnimationOrTransition actually returns an object, not a bool, we
this patch renames it to GetAnimationsOrTransitions.
2014-06-20 12:39:25 +09:00
Brian Birtles
753003158e Bug 1025709 part 5 - Replace aIsThrottled bool value with an enum; r=heycam 2014-06-20 12:39:25 +09:00
Brian Birtles
5e704e1b3d Bug 1025709 part 4 - Move EnsureStyleRuleFor from ElementTransitions and ElementAnimations to CommonElementAnimationData; r=heycam
Both ElementAnimations and ElementTransitions have an EnsureStyleRuleFor method.
The ElementAnimations version is a more general of the ElementTransitions one
with the exception that the ElementTransitions version checks for finished
transitions. This patch moves the code from ElementAnimations to
CommonElementAnimationData with one minor change: adding the checks for finished
transitions. The ElementTransitions version is removed.

Since the ElementAnimations version contains a second parameter, aIsThrottled,
callers of ElementTransitions must include this extra parameter. In
a subsequent patch we add an enum for this parameter to make call sites easier
to read.

The ElementAnimations version also sets the mNeedsRefreshes member so at the
same time we move mNeedsRefreshes to CommonElementAnimationData. Furthermore,
since the ElementAnimations version which we have adopted returns early if
mNeedsRefreshes is false, this patch ensures that when we call
EnsureStyleRuleFor from ElementTransitions::WalkTransitionRule, we set
mNeedsRefreshes to true first.

Another difference to account for is that the ElementTransitions version of
EnsureStyleRuleFor *always* sets mStyleRule (even if it doesn't add anything to
it) where as the ElementAnimations version only creates the rule when necessary
so we need to add a check to ElementTransitions::WalkTransitionRule that
mStyleRule is actually set before using it.
2014-06-20 12:39:24 +09:00
Brian Birtles
640d1175ef Bug 1025709 part 2 - Add IsFinished() to ElementAnimation; r=heycam
One of the main differences in handling a list of transitions vs a list of
regular animations is that when we are dealing with a list of transitions we
need to check for transitions that have finished and are about to be discarded
but need to be retained temporarily to provide correct triggering of subsequent
transitions. Such transitions are marked as "removed sentinels" and are ignored
for most operations.

This patch moves the methods for setting and checking such transitions to the
base class ElementAnimation so that we can treat animations and transitions
alike without having to downcast or do obscure checks for mStartTime.IsNull()
(which equates to checking if the animation is a "removed sentinel" but is not
particularly clear).

In the process, this patch renames said methods to Is/SetFinishedTransition
since hopefully that is a little easier to understand at a glance.
2014-06-20 12:39:24 +09:00
Brian Birtles
d4fb178556 Bug 1025709 part 1 - Move mDelay to AnimationTiming; r=heycam
This patch is the first part in preparing the way to merge ElementTransitions
with CommonElementAnimationData (which we'll eventually rename to something
nicer).

Here we move mTiming from CommonElementAnimationData to the AnimationTiming
struct. While this is not strictly necessary in order to do the later
refactoring it makes it simpler since it:

- Divides time calculation into calculation based on dynamic play state (the
  responsibility of animation players in Web Animations terms) and static
  author-specified timing parameters (a property of animations in Web Animations
  terms).
- In future we will probably put animations on the compositor during their
  delay phase so we will want the delay to be present in the AnimationTiming
  struct then.
- Makes AnimationTiming line up with the dictionary of the same name in Web
  Animations.
2014-06-20 12:39:23 +09:00
William Chen
6d093181ec Bug 1022741 - Use CrossShadowCurrentDoc() in Element::UpdateState. r=smaug 2014-06-10 14:41:31 -07:00
Brian Birtles
1fa5b12248 Bug 1004871 part 2 - Add AnimationTiming struct, to encapsulate animation timing parameters; r=dholbert
Introduces a struct to store timing parameters for passing to
GetPositionInIteration. In future this struct is expected to be expanded to
include other timing parameters as well (based roughly on Web Animations'
"Timing" interface, hence the name AnimationTiming).
2014-05-28 16:51:49 +09:00
Brian Birtles
808c09cd73 Bug 1004383 part 4 - Move mAnimations to CommonElementAnimationData; r=dbaron
As a result, transitions are now stored using a pointer to the base class,
mozilla::ElementAnimation. We downcast to a transition only when necessary. No
error-checking of the result of AsTransition is performed since we only ever
call it on the mAnimations member of ElementTransitions.
2014-05-15 08:38:37 +09:00
Brian Birtles
c2e22acede Bug 1004383 part 1 - Put StyleAnimation on the heap; r=dbaron
This patch takes StyleAnimation and makes it ref-counted heap object. This
should allow us to store StyleAnimation and its subclasses (transitions only
currently) in a consistent fashion (an array of base-class pointers).
Furthermore, this will be helpful if we want these things to be pointed to
from Javascript objects that may, for example, preserve their lifetime beyond
that of the element that currently owns them.

This patch also introduces a typedef for an array of refptrs to StyleAnimation
objects (and similarly for the subclass ElementPropertyTransition) to simplify
the code somewhat.
2014-05-15 08:38:37 +09:00
Benoit Jacob
472e4472e0 Bug 1004098 - Make nsTArray use size_t in its interface (32bitness is fine as an internal detail) - r=froydnj, sr=bsmedberg 2014-05-08 21:03:35 -04:00
Cameron McCormack
92b03b34b0 Bug 992333 - Skip custom properties when looking for properties to transition. r=dbaron 2014-04-13 11:44:31 +10:00
Brian Birtles
217cb32ecc Bug 880596 part 4 - Reuse ElementAnimation::HasAnimationOfProperty; r=dbaron
Now that ElementTransitionProperty inherits from ElementAnimation,
ElementTransitions::HasAnimationOfProperty can re-use
ElementAnimation::HasAnimationOfProperty in its definition of
ElementTransitions::HasAnimationOfProperty.

Similarly, in nsDisplayList::AddAnimationsAndTransitionsToLayer we can use this
method rather than drilling down to the appropriate segment by hand.
2014-04-03 14:57:27 +09:00
Brian Birtles
e503422f93 Bug 880596 part 3 - Remove ElementPropertyTransition::IsRunningAt and mIsRunningOnCompositor; r=dbaron
Both ElementPropertyTransition and ElementAnimation specify an IsRunningAt
method which have the same purpose but with two subtle differences:

a) ElementPropertyTransition::IsRunningAt checks if the transition is a removed
sentinel and if so returns false. This patch adds a check for a null start time
to IsRunningAt since I think in future we will want to allow null times in
various places to represent, for example, animations that are not connected to
a timeline. (However, ultimately we will probably not allow start times on
*animations* to be null, only on their associated player.)

Should we later use a different mechanism for marking sentinel transitions (e.g.
a boolean flag) this method should still be correct as it checks if aTime is
inside the transition interval before returning true.

b) ElementPropertyTransition::IsRunningAt returns false if the transition is in
the delay phase, that is, waiting to start. This patch changes this behavior so
that transitions are considered running even if they are in the delay phase.
This brings their behavior into line with animations and removes the need for
the ElementPropertyTransition::mIsRunningOnCompositor since it is only used to
determine when a transition in the delay phase has begun.

ElementAnimation::IsRunningAt also handles pause state and iterations but this
logic should still be correct for transitions which, in this area, only use
a subset of the functionality of animations since their pause state is always
playing and their iteration count is 1.
2014-04-03 14:57:27 +09:00
Brian Birtles
5e2f8ede42 Bug 880596 part 2 - Make ElementPropertyTransition inherit from ElementAnimation; r=dbaron
As part of moving towards more shared data structures for animation, this patch
makes ElementPropertyTransition inherit from ElementAnimation. At the same time
we switch from storing the target property, start/end values, start time, delay,
and timing function on the transition to the corresponding location in
ElementAnimation.

Since nsDisplayList::AddAnimationsAndTransitionsToLayer was already doing this
conversion in order to create animations to pass to the compositor thread, we
can remove the conversion code from there and just use the ElementAnimation data
structures as-is.

A number of assertions are added to verify that transitions are set up as
expected (namely, they have only a single property-animation with a single
segment). As we move to more generic handling of animations and transitions
these assertions should disappear.
2014-04-03 14:57:27 +09:00
Brian Birtles
19e2304b94 Bug 880596 part 1 - Separate delay from start time for transitions; r=dbaron
As a first step towards making CSS animations and CSS transitions use the same
data structures, this patch aligns their behavior with regards to start time and
delay handling.

Previously, ElementAnimation objects maintained separate mStartTime and mDelay
members whilst ElementPropertyTransition objects maintained a single mStartTime
property that incorporated the delay. This patch adds an mDelay member to
ElementPropertyTransition and stores the delay and start time separately.
Calculations involving ElementPropertyTransition::mStartTime are adjusted to
incorporate mDelay.
2014-04-03 14:57:27 +09:00
Masayuki Nakano
b7a8d4a392 Bug 983049 part.5 Rename nsEventDispatcher to mozilla::EventDispatcher r=smaug
--HG--
rename : dom/events/nsEventDispatcher.cpp => dom/events/EventDispatcher.cpp
rename : dom/events/nsEventDispatcher.h => dom/events/EventDispatcher.h
2014-03-18 13:48:21 +09:00
L. David Baron
a2f97c232b Bug 978712 - Prevent non-running transitions and animations (animations or transitions during their delay period, and animations after they finish) from repeatedly poking layer activity because we think we can run them on the compositor. r=heycam
This changes the behavior of the CanPerformOnCompositorThread methods of
both ElementAnimations and ElementTransitions to check that the
respective animations or transitions are actually running.  This is ok
because:
 - The main caller is nsLayoutUtils::HasAnimationsForCompositor, and all
   of its callers pretty clearly want the more restricted behavior (they're
   concerned with layer activity)
 - The only other callers of these functions are
   nsAnimationManager::FlushAnimations and
   nsTransitionManager::FlushTransitions (determining when to do
   throttling), nsAnimationManager::GetAnimationsForCompositor (whose
   only caller,
   nsDisplayListBuilder::AddAnimationsAndTransitionsToLayer, also checks
   IsRunningAt).  I think these also all want or are fine with having
   the IsRunningAt check.

As to the actual changes:
 - In the animation manager, I think it's a mistake that
   ElementAnimation::IsRunningAt didn't already check
   mIterationDuration, since we throw out animations with a bad
   iteration-duration in ElementAnimations::EnsureStyleRuleFor.  So this
   makes that change as well.
 - In the transition manager, IsRunningAt already checks
   !IsRemovedSentinel().

I've confirmed in gdb on a device that this fixes the repeated
nsIFrame::SchedulePaint calls that were the symptom of this bug.

I believe this patch also makes it so that a short animation of a
property that can't be animated on the compositor doesn't prevent the
entire duration of the animation of a property that can from being
throttled (having the main thread style updates suppressed).
2014-03-06 22:08:57 -08:00
Masayuki Nakano
5b112a02ec Bug 969219 Simplify constructor of InternalTransitionEvent r=smaug 2014-02-11 14:35:25 +09:00
Nicholas Cameron
8cdfae40fc Bug 914847. Mini-flush for animations. r=dbaron 2013-10-22 14:14:41 +02:00
Benoit Girard
4926ed1e4f Bug 936864 - Fix logic error in async animation code. r=roc 2013-11-13 17:21:39 -05:00
Robert O'Callahan
a999a450cf Bug 911889. Part 2: Refactor MarkLayersActive code into its own class and be much more explicit about what it does. r=mattwoodrow
This also changes the functionality a little bit to track independent
per-property mutation counts and independent "content active" status.
2013-09-04 23:30:57 +12:00
Phil Ringnalda
b679ae2f4c Back out 0a88dee3b92b:dc5cc7d7b84d (bug 911889) for beaucoup unexpected assertions
--HG--
extra : rebase_source : a2a13633b6028c99a3c732dbbafe8c800bc32071
2013-10-28 23:38:02 -07:00
Robert O'Callahan
c2cf6c85d0 Bug 911889. Part 2: Refactor MarkLayersActive code into its own class and be much more explicit about what it does. r=mattwoodrow
This also changes the functionality a little bit to track independent
per-property mutation counts and independent "content active" status.

--HG--
extra : rebase_source : e69b8e7a95d36720bd38d74f0789ede603e58a09
2013-09-04 23:30:57 +12:00
Wes Kocher
6256b8f389 Backed out changeset 87ee0a1865e4 (bug 914847) 2013-10-22 16:55:14 -04:00
Nicholas Cameron
dd6d5fdd9f Bug 914847. Mini-flush for animations. r=dbaron 2013-10-22 14:14:41 +02:00
Markus Stange
aaf1e127bb Bug 929362 - When refusing compositor animation during BuildLayer, set a property on the frame that disables all async animations on it forever. r=roc
--HG--
extra : rebase_source : 98c9b690a4842c19314dd46f5e531601b77fe527
2013-10-22 12:30:45 +02:00
Masayuki Nakano
6a38167904 Bug 920377 part.6 Get rid of nsTransitionEvent r=roc 2013-09-27 15:20:55 +09:00
Masayuki Nakano
2f532b885b Bug 912956 part.17 mozilla/ContentEvents.h should be included directly r=roc 2013-09-25 20:21:20 +09:00
Ehsan Akhgari
d5d3a9ae84 Bug 916610 - Minimize the #includes in layout/style; r=roc 2013-09-15 21:06:52 -04:00
L. David Baron
fff4661d1e Bug 900783: Make HasAnimationOfProperty return false in the refresh driver tick in which the transition completes. r=nrc
I don't know of any observable bug that this fixes, but the code without
this fix seems incorrect; the "removed sentinel" concept generally
requires that callers enumerating transitions check that they're not
enumerating the sentinel.

This ensures that HasAnimationOfProperty switches from returning true to
false in the first refresh cycle after the end of the animation rather
than the second.

I originally wrote this in
https://bugzilla.mozilla.org/show_bug.cgi?id=876626#c13 but it turned
out not to be related to that bug.
2013-09-09 12:21:24 +02:00
Ehsan Akhgari
c2ce7e67ab Bug 906790 - Minimize layout/base #includes; r=roc 2013-08-19 18:55:18 -04:00
L. David Baron
40c4d9c17c Bug 898888: Transition manager should use SetStyleContext rather than SetStyleContextWithoutNotification. r=nrc
While debugging bug 858937 I noticed that the transition manager was
calling nsIFrame::SetStyleContextWithoutNotification rather than
nsIFrame::SetStyleContext.  SetStyleContextWithoutNotification should
only be used for things that aren't really style changes, but are
instead changes we make during frame construction before things are
really initialized.  Anything that's really a dynamic style change, as
these are, should use SetStyleContext.

I realize I said the opposite in bug 780692 comment 186, and bz said the
same in bug 780692 comment 204, which is why this is the state that it
is.
2013-07-30 17:36:08 -07:00
L. David Baron
0354744354 Bug 896138 patch 4: Move restyle management code from nsCSSFrameConstructor to RestyleManager. r=heycam
This moves restyling management out of nsCSSFrameConstructor (thus
reducing its size), and keeps the restyling code closer together.

This is the first of two big chunks of code moved in this patch series.
A later patch in this series will move related code from nsFrameManager
into the same destination file.
2013-07-20 12:14:25 -07:00