Bug 537890. Part 4.5: Create 'mozmm' unit for physical millimeters on screen devices. r=dbaron

This commit is contained in:
Robert O'Callahan 2010-08-13 21:58:02 +12:00
Родитель fd75e64333
Коммит 46ae2ef8d0
3 изменённых файлов: 9 добавлений и 2 удалений

Просмотреть файл

@ -4118,7 +4118,7 @@ CSSParserImpl::ParseEnum(nsCSSValue& aValue,
struct UnitInfo {
char name[5]; // needs to be long enough for the longest unit, with
char name[6]; // needs to be long enough for the longest unit, with
// terminating null.
PRUint32 length;
nsCSSUnit unit;
@ -4138,6 +4138,7 @@ const UnitInfo UnitData[] = {
{ STR_WITH_LEN("ch"), eCSSUnit_Char, VARIANT_LENGTH },
{ STR_WITH_LEN("rem"), eCSSUnit_RootEM, VARIANT_LENGTH },
{ STR_WITH_LEN("mm"), eCSSUnit_Millimeter, VARIANT_LENGTH },
{ STR_WITH_LEN("mozmm"), eCSSUnit_PhysicalMillimeter, VARIANT_LENGTH },
{ STR_WITH_LEN("pc"), eCSSUnit_Pica, VARIANT_LENGTH },
{ STR_WITH_LEN("deg"), eCSSUnit_Degree, VARIANT_ANGLE },
{ STR_WITH_LEN("grad"), eCSSUnit_Grad, VARIANT_ANGLE },

Просмотреть файл

@ -246,6 +246,10 @@ nscoord nsCSSValue::GetFixedLength(nsPresContext* aPresContext) const
twips = NS_MILLIMETERS_TO_TWIPS(mValue.mFloat);
break;
case eCSSUnit_PhysicalMillimeter:
twips = NS_MILLIMETERS_TO_TWIPS(mValue.mFloat);
break;
case eCSSUnit_Centimeter:
twips = NS_CENTIMETERS_TO_TWIPS(mValue.mFloat);
break;
@ -892,6 +896,7 @@ nsCSSValue::AppendToString(nsCSSProperty aProperty, nsAString& aResult) const
case eCSSUnit_Inch: aResult.AppendLiteral("in"); break;
case eCSSUnit_Millimeter: aResult.AppendLiteral("mm"); break;
case eCSSUnit_PhysicalMillimeter: aResult.AppendLiteral("mozmm"); break;
case eCSSUnit_Centimeter: aResult.AppendLiteral("cm"); break;
case eCSSUnit_Point: aResult.AppendLiteral("pt"); break;
case eCSSUnit_Pica: aResult.AppendLiteral("pc"); break;

Просмотреть файл

@ -153,7 +153,8 @@ enum nsCSSUnit {
// Metric
eCSSUnit_Millimeter = 207, // (float) 1/1000 meter
eCSSUnit_Centimeter = 208, // (float) 1/100 meter
eCSSUnit_PhysicalMillimeter = 208, // (float) 1/1000 meter
eCSSUnit_Centimeter = 209, // (float) 1/100 meter
// US Typographic
eCSSUnit_Pica = 301, // (float) 12 points == 1/6 inch