backing out 205001 as it broke Windows printing. r=dbaron

This commit is contained in:
pavlov%pavlov.net 2006-02-21 22:56:02 +00:00
Родитель fde31772e6
Коммит 8f5bd015a5
4 изменённых файлов: 15 добавлений и 20 удалений

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

@ -417,7 +417,7 @@ nsMathMLFrame::CalcLength(nsPresContext* aPresContext,
NS_ASSERTION(aCSSValue.IsLengthUnit(), "not a length unit"); NS_ASSERTION(aCSSValue.IsLengthUnit(), "not a length unit");
if (aCSSValue.IsFixedLengthUnit()) { if (aCSSValue.IsFixedLengthUnit()) {
return aCSSValue.GetLengthTwips(aPresContext); return aCSSValue.GetLengthTwips();
} }
nsCSSUnit unit = aCSSValue.GetUnit(); nsCSSUnit unit = aCSSValue.GetUnit();

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

@ -41,7 +41,6 @@
#include "imgIRequest.h" #include "imgIRequest.h"
#include "nsIDocument.h" #include "nsIDocument.h"
#include "nsContentUtils.h" #include "nsContentUtils.h"
#include "nsPresContext.h"
// Paint forcing // Paint forcing
#include "prenv.h" #include "prenv.h"
@ -208,39 +207,36 @@ imgIRequest* nsCSSValue::GetImageValue() const
return mValue.mImage->mRequest; return mValue.mImage->mRequest;
} }
nscoord nsCSSValue::GetLengthTwips(nsPresContext* aPresContext) const nscoord nsCSSValue::GetLengthTwips() const
{ {
NS_ASSERTION(IsFixedLengthUnit(), "not a fixed length unit"); NS_ASSERTION(IsFixedLengthUnit(), "not a fixed length unit");
NS_ASSERTION(aPresContext, "aPresContext is null");
float scale =
aPresContext->ScaledPixelsToTwips() / aPresContext->PixelsToTwips();
if (IsFixedLengthUnit()) { if (IsFixedLengthUnit()) {
switch (mUnit) { switch (mUnit) {
case eCSSUnit_Inch: case eCSSUnit_Inch:
return NS_INCHES_TO_TWIPS(mValue.mFloat * scale); return NS_INCHES_TO_TWIPS(mValue.mFloat);
case eCSSUnit_Foot: case eCSSUnit_Foot:
return NS_FEET_TO_TWIPS(mValue.mFloat * scale); return NS_FEET_TO_TWIPS(mValue.mFloat);
case eCSSUnit_Mile: case eCSSUnit_Mile:
return NS_MILES_TO_TWIPS(mValue.mFloat * scale); return NS_MILES_TO_TWIPS(mValue.mFloat);
case eCSSUnit_Millimeter: case eCSSUnit_Millimeter:
return NS_MILLIMETERS_TO_TWIPS(mValue.mFloat * scale); return NS_MILLIMETERS_TO_TWIPS(mValue.mFloat);
case eCSSUnit_Centimeter: case eCSSUnit_Centimeter:
return NS_CENTIMETERS_TO_TWIPS(mValue.mFloat * scale); return NS_CENTIMETERS_TO_TWIPS(mValue.mFloat);
case eCSSUnit_Meter: case eCSSUnit_Meter:
return NS_METERS_TO_TWIPS(mValue.mFloat * scale); return NS_METERS_TO_TWIPS(mValue.mFloat);
case eCSSUnit_Kilometer: case eCSSUnit_Kilometer:
return NS_KILOMETERS_TO_TWIPS(mValue.mFloat * scale); return NS_KILOMETERS_TO_TWIPS(mValue.mFloat);
case eCSSUnit_Point: case eCSSUnit_Point:
return NSFloatPointsToTwips(mValue.mFloat * scale); return NSFloatPointsToTwips(mValue.mFloat);
case eCSSUnit_Pica: case eCSSUnit_Pica:
return NS_PICAS_TO_TWIPS(mValue.mFloat * scale); return NS_PICAS_TO_TWIPS(mValue.mFloat);
case eCSSUnit_Didot: case eCSSUnit_Didot:
return NS_DIDOTS_TO_TWIPS(mValue.mFloat * scale); return NS_DIDOTS_TO_TWIPS(mValue.mFloat);
case eCSSUnit_Cicero: case eCSSUnit_Cicero:
return NS_CICEROS_TO_TWIPS(mValue.mFloat * scale); return NS_CICEROS_TO_TWIPS(mValue.mFloat);
default: default:
NS_ERROR("should never get here"); NS_ERROR("should never get here");
break; break;

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

@ -49,7 +49,6 @@
class imgIRequest; class imgIRequest;
class nsIDocument; class nsIDocument;
class nsPresContext;
enum nsCSSUnit { enum nsCSSUnit {
eCSSUnit_Null = 0, // (n/a) null unit, value is not specified eCSSUnit_Null = 0, // (n/a) null unit, value is not specified
@ -244,7 +243,7 @@ public:
// all over. // all over.
NS_HIDDEN_(imgIRequest*) GetImageValue() const; NS_HIDDEN_(imgIRequest*) GetImageValue() const;
NS_HIDDEN_(nscoord) GetLengthTwips(nsPresContext* aPresContext) const; NS_HIDDEN_(nscoord) GetLengthTwips() const;
NS_HIDDEN_(void) Reset() // sets to null NS_HIDDEN_(void) Reset() // sets to null
{ {

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

@ -196,7 +196,7 @@ nscoord CalcLength(const nsCSSValue& aValue,
{ {
NS_ASSERTION(aValue.IsLengthUnit(), "not a length unit"); NS_ASSERTION(aValue.IsLengthUnit(), "not a length unit");
if (aValue.IsFixedLengthUnit()) { if (aValue.IsFixedLengthUnit()) {
return aValue.GetLengthTwips(aPresContext); return aValue.GetLengthTwips();
} }
nsCSSUnit unit = aValue.GetUnit(); nsCSSUnit unit = aValue.GetUnit();
if (unit == eCSSUnit_Pixel) { if (unit == eCSSUnit_Pixel) {