Bug 1383998 - Increase animation generation if attributes are changed. r=heycam

We have to set mHaveNonAnimationRestyles if we have attributes changed
(note: we increase the animation generation only if mHaveNonAnimationRestyles
is set). Attributes changed may create a new transition, and we use the
animation generation as the order of the transition, so
Element::GetAnimations() can return transitions with correct order.

Besides, I think ContentStateChanged() will not trigger a new
transition, so we don't need to make mHaveNonAnimationRestyles there.

MozReview-Commit-ID: J5XgW8nqeLH

--HG--
extra : rebase_source : 24c4b4364935fc5a4b8437f119cbf93035262684
This commit is contained in:
Boris Chiou 2017-08-02 11:43:41 +08:00
Родитель e4fb1c57a7
Коммит 74b215eeaa
1 изменённых файлов: 8 добавлений и 0 удалений

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

@ -1169,6 +1169,10 @@ ServoRestyleManager::TakeSnapshotForAttributeChange(Element* aElement,
// cause the style to change.
IncrementUndisplayedRestyleGeneration();
// Some other random attribute changes may also affect the transitions,
// so we also set this true here.
mHaveNonAnimationRestyles = true;
ServoElementSnapshot& snapshot = SnapshotFor(aElement);
snapshot.AddAttrs(aElement, aNameSpaceID, aAttribute);
@ -1228,6 +1232,10 @@ ServoRestyleManager::AttributeChanged(Element* aElement, int32_t aNameSpaceID,
// Assuming we need to invalidate cached style in getComputedStyle for
// undisplayed elements, since we don't know if it is needed.
IncrementUndisplayedRestyleGeneration();
// If we change attributes, we have to mark this to be true, so we will
// increase the animation generation for the new created transition if any.
mHaveNonAnimationRestyles = true;
}
}