nsresult SVGPointListSMILType::Assign(nsSMILValue& aDest, const nsSMILValue& aSrc) const { NS_PRECONDITION(aDest.mType == aSrc.mType, "Incompatible SMIL types"); NS_PRECONDITION(aDest.mType == this, "Unexpected SMIL value"); const SVGPointListAndInfo* src = static_cast<const SVGPointListAndInfo*>(aSrc.mU.mPtr); SVGPointListAndInfo* dest = static_cast<SVGPointListAndInfo*>(aDest.mU.mPtr); return dest->CopyFrom(*src); }
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; }