Bug 813373, patch 2: Remove pres context member from ValueWrapper. r=dholbert
authorL. David Baron <dbaron@dbaron.org>
Tue, 20 Nov 2012 11:55:14 -0800
changeset 113809 cbf88ae52c5b79057c36b3b81d751b4dea2ede2c
parent 113808 a6e4b30b1d109b62a6f52b3021437f5be0bd073b
child 113810 da575e9f17c45bfc3aa25e0e43854214005dc57b
push id23890
push userryanvm@gmail.com
push dateWed, 21 Nov 2012 02:43:32 +0000
treeherdermozilla-central@4f19e7fd8bea [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdholbert
bugs813373
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 813373, patch 2: Remove pres context member from ValueWrapper. r=dholbert
content/smil/nsSMILCSSValueType.cpp
--- a/content/smil/nsSMILCSSValueType.cpp
+++ b/content/smil/nsSMILCSSValueType.cpp
@@ -16,23 +16,21 @@
 #include "mozilla/dom/Element.h"
 #include "nsDebug.h"
 
 using namespace mozilla::dom;
 
 /*static*/ nsSMILCSSValueType nsSMILCSSValueType::sSingleton;
 
 struct ValueWrapper {
-  ValueWrapper(nsCSSProperty aPropID, const nsStyleAnimation::Value& aValue,
-               nsPresContext* aPresContext) :
-    mPropID(aPropID), mCSSValue(aValue), mPresContext(aPresContext) {}
+  ValueWrapper(nsCSSProperty aPropID, const nsStyleAnimation::Value& aValue) :
+    mPropID(aPropID), mCSSValue(aValue) {}
 
   nsCSSProperty mPropID;
   nsStyleAnimation::Value mCSSValue;
-  nsPresContext* mPresContext;
 };
 
 // Helper "zero" values of various types
 // -------------------------------------
 static const nsStyleAnimation::Value
   sZeroCoord(0, nsStyleAnimation::Value::CoordConstructor);
 static const nsStyleAnimation::Value
   sZeroPercent(0.0f, nsStyleAnimation::Value::PercentConstructor);
@@ -189,17 +187,16 @@ nsSMILCSSValueType::IsEqual(const nsSMIL
   const ValueWrapper* leftWrapper = ExtractValueWrapper(aLeft);
   const ValueWrapper* rightWrapper = ExtractValueWrapper(aRight);
 
   if (leftWrapper) {
     if (rightWrapper) {
       // Both non-null
       NS_WARN_IF_FALSE(leftWrapper != rightWrapper,
                        "Two nsSMILValues with matching ValueWrapper ptr");
-      // mPresContext doesn't really matter for equality comparison
       return (leftWrapper->mPropID == rightWrapper->mPropID &&
               leftWrapper->mCSSValue == rightWrapper->mCSSValue);
     }
     // Left non-null, right null
     return false;
   }
   if (rightWrapper) {
     // Left null, right non-null
@@ -242,17 +239,17 @@ nsSMILCSSValueType::Add(nsSMILValue& aDe
   // If so, update outparam to use the new value.
   if (destWrapper && &destWrapper->mCSSValue != destValue) {
     destWrapper->mCSSValue = *destValue;
   }
 
   // Handle barely-initialized "zero" destination.
   if (!destWrapper) {
     aDest.mU.mPtr = destWrapper =
-      new ValueWrapper(property, *destValue, valueToAddWrapper->mPresContext);
+      new ValueWrapper(property, *destValue);
   }
 
   return nsStyleAnimation::Add(property,
                                destWrapper->mCSSValue, *valueToAdd, aCount) ?
     NS_OK : NS_ERROR_FAILURE;
 }
 
 nsresult
@@ -306,18 +303,17 @@ nsSMILCSSValueType::Interpolate(const ns
   if (!FinalizeStyleAnimationValues(startCSSValue, endCSSValue)) {
     return NS_ERROR_FAILURE;
   }
 
   nsStyleAnimation::Value resultValue;
   if (nsStyleAnimation::Interpolate(endWrapper->mPropID,
                                     *startCSSValue, *endCSSValue,
                                     aUnitDistance, resultValue)) {
-    aResult.mU.mPtr = new ValueWrapper(endWrapper->mPropID, resultValue,
-                                       endWrapper->mPresContext);
+    aResult.mU.mPtr = new ValueWrapper(endWrapper->mPropID, resultValue);
     return NS_OK;
   }
   return NS_ERROR_FAILURE;
 }
 
 // Helper function to extract presContext
 static nsPresContext*
 GetPresContextForElement(Element* aElem)
@@ -394,17 +390,17 @@ nsSMILCSSValueType::ValueFromString(nsCS
     NS_WARNING("Not parsing animation value; unable to get PresContext");
     return;
   }
 
   nsStyleAnimation::Value parsedValue;
   if (ValueFromStringHelper(aPropID, aTargetElement, presContext,
                             aString, parsedValue, aIsContextSensitive)) {
     sSingleton.Init(aValue);
-    aValue.mU.mPtr = new ValueWrapper(aPropID, parsedValue, presContext);
+    aValue.mU.mPtr = new ValueWrapper(aPropID, parsedValue);
   }
 }
 
 // static
 bool
 nsSMILCSSValueType::ValueToString(const nsSMILValue& aValue,
                                   nsAString& aString)
 {