Backed out changeset 52a34f8e0dd5 due to PR_STATIC_ASSERT failure on ppc
authorDaniel Holbert <dholbert@cs.stanford.edu>
Thu, 25 Mar 2010 09:20:21 -0700
changeset 39831 d2a0a93f10b3055a121e54fef1d5054a37bfddfa
parent 39828 52a34f8e0dd5496cf0bb6d51131e6157c50cb411
child 39832 30d720fef693741a34a2497aafbb97571e7cb779
push idunknown
push userunknown
push dateunknown
milestone1.9.3a4pre
backs out52a34f8e0dd5496cf0bb6d51131e6157c50cb411
Backed out changeset 52a34f8e0dd5 due to PR_STATIC_ASSERT failure on ppc
content/smil/nsSMILCSSProperty.cpp
content/svg/content/src/nsSVGTransformSMILAttr.cpp
--- a/content/smil/nsSMILCSSProperty.cpp
+++ b/content/smil/nsSMILCSSProperty.cpp
@@ -91,37 +91,30 @@ nsSMILCSSProperty::nsSMILCSSProperty(nsC
   NS_ABORT_IF_FALSE(IsPropertyAnimatable(mPropID),
                     "Creating a nsSMILCSSProperty for a property "
                     "that's not supported for animation");
 }
 
 nsSMILValue
 nsSMILCSSProperty::GetBaseValue() const
 {
-  // To benefit from Return Value Optimization and avoid copy constructor calls
-  // due to our use of return-by-value, we must return the exact same object
-  // from ALL return points. This function must only return THIS variable:
-  nsSMILValue baseValue;
-
   // SPECIAL CASE: Shorthands
   if (nsCSSProps::IsShorthand(mPropID)) {
     // We can't look up the base (computed-style) value of shorthand
     // properties, because they aren't guaranteed to have a consistent computed
     // value.  However, that's not a problem, because it turns out the caller
     // isn't going to end up using the value we return anyway. Base values only
     // get used when there's interpolation or addition, and the shorthand
     // properties we know about don't support those operations. So, we can just
     // return a dummy value (initialized with the right type, so as not to
     // indicate failure).
-    nsSMILValue tmpVal(&nsSMILCSSValueType::sSingleton);
-    baseValue.Swap(tmpVal);
-    return baseValue;
+    return nsSMILValue(&nsSMILCSSValueType::sSingleton);
   }
 
-  // GENERAL CASE: Non-Shorthands
+  // GENERAL CASE: Non-Shorthands  
   // (1) Put empty string in override style for property mPropID
   // (saving old override style value, so we can set it again when we're done)
   nsCOMPtr<nsIDOMCSSStyleDeclaration> overrideStyle;
   mElement->GetSMILOverrideStyle(getter_AddRefs(overrideStyle));
   nsCOMPtr<nsICSSDeclaration> overrideDecl = do_QueryInterface(overrideStyle);
   nsAutoString cachedOverrideStyleVal;
   if (overrideDecl) {
     overrideDecl->GetPropertyValue(mPropID, cachedOverrideStyleVal);
@@ -136,17 +129,18 @@ nsSMILCSSProperty::GetBaseValue() const
   PRBool didGetComputedVal = GetCSSComputedValue(mElement, mPropID,
                                                  computedStyleVal);
 
   // (3) Put cached override style back (if it's non-empty)
   if (overrideDecl && !cachedOverrideStyleVal.IsEmpty()) {
     overrideDecl->SetPropertyValue(mPropID, cachedOverrideStyleVal);
   }
 
-  // (4) Populate our nsSMILValue from the computed style
+  // (4) Create a nsSMILValue from the computed style
+  nsSMILValue baseValue;
   if (didGetComputedVal) {
     nsSMILCSSValueType::ValueFromString(mPropID, mElement,
                                         computedStyleVal, baseValue);
   }
   return baseValue;
 }
 
 nsresult
--- a/content/svg/content/src/nsSVGTransformSMILAttr.cpp
+++ b/content/svg/content/src/nsSVGTransformSMILAttr.cpp
@@ -69,34 +69,30 @@ nsSVGTransformSMILAttr::ValueFromString(
   ParseValue(aStr, transformType, aValue);
   aCanCache = PR_TRUE;
   return aValue.IsNull() ? NS_ERROR_FAILURE : NS_OK;
 }
 
 nsSMILValue
 nsSVGTransformSMILAttr::GetBaseValue() const
 {
-  // To benefit from Return Value Optimization and avoid copy constructor calls
-  // due to our use of return-by-value, we must return the exact same object
-  // from ALL return points. This function must only return THIS variable:
   nsSMILValue val(&nsSVGTransformSMILType::sSingleton);
+  if (val.IsNull())
+    return val; // Initialization failed
 
   nsIDOMSVGTransformList *list = mVal->mBaseVal.get();
 
   PRUint32 numItems = 0;
   list->GetNumberOfItems(&numItems);
   for (PRUint32 i = 0; i < numItems; i++) {
     nsCOMPtr<nsIDOMSVGTransform> transform;
     nsresult rv = list->GetItem(i, getter_AddRefs(transform));
     if (NS_SUCCEEDED(rv) && transform) {
       rv = AppendSVGTransformToSMILValue(transform.get(), val);
-      if (NS_FAILED(rv)) {   // Appending to |val| failed (OOM?)
-        val = nsSMILValue();
-        break;
-      }
+      NS_ENSURE_SUCCESS(rv, nsSMILValue());
     }
   }
 
   return val;
 }
 
 void
 nsSVGTransformSMILAttr::ClearAnimValue()