From 2c139cef8fe5a5eb398f6351bf021b4656e87a1c Mon Sep 17 00:00:00 2001 From: "dbaron@dbaron.org" Date: Thu, 15 Nov 2007 10:11:03 -0800 Subject: [PATCH] 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+ --- widget/src/windows/nsNativeThemeWin.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/widget/src/windows/nsNativeThemeWin.cpp b/widget/src/windows/nsNativeThemeWin.cpp index 8ad6598fe5a..3b8edbf79b5 100644 --- a/widget/src/windows/nsNativeThemeWin.cpp +++ b/widget/src/windows/nsNativeThemeWin.cpp @@ -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;