Add inflation parameter to nsLayoutUtils::GetFontMetricsFor* methods. (Bug 627842, patch 6) r=roc

This commit is contained in:
L. David Baron 2011-11-15 17:02:00 +13:00
parent 2ae2d74942
commit aa9ba3f977
2 changed files with 15 additions and 7 deletions

View File

@ -1928,22 +1928,26 @@ nsLayoutUtils::GetTextShadowRectsUnion(const nsRect& aTextAndDecorationsRect,
nsresult
nsLayoutUtils::GetFontMetricsForFrame(const nsIFrame* aFrame,
nsFontMetrics** aFontMetrics)
nsFontMetrics** aFontMetrics,
float aInflation)
{
return nsLayoutUtils::GetFontMetricsForStyleContext(aFrame->GetStyleContext(),
aFontMetrics);
aFontMetrics,
aInflation);
}
nsresult
nsLayoutUtils::GetFontMetricsForStyleContext(nsStyleContext* aStyleContext,
nsFontMetrics** aFontMetrics)
nsFontMetrics** aFontMetrics,
float aInflation)
{
// pass the user font set object into the device context to pass along to CreateFontGroup
gfxUserFontSet* fs = aStyleContext->PresContext()->GetUserFontSet();
nsFont font = aStyleContext->GetStyleFont()->mFont;
font.size = NSToCoordRound(font.size * aInflation);
return aStyleContext->PresContext()->DeviceContext()->GetMetricsFor(
aStyleContext->GetStyleFont()->mFont,
aStyleContext->GetStyleVisibility()->mLanguage,
font, aStyleContext->GetStyleVisibility()->mLanguage,
fs, *aFontMetrics);
}

View File

@ -742,19 +742,23 @@ public:
* Get the font metrics corresponding to the frame's style data.
* @param aFrame the frame
* @param aFontMetrics the font metrics result
* @param aSizeInflation number to multiply font size by
* @return success or failure code
*/
static nsresult GetFontMetricsForFrame(const nsIFrame* aFrame,
nsFontMetrics** aFontMetrics);
nsFontMetrics** aFontMetrics,
float aSizeInflation = 1.0f);
/**
* Get the font metrics corresponding to the given style data.
* @param aStyleContext the style data
* @param aFontMetrics the font metrics result
* @param aSizeInflation number to multiply font size by
* @return success or failure code
*/
static nsresult GetFontMetricsForStyleContext(nsStyleContext* aStyleContext,
nsFontMetrics** aFontMetrics);
nsFontMetrics** aFontMetrics,
float aSizeInflation = 1.0f);
/**
* Find the immediate child of aParent whose frame subtree contains