for (int i = 0; i < numChildren; i++) { nsOption* option = (nsOption*) select->ChildAt(i); nsString text; if (PR_TRUE != option->GetContent(text)) { text = " ";
int optionX = -1; for (int childX = 0; childX < numChildren; childX++) { nsIContent* child = select->ChildAt(childX); nsOption* option; nsresult result = child->QueryInterface(kOptionIID, (void**)&option); if (NS_OK == result) { optionX++; nsString text; if (PR_TRUE != option->GetContent(text)) { text = " "; } list->AddItemAt(text, optionX); NS_RELEASE(option);
nsSelectFrame::PostCreateWidget(nsIPresContext* aPresContext, nsIView *aView){  nsSelect* select;  GetContent((nsIContent *&)select);  nsIView* view;  GetView(view);  nsIListWidget* list;  nsresult stat = view->QueryInterface(kListWidgetIID, (void **) &list);  if (NS_OK != stat) {    NS_ASSERTION((NS_OK == stat), "invalid widget");    return;  }  list->SetBackgroundColor(NS_RGB(0xFF, 0xFF, 0xFF));  const nsStyleFont* styleFont = (const nsStyleFont*)mStyleContext->GetStyleData(eStyleStruct_Font);  if ((styleFont->mFlags & NS_STYLE_FONT_FACE_EXPLICIT) ||       (styleFont->mFlags & NS_STYLE_FONT_SIZE_EXPLICIT)) {    nsFont  widgetFont(styleFont->mFixedFont);    widgetFont.weight = NS_FONT_WEIGHT_NORMAL;  // always normal weight    widgetFont.size = styleFont->mFont.size;    // normal font size    if (0 == (styleFont->mFlags & NS_STYLE_FONT_FACE_EXPLICIT)) {      widgetFont.name = "Arial";  // XXX windows specific font    }    list->SetFont(widgetFont);  }  else {    // use arial, scaled down one HTML size    // italics, decoration & variant(?) get used    nsFont  widgetFont(styleFont->mFont);    widgetFont.name = "Arial";  // XXX windows specific font    widgetFont.weight = NS_FONT_WEIGHT_NORMAL;     const nsFont& normal = aPresContext->GetDefaultFont();    PRInt32 scaler = aPresContext->GetFontScaler();    float scaleFactor = nsStyleUtil::GetScalingFactor(scaler);    PRInt32 fontIndex = nsStyleUtil::FindNextSmallerFontSize(widgetFont.size, (PRInt32)normal.size, scaleFactor);    widgetFont.size = nsStyleUtil::CalcFontPointSize(fontIndex, (PRInt32)normal.size, scaleFactor);    list->SetFont(widgetFont);  }  PRInt32 numChildren = select->ChildCount();  for (int i = 0; i < numChildren; i++) {    nsOption* option = (nsOption*) select->ChildAt(i);  // YYY this had better be an option    nsString text;    if (PR_TRUE != option->GetContent(text)) {      text = " ";    }    list->AddItemAt(text, i);    NS_RELEASE(option); // YYY remove comment if ok  }  NS_RELEASE(view);  select->Reset();  // initializes selections }