Bug 1048838 - Properly invalidate the style rule in nsTransitionManager::StyleContextChanged. r=dbaron, a=sledru
authorBrian Birtles <birtles@gmail.com>
Tue, 12 Aug 2014 16:57:21 +0900
changeset 217632 b8bfb14bab0c2dc2f796d318857f2a58df00e69f
parent 217631 0dfba827f5fd9727a0440fd2044b0696325ac761
child 217633 e85f5894f07571d911c501ccd1134b0d5b39ea06
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron, sledru
bugs1048838, 1025709
Bug 1048838 - Properly invalidate the style rule in nsTransitionManager::StyleContextChanged. r=dbaron, a=sledru This patch fixes a regression from https://hg.mozilla.org/mozilla-central/rev/31695984cfe2 (bug 1025709). That patch replaced the EnsureStyleRuleFor method on ElementTransitions and ElementAnimations with a common method in CommonElementAnimationData. ElementTransitions::EnsureStyleRuleFor would create a new style rule if there was no style rule (mStyleRule == nullptr) or if the refresh time was old (mStyleRuleRefreshTime != aRefreshTime). ElementAnimations::EnsureStyleRuleFor, however, would create a new style rule only if mStyleRuleRefreshTime was null or old since a null style rule may still be valid for animations (unlike transitions). If we bail as soon as we a null style rule we would never update mNeedsRefreshes when the animation finishes. The unified version of EnsureStyleRuleFor in CommonElementAnimationData adopted the behavior from ElementAnimations checking for a null or old mStyleRuleRefreshTime. However, nsTransitionManager::StyleContextChanged sets mStyleRule to nullptr to indicate that we need to generate a new style rule. This means that we will fail to create a style rule for the transition in some cases. This patch addresses this by making nsTransitionManager::StyleContextChanged set mStyleRuleRefreshTime to a null timestamp. Setting mStyleRule to nullptr is no longer necessary since EnsureStyleRuleFor will do this when necessary and nsTransitionManager::mStyleRule is only used after calling EnsureStyleRuleFor.
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -369,17 +369,19 @@ nsTransitionManager::StyleContextChanged
                "Animation property should have one segment for a transition");
     AnimationProperty& prop = animation->mProperties[0];
     AnimationPropertySegment& segment = prop.mSegments[0];
     if (whichStarted.HasProperty(prop.mProperty)) {
       coverRule->AddValue(prop.mProperty, segment.mFromValue);
-  collection->mStyleRule = nullptr;
+  // Set the style rule refresh time to null so that EnsureStyleRuleFor
+  // creates a new style rule.
+  collection->mStyleRuleRefreshTime = TimeStamp();
   return coverRule.forget();
   nsCSSProperty aProperty,
   const StyleTransition& aTransition,