Bug 537890. Part 4: Make points be a fixed number of CSS pixels. r=dbaron

This commit is contained in:
Robert O'Callahan
2010-08-13 21:58:01 +12:00
parent 30246abb30
commit 6708ede88f
6 changed files with 87 additions and 44 deletions

View File

@@ -348,15 +348,15 @@ nsMathMLFrame::CalcLength(nsPresContext* aPresContext,
NS_ASSERTION(aCSSValue.IsLengthUnit(), "not a length unit");
if (aCSSValue.IsFixedLengthUnit()) {
return aPresContext->TwipsToAppUnits(aCSSValue.GetLengthTwips());
return aCSSValue.GetFixedLength(aPresContext);
}
if (aCSSValue.IsPixelLengthUnit()) {
return aCSSValue.GetPixelLength();
}
nsCSSUnit unit = aCSSValue.GetUnit();
if (eCSSUnit_Pixel == unit) {
return nsPresContext::CSSPixelsToAppUnits(aCSSValue.GetFloatValue());
}
else if (eCSSUnit_EM == unit) {
if (eCSSUnit_EM == unit) {
const nsStyleFont* font = aStyleContext->GetStyleFont();
return NSToCoordRound(aCSSValue.GetFloatValue() * (float)font->mFont.size);
}
@@ -368,6 +368,8 @@ nsMathMLFrame::CalcLength(nsPresContext* aPresContext,
return NSToCoordRound(aCSSValue.GetFloatValue() * (float)xHeight);
}
// MathML doesn't specify other CSS units such as rem or ch
NS_ERROR("Unsupported unit");
return 0;
}