if (*aOffset < 0.0f) *aOffset = 0.0f; if (*aOffset > 1.0f) *aOffset = 1.0f;
nsSVGGradientFrame::GetStopOffset(PRInt32 aIndex, float *aOffset){  PRInt32 stopCount = 0;  nsIDOMSVGStopElement *stopElement = nsnull;  for (nsIFrame* stopFrame = mFrames.FirstChild(); stopFrame;       stopFrame = stopFrame->GetNextSibling()) {    stopFrame->GetContent()->QueryInterface(NS_GET_IID(nsIDOMSVGStopElement),(void**)&stopElement);    if (stopElement) {      // Is this the one we're looking for?      if (stopCount == aIndex)        break; // Yes, break out of the loop      stopCount++;    }  }  if (stopCount == 0) {    // No stops?  check for URI target    if (checkURITarget())      return mNextGrad->GetStopOffset(aIndex, aOffset);  }  if (!stopElement) {    *aOffset = nsnull;    return NS_ERROR_FAILURE;  }  nsCOMPtr<nsIDOMSVGAnimatedNumber> aNum;  stopElement->GetOffset(getter_AddRefs(aNum));  aNum->GetBaseVal(aOffset);  return NS_OK;}