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