options->Item(i, &node); if (node) { nsresult result = node->QueryInterface(kIDOMHTMLOptionElementIID, (void**)&option); if ((NS_OK == result) && option) { nsString text;  if (NS_CONTENT_ATTR_HAS_VALUE != option->GetText(text)) { text = " "; } listWidget->AddItemAt(text, i); NS_RELEASE(option); } NS_RELEASE(node); }
nsString text(" "); GetOptionText(options,i,text); listWidget->AddItemAt(text,i);
nsNativeSelectControlFrame::PostCreateWidget(nsIPresContext* aPresContext,                                       nscoord& aWidth,                                       nscoord& aHeight){  if (!mWidget) {    return;  }  nsIListWidget* listWidget;  if (NS_OK != mWidget->QueryInterface(kListWidgetIID, (void **) &listWidget)) {    NS_ASSERTION(PR_FALSE, "invalid widget");    return;  }  mWidget->Enable(!nsFormFrame::GetDisabled(this));  nsFont font(aPresContext->GetDefaultFixedFontDeprecated());   GetFont(aPresContext, font);  mWidget->SetFont(font);  SetColors(*aPresContext);  // add the options   if (!mOptionsAdded) {    nsIDOMHTMLCollection* options = GetOptions();    if (options) {      PRUint32 numOptions;      options->GetLength(&numOptions);      nsIDOMNode* node;      nsIDOMHTMLOptionElement* option;      // Initialize the locally cached numOptions and optionSelected array.      // The values of the optionsSelected array are filled in by Reset()      mNumOptions = numOptions;      if ((numOptions > 0) && (mOptionSelected == nsnull)) {        mOptionSelected = new PRBool[numOptions];      }      for (PRUint32 i = 0; i < numOptions; i++) {        options->Item(i, &node);        if (node) {          nsresult result = node->QueryInterface(kIDOMHTMLOptionElementIID, (void**)&option);          if ((NS_OK == result) && option) {            nsString text;            // XXX need to compress whitespace            if (NS_CONTENT_ATTR_HAS_VALUE != option->GetText(text)) {                text = " ";            }            listWidget->AddItemAt(text, i);            NS_RELEASE(option);          }          NS_RELEASE(node);        }      }      NS_RELEASE(options);    }    mOptionsAdded = PR_TRUE;  }  NS_RELEASE(listWidget);  // get the size of the combo box and let Reflow change its desired size   // XXX this technique should be considered for other widgets as well  if (mIsComboBox) {      nscoord ignore;    nscoord height;    GetWidgetSize(*aPresContext, ignore, height);    if (height > aHeight) {      aHeight = height;    }  }  Reset();  // initializes selections }