Bug 1358965 - Don't call UpdateEffectProperties and UpdateTransitions() for null computed values. r=birtles
authorHiroyuki Ikezoe <hikezoe@mozilla.com>
Tue, 25 Apr 2017 11:29:43 +0900
changeset 354724 5e652e7d35e71cee6749dfcc5cdc3c071bfcd8c9
parent 354723 ec0146387c72ed8c08a5574e38a8f74fb7cfcc9f
child 354725 f4353d26ccd15cf4311f2044bbff134820b6da48
push id31711
push usercbook@mozilla.com
push dateTue, 25 Apr 2017 09:24:00 +0000
treeherdermozilla-central@a30dc237c3a6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbirtles
bugs1358965
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1358965 - Don't call UpdateEffectProperties and UpdateTransitions() for null computed values. r=birtles MozReview-Commit-ID: 9NfR2Dzq92g
layout/style/ServoBindings.cpp
--- 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);
     }