Bug 1171817 part 8 - Override sequence numbers for CSS animations; r=dbaron

This patch re-uses Animation::mSequenceNum to store the index of CSS animations
within their corresponding animation-name property. When the animation is
removed from an animation-name property it reverts to using the default
animation composite order.

This patch also updates Animation::DoCancel to call UpdateTiming instead of
UpdateEffect. This is because UpdateTiming is responsible for updating the
sequence number (when custom composite order is not in effect). When we remove
an animation from animation-name it will be cancelled and at that point we
expect its sequence number to be cleared which will only happen if
UpdateTiming gets called.
This commit is contained in:
Brian Birtles 2015-06-09 11:13:54 +09:00
parent c65aa49bb3
commit d85df33a58
3 changed files with 19 additions and 1 deletions

View File

@ -444,7 +444,7 @@ Animation::DoCancel()
mHoldTime.SetNull();
mStartTime.SetNull();
UpdateEffect();
UpdateTiming(SeekFlag::NoSeek);
}
void

View File

@ -420,6 +420,8 @@ nsAnimationManager::CheckAnimationRule(nsStyleContext* aStyleContext,
}
}
oldAnim->CopyAnimationIndex(*newAnim->AsCSSAnimation());
if (animationChanged) {
nsNodeUtils::AnimationChanged(oldAnim);
}
@ -553,6 +555,7 @@ nsAnimationManager::BuildAnimations(nsStyleContext* aStyleContext,
nsRefPtr<CSSAnimation> dest = new CSSAnimation(aTimeline, src.GetName());
dest->SetOwningElement(*aTarget, aStyleContext->GetPseudoType());
dest->SetAnimationIndex(static_cast<uint64_t>(animIdx));
aAnimations.AppendElement(dest);
AnimationTiming timing;

View File

@ -101,10 +101,25 @@ public:
mOwningPseudoType = nsCSSPseudoElements::ePseudo_NotPseudoElement;
Animation::CancelFromStyle();
MOZ_ASSERT(mSequenceNum == kUnsequenced);
}
bool IsStylePaused() const { return mIsStylePaused; }
bool IsUsingCustomCompositeOrder() const override { return !!mOwningElement; }
void SetAnimationIndex(uint64_t aIndex)
{
MOZ_ASSERT(IsUsingCustomCompositeOrder());
mSequenceNum = aIndex;
}
void CopyAnimationIndex(const CSSAnimation& aOther)
{
MOZ_ASSERT(IsUsingCustomCompositeOrder() &&
aOther.IsUsingCustomCompositeOrder());
mSequenceNum = aOther.mSequenceNum;
}
void QueueEvents(EventArray& aEventsToDispatch);
// Returns the element or pseudo-element whose animation-name property