Bug 1355758 - Update RestyleManager::mAnimationGeneration for non-animation update. r=heycam

We use RestyleManager::mAnimationGeneration as the animation index of a
new created transition, and Element.getAnimations() uses this index to
sort the order of transitions. We increase mAnimationGeneration one per
restyle cycle if there is any non-animation update.

MozReview-Commit-ID: KmirBzI7CXi

--HG--
extra : rebase_source : 6a9001ea99f86c25b1d8d0a822b51b8753248bfb
This commit is contained in:
Boris Chiou 2017-04-21 16:44:17 +08:00
Родитель 42bf7f5ae3
Коммит 14c973b7b3
2 изменённых файлов: 17 добавлений и 0 удалений

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

@ -55,6 +55,10 @@ ServoRestyleManager::PostRestyleEvent(Element* aElement,
return;
}
if (aRestyleHint & ~eRestyle_AllHintsWithAnimations) {
mHaveNonAnimationRestyles = true;
}
Servo_NoteExplicitHints(aElement, aRestyleHint, aMinChangeHint);
}
@ -71,6 +75,8 @@ ServoRestyleManager::RebuildAllStyleData(nsChangeHint aExtraHint,
{
StyleSet()->RebuildData();
mHaveNonAnimationRestyles = true;
// NOTE(emilio): GeckoRestlyeManager does a sync style flush, which seems
// not to be needed in my testing.
//
@ -387,6 +393,9 @@ ServoRestyleManager::ProcessPendingRestyles()
// in a loop because certain rare paths in the frame constructor (like
// uninstalling XBL bindings) can trigger additional style validations.
mInStyleRefresh = true;
if (mHaveNonAnimationRestyles) {
++mAnimationGeneration;
}
while (styleSet->StyleDocument()) {
// Recreate style contexts, and queue up change hints (which also handle
// lazy frame construction).
@ -419,6 +428,7 @@ ServoRestyleManager::ProcessPendingRestyles()
FlushOverflowChangedTracker();
mHaveNonAnimationRestyles = false;
mInStyleRefresh = false;
styleSet->AssertTreeIsClean();

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

@ -148,6 +148,13 @@ private:
// Only non-null while processing change hints. See the comment in
// ProcessPendingRestyles.
ReentrantChangeList* mReentrantChanges;
// We use this flag to track if the current restyle contains any non-animation
// update, which triggers a normal restyle, and so there might be any new
// transition created later. Therefore, if this flag is true, we need to
// increase mAnimationGeneration before creating new transitions, so their
// creation sequence will be correct.
bool mHaveNonAnimationRestyles = false;
};
} // namespace mozilla