PRInt32 index;   if (aStartIndex == 0 && aForward) { index = mElements.IndexOf(aOption); if (index == -1) { return NS_ERROR_FAILURE; }  *aIndex = index; return NS_OK; }  PRInt32 high = mElements.Count(); PRInt32 step = aForward ? 1 : -1;  for (index = aStartIndex; index < high && index > -1; index += step) { if (mElements[index] == aOption) { *aIndex = index; return NS_OK; } }  return NS_ERROR_FAILURE;
return mOptions->GetOptionIndex(aOption, aStartIndex, aForward, aIndex);
nsHTMLOptionCollection::GetOptionIndex(nsIDOMHTMLOptionElement* aOption,                                       PRInt32 aStartIndex,                                       PRBool aForward,                                       PRInt32* aIndex){  PRInt32 index;  // Make the common case fast  if (aStartIndex == 0 && aForward) {    index = mElements.IndexOf(aOption);    if (index == -1) {      return NS_ERROR_FAILURE;    }        *aIndex = index;    return NS_OK;  }  PRInt32 high = mElements.Count();  PRInt32 step = aForward ? 1 : -1;  for (index = aStartIndex; index < high && index > -1; index += step) {    if (mElements[index] == aOption) {      *aIndex = index;      return NS_OK;    }  }  return NS_ERROR_FAILURE;}