Remove internal support for units that were never in CSS (feet, miles, meters, kilometers, didots, ciceros). (Bug 482146) r+sr=bzbarsky
authorL. David Baron <dbaron@dbaron.org>
Mon, 09 Mar 2009 16:14:34 -0700
changeset 25951 f036b54d0403
parent 25950 2f3c15f5b0c8
child 25952 e9b0ca8dd58d
push id5809
push userdbaron@mozilla.com
push dateMon, 09 Mar 2009 23:15:01 +0000
treeherdermozilla-central@b5d5992fcc4e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs482146
milestone1.9.2a1pre
Remove internal support for units that were never in CSS (feet, miles, meters, kilometers, didots, ciceros). (Bug 482146) r+sr=bzbarsky
gfx/public/nsCoord.h
layout/style/nsCSSDeclaration.cpp
layout/style/nsCSSValue.cpp
layout/style/nsCSSValue.h
--- a/gfx/public/nsCoord.h
+++ b/gfx/public/nsCoord.h
@@ -411,36 +411,24 @@ inline float NSTwipsToUnits(nscoord aTwi
   return (aTwips * (aUnitsPerPoint / TWIPS_PER_POINT_FLOAT));
 }
 
 
 /// Unit conversion macros
 //@{
 #define NS_POINTS_TO_TWIPS(x)         NSUnitsToTwips((x), 1.0f)
 #define NS_INCHES_TO_TWIPS(x)         NSUnitsToTwips((x), POINTS_PER_INCH_FLOAT)                      // 72 points per inch
-#define NS_FEET_TO_TWIPS(x)           NSUnitsToTwips((x), (POINTS_PER_INCH_FLOAT * 12.0f))            // 12 inches per foot
-#define NS_MILES_TO_TWIPS(x)          NSUnitsToTwips((x), (POINTS_PER_INCH_FLOAT * 12.0f * 5280.0f))  // 5280 feet per mile
 
 #define NS_MILLIMETERS_TO_TWIPS(x)    NSUnitsToTwips((x), (POINTS_PER_INCH_FLOAT * 0.03937f))
 #define NS_CENTIMETERS_TO_TWIPS(x)    NSUnitsToTwips((x), (POINTS_PER_INCH_FLOAT * 0.3937f))
-#define NS_METERS_TO_TWIPS(x)         NSUnitsToTwips((x), (POINTS_PER_INCH_FLOAT * 39.37f))
-#define NS_KILOMETERS_TO_TWIPS(x)     NSUnitsToTwips((x), (POINTS_PER_INCH_FLOAT * 39370.0f))
 
 #define NS_PICAS_TO_TWIPS(x)          NSUnitsToTwips((x), 12.0f)                      // 12 points per pica
-#define NS_DIDOTS_TO_TWIPS(x)         NSUnitsToTwips((x), (16.0f / 15.0f))            // 15 didots per 16 points
-#define NS_CICEROS_TO_TWIPS(x)        NSUnitsToTwips((x), (12.0f * (16.0f / 15.0f)))  // 12 didots per cicero
 
 #define NS_TWIPS_TO_POINTS(x)         NSTwipsToUnits((x), 1.0f)
 #define NS_TWIPS_TO_INCHES(x)         NSTwipsToUnits((x), 1.0f / POINTS_PER_INCH_FLOAT)
-#define NS_TWIPS_TO_FEET(x)           NSTwipsToUnits((x), 1.0f / (POINTS_PER_INCH_FLOAT * 12.0f))
-#define NS_TWIPS_TO_MILES(x)          NSTwipsToUnits((x), 1.0f / (POINTS_PER_INCH_FLOAT * 12.0f * 5280.0f))
 
 #define NS_TWIPS_TO_MILLIMETERS(x)    NSTwipsToUnits((x), 1.0f / (POINTS_PER_INCH_FLOAT * 0.03937f))
 #define NS_TWIPS_TO_CENTIMETERS(x)    NSTwipsToUnits((x), 1.0f / (POINTS_PER_INCH_FLOAT * 0.3937f))
-#define NS_TWIPS_TO_METERS(x)         NSTwipsToUnits((x), 1.0f / (POINTS_PER_INCH_FLOAT * 39.37f))
-#define NS_TWIPS_TO_KILOMETERS(x)     NSTwipsToUnits((x), 1.0f / (POINTS_PER_INCH_FLOAT * 39370.0f))
 
 #define NS_TWIPS_TO_PICAS(x)          NSTwipsToUnits((x), 1.0f / 12.0f)
-#define NS_TWIPS_TO_DIDOTS(x)         NSTwipsToUnits((x), 1.0f / (16.0f / 15.0f))
-#define NS_TWIPS_TO_CICEROS(x)        NSTwipsToUnits((x), 1.0f / (12.0f * (16.0f / 15.0f)))
 //@}
 
 #endif /* NSCOORD_H */
--- a/layout/style/nsCSSDeclaration.cpp
+++ b/layout/style/nsCSSDeclaration.cpp
@@ -438,26 +438,20 @@ nsCSSDeclaration::AppendCSSValueToString
     case eCSSUnit_Integer:      break;
     case eCSSUnit_Enumerated:   break;
     case eCSSUnit_EnumColor:    break;
     case eCSSUnit_Color:        break;
     case eCSSUnit_Percent:      aResult.Append(PRUnichar('%'));    break;
     case eCSSUnit_Number:       break;
 
     case eCSSUnit_Inch:         aResult.AppendLiteral("in");   break;
