зеркало из https://github.com/mozilla/pjs.git
Changed getVerticalInsidePading to take the PresContext to the method can use the cached LookAndFeel object
and it now uses the cached L&F obj
This commit is contained in:
Родитель
c68c7a7a65
Коммит
fc6b63e267
|
@ -50,8 +50,6 @@
|
|||
|
||||
static NS_DEFINE_IID(kIFormControlIID, NS_IFORMCONTROL_IID);
|
||||
static NS_DEFINE_IID(kIButtonIID, NS_IBUTTON_IID);
|
||||
static NS_DEFINE_IID(kLookAndFeelCID, NS_LOOKANDFEEL_CID);
|
||||
static NS_DEFINE_IID(kILookAndFeelIID, NS_ILOOKANDFEEL_IID);
|
||||
|
||||
void
|
||||
nsButtonControlFrame::GetDefaultLabel(nsString& aString)
|
||||
|
@ -136,14 +134,14 @@ nsButtonControlFrame::GetHorizontalBorderWidth(float aPixToTwip) const
|
|||
}
|
||||
|
||||
nscoord
|
||||
nsButtonControlFrame::GetVerticalInsidePadding(float aPixToTwip,
|
||||
nscoord aInnerHeight) const
|
||||
nsButtonControlFrame::GetVerticalInsidePadding(nsIPresContext& aPresContext,
|
||||
float aPixToTwip,
|
||||
nscoord aInnerHeight) const
|
||||
{
|
||||
float pad;
|
||||
nsILookAndFeel * lookAndFeel;
|
||||
if (NS_OK == nsComponentManager::CreateInstance(kLookAndFeelCID, nsnull, kILookAndFeelIID, (void**)&lookAndFeel)) {
|
||||
nsCOMPtr<nsILookAndFeel> lookAndFeel;
|
||||
if (NS_SUCCEEDED(aPresContext.GetLookAndFeel(getter_AddRefs(lookAndFeel)))) {
|
||||
lookAndFeel->GetMetric(nsILookAndFeel::eMetricFloat_ButtonVerticalInsidePadding, pad);
|
||||
NS_RELEASE(lookAndFeel);
|
||||
}
|
||||
return (nscoord)NSToIntRound((float)aInnerHeight * pad);
|
||||
}
|
||||
|
@ -160,12 +158,11 @@ nsButtonControlFrame::GetHorizontalInsidePadding(nsIPresContext& aPresContext,
|
|||
float pad;
|
||||
PRInt32 padQuirks;
|
||||
PRInt32 padQuirksOffset;
|
||||
nsILookAndFeel * lookAndFeel;
|
||||
if (NS_OK == nsComponentManager::CreateInstance(kLookAndFeelCID, nsnull, kILookAndFeelIID, (void**)&lookAndFeel)) {
|
||||
nsCOMPtr<nsILookAndFeel> lookAndFeel;
|
||||
if (NS_SUCCEEDED(aPresContext.GetLookAndFeel(getter_AddRefs(lookAndFeel)))) {
|
||||
lookAndFeel->GetMetric(nsILookAndFeel::eMetricFloat_ButtonHorizontalInsidePadding, pad);
|
||||
lookAndFeel->GetMetric(nsILookAndFeel::eMetric_ButtonHorizontalInsidePaddingNavQuirks, padQuirks);
|
||||
lookAndFeel->GetMetric(nsILookAndFeel::eMetric_ButtonHorizontalInsidePaddingOffsetNavQuirks, padQuirksOffset);
|
||||
NS_RELEASE(lookAndFeel);
|
||||
}
|
||||
if (eCompatibility_NavQuirks == mode) {
|
||||
return (nscoord)NSToIntRound(float(aInnerWidth) * pad);
|
||||
|
|
|
@ -45,7 +45,8 @@ public:
|
|||
|
||||
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,
|
||||
|
|
Загрузка…
Ссылка в новой задаче