Bug 266236 part 6: Change out-parameters to return values and remove a bunch of default parameters that were never called with non-default values.

This commit is contained in:
Zack Weinberg
2011-04-07 18:04:40 -07:00
parent 5b09836f9f
commit fc6685866d
13 changed files with 157 additions and 329 deletions

View File

@@ -289,27 +289,12 @@ nsMathMLFrame::GetRuleThickness(nsRenderingContext& aRenderingContext,
nscoord xHeight;
aFontMetrics->GetXHeight(xHeight);
PRUnichar overBar = 0x00AF;
nsBoundingMetrics bm;
nsresult rv = aRenderingContext.GetBoundingMetrics(&overBar, PRUint32(1), bm);
if (NS_SUCCEEDED(rv)) {
aRuleThickness = bm.ascent + bm.descent;
}
if (NS_FAILED(rv) || aRuleThickness <= 0 || aRuleThickness >= xHeight) {
nsBoundingMetrics bm = aRenderingContext.GetBoundingMetrics(&overBar, 1);
aRuleThickness = bm.ascent + bm.descent;
if (aRuleThickness <= 0 || aRuleThickness >= xHeight) {
// fall-back to the other version
GetRuleThickness(aFontMetrics, aRuleThickness);
}
#if 0
nscoord oldRuleThickness;
GetRuleThickness(aFontMetrics, oldRuleThickness);
PRUnichar sqrt = 0xE063; // a sqrt glyph from TeX's CMEX font
rv = aRenderingContext.GetBoundingMetrics(&sqrt, PRUint32(1), bm);
nscoord sqrtrule = bm.ascent; // according to TeX, the ascent should be the rule
printf("xheight:%4d rule:%4d oldrule:%4d sqrtrule:%4d\n",
xHeight, aRuleThickness, oldRuleThickness, sqrtrule);
#endif
}
/* static */ void
@@ -327,12 +312,9 @@ nsMathMLFrame::GetAxisHeight(nsRenderingContext& aRenderingContext,
nscoord xHeight;
aFontMetrics->GetXHeight(xHeight);
PRUnichar minus = 0x2212; // not '-', but official Unicode minus sign
nsBoundingMetrics bm;
nsresult rv = aRenderingContext.GetBoundingMetrics(&minus, PRUint32(1), bm);
if (NS_SUCCEEDED(rv)) {
aAxisHeight = bm.ascent - (bm.ascent + bm.descent)/2;
}
if (NS_FAILED(rv) || aAxisHeight <= 0 || aAxisHeight >= xHeight) {
nsBoundingMetrics bm = aRenderingContext.GetBoundingMetrics(&minus, 1);
aAxisHeight = bm.ascent - (bm.ascent + bm.descent)/2;
if (aAxisHeight <= 0 || aAxisHeight >= xHeight) {
// fall-back to the other version
GetAxisHeight(aFontMetrics, aAxisHeight);
}