Bug 823124; speculative fix - null style rule from an animation; r=dbaron
authorNicholas Cameron <ncameron@mozilla.com>
Thu, 27 Dec 2012 11:42:34 +1300
changeset 126175 50b3e25c750d13ced66a71931be1c0ea1e04303b
parent 126174 a836a0d544dafe562c042cb7172a606200a826b1
child 126176 21865911745c883824e6f359682f57a2e8193176
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdbaron
bugs823124
milestone20.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 823124; speculative fix - null style rule from an animation; r=dbaron
layout/style/nsTransitionManager.cpp
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -265,41 +265,45 @@ nsTransitionManager::UpdateThrottledStyl
   nsStyleContext* oldStyle = primaryFrame->GetStyleContext();
   nsRuleNode* ruleNode = oldStyle->GetRuleNode();
   nsTArray<nsStyleSet::RuleAndLevel> rules;
   do {
     if (ruleNode->IsRoot()) {
       break;
     }
 
-    nsStyleSet::RuleAndLevel* curRule = rules.AppendElement();
-    curRule->mLevel = ruleNode->GetLevel();
+    nsStyleSet::RuleAndLevel curRule;
+    curRule.mLevel = ruleNode->GetLevel();
 
-    if (curRule->mLevel == nsStyleSet::eAnimationSheet) {
+    if (curRule.mLevel == nsStyleSet::eAnimationSheet) {
       ElementAnimations* ea = 
         mPresContext->AnimationManager()->GetElementAnimations(aElement,
                                                                oldStyle->GetPseudoType(),
                                                                false);
       NS_ASSERTION(ea, "Rule has level eAnimationSheet without animation on manager");
 
       mPresContext->AnimationManager()->EnsureStyleRuleFor(ea);
-      curRule->mRule = ea->mStyleRule;
+      curRule.mRule = ea->mStyleRule;
 
       ForceLayerRerendering(primaryFrame, ea);
-    } else if (curRule->mLevel == nsStyleSet::eTransitionSheet) {
+    } else if (curRule.mLevel == nsStyleSet::eTransitionSheet) {
       ElementTransitions *et =
         GetElementTransitions(aElement, oldStyle->GetPseudoType(), false);
       NS_ASSERTION(et, "Rule has level eTransitionSheet without transition on manager");
       
       et->EnsureStyleRuleFor(mPresContext->RefreshDriver()->MostRecentRefresh());
-      curRule->mRule = et->mStyleRule;
+      curRule.mRule = et->mStyleRule;
 
       ForceLayerRerendering(primaryFrame, et);
     } else {
-      curRule->mRule = ruleNode->GetRule();
+      curRule.mRule = ruleNode->GetRule();
+    }
+
+    if (curRule.mRule) {
+      rules.AppendElement(curRule);
     }
   } while ((ruleNode = ruleNode->GetParent()));
 
   nsRefPtr<nsStyleContext> newStyle = mPresContext->PresShell()->StyleSet()->
     ResolveStyleForRules(aParentStyle, oldStyle, rules);
   primaryFrame->SetStyleContextWithoutNotification(newStyle);
 
   ReparentBeforeAndAfter(aElement, primaryFrame, newStyle, mPresContext->PresShell()->StyleSet());
@@ -324,17 +328,16 @@ nsTransitionManager::UpdateThrottledStyl
   if (element &&
       (et = GetElementTransitions(element,
                                   nsCSSPseudoElements::ePseudo_NotPseudoElement,
                                   false))) {
     // re-resolve our style
     newStyle = UpdateThrottledStyle(element, aParentStyle);
     // remove the current transition from the working set
     et->mFlushGeneration = mPresContext->RefreshDriver()->MostRecentRefresh();
-;
   } else {
     // reparent the element's style
     nsStyleSet* styleSet = mPresContext->PresShell()->StyleSet();
     nsIFrame* primaryFrame = aContent->GetPrimaryFrame();
     if (!primaryFrame) {
       return;
     }