Remove internal support for units that were never in CSS (feet, miles, meters, kilometers, didots, ciceros). (Bug 482146) r+sr=bzbarsky

This commit is contained in:
L. David Baron 2009-03-09 16:14:34 -07:00
parent d8a2ce67e9
commit d2e251ca18
4 changed files with 1 additions and 39 deletions

View File

@ -416,31 +416,19 @@ inline float NSTwipsToUnits(nscoord aTwips, float aUnitsPerPoint)
//@{
#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 */

View File

@ -443,16 +443,10 @@ nsCSSDeclaration::AppendCSSValueToString(nsCSSProperty aProperty,
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;

View File

@ -215,28 +215,16 @@ nscoord nsCSSValue::GetLengthTwips() const
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;

View File

@ -122,23 +122,15 @@ enum nsCSSUnit {
// 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
@ -203,7 +195,7 @@ public:
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