зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1203009 part 3 - Add mNeedsNewAnimationIndexWhenRun flag to CSSAnimation and CSSTransition; r=heycam
In the new composite order arrangement CSSAnimations and CSSTransition have the following life-cycle: 1. Animation created by markup => composite order determined by markup (e.g. CSS animations use tree order and animation-name order; CSS transitions use transition trigger order) 2. Animation cancelled by changing markup => composite order is undefined 3. Animation is played again using the API => composite order is defined by when the animation is first played. Another way of saying this is that, at the point when the animation is played, it is appended to the "global animation list". 4. Animation is subsequently cancelled / played => no change We need a way to know when we are going from 2 to 3. It would seem like we could do that by setting mAnimationIndex to some sentinel value while it is in 2. However, even when in 2, although the spec doesn't define the composite order animations at this point (from an API point of view you can't access these objects and they don't contribute to style so it doesn't need to be defined), we sometimes will need to establish an order. This can happen, for example, when an animation queues events and then is later cancelled before the events are dispatched. Because we sort events based on their associated animation at the time of dispatch (for performance reasons) we need a deterministic order for these idle animations. We do that (in a subsequent patch in this series) by setting mAnimationIndex when we transition from 1 to 2. That is, these idle animations are effectively ordered by when they became idle (which always happens in a deterministic fashion).
This commit is contained in:
Родитель
f64b384fb1
Коммит
96b49a1126
|
@ -63,6 +63,7 @@ public:
|
|||
, mAnimationName(aAnimationName)
|
||||
, mIsStylePaused(false)
|
||||
, mPauseShouldStick(false)
|
||||
, mNeedsNewAnimationIndexWhenRun(false)
|
||||
, mPreviousPhaseOrIteration(PREVIOUS_PHASE_BEFORE)
|
||||
{
|
||||
// We might need to drop this assertion once we add a script-accessible
|
||||
|
@ -223,6 +224,10 @@ protected:
|
|||
bool mIsStylePaused;
|
||||
bool mPauseShouldStick;
|
||||
|
||||
// When true, indicates that when this animation next leaves the idle state,
|
||||
// its animation index should be updated.
|
||||
bool mNeedsNewAnimationIndexWhenRun;
|
||||
|
||||
enum {
|
||||
PREVIOUS_PHASE_BEFORE = uint64_t(-1),
|
||||
PREVIOUS_PHASE_AFTER = uint64_t(-2)
|
||||
|
|
|
@ -85,6 +85,7 @@ public:
|
|||
explicit CSSTransition(nsIGlobalObject* aGlobal)
|
||||
: dom::Animation(aGlobal)
|
||||
, mWasFinishedOnLastTick(false)
|
||||
, mNeedsNewAnimationIndexWhenRun(false)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -175,6 +176,10 @@ protected:
|
|||
OwningElementRef mOwningElement;
|
||||
|
||||
bool mWasFinishedOnLastTick;
|
||||
|
||||
// When true, indicates that when this transition next leaves the idle state,
|
||||
// its animation index should be updated.
|
||||
bool mNeedsNewAnimationIndexWhenRun;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
|
|
Загрузка…
Ссылка в новой задаче