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.

--HG--
extra : commitid : 6kwqrE1A55J
extra : rebase_source : 86df7ec85ede5d2015e0239efd90b531e16b8aa1
This commit is contained in:
Brian Birtles 2015-07-09 08:05:16 +09:00
parent 5fd77720f9
commit cf56e70bfb

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