Bug 1171817 part 16 - Always cancel transitions before removing them; r=dbaron

Earlier in this patch series we added an assertion to the destructor for
CSSAnimation and CSSTransition to check that the owning element has been
cleared when the animation is destroyed.

This assertion fails, however, for transitions because there are a two
code paths where a transition may be destroyed without being cancelled.
This patch adjusts those two code paths to ensure transitions are always
cancelled before being destroyed.
This commit is contained in:
Brian Birtles 2015-07-09 08:05:16 +09:00
parent 7d4395728f
commit c4f8b27475

View File

@ -406,9 +406,9 @@ nsTransitionManager::StyleContextChanged(dom::Element *aElement,
currentValue != segment.mToValue) {
// stop the transition
if (!anim->GetEffect()->IsFinishedTransition()) {
anim->CancelFromStyle();
collection->UpdateAnimationGeneration(mPresContext);
}
anim->CancelFromStyle();
animations.RemoveElementAt(i);
}
} while (i != 0);
@ -721,6 +721,7 @@ nsTransitionManager::PruneCompletedTransitions(mozilla::dom::Element* aElement,
if (!ExtractComputedValueForTransition(prop.mProperty, aNewStyleContext,
currentValue) ||
currentValue != segment.mToValue) {
anim->CancelFromStyle();
animations.RemoveElementAt(i);
}
} while (i != 0);