Changed getVerticalInsidePading to take the PresContext to the method can use the cached LookAndFeel object
This commit is contained in:
@@ -449,8 +449,9 @@ nsFileControlFrame::GetFont(nsIPresContext* aPresContext,
|
||||
return NS_OK;
|
||||
}
|
||||
nscoord
|
||||
nsFileControlFrame::GetVerticalInsidePadding(float aPixToTwip,
|
||||
nscoord aInnerHeight) const
|
||||
nsFileControlFrame::GetVerticalInsidePadding(nsIPresContext& aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerHeight) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,8 @@ public:
|
||||
nsFont& aFont);
|
||||
|
||||
NS_IMETHOD GetFormContent(nsIContent*& aContent) const;
|
||||
virtual nscoord GetVerticalInsidePadding(float aPixToTwip,
|
||||
virtual nscoord GetVerticalInsidePadding(nsIPresContext& aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerHeight) const;
|
||||
virtual nscoord GetHorizontalInsidePadding(nsIPresContext& aPresContext,
|
||||
float aPixToTwip,
|
||||
|
||||
@@ -107,8 +107,9 @@ nsFormControlFrame::GetHorizontalBorderWidth(float aPixToTwip) const
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsFormControlFrame::GetVerticalInsidePadding(float aPixToTwip,
|
||||
nscoord aInnerHeight) const
|
||||
nsFormControlFrame::GetVerticalInsidePadding(nsIPresContext& aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerHeight) const
|
||||
{
|
||||
return NSIntPixelsToTwips(3, aPixToTwip);
|
||||
}
|
||||
@@ -119,7 +120,7 @@ nsFormControlFrame::GetHorizontalInsidePadding(nsIPresContext& aPresContext,
|
||||
nscoord aInnerWidth,
|
||||
nscoord aCharWidth) const
|
||||
{
|
||||
return GetVerticalInsidePadding(aPixToTwip, aInnerWidth);
|
||||
return GetVerticalInsidePadding(aPresContext, aPixToTwip, aInnerWidth);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
|
||||
@@ -152,7 +152,8 @@ public:
|
||||
static nscoord GetScrollbarWidth(float aPixToTwip);
|
||||
virtual nscoord GetVerticalBorderWidth(float aPixToTwip) const;
|
||||
virtual nscoord GetHorizontalBorderWidth(float aPixToTwip) const;
|
||||
virtual nscoord GetVerticalInsidePadding(float aPixToTwip,
|
||||
virtual nscoord GetVerticalInsidePadding(nsIPresContext& aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerHeight) const;
|
||||
virtual nscoord GetHorizontalInsidePadding(nsIPresContext& aPresContext,
|
||||
float aPixToTwip,
|
||||
|
||||
@@ -400,6 +400,7 @@ nsHTMLButtonControlFrame::Paint(nsIPresContext& aPresContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer)
|
||||
{
|
||||
printf("*********** nsHTMLButtonControlFrame::Paint\n");
|
||||
const nsStyleDisplay* disp = (const nsStyleDisplay*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
if (disp->mVisible)
|
||||
@@ -608,8 +609,9 @@ nsHTMLButtonControlFrame::GetFormContent(nsIContent*& aContent) const
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsHTMLButtonControlFrame::GetVerticalInsidePadding(float aPixToTwip,
|
||||
nscoord aInnerHeight) const
|
||||
nsHTMLButtonControlFrame::GetVerticalInsidePadding(nsIPresContext& aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerHeight) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -118,7 +118,8 @@ public:
|
||||
nsFont& aFont);
|
||||
|
||||
NS_IMETHOD GetFormContent(nsIContent*& aContent) const;
|
||||
virtual nscoord GetVerticalInsidePadding(float aPixToTwip,
|
||||
virtual nscoord GetVerticalInsidePadding(nsIPresContext& aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerHeight) const;
|
||||
virtual nscoord GetHorizontalInsidePadding(nsIPresContext& aPresContext,
|
||||
float aPixToTwip,
|
||||
|
||||
@@ -105,7 +105,8 @@ public:
|
||||
nsFont& aFont);
|
||||
|
||||
NS_IMETHOD GetFormContent(nsIContent*& aContent) const;
|
||||
virtual nscoord GetVerticalInsidePadding(float aPixToTwip,
|
||||
virtual nscoord GetVerticalInsidePadding(nsIPresContext& aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerHeight) const;
|
||||
virtual nscoord GetHorizontalInsidePadding(nsIPresContext& aPresContext,
|
||||
float aPixToTwip,
|
||||
@@ -436,8 +437,9 @@ nsImageControlFrame::GetFormContent(nsIContent*& aContent) const
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsImageControlFrame::GetVerticalInsidePadding(float aPixToTwip,
|
||||
nscoord aInnerHeight) const
|
||||
nsImageControlFrame::GetVerticalInsidePadding(nsIPresContext& aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerHeight) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -449,8 +449,9 @@ nsFileControlFrame::GetFont(nsIPresContext* aPresContext,
|
||||
return NS_OK;
|
||||
}
|
||||
nscoord
|
||||
nsFileControlFrame::GetVerticalInsidePadding(float aPixToTwip,
|
||||
nscoord aInnerHeight) const
|
||||
nsFileControlFrame::GetVerticalInsidePadding(nsIPresContext& aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerHeight) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -85,7 +85,8 @@ public:
|
||||
nsFont& aFont);
|
||||
|
||||
NS_IMETHOD GetFormContent(nsIContent*& aContent) const;
|
||||
virtual nscoord GetVerticalInsidePadding(float aPixToTwip,
|
||||
virtual nscoord GetVerticalInsidePadding(nsIPresContext& aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerHeight) const;
|
||||
virtual nscoord GetHorizontalInsidePadding(nsIPresContext& aPresContext,
|
||||
float aPixToTwip,
|
||||
|
||||
@@ -107,8 +107,9 @@ nsFormControlFrame::GetHorizontalBorderWidth(float aPixToTwip) const
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsFormControlFrame::GetVerticalInsidePadding(float aPixToTwip,
|
||||
nscoord aInnerHeight) const
|
||||
nsFormControlFrame::GetVerticalInsidePadding(nsIPresContext& aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerHeight) const
|
||||
{
|
||||
return NSIntPixelsToTwips(3, aPixToTwip);
|
||||
}
|
||||
@@ -119,7 +120,7 @@ nsFormControlFrame::GetHorizontalInsidePadding(nsIPresContext& aPresContext,
|
||||
nscoord aInnerWidth,
|
||||
nscoord aCharWidth) const
|
||||
{
|
||||
return GetVerticalInsidePadding(aPixToTwip, aInnerWidth);
|
||||
return GetVerticalInsidePadding(aPresContext, aPixToTwip, aInnerWidth);
|
||||
}
|
||||
|
||||
PRInt32
|
||||
|
||||
@@ -152,7 +152,8 @@ public:
|
||||
static nscoord GetScrollbarWidth(float aPixToTwip);
|
||||
virtual nscoord GetVerticalBorderWidth(float aPixToTwip) const;
|
||||
virtual nscoord GetHorizontalBorderWidth(float aPixToTwip) const;
|
||||
virtual nscoord GetVerticalInsidePadding(float aPixToTwip,
|
||||
virtual nscoord GetVerticalInsidePadding(nsIPresContext& aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerHeight) const;
|
||||
virtual nscoord GetHorizontalInsidePadding(nsIPresContext& aPresContext,
|
||||
float aPixToTwip,
|
||||
|
||||
@@ -400,6 +400,7 @@ nsHTMLButtonControlFrame::Paint(nsIPresContext& aPresContext,
|
||||
const nsRect& aDirtyRect,
|
||||
nsFramePaintLayer aWhichLayer)
|
||||
{
|
||||
printf("*********** nsHTMLButtonControlFrame::Paint\n");
|
||||
const nsStyleDisplay* disp = (const nsStyleDisplay*)
|
||||
mStyleContext->GetStyleData(eStyleStruct_Display);
|
||||
if (disp->mVisible)
|
||||
@@ -608,8 +609,9 @@ nsHTMLButtonControlFrame::GetFormContent(nsIContent*& aContent) const
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsHTMLButtonControlFrame::GetVerticalInsidePadding(float aPixToTwip,
|
||||
nscoord aInnerHeight) const
|
||||
nsHTMLButtonControlFrame::GetVerticalInsidePadding(nsIPresContext& aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerHeight) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -118,7 +118,8 @@ public:
|
||||
nsFont& aFont);
|
||||
|
||||
NS_IMETHOD GetFormContent(nsIContent*& aContent) const;
|
||||
virtual nscoord GetVerticalInsidePadding(float aPixToTwip,
|
||||
virtual nscoord GetVerticalInsidePadding(nsIPresContext& aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerHeight) const;
|
||||
virtual nscoord GetHorizontalInsidePadding(nsIPresContext& aPresContext,
|
||||
float aPixToTwip,
|
||||
|
||||
@@ -105,7 +105,8 @@ public:
|
||||
nsFont& aFont);
|
||||
|
||||
NS_IMETHOD GetFormContent(nsIContent*& aContent) const;
|
||||
virtual nscoord GetVerticalInsidePadding(float aPixToTwip,
|
||||
virtual nscoord GetVerticalInsidePadding(nsIPresContext& aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerHeight) const;
|
||||
virtual nscoord GetHorizontalInsidePadding(nsIPresContext& aPresContext,
|
||||
float aPixToTwip,
|
||||
@@ -436,8 +437,9 @@ nsImageControlFrame::GetFormContent(nsIContent*& aContent) const
|
||||
}
|
||||
|
||||
nscoord
|
||||
nsImageControlFrame::GetVerticalInsidePadding(float aPixToTwip,
|
||||
nscoord aInnerHeight) const
|
||||
nsImageControlFrame::GetVerticalInsidePadding(nsIPresContext& aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerHeight) const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -26,13 +26,12 @@
|
||||
#include "nsILookAndFeel.h"
|
||||
#include "nsWidgetsCID.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
|
||||
#define NS_DEFAULT_CHECKBOX_SIZE 12
|
||||
|
||||
static NS_DEFINE_IID(kICheckButtonIID, NS_ICHECKBUTTON_IID);
|
||||
static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
|
||||
static NS_DEFINE_IID(kILookAndFeelIID, NS_ILOOKANDFEEL_IID);
|
||||
|
||||
|
||||
nsresult
|
||||
@@ -52,13 +51,12 @@ NS_NewNativeCheckboxControlFrame(nsIFrame** aNewFrame)
|
||||
|
||||
|
||||
nscoord
|
||||
nsNativeCheckboxControlFrame::GetCheckboxSize(float aPixToTwip) const
|
||||
nsNativeCheckboxControlFrame::GetCheckboxSize(nsIPresContext* aPresContext, float aPixToTwip) const
|
||||
{
|
||||
nsILookAndFeel * lookAndFeel;
|
||||
PRInt32 checkboxSize = 0;
|
||||
if (NS_OK == nsComponentManager::CreateInstance(kLookAndFeelCID, nsnull, kILookAndFeelIID, (void**)&lookAndFeel)) {
|
||||
nsCOMPtr<nsILookAndFeel> lookAndFeel;
|
||||
if (NS_SUCCEEDED(aPresContext->GetLookAndFeel(getter_AddRefs(lookAndFeel)))) {
|
||||
lookAndFeel->GetMetric(nsILookAndFeel::eMetric_CheckboxSize, checkboxSize);
|
||||
NS_RELEASE(lookAndFeel);
|
||||
}
|
||||
if (checkboxSize == 0)
|
||||
checkboxSize = NS_DEFAULT_CHECKBOX_SIZE;
|
||||
@@ -74,7 +72,7 @@ nsNativeCheckboxControlFrame::GetDesiredSize(nsIPresContext* aPresConte
|
||||
float p2t;
|
||||
aPresContext->GetScaledPixelsToTwips(&p2t);
|
||||
|
||||
aDesiredWidgetSize.width = GetCheckboxSize(p2t);
|
||||
aDesiredWidgetSize.width = GetCheckboxSize(aPresContext, p2t);
|
||||
aDesiredWidgetSize.height = aDesiredWidgetSize.width;
|
||||
aDesiredLayoutSize.width = aDesiredWidgetSize.width;
|
||||
aDesiredLayoutSize.height = aDesiredWidgetSize.height;
|
||||
|
||||
@@ -39,7 +39,7 @@ protected:
|
||||
virtual CheckState GetCheckboxState();
|
||||
virtual void SetCheckboxState(CheckState aValue);
|
||||
|
||||
virtual nscoord GetCheckboxSize(float aPixToTwip) const;
|
||||
virtual nscoord GetCheckboxSize(nsIPresContext* aPresContext, float aPixToTwip) const;
|
||||
virtual void GetDesiredSize(nsIPresContext* aPresContext,
|
||||
const nsHTMLReflowState& aReflowState,
|
||||
nsHTMLReflowMetrics& aDesiredLayoutSize,
|
||||
|
||||
Reference in New Issue
Block a user