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.

--HG--
extra : commitid : 2KrTezItH3q
extra : rebase_source : 50de87465deef85558ca50de5e6286f7b5603051
This commit is contained in:
Brian Birtles 2015-06-09 11:13:54 +09:00
Родитель 9836323890
Коммит 855752164f
3 изменённых файлов: 19 добавлений и 1 удалений

Просмотреть файл

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

Просмотреть файл

@ -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;

Просмотреть файл

@ -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