When doing GetMinimumWidgetSize for HTML buttons, use the minimum size (TS_MIN) rather than the preferred size (TS_TRUE). b=375073 r+sr=roc a=blocking1.9+

This commit is contained in:
dbaron@dbaron.org 2007-11-15 10:11:03 -08:00
parent 579235bed6
commit 2c139cef8f

View File

@ -1539,7 +1539,7 @@ nsNativeThemeWin::GetMinimumWidgetSize(nsIRenderingContext* aContext, nsIFrame*
if (!hdc)
return NS_ERROR_FAILURE;
PRInt32 sizeReq = 1; // Best-fit size.
PRInt32 sizeReq = 1; // Best-fit size. (TS_TRUE)
if (aWidgetType == NS_THEME_PROGRESSBAR ||
aWidgetType == NS_THEME_PROGRESSBAR_VERTICAL)
sizeReq = 0; // Best-fit size for progress meters is too large for most
@ -1547,6 +1547,13 @@ nsNativeThemeWin::GetMinimumWidgetSize(nsIRenderingContext* aContext, nsIFrame*
// In our app, we want these widgets to be able to really shrink down,
// so use the min-size request value (of 0).
// We should let HTML buttons shrink to their min size.
// FIXME: We should probably really separate GetPreferredWidgetSize
// from GetMinimumWidgetSize, so callers can use the one they want.
if (aWidgetType == NS_THEME_BUTTON &&
aFrame->GetContent()->IsNodeOfType(nsINode::eHTML))
sizeReq = 0; /* TS_MIN */
SIZE sz;
getThemePartSize(theme, hdc, part, state, NULL, sizeReq, &sz);
aResult->width = sz.cx;