return (aFont->mFont.size / 2); case eCSSUnit_XHeight:  return ((aFont->mFont.size / 3) * 2); case eCSSUnit_CapHeight:
return NSToCoordRound((aValue.GetFloatValue() * (float)aFont->mFont.size) / 2.0f); case eCSSUnit_XHeight: { nsIFontMetrics* fm = aPresContext->GetMetricsFor(aFont->mFont); NS_ASSERTION(nsnull != fm, "can't get font metrics"); nscoord xHeight; if (nsnull != fm) { fm->GetXHeight(xHeight); NS_RELEASE(fm); } else { xHeight = ((aFont->mFont.size / 3) * 2); } return NSToCoordRound(aValue.GetFloatValue() * (float)xHeight); } case eCSSUnit_CapHeight: {
nscoord CalcLength(const nsCSSValue& aValue,                   const nsStyleFont* aFont,                    nsIPresContext* aPresContext){  NS_ASSERTION(aValue.IsLengthUnit(), "not a length unit");  if (aValue.IsFixedLengthUnit()) {    return aValue.GetLengthTwips();  }  nsCSSUnit unit = aValue.GetUnit();  switch (unit) {    case eCSSUnit_EM:      return aFont->mFont.size;    case eCSSUnit_EN:      return (aFont->mFont.size / 2);    case eCSSUnit_XHeight://      NS_NOTYETIMPLEMENTED("x height unit");      return ((aFont->mFont.size / 3) * 2); // XXX HACK!    case eCSSUnit_CapHeight:      NS_NOTYETIMPLEMENTED("cap height unit");      return ((aFont->mFont.size / 3) * 2); // XXX HACK!    case eCSSUnit_Pixel:      return NSFloatPixelsToTwips(aValue.GetFloatValue(), aPresContext->GetPixelsToTwips());  }  return 0;}