Make AnimValuesStyleRule::AddEmptyValue infallible. (Bug 435442, patch 8) r=bzbarsky
authorL. David Baron <dbaron@dbaron.org>
Mon, 11 Apr 2011 23:18:43 -0700
changeset 67982 f4d2a9cb8e06bbf0936399684a67f693b70ff111
parent 67981 548241dd0c12732ff0c5c3b3a3b9ba650411e484
child 67983 618c5d784dace564d9fdb4dabba2a1582214c321
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbzbarsky
bugs435442
milestone2.2a1pre
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
Make AnimValuesStyleRule::AddEmptyValue infallible. (Bug 435442, patch 8) r=bzbarsky
layout/style/AnimationCommon.h
layout/style/nsTransitionManager.cpp
--- a/layout/style/AnimationCommon.h
+++ b/layout/style/AnimationCommon.h
@@ -108,34 +108,31 @@ public:
 #endif
 
   void AddValue(nsCSSProperty aProperty, nsStyleAnimation::Value &aStartValue)
   {
     PropertyValuePair v = { aProperty, aStartValue };
     mPropertyValuePairs.AppendElement(v);
   }
 
-  // Caller must fill in returned value, when non-null.
+  // Caller must fill in returned value.
   nsStyleAnimation::Value* AddEmptyValue(nsCSSProperty aProperty)
   {
     PropertyValuePair *p = mPropertyValuePairs.AppendElement();
-    if (!p) {
-      return nsnull;
-    }
     p->mProperty = aProperty;
     return &p->mValue;
   }
 
   struct PropertyValuePair {
     nsCSSProperty mProperty;
     nsStyleAnimation::Value mValue;
   };
 
 private:
-  nsTArray<PropertyValuePair> mPropertyValuePairs;
+  InfallibleTArray<PropertyValuePair> mPropertyValuePairs;
 };
 
 class ComputedTimingFunction {
 public:
   typedef nsTimingFunction::Type Type;
   void Init(const nsTimingFunction &aFunction);
   double GetValue(double aPortion) const;
 private:
--- a/layout/style/nsTransitionManager.cpp
+++ b/layout/style/nsTransitionManager.cpp
@@ -183,19 +183,16 @@ ElementTransitions::EnsureStyleRuleFor(T
     for (PRUint32 i = 0, i_end = mPropertyTransitions.Length(); i < i_end; ++i)
     {
       ElementPropertyTransition &pt = mPropertyTransitions[i];
       if (pt.IsRemovedSentinel()) {
         continue;
       }
 
       nsStyleAnimation::Value *val = mStyleRule->AddEmptyValue(pt.mProperty);
-      if (!val) {
-        continue;
-      }
 
       double valuePortion = pt.ValuePortionFor(aRefreshTime);
 #ifdef DEBUG
       PRBool ok =
 #endif
         nsStyleAnimation::Interpolate(pt.mProperty,
                                       pt.mStartValue, pt.mEndValue,
                                       valuePortion, *val);