Bug 1188251 part 5 - Move some assertions from FlushTransitions to RequestRestyle; r=dholbert
authorBrian Birtles <birtles@gmail.com>
Mon, 17 Aug 2015 13:59:44 +0900
changeset 257999 754717f00c5e1f31fde952cd96a0680c20b7c64e
parent 257998 ae2c4fad97a0b41f71364091cfe1cfc9dbd9eae3
child 258000 8cbb80c89aefa630ac067191b17d5e2a67bb43d2
push id29238
push userryanvm@gmail.com
push dateMon, 17 Aug 2015 13:06:57 +0000
treeherdermozilla-central@a6eeb28458fd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs1188251
milestone43.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 1188251 part 5 - Move some assertions from FlushTransitions to RequestRestyle; r=dholbert There are a couple of assertions that only exist in FlushTransitions (and not FlushAnimations). This patch moves them to RequestRestyle since they appear to apply to either transitions or animations equally. By eliminating this difference between FlushTransitions and FlushAnimations we should then be in a position to combine them into a common method on the base class.
layout/style/AnimationCommon.cpp
layout/style/nsTransitionManager.cpp
--- a/layout/style/AnimationCommon.cpp
+++ b/layout/style/AnimationCommon.cpp
@@ -963,22 +963,29 @@ AnimationCollection::CanThrottleAnimatio
   }
 
   return true;
 }
 
 void
 AnimationCollection::RequestRestyle(RestyleType aRestyleType)
 {
+  MOZ_ASSERT(IsForElement() || IsForBeforePseudo() || IsForAfterPseudo(),
+             "Unexpected mElementProperty; might restyle too much");
+
   nsPresContext* presContext = mManager->PresContext();
   if (!presContext) {
     // Pres context will be null after the manager is disconnected.
     return;
   }
 
+  MOZ_ASSERT(mElement->GetCrossShadowCurrentDoc() == presContext->Document(),
+             "Element::UnbindFromTree should have destroyed the element "
+             "transition/animations object");
+
   // SetNeedStyleFlush is cheap and required regardless of the restyle type
   // so we do it unconditionally. Furthermore, if the posted animation restyle
   // has been postponed due to the element being display:none (i.e.
   // mHasPendingAnimationRestyle is set) then we should still mark the
   // document as needing a style flush.
   presContext->Document()->SetNeedStyleFlush();
 
   // If we are already waiting on an animation restyle then there's nothing
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -927,39 +927,24 @@ nsTransitionManager::FlushTransitions(Fl
       }
 
       nsAutoAnimationMutationBatch mb(collection->mElement);
 
       collection->Tick();
 
       bool canThrottleTick = aFlags == Can_Throttle;
 
-      MOZ_ASSERT(collection->mElement->GetCrossShadowCurrentDoc() ==
-                   mPresContext->Document(),
-                 "Element::UnbindFromTree should have "
-                 "destroyed the element transitions object");
-
       // Look for any transitions that can't be throttled because they
       // may be starting or stopping
       for (auto iter = collection->mAnimations.cbegin();
            canThrottleTick && iter != collection->mAnimations.cend();
            ++iter) {
         canThrottleTick &= (*iter)->CanThrottle();
       }
 
-      // We need to restyle even if the transition rule no longer
-      // applies (in which case we just made it not apply).
-      MOZ_ASSERT(collection->mElementProperty ==
-                   nsGkAtoms::transitionsProperty ||
-                 collection->mElementProperty ==
-                   nsGkAtoms::transitionsOfBeforeProperty ||
-                 collection->mElementProperty ==
-                   nsGkAtoms::transitionsOfAfterProperty,
-                 "Unexpected element property; might restyle too much");
-
       collection->RequestRestyle(canThrottleTick ?
                                  AnimationCollection::RestyleType::Throttled :
                                  AnimationCollection::RestyleType::Standard);
     }
   }
 
   MaybeStartOrStopObservingRefreshDriver();
 }