Bug 1358965 - Don't call UpdateEffectProperties and UpdateTransitions() for null computed values. r?birtles
MozReview-Commit-ID: 9NfR2Dzq92g
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -478,16 +478,27 @@ Gecko_UpdateAnimations(RawGeckoElementBo
nsCSSPseudoElements::GetPseudoType(aPseudoTagOrNull,
CSSEnabledState::eForAllContent);
if (tasks & UpdateAnimationsTasks::CSSAnimations) {
presContext->AnimationManager()->
UpdateAnimations(const_cast<dom::Element*>(aElement), pseudoType,
servoValues);
}
+
+ // aComputedValues might be nullptr if the target element is now in a
+ // display:none subtree. We still call Gecko_UpdateAnimations in this case
+ // because we need to stop CSS animations in the display:none subtree.
+ // However, we don't need to update transitions since they are stopped by
+ // RestyleManager::AnimationsWithDestroyedFrame so we just return early
+ // here.
+ if (!aComputedValues) {
+ return;
+ }
+
if (tasks & UpdateAnimationsTasks::CSSTransitions) {
MOZ_ASSERT(aOldComputedValues);
const ServoComputedValuesWithParent oldServoValues =
{ aOldComputedValues, nullptr };
presContext->TransitionManager()->
UpdateTransitions(const_cast<dom::Element*>(aElement), pseudoType,
oldServoValues, servoValues);
}