Switch lots of callers to using nsLayoutUtils::GetFontMetricsForFrame and nsLayoutUtils::GetFontMetricsForStyleContext. (Bug 678671, patch 1) r=roc

This changes a number of callers that were previously bypassing the use
of the correct language (with either no language or the charset-detected
language on the pres context via nsPresContext::GetMetricsFor) and/or
the correct user font set to pass the correct values, which should
improve the correctness of the behavior of whatever they were using the
fonts for, and also reduce the number of unique sets of font metrics
requested (which helps nsFontCache effectiveness).
This commit is contained in:
L. David Baron
2011-08-14 10:08:04 -07:00
parent d3e1227b3d
commit 174de8408b
18 changed files with 54 additions and 66 deletions

View File

@@ -328,8 +328,9 @@ nsMathMLFrame::CalcLength(nsPresContext* aPresContext,
return NSToCoordRound(aCSSValue.GetFloatValue() * (float)font->mFont.size);
}
else if (eCSSUnit_XHeight == unit) {
const nsStyleFont* font = aStyleContext->GetStyleFont();
nsRefPtr<nsFontMetrics> fm = aPresContext->GetMetricsFor(font->mFont);
nsRefPtr<nsFontMetrics> fm;
nsLayoutUtils::GetFontMetricsForStyleContext(aStyleContext,
getter_AddRefs(fm));
nscoord xHeight = fm->XHeight();
return NSToCoordRound(aCSSValue.GetFloatValue() * (float)xHeight);
}