if (!GetMultiple(&multiple) &&
GetMultiple(&multiple); if (!multiple &&
nsNativeSelectControlFrame::GetDesiredSize(nsIPresContext*          aPresContext,                                     const nsHTMLReflowState& aReflowState,                                     nsHTMLReflowMetrics&     aDesiredLayoutSize,                                     nsSize&                  aDesiredWidgetSize){  nsIDOMHTMLCollection* options = GetOptions();  if (!options)    return;  // get the css size   nsSize styleSize;  GetStyleSize(*aPresContext, aReflowState, styleSize);  // get the size of the longest option   PRInt32 maxWidth = 1;  PRUint32 numOptions;  options->GetLength(&numOptions);    for (PRInt32 i = 0; i < (PRInt32)numOptions; i++) {    nsIDOMHTMLOptionElement* option = GetOption(*options, i);    if (option) {      //option->CompressContent();       nsAutoString text;      if (NS_CONTENT_ATTR_HAS_VALUE != option->GetText(text)) {        continue;      }      nsSize textSize;      // use the style for the select rather that the option, since widgets don't support it      nsFormControlHelper::GetTextSize(*aPresContext, this, text, textSize, aReflowState.rendContext);       if (textSize.width > maxWidth) {        maxWidth = textSize.width;      }      NS_RELEASE(option);    }  }  PRInt32 rowHeight = 0;  nsSize desiredSize;  nsSize minSize;  PRBool widthExplicit, heightExplicit;  nsInputDimensionSpec textSpec(nsnull, PR_FALSE, nsnull, nsnull,                                maxWidth, PR_TRUE, nsHTMLAtoms::size, 1);  // XXX fix CalculateSize to return PRUint32  mNumRows =     (PRUint32)nsFormControlHelper::CalculateSize(aPresContext, aReflowState.rendContext, this, styleSize,                                                  textSpec, desiredSize, minSize, widthExplicit,                                                  heightExplicit, rowHeight);  // here it is determined whether we are a combo box  PRInt32 sizeAttr;  GetSizeFromContent(&sizeAttr);  PRBool multiple;  if (!GetMultiple(&multiple) &&       ((1 >= sizeAttr) || ((ATTR_NOTSET == sizeAttr) && (1 >= mNumRows)))) {    mIsComboBox = PR_TRUE;  }  float sp2t;  float p2t;  aPresContext->GetPixelsToTwips(&p2t);  aPresContext->GetScaledPixelsToTwips(&sp2t);  nscoord scrollbarWidth  = 0;  nscoord scrollbarHeight = 0;  float   scale;  nsCOMPtr<nsIDeviceContext> dx;  aPresContext->GetDeviceContext(getter_AddRefs(dx));  if (dx) {    float sbWidth;    float sbHeight;    dx->GetCanonicalPixelScale(scale);    dx->GetScrollBarDimensions(sbWidth, sbHeight);    scrollbarWidth  = PRInt32(sbWidth * scale);    scrollbarHeight = PRInt32(sbHeight * scale);  } else {    scrollbarWidth  = GetScrollbarWidth(sp2t);    scrollbarHeight = scrollbarWidth;  }  aDesiredLayoutSize.width = desiredSize.width;  PRBool needScrollbar;#ifdef XP_MAC  needScrollbar = PR_TRUE;  scrollbarWidth = (mIsComboBox)    ? NSIntPixelsToTwips(25, p2t*scale)    : (scrollbarWidth + NSIntPixelsToTwips(2, p2t*scale));#else  needScrollbar = ((mNumRows < (PRInt32)numOptions) || mIsComboBox);#endif  // account for vertical scrollbar, if present    if (!widthExplicit && needScrollbar) {    aDesiredLayoutSize.width += scrollbarWidth;  }  if (aDesiredLayoutSize.maxElementSize) {    aDesiredLayoutSize.maxElementSize->width = minSize.width;    if (!widthExplicit && needScrollbar) {      aDesiredLayoutSize.maxElementSize->width += scrollbarWidth;    }  }  // XXX put this in widget library, combo boxes are fixed height (visible part)  aDesiredLayoutSize.height = (mIsComboBox)    ? rowHeight + (2 * GetVerticalInsidePadding(p2t, rowHeight))    : desiredSize.height;   if (aDesiredLayoutSize.maxElementSize) {    aDesiredLayoutSize.maxElementSize->height = (mIsComboBox)      ? rowHeight + (2 * GetVerticalInsidePadding(p2t, rowHeight))      : minSize.height;   }  aDesiredLayoutSize.ascent = aDesiredLayoutSize.height;  aDesiredLayoutSize.descent = 0;  aDesiredWidgetSize.width  = aDesiredLayoutSize.width;  aDesiredWidgetSize.height = aDesiredLayoutSize.height;  if (mIsComboBox) {  // add in pull down size    PRInt32 extra = NSIntPixelsToTwips(10, p2t*scale);    aDesiredWidgetSize.height += (rowHeight * (numOptions > 20 ? 20 : numOptions)) + extra;  }  // override the width and height for a combo box that has already got a widget  if (mWidget && mIsComboBox) {    nscoord ignore;    GetWidgetSize(*aPresContext, ignore, aDesiredLayoutSize.height);    aDesiredLayoutSize.ascent = aDesiredLayoutSize.height;    if (aDesiredLayoutSize.maxElementSize) {      aDesiredLayoutSize.maxElementSize->height = aDesiredLayoutSize.height;    }  }  NS_RELEASE(options);}