From 29d3f67dae1ba5efb1b6a6ee4496ae13166e6c55 Mon Sep 17 00:00:00 2001 From: "bryner%netscape.com" Date: Mon, 14 Jan 2002 05:40:37 +0000 Subject: [PATCH] Bug 119837 - add a parameter to nsITheme::GetMinimumWidgetSize to specify if CSS is allowed to override the min size. r=bzbarsky, sr=hyatt. git-svn-id: svn://10.0.0.236/trunk@112053 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/gfx/public/nsITheme.h | 3 ++- mozilla/gfx/src/gtk/nsNativeThemeGTK.cpp | 3 ++- mozilla/gfx/src/gtk/nsNativeThemeGTK.h | 3 ++- mozilla/gfx/src/windows/nsNativeThemeWin.cpp | 5 +++-- mozilla/gfx/src/windows/nsNativeThemeWin.h | 3 ++- mozilla/layout/xul/base/src/nsBox.cpp | 7 ++++--- 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/mozilla/gfx/public/nsITheme.h b/mozilla/gfx/public/nsITheme.h index 570e73ea3d3..be80d59ef78 100644 --- a/mozilla/gfx/public/nsITheme.h +++ b/mozilla/gfx/public/nsITheme.h @@ -62,7 +62,8 @@ public: NS_IMETHOD GetMinimumWidgetSize(nsIRenderingContext* aContext, nsIFrame* aFrame, PRUint8 aWidgetType, - nsSize* aResult)=0; + nsSize* aResult, + PRBool* aIsOverridable)=0; NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType, nsIAtom* aAttribute, PRBool* aShouldRepaint)=0; diff --git a/mozilla/gfx/src/gtk/nsNativeThemeGTK.cpp b/mozilla/gfx/src/gtk/nsNativeThemeGTK.cpp index c7ccebe0beb..fe055b57cab 100644 --- a/mozilla/gfx/src/gtk/nsNativeThemeGTK.cpp +++ b/mozilla/gfx/src/gtk/nsNativeThemeGTK.cpp @@ -333,9 +333,10 @@ nsNativeThemeGTK::GetWidgetBorder(nsIDeviceContext* aContext, NS_IMETHODIMP nsNativeThemeGTK::GetMinimumWidgetSize(nsIRenderingContext* aContext, nsIFrame* aFrame, PRUint8 aWidgetType, - nsSize* aResult) + nsSize* aResult, PRBool* aIsOverridable) { aResult->width = aResult->height = 0; + *aIsOverridable = PR_TRUE; switch (aWidgetType) { case NS_THEME_SCROLLBAR_BUTTON_UP: diff --git a/mozilla/gfx/src/gtk/nsNativeThemeGTK.h b/mozilla/gfx/src/gtk/nsNativeThemeGTK.h index 324313e4f83..ece202714b2 100644 --- a/mozilla/gfx/src/gtk/nsNativeThemeGTK.h +++ b/mozilla/gfx/src/gtk/nsNativeThemeGTK.h @@ -62,7 +62,8 @@ public: NS_IMETHOD GetMinimumWidgetSize(nsIRenderingContext* aContext, nsIFrame* aFrame, PRUint8 aWidgetType, - nsSize* aResult); + nsSize* aResult, + PRBool* aIsOverridable); NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType, nsIAtom* aAttribute, PRBool* aShouldRepaint); diff --git a/mozilla/gfx/src/windows/nsNativeThemeWin.cpp b/mozilla/gfx/src/windows/nsNativeThemeWin.cpp index bd0574f3151..93da4d49c85 100644 --- a/mozilla/gfx/src/windows/nsNativeThemeWin.cpp +++ b/mozilla/gfx/src/windows/nsNativeThemeWin.cpp @@ -783,12 +783,13 @@ nsNativeThemeWin::GetWidgetBorder(nsIDeviceContext* aContext, NS_IMETHODIMP nsNativeThemeWin::GetMinimumWidgetSize(nsIRenderingContext* aContext, nsIFrame* aFrame, PRUint8 aWidgetType, - nsSize* aResult) + nsSize* aResult, PRBool* aIsOverridable) { if (!getThemePartSize) return NS_ERROR_FAILURE; (*aResult).width = (*aResult).height = 0; + *aIsOverridable = PR_TRUE; if (aWidgetType == NS_THEME_TOOLBOX || aWidgetType == NS_THEME_TOOLBAR || aWidgetType == NS_THEME_STATUSBAR || aWidgetType == NS_THEME_PROGRESSBAR_CHUNK || @@ -964,4 +965,4 @@ NS_METHOD NS_NewNativeTheme(nsISupports *aOuter, REFNSIID aIID, void **aResult) if (!theme) return NS_ERROR_OUT_OF_MEMORY; return theme->QueryInterface(aIID, aResult); -} \ No newline at end of file +} diff --git a/mozilla/gfx/src/windows/nsNativeThemeWin.h b/mozilla/gfx/src/windows/nsNativeThemeWin.h index f1271d70e70..10c76173320 100644 --- a/mozilla/gfx/src/windows/nsNativeThemeWin.h +++ b/mozilla/gfx/src/windows/nsNativeThemeWin.h @@ -45,7 +45,8 @@ public: NS_IMETHOD GetMinimumWidgetSize(nsIRenderingContext* aContext, nsIFrame* aFrame, PRUint8 aWidgetType, - nsSize* aResult); + nsSize* aResult, + PRBool* aIsOverridable); NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType, nsIAtom* aAttribute, PRBool* aShouldRepaint); diff --git a/mozilla/layout/xul/base/src/nsBox.cpp b/mozilla/layout/xul/base/src/nsBox.cpp index 4bd53fea7f9..a12d0c56641 100644 --- a/mozilla/layout/xul/base/src/nsBox.cpp +++ b/mozilla/layout/xul/base/src/nsBox.cpp @@ -1275,6 +1275,7 @@ nsIBox::AddCSSMinSize(nsBoxLayoutState& aState, nsIBox* aBox, nsSize& aSize) PRBool widthSet = PR_FALSE; PRBool heightSet = PR_FALSE; + PRBool canOverride = PR_TRUE; nsIFrame* frame = nsnull; aBox->GetFrame(&frame); @@ -1291,7 +1292,7 @@ nsIBox::AddCSSMinSize(nsBoxLayoutState& aState, nsIBox* aBox, nsSize& aSize) const nsHTMLReflowState* reflowState = aState.GetReflowState(); if (reflowState) { theme->GetMinimumWidgetSize(reflowState->rendContext, frame, - display->mAppearance, &size); + display->mAppearance, &size, &canOverride); float p2t; aState.GetPresContext()->GetScaledPixelsToTwips(&p2t); aSize.width = NSIntPixelsToTwips(size.width, p2t); @@ -1313,7 +1314,7 @@ nsIBox::AddCSSMinSize(nsBoxLayoutState& aState, nsIBox* aBox, nsSize& aSize) // we will assume 0 means not set. if (position->mMinWidth.GetUnit() == eStyleUnit_Coord) { nscoord min = position->mMinWidth.GetCoordValue(); - if (min && (!widthSet || min > aSize.width)) { + if (min && (!widthSet || (min > aSize.width && canOverride))) { aSize.width = min; widthSet = PR_TRUE; } @@ -1321,7 +1322,7 @@ nsIBox::AddCSSMinSize(nsBoxLayoutState& aState, nsIBox* aBox, nsSize& aSize) if (position->mMinHeight.GetUnit() == eStyleUnit_Coord) { nscoord min = position->mMinHeight.GetCoordValue(); - if (min && (!heightSet || min > aSize.height)) { + if (min && (!heightSet || (min > aSize.height && canOverride))) { aSize.height = min; heightSet = PR_TRUE; }