nsSMILValue SVGAnimatedPointList::SMILAnimatedPointList::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; nsSMILValue tmp(&SVGPointListSMILType::sSingleton); SVGPointListAndInfo *list = static_cast<SVGPointListAndInfo*>(tmp.mU.mPtr); nsresult rv = list->CopyFrom(mVal->mBaseVal); if (NS_SUCCEEDED(rv)) { list->SetInfo(mElement); val.Swap(tmp); } return val; }
nsresult SVGAnimatedPointList:: SMILAnimatedPointList::ValueFromString(const nsAString& aStr, const dom::SVGAnimationElement* /*aSrcElement*/, nsSMILValue& aValue, bool& aPreventCachingOfSandwich) const { nsSMILValue val(&SVGPointListSMILType::sSingleton); SVGPointListAndInfo *list = static_cast<SVGPointListAndInfo*>(val.mU.mPtr); nsresult rv = list->SetValueFromString(aStr); if (NS_SUCCEEDED(rv)) { list->SetInfo(mElement); aValue.Swap(val); } aPreventCachingOfSandwich = false; return rv; }