mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 19:35:51 +00:00
Bug 119837 - add a parameter to nsITheme::GetMinimumWidgetSize to specify if CSS is allowed to override the min size. r=bzbarsky, sr=hyatt.
This commit is contained in:
parent
fe74df5263
commit
0aacd3c809
@ -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;
|
||||
|
@ -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:
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user