PRInt32 aLevel)
PRInt32 aDepth)
nsHTMLSelectElement::InsertOptionsIntoListRecurse(nsIContent* aOptions,                                                  PRInt32* aInsertIndex,                                                  PRInt32 aLevel){  // We *assume* here that someone's brain has not gone horribly  // wrong by putting <option> inside of <option>.  I'm sorry, I'm  // just not going to look for an option inside of an option.  // Sue me.  nsCOMPtr<nsIDOMHTMLOptionElement> optElement(do_QueryInterface(aOptions));  if (optElement) {    nsCOMPtr<nsIDOMNode> optNode(do_QueryInterface(optElement));    mOptions->InsertElementAt(optNode, *aInsertIndex);    (*aInsertIndex)++;    return NS_OK;  }  // If it's at the top level, then we just found out there are non-options  // at the top level, which will throw off the insert count  if (aLevel == 0) {    mArtifactsAtTopLevel++;  }  nsCOMPtr<nsIAtom> tag;  aOptions->GetTag(*getter_AddRefs(tag));  if (tag == nsHTMLAtoms::optgroup) {    mOptGroupCount++;    DispatchDOMEvent(NS_LITERAL_STRING("selectHasGroups"));  }  // Recurse down into optgroups  //  // I *would* put a restriction in here to only search under  // optgroups (and not, for example, <P></P>), but it really  // doesn't *hurt* to search under other stuff and it's more  // efficient in the normal only-optgroup-and-option case  // (one less QueryInterface).  PRInt32 numChildren;  aOptions->ChildCount(numChildren);  nsCOMPtr<nsIContent> child;  for (PRInt32 i=0;i<numChildren;i++) {    aOptions->ChildAt(i,*getter_AddRefs(child));    InsertOptionsIntoListRecurse(child, aInsertIndex, aLevel+1);  }  return NS_OK;}