-    case eCSSUnit_Foot:         aResult.AppendLiteral("ft");   break;
-    case eCSSUnit_Mile:         aResult.AppendLiteral("mi");   break;
     case eCSSUnit_Millimeter:   aResult.AppendLiteral("mm");   break;
     case eCSSUnit_Centimeter:   aResult.AppendLiteral("cm");   break;
-    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_XHeight:      aResult.AppendLiteral("ex");   break;
     case eCSSUnit_Char:         aResult.AppendLiteral("ch");   break;
     case eCSSUnit_RootEM:       aResult.AppendLiteral("rem");  break;
 
     case eCSSUnit_Pixel:        aResult.AppendLiteral("px");   break;
 
--- a/layout/style/nsCSSValue.cpp
+++ b/layout/style/nsCSSValue.cpp
@@ -210,38 +210,26 @@ imgIRequest* nsCSSValue::GetImageValue()
 nscoord nsCSSValue::GetLengthTwips() const
 {
   NS_ASSERTION(IsFixedLengthUnit(), "not a fixed length unit");
 
   if (IsFixedLengthUnit()) {
     switch (mUnit) {
     case eCSSUnit_Inch:        
       return NS_INCHES_TO_TWIPS(mValue.mFloat);
-    case eCSSUnit_Foot:        
-      return NS_FEET_TO_TWIPS(mValue.mFloat);
-    case eCSSUnit_Mile:        
-      return NS_MILES_TO_TWIPS(mValue.mFloat);
 
     case eCSSUnit_Millimeter:
       return NS_MILLIMETERS_TO_TWIPS(mValue.mFloat);
     case eCSSUnit_Centimeter:
       return NS_CENTIMETERS_TO_TWIPS(mValue.mFloat);
-    case eCSSUnit_Meter:
-      return NS_METERS_TO_TWIPS(mValue.mFloat);
-    case eCSSUnit_Kilometer:
-      return NS_KILOMETERS_TO_TWIPS(mValue.mFloat);
 
     case eCSSUnit_Point:
       return NS_POINTS_TO_TWIPS(mValue.mFloat);
     case eCSSUnit_Pica:
       return NS_PICAS_TO_TWIPS(mValue.mFloat);
-    case eCSSUnit_Didot:
-      return NS_DIDOTS_TO_TWIPS(mValue.mFloat);
-    case eCSSUnit_Cicero:
-      return NS_CICEROS_TO_TWIPS(mValue.mFloat);
     default:
       NS_ERROR("should never get here");
       break;
     }
   }
   return 0;
 }
 
--- a/layout/style/nsCSSValue.h
+++ b/layout/style/nsCSSValue.h
@@ -117,33 +117,25 @@ enum nsCSSUnit {
   eCSSUnit_EnumColor    = 80,     // (int) enumerated color (kColorKTable)
   eCSSUnit_Color        = 81,     // (nscolor) an RGBA value
   eCSSUnit_Percent      = 90,     // (float) 1.0 == 100%) value is percentage of something
   eCSSUnit_Number       = 91,     // (float) value is numeric (usually multiplier, different behavior that percent)
 
   // Length units - fixed
   // US English
   eCSSUnit_Inch         = 100,    // (float) 0.0254 meters
-  eCSSUnit_Foot         = 101,    // (float) 12 inches
-  eCSSUnit_Mile         = 102,    // (float) 5280 feet
 
   // Metric
   eCSSUnit_Millimeter   = 207,    // (float) 1/1000 meter
   eCSSUnit_Centimeter   = 208,    // (float) 1/100 meter
-  eCSSUnit_Meter        = 210,    // (float) Standard length
-  eCSSUnit_Kilometer    = 213,    // (float) 1000 meters
 
   // US Typographic
   eCSSUnit_Point        = 300,    // (float) 1/72 inch
   eCSSUnit_Pica         = 301,    // (float) 12 points == 1/6 inch
 
-  // 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_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
   eCSSUnit_RootEM       = 803,    // (float) == root element font size
 
   // Screen relative measure
@@ -198,17 +190,17 @@ public:
   {
     return !(*this == aOther);
   }
 
   nsCSSUnit GetUnit() const { return mUnit; }
   PRBool    IsLengthUnit() const
     { return eCSSUnit_Inch <= mUnit && mUnit <= eCSSUnit_Pixel; }
   PRBool    IsFixedLengthUnit() const  
-    { return eCSSUnit_Inch <= mUnit && mUnit <= eCSSUnit_Cicero; }
+    { return eCSSUnit_Inch <= mUnit && mUnit <= eCSSUnit_Pica; }
   PRBool    IsRelativeLengthUnit() const  
     { return eCSSUnit_EM <= mUnit && mUnit <= eCSSUnit_Pixel; }
   PRBool    IsAngularUnit() const  
     { return eCSSUnit_Degree <= mUnit && mUnit <= eCSSUnit_Radian; }
   PRBool    IsFrequencyUnit() const  
     { return eCSSUnit_Hertz <= mUnit && mUnit <= eCSSUnit_Kilohertz; }
   PRBool    IsTimeUnit() const  
     { return eCSSUnit_Seconds <= mUnit && mUnit <= eCSSUnit_Milliseconds; }