This commit is contained in:
Daniel Holbert 2010-03-25 09:20:35 -07:00
commit 3d7797465b
2 changed files with 7 additions and 17 deletions

View File

@ -96,11 +96,6 @@ nsSMILCSSProperty::nsSMILCSSProperty(nsCSSProperty aPropID,
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
@ -111,12 +106,10 @@ nsSMILCSSProperty::GetBaseValue() const
// 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;
@ -141,7 +134,8 @@ nsSMILCSSProperty::GetBaseValue() const
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);

View File

@ -74,10 +74,9 @@ nsSVGTransformSMILAttr::ValueFromString(const nsAString& aStr,
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();
@ -88,10 +87,7 @@ nsSVGTransformSMILAttr::GetBaseValue() const
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());
}
}