Remove some unreachable stub code for en (half an em) and cap (cap-height metric of font) units that we never create. (Bug 458878) r+sr=bzbarsky a=blocking1.9.1+
authorL. David Baron <dbaron@dbaron.org>
Thu, 04 Dec 2008 08:09:53 -0800
changeset 22338 5da43688eee4b90ea0cd00b48249915d030e39a1
parent 22337 fb1b3f68b09d2ee2bc6911f4b9231a1bfcaf4ecc
child 22339 f8b47378d8eab5e01424c8ad0f5465ef77c6ec5d
push idunknown
push userunknown
push dateunknown
reviewersblocking1.9.1
bugs458878
milestone1.9.2a1pre
Remove some unreachable stub code for en (half an em) and cap (cap-height metric of font) units that we never create. (Bug 458878) r+sr=bzbarsky a=blocking1.9.1+
layout/style/nsCSSDeclaration.cpp
layout/style/nsCSSValue.h
layout/style/nsRuleNode.cpp
--- a/layout/style/nsCSSDeclaration.cpp
+++ b/layout/style/nsCSSDeclaration.cpp
@@ -484,19 +484,17 @@ nsCSSDeclaration::AppendCSSValueToString
     case eCSSUnit_Meter:        aResult.AppendLiteral("m");    break;
     case eCSSUnit_Kilometer:    aResult.AppendLiteral("km");   break;
     case eCSSUnit_Point:        aResult.AppendLiteral("pt");   break;
     case eCSSUnit_Pica:         aResult.AppendLiteral("pc");   break;
     case eCSSUnit_Didot:        aResult.AppendLiteral("dt");   break;
     case eCSSUnit_Cicero:       aResult.AppendLiteral("cc");   break;
 
     case eCSSUnit_EM:           aResult.AppendLiteral("em");   break;
-    case eCSSUnit_EN:           aResult.AppendLiteral("en");   break;
     case eCSSUnit_XHeight:      aResult.AppendLiteral("ex");   break;
-    case eCSSUnit_CapHeight:    aResult.AppendLiteral("cap");  break;
     case eCSSUnit_Char:         aResult.AppendLiteral("ch");   break;
 
     case eCSSUnit_Pixel:        aResult.AppendLiteral("px");   break;
 
     case eCSSUnit_Degree:       aResult.AppendLiteral("deg");  break;
     case eCSSUnit_Grad:         aResult.AppendLiteral("grad"); break;
     case eCSSUnit_Radian:       aResult.AppendLiteral("rad");  break;
 
--- a/layout/style/nsCSSValue.h
+++ b/layout/style/nsCSSValue.h
@@ -134,20 +134,18 @@ enum nsCSSUnit {
 
   // European Typographic
   eCSSUnit_Didot        = 400,    // (float) 15 didots == 16 points
   eCSSUnit_Cicero       = 401,    // (float) 12 didots
 
   // Length units - relative
   // Font relative measure
   eCSSUnit_EM           = 800,    // (float) == current font size
-  eCSSUnit_EN           = 801,    // (float) .5 em
-  eCSSUnit_XHeight      = 802,    // (float) distance from top of lower case x to baseline
-  eCSSUnit_CapHeight    = 803,    // (float) distance from top of uppercase case H to baseline
-  eCSSUnit_Char         = 804,    // (float) number of characters, used for width with monospace font
+  eCSSUnit_XHeight      = 801,    // (float) distance from top of lower case x to baseline
+  eCSSUnit_Char         = 802,    // (float) number of characters, used for width with monospace font
 
   // Screen relative measure
   eCSSUnit_Pixel        = 900,    // (float) CSS pixel unit
 
   // Angular units
   eCSSUnit_Degree       = 1000,    // (float) 360 per circle
   eCSSUnit_Grad         = 1001,    // (float) 400 per circle
   eCSSUnit_Radian       = 1002,    // (float) 2*pi per circle
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -193,32 +193,24 @@ static nscoord CalcLengthWith(const nsCS
     // prefs into account?
     aFontSize = aStyleFont->mFont.size;
   }
   switch (unit) {
     case eCSSUnit_EM: {
       return NSToCoordRoundWithClamp(aValue.GetFloatValue() * float(aFontSize));
       // XXX scale against font metrics height instead?
     }
-    case eCSSUnit_EN: {
-      return NSToCoordRoundWithClamp((aValue.GetFloatValue() * float(aFontSize)) / 2.0f);
-    }
     case eCSSUnit_XHeight: {
       nsFont font = aStyleFont->mFont;
       font.size = aFontSize;
       nsCOMPtr<nsIFontMetrics> fm = aPresContext->GetMetricsFor(font);
       nscoord xHeight;
       fm->GetXHeight(xHeight);
       return NSToCoordRoundWithClamp(aValue.GetFloatValue() * float(xHeight));
     }
-    case eCSSUnit_CapHeight: {
-      NS_NOTYETIMPLEMENTED("cap height unit");
-      nscoord capHeight = ((aFontSize / 3) * 2); // XXX HACK!
-      return NSToCoordRoundWithClamp(aValue.GetFloatValue() * float(capHeight));
-    }
     case eCSSUnit_Char: {
       nsFont font = aStyleFont->mFont;
       font.size = aFontSize;
       nsCOMPtr<nsIFontMetrics> fm = aPresContext->GetMetricsFor(font);
       nsCOMPtr<nsIThebesFontMetrics> tfm(do_QueryInterface(fm));
       gfxFloat zeroWidth = (tfm->GetThebesFontGroup()->GetFontAt(0)
                             ->GetMetrics().zeroOrAveCharWidth);