nsresult SVGNumberListSMILType::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 SVGNumberListAndInfo* src = static_cast<const SVGNumberListAndInfo*>(aSrc.mU.mPtr); SVGNumberListAndInfo* dest = static_cast<SVGNumberListAndInfo*>(aDest.mU.mPtr); return dest->CopyFrom(*src); }
nsSMILValue SVGAnimatedNumberList::SMILAnimatedNumberList::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(&SVGNumberListSMILType::sSingleton); SVGNumberListAndInfo *nlai = static_cast<SVGNumberListAndInfo*>(tmp.mU.mPtr); nsresult rv = nlai->CopyFrom(mVal->mBaseVal); if (NS_SUCCEEDED(rv)) { nlai->SetInfo(mElement); Swap(val, tmp); } return val; }
nsresult SVGAnimatedNumberList:: SMILAnimatedNumberList::ValueFromString(const nsAString& aStr, const dom::SVGAnimationElement* /*aSrcElement*/, nsSMILValue& aValue, bool& aPreventCachingOfSandwich) const { nsSMILValue val(&SVGNumberListSMILType::sSingleton); SVGNumberListAndInfo *nlai = static_cast<SVGNumberListAndInfo*>(val.mU.mPtr); nsresult rv = nlai->SetValueFromString(aStr); if (NS_SUCCEEDED(rv)) { nlai->SetInfo(mElement); aValue = std::move(val); } aPreventCachingOfSandwich = false; return rv; }