Bug 105708 - "move nsUnitConversion.h" [p=reg@openpave.org (Jeremy Lea) r+sr+a1.9=roc]
authorreed@reedloden.com
Tue, 01 Jan 2008 02:11:02 -0800
changeset 9753 643466f3038ade81aad7670a578c4d24b370dd07
parent 9752 2055aa5dd78399d8f36efcdc4a7acf186b952a07
child 9754 3a0a4cb54bf831b116354a3a9d06498999e7f6d4
push idunknown
push userunknown
push dateunknown
bugs105708
milestone1.9b3pre
Bug 105708 - "move nsUnitConversion.h" [p=reg@openpave.org (Jeremy Lea) r+sr+a1.9=roc]
embedding/browser/activex/src/control/StdAfx.h
embedding/browser/photon/src/nsPrintSettingsImpl.cpp
embedding/components/printingui/src/win/nsPrintDialogUtil.cpp
gfx/public/nsCoord.h
gfx/public/nsRect.h
gfx/public/nsTransform2D.h
gfx/src/beos/nsDeviceContextBeOS.h
gfx/src/beos/nsFontMetricsBeOS.h
gfx/src/beos/nsRenderingContextBeOS.h
gfx/src/mac/nsDeviceContextMac.h
gfx/src/mac/nsFontMetricsMac.h
gfx/src/nsColor.cpp
gfx/src/nsRect.cpp
gfx/src/nsRegressionTestFontMetrics.h
gfx/src/photon/nsDeviceContextPh.h
gfx/src/photon/nsFontMetricsPh.h
gfx/src/photon/nsRenderingContextPh.h
gfx/src/thebes/nsSystemFontsBeOS.cpp
gfx/src/thebes/nsSystemFontsOS2.cpp
gfx/src/windows/nsFontMetricsWin.h
gfx/src/windows/nsRenderingContextWin.h
layout/generic/nsSpacerFrame.cpp
layout/mathml/base/src/nsMathMLChar.cpp
layout/mathml/base/src/nsMathMLContainerFrame.cpp
layout/mathml/base/src/nsMathMLForeignFrameWrapper.cpp
layout/mathml/base/src/nsMathMLTokenFrame.cpp
layout/mathml/base/src/nsMathMLmactionFrame.cpp
layout/mathml/base/src/nsMathMLmfencedFrame.cpp
layout/mathml/base/src/nsMathMLmfracFrame.cpp
layout/mathml/base/src/nsMathMLmmultiscriptsFrame.cpp
layout/mathml/base/src/nsMathMLmoFrame.cpp
layout/mathml/base/src/nsMathMLmoverFrame.cpp
layout/mathml/base/src/nsMathMLmpaddedFrame.cpp
layout/mathml/base/src/nsMathMLmphantomFrame.cpp
layout/mathml/base/src/nsMathMLmrootFrame.cpp
layout/mathml/base/src/nsMathMLmrowFrame.cpp
layout/mathml/base/src/nsMathMLmspaceFrame.cpp
layout/mathml/base/src/nsMathMLmsqrtFrame.cpp
layout/mathml/base/src/nsMathMLmstyleFrame.cpp
layout/mathml/base/src/nsMathMLmsubFrame.cpp
layout/mathml/base/src/nsMathMLmsubsupFrame.cpp
layout/mathml/base/src/nsMathMLmsupFrame.cpp
layout/mathml/base/src/nsMathMLmtableFrame.cpp
layout/mathml/base/src/nsMathMLmunderFrame.cpp
layout/mathml/base/src/nsMathMLmunderoverFrame.cpp
layout/style/nsCSSDeclaration.cpp
layout/style/nsCSSParser.cpp
layout/style/nsCSSStruct.cpp
layout/style/nsCSSStyleRule.cpp
layout/style/nsCSSValue.h
layout/style/nsROCSSPrimitiveValue.h
layout/style/nsStyleContext.cpp
layout/style/nsStyleStruct.cpp
layout/style/nsStyleUtil.cpp
layout/xul/base/src/nsBoxFrame.cpp
layout/xul/base/src/nsDeckFrame.cpp
layout/xul/base/src/nsScrollbarButtonFrame.cpp
layout/xul/base/src/nsSliderFrame.cpp
layout/xul/base/src/nsStackFrame.cpp
view/src/nsScrollPortView.cpp
view/src/nsViewManager.cpp
widget/src/beos/nsDragService.cpp
widget/src/cocoa/nsScreenCocoa.mm
widget/src/gtk2/nsDeviceContextSpecG.cpp
widget/src/windows/nsDeviceContextSpecWin.cpp
widget/src/xpwidgets/nsPrintOptionsImpl.cpp
widget/src/xpwidgets/nsPrintSettingsImpl.cpp
xpcom/ds/Makefile.in
xpcom/ds/nsUnitConversion.h
--- a/embedding/browser/activex/src/control/StdAfx.h
+++ b/embedding/browser/activex/src/control/StdAfx.h
@@ -95,17 +95,16 @@
 #include "nsIPrompt.h"
 #include "nsIEditor.h"
 #include "nsIEditingSession.h"
 #include "nsICommandManager.h"
 
 #include "nsIDocument.h"
 #include "nsIDocumentObserver.h"
 #include "nsIStreamListener.h"
-#include "nsUnitConversion.h"
 #include "nsVoidArray.h"
 
 #include "nsIDocumentViewer.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMDocumentType.h"
 #include "nsIDOMElement.h"
--- a/embedding/browser/photon/src/nsPrintSettingsImpl.cpp
+++ b/embedding/browser/photon/src/nsPrintSettingsImpl.cpp
@@ -32,17 +32,16 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsPrintSettingsImpl.h"
 #include "nsCoord.h"
-#include "nsUnitConversion.h"
 #include "nsReadableUtils.h"
 
 // For Prefs
 #include "nsIPref.h"
 #include "nsIServiceManager.h"
 
 NS_IMPL_ISUPPORTS1(nsPrintSettings, nsIPrintSettings)
 
--- a/embedding/components/printingui/src/win/nsPrintDialogUtil.cpp
+++ b/embedding/components/printingui/src/win/nsPrintDialogUtil.cpp
@@ -69,17 +69,16 @@ WIN_LIBS=                               
 
 #include "nsIWebBrowserPrint.h"
 #include "nsString.h"
 #include "nsIServiceManager.h"
 #include "nsReadableUtils.h"
 #include "nsIWidget.h"
 #include "nsIPrintSettings.h"
 #include "nsIPrintSettingsWin.h"
-#include "nsUnitConversion.h"
 #include "nsIPrintOptions.h"
 #include "nsWidgetsCID.h"
 static NS_DEFINE_IID(kPrinterEnumeratorCID, NS_PRINTER_ENUMERATOR_CID);
 
 #include "nsRect.h"
 
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
--- a/gfx/public/nsCoord.h
+++ b/gfx/public/nsCoord.h
@@ -33,31 +33,30 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef NSCOORD_H
 #define NSCOORD_H
 
+#include "nscore.h"
+#include "nsMathUtils.h"
 #include <math.h>
+#include <float.h>
 
 #include "nsDebug.h"
 
 /*
  * Basic type used for the geometry classes.
  *
- * Normally all coordinates are maintained in the twips coordinate
- * space. A twip is 1/20th of a point, and there are 72 points per
- * inch. However, nscoords do appear in pixel space and other
- * coordinate spaces.
- *
- * Twips are used because they are a device-independent unit of measure. See
- * header file nsUnitConversion.h for many useful macros to convert between
- * different units of measure.
+ * Normally all coordinates are maintained in an app unit coordinate
+ * space. An app unit is 1/60th of a CSS device pixel, which is, in turn
+ * an integer number of device pixels, such at the CSS DPI is as close to
+ * 96dpi as possible.
  */
 
 // This controls whether we're using integers or floats for coordinates. We
 // want to eventually use floats. If you change this, you need to manually
 // change the definition of nscoord in gfx/idl/gfxtypes.idl.
 //#define NS_COORD_IS_FLOAT
 
 inline float NS_IEEEPositiveInfinity() {
@@ -250,9 +249,141 @@ inline PRInt32 NSCoordToInt(nscoord aCoo
 inline float NSCoordToFloat(nscoord aCoord) {
   VERIFY_COORD(aCoord);
 #ifdef NS_COORD_IS_FLOAT
   NS_ASSERTION(!NS_IEEEIsNan(aCoord), "NaN encountered in float conversion");
 #endif
   return (float)aCoord;
 }
 
+/*
+ * Coord Rounding Functions
+ */
+inline nscoord NSToCoordFloor(float aValue)
+{
+  return nscoord(NS_floorf(aValue));
+}
+
+inline nscoord NSToCoordCeil(float aValue)
+{
+  return nscoord(NS_ceilf(aValue));
+}
+
+inline nscoord NSToCoordRound(float aValue)
+{
+  return nscoord(NS_floorf(aValue + 0.5f));
+}
+
+/*
+ * Int Rounding Functions
+ */
+inline PRInt32 NSToIntFloor(float aValue)
+{
+  return PRInt32(NS_floorf(aValue));
+}
+
+inline PRInt32 NSToIntCeil(float aValue)
+{
+  return PRInt32(NS_ceilf(aValue));
+}
+
+inline PRInt32 NSToIntRound(float aValue)
+{
+  return NS_lroundf(aValue);
+}
+
+/* 
+ * App Unit/Pixel conversions
+ */
+inline nscoord NSFloatPixelsToAppUnits(float aPixels, PRInt32 aAppUnitsPerPixel)
+{
+  float product = aPixels * aAppUnitsPerPixel;
+  nscoord result;
+
+#ifdef NS_COORD_IS_FLOAT
+  // No need to bounds-check if converting float to float
+  result = NSToCoordRound(product);
+#else
+  // Bounds-check before converting out of float, to avoid overflow
+  if (product >= nscoord_MAX) {
+    NS_WARNING("Overflowed nscoord_MAX in conversion to nscoord");
+    result = nscoord_MAX;
+  } else if (product <= nscoord_MIN) {
+    NS_WARNING("Overflowed nscoord_MIN in conversion to nscoord");
+    result = nscoord_MIN;
+  } else {
+    result = NSToCoordRound(product);
+  }
+#endif
+
+  VERIFY_COORD(result);
+  return result;
+}
+
+inline nscoord NSIntPixelsToAppUnits(PRInt32 aPixels, PRInt32 aAppUnitsPerPixel)
+{
+  // The cast to nscoord makes sure we don't overflow if we ever change
+  // nscoord to float
+  nscoord r = aPixels * (nscoord)aAppUnitsPerPixel;
+  VERIFY_COORD(r);
+  return r;
+}
+
+inline float NSAppUnitsToFloatPixels(nscoord aAppUnits, PRInt32 aAppUnitsPerPixel)
+{
+  return (float(aAppUnits) / aAppUnitsPerPixel);
+}
+
+inline PRInt32 NSAppUnitsToIntPixels(nscoord aAppUnits, PRInt32 aAppUnitsPerPixel)
+{
+  return NSToIntRound(float(aAppUnits) / aAppUnitsPerPixel);
+}
+
+/// handy constants
+#define TWIPS_PER_POINT_INT           20
+#define TWIPS_PER_POINT_FLOAT         20.0f
+
+/* 
+ * Twips/unit conversions
+ */
+inline nscoord NSUnitsToTwips(float aValue, float aPointsPerUnit)
+{
+  return NSToCoordRound(aValue * aPointsPerUnit * TWIPS_PER_POINT_FLOAT);
+}
+
+inline float NSTwipsToUnits(nscoord aTwips, float aUnitsPerPoint)
+{
+  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), 72.0f)                      // 72 points per inch
+#define NS_FEET_TO_TWIPS(x)           NSUnitsToTwips((x), (72.0f * 12.0f))            // 12 inches per foot
+#define NS_MILES_TO_TWIPS(x)          NSUnitsToTwips((x), (72.0f * 12.0f * 5280.0f))  // 5280 feet per mile
+
+#define NS_MILLIMETERS_TO_TWIPS(x)    NSUnitsToTwips((x), (72.0f * 0.03937f))
+#define NS_CENTIMETERS_TO_TWIPS(x)    NSUnitsToTwips((x), (72.0f * 0.3937f))
+#define NS_METERS_TO_TWIPS(x)         NSUnitsToTwips((x), (72.0f * 39.37f))
+#define NS_KILOMETERS_TO_TWIPS(x)     NSUnitsToTwips((x), (72.0f * 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 / 72.0f)
+#define NS_TWIPS_TO_FEET(x)           NSTwipsToUnits((x), 1.0f / (72.0f * 12.0f))
+#define NS_TWIPS_TO_MILES(x)          NSTwipsToUnits((x), 1.0f / (72.0f * 12.0f * 5280.0f))
+
+#define NS_TWIPS_TO_MILLIMETERS(x)    NSTwipsToUnits((x), 1.0f / (72.0f * 0.03937f))
+#define NS_TWIPS_TO_CENTIMETERS(x)    NSTwipsToUnits((x), 1.0f / (72.0f * 0.3937f))
+#define NS_TWIPS_TO_METERS(x)         NSTwipsToUnits((x), 1.0f / (72.0f * 39.37f))
+#define NS_TWIPS_TO_KILOMETERS(x)     NSTwipsToUnits((x), 1.0f / (72.0f * 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/gfx/public/nsRect.h
+++ b/gfx/public/nsRect.h
@@ -39,17 +39,16 @@
 #ifndef NSRECT_H
 #define NSRECT_H
 
 #include <stdio.h>
 #include "nsCoord.h"
 #include "nsPoint.h"
 #include "nsSize.h"
 #include "nsMargin.h"
-#include "nsUnitConversion.h"
 #include "gfxCore.h"
 #include "nsTraceRefcnt.h"
 
 struct NS_GFX nsRect {
   nscoord x, y;
   nscoord width, height;
 
   // Constructors
--- a/gfx/public/nsTransform2D.h
+++ b/gfx/public/nsTransform2D.h
@@ -35,17 +35,16 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsTransform2D_h___
 #define nsTransform2D_h___
 
 #include "gfxCore.h"
 #include "nsCoord.h"
-#include "nsUnitConversion.h"
 
 #define MG_2DIDENTITY     0
 #define MG_2DTRANSLATION  1
 #define MG_2DSCALE        2
 
 class NS_GFX nsTransform2D
 {
 private:
--- a/gfx/src/beos/nsDeviceContextBeOS.h
+++ b/gfx/src/beos/nsDeviceContextBeOS.h
@@ -34,17 +34,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsDeviceContextBeOS_h___
 #define nsDeviceContextBeOS_h___
 
 #include "nsDeviceContext.h"
-#include "nsUnitConversion.h"
 #include "nsIWidget.h"
 #include "nsIView.h"
 #include "nsIRenderingContext.h"
 
 #include "nsRenderingContextBeOS.h"
 
 class nsDeviceContextBeOS : public DeviceContextImpl
 {
--- a/gfx/src/beos/nsFontMetricsBeOS.h
+++ b/gfx/src/beos/nsFontMetricsBeOS.h
@@ -40,17 +40,16 @@
 #ifndef nsFontMetricsBeOS_h__
 #define nsFontMetricsBeOS_h__
 
 #include "nsDeviceContextBeOS.h" 
 #include "nsIFontMetrics.h" 
 #include "nsIFontEnumerator.h" 
 #include "nsFont.h"
 #include "nsString.h"
-#include "nsUnitConversion.h"
 #include "nsIDeviceContext.h"
 #include "nsCRT.h"
 #include "nsCOMPtr.h"
 #include "nsRenderingContextBeOS.h" 
 #include "nsICharRepresentable.h" 
 #include "nsDataHashtable.h"
 
 #include <Font.h>
--- a/gfx/src/beos/nsRenderingContextBeOS.h
+++ b/gfx/src/beos/nsRenderingContextBeOS.h
@@ -35,17 +35,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsRenderingContextBeOS_h___
 #define nsRenderingContextBeOS_h___
 
 #include "nsRenderingContextImpl.h"
-#include "nsUnitConversion.h"
 #include "nsFont.h"
 #include "nsIFontMetrics.h"
 #include "nsPoint.h"
 #include "nsString.h"
 #include "nsCRT.h"
 #include "nsTransform2D.h"
 #include "nsIWidget.h"
 #include "nsRect.h"
--- a/gfx/src/mac/nsDeviceContextMac.h
+++ b/gfx/src/mac/nsDeviceContextMac.h
@@ -34,17 +34,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsDeviceContextMac_h___
 #define nsDeviceContextMac_h___
 
 #include "nsDeviceContext.h"
-#include "nsUnitConversion.h"
 #include "nsIWidget.h"
 #include "nsIView.h"
 #include "nsIRenderingContext.h"
 #include "nsIFontEnumerator.h"
 #include <Types.h>
 #include <Quickdraw.h>
 
 #include "nsIScreen.h"
--- a/gfx/src/mac/nsFontMetricsMac.h
+++ b/gfx/src/mac/nsFontMetricsMac.h
@@ -38,17 +38,16 @@
 #ifndef nsFontMetricsMac_h__
 #define nsFontMetricsMac_h__
 
 #include <TextEdit.h>	// for TextStyle
 
 #include "nsIFontMetrics.h"
 #include "nsFont.h"
 #include "nsString.h"
-#include "nsUnitConversion.h"
 #include "nsIDeviceContext.h"
 #include "nsCRT.h"
 #include "nsIAtom.h"
 #include "nsCOMPtr.h"
 class nsUnicodeFontMappingMac;
 
 class nsFontMetricsMac : public nsIFontMetrics
 {
--- a/gfx/src/nsColor.cpp
+++ b/gfx/src/nsColor.cpp
@@ -36,17 +36,16 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "plstr.h"
 #include "nsColor.h"
 #include "nsColorNames.h"
 #include "nsString.h"
 #include "nscore.h"
 #include "nsCoord.h"
-#include "nsUnitConversion.h"
 #include "nsCOMPtr.h"
 #include "nsIServiceManager.h"
 #include <math.h>
 #include "prprf.h"
 
 static int ComponentValue(const PRUnichar* aColorSpec, int aLen, int color, int dpc)
 {
   int component = 0;
--- a/gfx/src/nsRect.cpp
+++ b/gfx/src/nsRect.cpp
@@ -32,17 +32,16 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsRect.h"
 #include "nsString.h"
-#include "nsUnitConversion.h"
 #include "nsIDeviceContext.h"
 
 #ifdef MIN
 #undef MIN
 #endif
 
 #ifdef MAX
 #undef MAX
--- a/gfx/src/nsRegressionTestFontMetrics.h
+++ b/gfx/src/nsRegressionTestFontMetrics.h
@@ -36,17 +36,16 @@
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsRegressionTestFontMetrics_h__
 #define nsRegressionTestFontMetrics_h__
 
 #include "nsIFontMetrics.h"
 #include "nsFont.h"
 #include "nsString.h"
-#include "nsUnitConversion.h"
 #include "nsIDeviceContext.h"
 
 class nsRegressionTestFontMetrics : public nsIFontMetrics
 {
 public:
    friend nsresult NS_NewRegressionTestFontMetrics(nsIFontMetrics** aMetrics);
    virtual ~nsRegressionTestFontMetrics();
 
--- a/gfx/src/photon/nsDeviceContextPh.h
+++ b/gfx/src/photon/nsDeviceContextPh.h
@@ -34,17 +34,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsDeviceContextPh_h___
 #define nsDeviceContextPh_h___
 
 #include "nsDeviceContext.h"
-#include "nsUnitConversion.h"
 #include "nsIWidget.h"
 #include "nsIView.h"
 #include "nsIRenderingContext.h"
 #include "nsIScreenManager.h"
 
 #include "nsRenderingContextPh.h"
 #include <Pt.h>
 
--- a/gfx/src/photon/nsFontMetricsPh.h
+++ b/gfx/src/photon/nsFontMetricsPh.h
@@ -39,17 +39,16 @@
 #define nsFontMetricsPh_h__
 
 #include <Pt.h>
 
 #include "nsIFontMetrics.h"
 #include "nsIFontEnumerator.h"
 #include "nsFont.h"
 #include "nsString.h"
-#include "nsUnitConversion.h"
 #include "nsIDeviceContext.h"
 #include "nsCRT.h"
 #include "nsDeviceContextPh.h"
 #include "nsCOMPtr.h"
 
 class nsFontMetricsPh : public nsIFontMetrics
 {
 public:
--- a/gfx/src/photon/nsRenderingContextPh.h
+++ b/gfx/src/photon/nsRenderingContextPh.h
@@ -33,17 +33,16 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #ifndef nsRenderingContextPh_h___
 #define nsRenderingContextPh_h___
 
 #include "nsRenderingContextImpl.h"
-#include "nsUnitConversion.h"
 #include "nsFont.h"
 #include "nsIFontMetrics.h"
 #include "nsPoint.h"
 #include "nsString.h"
 #include "nsCRT.h"
 #include "nsTransform2D.h"
 #include "nsIViewManager.h"
 #include "nsIWidget.h"
--- a/gfx/src/thebes/nsSystemFontsBeOS.cpp
+++ b/gfx/src/thebes/nsSystemFontsBeOS.cpp
@@ -38,17 +38,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include <Font.h>
 #include <Menu.h>
 
 #include "nsIDeviceContext.h"
-#include "nsUnitConversion.h"
 #include "nsSystemFontsBeOS.h"
 
 #define DEFAULT_PIXEL_FONT_SIZE 16.0f
 
 nsSystemFontsBeOS::nsSystemFontsBeOS()
   : mDefaultFontName(NS_LITERAL_STRING("sans-serif"))
   , mMenuFontName(NS_LITERAL_STRING("sans-serif"))
   , mCaptionFontName(NS_LITERAL_STRING("sans-serif"))
--- a/gfx/src/thebes/nsSystemFontsOS2.cpp
+++ b/gfx/src/thebes/nsSystemFontsOS2.cpp
@@ -35,17 +35,16 @@
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsIDeviceContext.h"
-#include "nsUnitConversion.h"
 #include "nsSystemFontsOS2.h"
 #include <stdlib.h>
 
 /************************
  *   Helper functions   *
  ************************/
 static BOOL bIsDBCS;
 static BOOL bIsDBCSSet = FALSE;
--- a/gfx/src/windows/nsFontMetricsWin.h
+++ b/gfx/src/windows/nsFontMetricsWin.h
@@ -41,17 +41,16 @@
 
 #include <windows.h>
 
 #include "plhash.h"
 #include "nsIFontMetrics.h"
 #include "nsIFontEnumerator.h"
 #include "nsFont.h"
 #include "nsString.h"
-#include "nsUnitConversion.h"
 #include "nsIDeviceContext.h"
 #include "nsCRT.h"
 #include "nsDeviceContextWin.h"
 #include "nsCOMPtr.h"
 #include "nsVoidArray.h"
 #include "nsICharRepresentable.h"
 #include "nsCompressedCharMap.h"
 #include "nsUnicharUtils.h"
--- a/gfx/src/windows/nsRenderingContextWin.h
+++ b/gfx/src/windows/nsRenderingContextWin.h
@@ -35,17 +35,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsRenderingContextWin_h___
 #define nsRenderingContextWin_h___
 
 #include "nsIRenderingContext.h"
-#include "nsUnitConversion.h"
 #include "nsFont.h"
 #include "nsFontMetricsWin.h"
 #include "nsPoint.h"
 #include "nsString.h"
 #include "nsCRT.h"
 #include "nsTransform2D.h"
 #include "nsIViewManager.h"
 #include "nsIWidget.h"
--- a/layout/generic/nsSpacerFrame.cpp
+++ b/layout/generic/nsSpacerFrame.cpp
@@ -37,17 +37,16 @@
 
 /* rendering object for HTML <spacer> element */
 
 #include "nsHTMLParts.h"
 #include "nsFrame.h"
 #include "nsLineLayout.h"
 #include "nsPresContext.h"
 #include "nsGkAtoms.h"
-#include "nsUnitConversion.h"
 #include "nsStyleConsts.h"
 #include "nsINameSpaceManager.h"
 
 // Spacer type's
 #define TYPE_WORD  0            // horizontal space
 #define TYPE_LINE  1            // line-break + vertical space
 #define TYPE_IMAGE 2            // acts like a sized image with nothing to see
 
--- a/layout/mathml/base/src/nsMathMLChar.cpp
+++ b/layout/mathml/base/src/nsMathMLChar.cpp
@@ -36,17 +36,16 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsCOMPtr.h"
 #include "nsFrame.h"
 #include "nsPresContext.h"
-#include "nsUnitConversion.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsString.h"
 #include "nsUnicharUtils.h"
 #include "nsIRenderingContext.h"
 #include "gfxPlatform.h"
 #include "nsIFontMetrics.h"
 
--- a/layout/mathml/base/src/nsMathMLContainerFrame.cpp
+++ b/layout/mathml/base/src/nsMathMLContainerFrame.cpp
@@ -39,17 +39,16 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsCOMPtr.h"
 #include "nsHTMLParts.h"
 #include "nsFrame.h"
 #include "nsPresContext.h"
 #include "nsIPresShell.h"
 #include "nsCSSAnonBoxes.h"
-#include "nsUnitConversion.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsINameSpaceManager.h"
 #include "nsIRenderingContext.h"
 #include "nsIFontMetrics.h"
 
 #include "nsIDOMText.h"
 #include "nsIDOMMutationEvent.h"
--- a/layout/mathml/base/src/nsMathMLForeignFrameWrapper.cpp
+++ b/layout/mathml/base/src/nsMathMLForeignFrameWrapper.cpp
@@ -42,17 +42,16 @@
 //
 
 #include "nsCOMPtr.h"
 #include "nsHTMLParts.h"
 #include "nsFrame.h"
 #include "nsAreaFrame.h"
 #include "nsLineLayout.h"
 #include "nsPresContext.h"
-#include "nsUnitConversion.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsIRenderingContext.h"
 #include "nsIFontMetrics.h"
 
 #include "nsMathMLForeignFrameWrapper.h"
 
 NS_IMPL_ADDREF_INHERITED(nsMathMLForeignFrameWrapper, nsMathMLFrame)
--- a/layout/mathml/base/src/nsMathMLTokenFrame.cpp
+++ b/layout/mathml/base/src/nsMathMLTokenFrame.cpp
@@ -34,17 +34,16 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsCOMPtr.h"
 #include "nsFrame.h"
 #include "nsPresContext.h"
-#include "nsUnitConversion.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsIRenderingContext.h"
 #include "nsIFontMetrics.h"
 #include "nsContentUtils.h"
 #include "nsCSSFrameConstructor.h"
 #include "nsMathMLTokenFrame.h"
 
--- a/layout/mathml/base/src/nsMathMLmactionFrame.cpp
+++ b/layout/mathml/base/src/nsMathMLmactionFrame.cpp
@@ -34,17 +34,16 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsCOMPtr.h"
 #include "nsFrame.h"
 #include "nsPresContext.h"
-#include "nsUnitConversion.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsINameSpaceManager.h"
 #include "nsIRenderingContext.h"
 #include "nsIFontMetrics.h"
 
 #include "nsCSSRendering.h"
 #include "prprf.h"         // For PR_snprintf()
--- a/layout/mathml/base/src/nsMathMLmfencedFrame.cpp
+++ b/layout/mathml/base/src/nsMathMLmfencedFrame.cpp
@@ -37,17 +37,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 
 #include "nsCOMPtr.h"
 #include "nsFrame.h"
 #include "nsPresContext.h"
-#include "nsUnitConversion.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsIRenderingContext.h"
 #include "nsIFontMetrics.h"
 
 #include "nsMathMLmfencedFrame.h"
 
 //
--- a/layout/mathml/base/src/nsMathMLmfracFrame.cpp
+++ b/layout/mathml/base/src/nsMathMLmfracFrame.cpp
@@ -37,17 +37,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 
 #include "nsCOMPtr.h"
 #include "nsFrame.h"
 #include "nsPresContext.h"
-#include "nsUnitConversion.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsIRenderingContext.h"
 #include "nsIFontMetrics.h"
 
 #include "nsMathMLmfencedFrame.h"
 #include "nsMathMLmfracFrame.h"
 
--- a/layout/mathml/base/src/nsMathMLmmultiscriptsFrame.cpp
+++ b/layout/mathml/base/src/nsMathMLmmultiscriptsFrame.cpp
@@ -37,17 +37,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 
 #include "nsCOMPtr.h"
 #include "nsFrame.h"
 #include "nsPresContext.h"
-#include "nsUnitConversion.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsIRenderingContext.h"
 #include "nsIFontMetrics.h"
 
 #include "nsMathMLmmultiscriptsFrame.h"
 
 //
--- a/layout/mathml/base/src/nsMathMLmoFrame.cpp
+++ b/layout/mathml/base/src/nsMathMLmoFrame.cpp
@@ -37,17 +37,16 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsCOMPtr.h"
 #include "nsFrame.h"
 #include "nsPresContext.h"
-#include "nsUnitConversion.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsIRenderingContext.h"
 #include "nsIFontMetrics.h"
 #include "nsContentUtils.h"
 
 #include "nsIDOMText.h"
 
--- a/layout/mathml/base/src/nsMathMLmoverFrame.cpp
+++ b/layout/mathml/base/src/nsMathMLmoverFrame.cpp
@@ -38,17 +38,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 
 #include "nsCOMPtr.h"
 #include "nsFrame.h"
 #include "nsPresContext.h"
-#include "nsUnitConversion.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsINameSpaceManager.h"
 #include "nsIRenderingContext.h"
 #include "nsIFontMetrics.h"
 
 #include "nsMathMLmoverFrame.h"
 #include "nsMathMLmsupFrame.h"
--- a/layout/mathml/base/src/nsMathMLmpaddedFrame.cpp
+++ b/layout/mathml/base/src/nsMathMLmpaddedFrame.cpp
@@ -37,17 +37,16 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 
 #include "nsCOMPtr.h"
 #include "nsCRT.h"  // to get NS_IS_SPACE
 #include "nsFrame.h"
 #include "nsPresContext.h"
-#include "nsUnitConversion.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsIRenderingContext.h"
 #include "nsIFontMetrics.h"
 
 #include "nsMathMLmpaddedFrame.h"
 
 //
--- a/layout/mathml/base/src/nsMathMLmphantomFrame.cpp
+++ b/layout/mathml/base/src/nsMathMLmphantomFrame.cpp
@@ -36,17 +36,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 
 #include "nsCOMPtr.h"
 #include "nsFrame.h"
 #include "nsPresContext.h"
-#include "nsUnitConversion.h"
 #include "nsStyleConsts.h"
 #include "nsIRenderingContext.h"
 #include "nsIFontMetrics.h"
 
 #include "nsMathMLmphantomFrame.h"
 
 //
 // <mphantom> -- make content invisible but preserve its size
--- a/layout/mathml/base/src/nsMathMLmrootFrame.cpp
+++ b/layout/mathml/base/src/nsMathMLmrootFrame.cpp
@@ -38,17 +38,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 
 #include "nsCOMPtr.h"
 #include "nsFrame.h"
 #include "nsPresContext.h"
-#include "nsUnitConversion.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsIRenderingContext.h"
 #include "nsIFontMetrics.h"
 
 #include "nsMathMLmrootFrame.h"
 
 //
--- a/layout/mathml/base/src/nsMathMLmrowFrame.cpp
+++ b/layout/mathml/base/src/nsMathMLmrowFrame.cpp
@@ -36,17 +36,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 
 #include "nsCOMPtr.h"
 #include "nsFrame.h"
 #include "nsPresContext.h"
-#include "nsUnitConversion.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsIRenderingContext.h"
 #include "nsIFontMetrics.h"
 
 #include "nsMathMLmrowFrame.h"
 
 //
--- a/layout/mathml/base/src/nsMathMLmspaceFrame.cpp
+++ b/layout/mathml/base/src/nsMathMLmspaceFrame.cpp
@@ -35,17 +35,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 
 #include "nsCOMPtr.h"
 #include "nsFrame.h"
 #include "nsPresContext.h"
-#include "nsUnitConversion.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsIRenderingContext.h"
 #include "nsIFontMetrics.h"
 
 #include "nsMathMLmspaceFrame.h"
 
 
--- a/layout/mathml/base/src/nsMathMLmsqrtFrame.cpp
+++ b/layout/mathml/base/src/nsMathMLmsqrtFrame.cpp
@@ -38,17 +38,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 
 #include "nsCOMPtr.h"
 #include "nsFrame.h"
 #include "nsPresContext.h"
-#include "nsUnitConversion.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsIRenderingContext.h"
 #include "nsIFontMetrics.h"
 
 #include "nsMathMLmsqrtFrame.h"
 
 //
--- a/layout/mathml/base/src/nsMathMLmstyleFrame.cpp
+++ b/layout/mathml/base/src/nsMathMLmstyleFrame.cpp
@@ -36,17 +36,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 
 #include "nsCOMPtr.h"
 #include "nsFrame.h"
 #include "nsPresContext.h"
-#include "nsUnitConversion.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsINameSpaceManager.h"
 #include "nsIRenderingContext.h"
 #include "nsIFontMetrics.h"
 
 #include "nsMathMLmstyleFrame.h"
 
--- a/layout/mathml/base/src/nsMathMLmsubFrame.cpp
+++ b/layout/mathml/base/src/nsMathMLmsubFrame.cpp
@@ -37,17 +37,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 
 #include "nsCOMPtr.h"
 #include "nsFrame.h"
 #include "nsPresContext.h"
-#include "nsUnitConversion.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsIRenderingContext.h"
 #include "nsIFontMetrics.h"
 
 #include "nsMathMLmsubFrame.h"
 
 //
--- a/layout/mathml/base/src/nsMathMLmsubsupFrame.cpp
+++ b/layout/mathml/base/src/nsMathMLmsubsupFrame.cpp
@@ -37,17 +37,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 
 #include "nsCOMPtr.h"
 #include "nsFrame.h"
 #include "nsPresContext.h"
-#include "nsUnitConversion.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsIRenderingContext.h"
 #include "nsIFontMetrics.h"
 
 #include "nsMathMLmsubsupFrame.h"
 
 //
--- a/layout/mathml/base/src/nsMathMLmsupFrame.cpp
+++ b/layout/mathml/base/src/nsMathMLmsupFrame.cpp
@@ -36,17 +36,16 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsCOMPtr.h"
 #include "nsFrame.h"
 #include "nsPresContext.h"
-#include "nsUnitConversion.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsIRenderingContext.h"
 #include "nsIFontMetrics.h"
 
 #include "nsMathMLmsupFrame.h"
 
 //
--- a/layout/mathml/base/src/nsMathMLmtableFrame.cpp
+++ b/layout/mathml/base/src/nsMathMLmtableFrame.cpp
@@ -35,17 +35,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsCOMPtr.h"
 #include "nsFrame.h"
 #include "nsAreaFrame.h"
 #include "nsPresContext.h"
-#include "nsUnitConversion.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsINameSpaceManager.h"
 #include "nsIRenderingContext.h"
 #include "nsIFontMetrics.h"
 
 #include "nsVoidArray.h"
 #include "nsCSSFrameConstructor.h"
--- a/layout/mathml/base/src/nsMathMLmunderFrame.cpp
+++ b/layout/mathml/base/src/nsMathMLmunderFrame.cpp
@@ -38,17 +38,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 
 #include "nsCOMPtr.h"
 #include "nsFrame.h"
 #include "nsPresContext.h"
-#include "nsUnitConversion.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsINameSpaceManager.h"
 #include "nsIRenderingContext.h"
 #include "nsIFontMetrics.h"
 
 #include "nsMathMLmunderFrame.h"
 #include "nsMathMLmsubFrame.h"
--- a/layout/mathml/base/src/nsMathMLmunderoverFrame.cpp
+++ b/layout/mathml/base/src/nsMathMLmunderoverFrame.cpp
@@ -38,17 +38,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 
 #include "nsCOMPtr.h"
 #include "nsFrame.h"
 #include "nsPresContext.h"
-#include "nsUnitConversion.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsINameSpaceManager.h"
 #include "nsIRenderingContext.h"
 #include "nsIFontMetrics.h"
 
 #include "nsMathMLmunderoverFrame.h"
 #include "nsMathMLmsubsupFrame.h"
--- a/layout/style/nsCSSDeclaration.cpp
+++ b/layout/style/nsCSSDeclaration.cpp
@@ -45,17 +45,16 @@
 #include "nscore.h"
 #include "nsCSSDeclaration.h"
 #include "nsString.h"
 #include "nsIAtom.h"
 #include "nsUnicharUtils.h"
 #include "nsReadableUtils.h"
 #include "nsCRT.h"
 #include "nsCSSProps.h"
-#include "nsUnitConversion.h"
 #include "nsFont.h"
 #include "nsReadableUtils.h"
 #include "nsStyleUtil.h"
 
 #include "nsStyleConsts.h"
 
 #include "nsCOMPtr.h"
 
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -69,17 +69,16 @@
 #include "nsStyleConsts.h"
 #include "nsCSSPseudoClasses.h"
 #include "nsCSSPseudoElements.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsINameSpaceManager.h"
 #include "nsXMLNameSpaceMap.h"
 #include "nsThemeConstants.h"
 #include "nsContentErrors.h"
-#include "nsUnitConversion.h"
 #include "nsPrintfCString.h"
 #include "nsIMediaList.h"
 #include "nsILookAndFeel.h"
 #include "nsStyleUtil.h"
 #include "nsIPrincipal.h"
 
 #include "prprf.h"
 #include "math.h"
--- a/layout/style/nsCSSStruct.cpp
+++ b/layout/style/nsCSSStruct.cpp
@@ -45,17 +45,16 @@
 
 #include "nscore.h"
 #include "nsCSSStruct.h"
 #include "nsString.h"
 #include "nsIAtom.h"
 #include "nsUnicharUtils.h"
 #include "nsCRT.h"
 #include "nsCSSProps.h"
-#include "nsUnitConversion.h"
 #include "nsFont.h"
 
 #include "nsStyleConsts.h"
 
 #include "nsCOMPtr.h"
 #include "nsReadableUtils.h"
 #include "nsPrintfCString.h"
 
--- a/layout/style/nsCSSStyleRule.cpp
+++ b/layout/style/nsCSSStyleRule.cpp
@@ -55,17 +55,16 @@
 #include "nsPresContext.h"
 #include "nsIDocument.h"
 #include "nsIDeviceContext.h"
 #include "nsIAtom.h"
 #include "nsCRT.h"
 #include "nsString.h"
 #include "nsStyleConsts.h"
 #include "nsStyleUtil.h"
-#include "nsUnitConversion.h"
 #include "nsIFontMetrics.h"
 #include "nsIDOMCSSStyleSheet.h"
 #include "nsICSSStyleRuleDOMWrapper.h"
 #include "nsIDOMCSSStyleDeclaration.h"
 #include "nsDOMCSSDeclaration.h"
 #include "nsINameSpaceManager.h"
 #include "nsXMLNameSpaceMap.h"
 #include "nsILookAndFeel.h"
--- a/layout/style/nsCSSValue.h
+++ b/layout/style/nsCSSValue.h
@@ -39,17 +39,16 @@
 
 #ifndef nsCSSValue_h___
 #define nsCSSValue_h___
 
 #include "nsColor.h"
 #include "nsString.h"
 #include "nsCoord.h"
 #include "nsCSSProperty.h"
-#include "nsUnitConversion.h"
 #include "nsIURI.h"
 #include "nsCOMPtr.h"
 #include "nsAutoPtr.h"
 #include "nsCRTGlue.h"
 #include "nsStringBuffer.h"
 
 class imgIRequest;
 class nsIDocument;
--- a/layout/style/nsROCSSPrimitiveValue.h
+++ b/layout/style/nsROCSSPrimitiveValue.h
@@ -38,17 +38,16 @@
 /* DOM object representing values in DOM computed style */
 
 #ifndef nsROCSSPrimitiveValue_h___
 #define nsROCSSPrimitiveValue_h___
 
 #include "nsIDOMCSSPrimitiveValue.h"
 #include "nsString.h"
 #include "nsCoord.h"
-#include "nsUnitConversion.h"
 #include "nsReadableUtils.h"
 #include "nsIURI.h"
 #include "nsIAtom.h"
 #include "nsCSSKeywords.h"
 
 #include "nsCOMPtr.h"
 #include "nsDOMError.h"
 #include "nsDOMCSSRect.h"
--- a/layout/style/nsStyleContext.cpp
+++ b/layout/style/nsStyleContext.cpp
@@ -46,17 +46,16 @@
 #include "nsCRT.h"
 
 #include "nsCOMPtr.h"
 #include "nsStyleSet.h"
 #include "nsIPresShell.h"
 #include "prenv.h"
 
 #include "nsRuleNode.h"
-#include "nsUnitConversion.h"
 #include "nsStyleContext.h"
 #include "imgIRequest.h"
 
 #include "nsPrintfCString.h"
 
 #ifdef DEBUG
 // #define NOISY_DEBUG
 #endif
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -41,17 +41,16 @@
  * structs that contain the data provided by nsStyleContext, the
  * internal API for computed style data for an element
  */
 
 #include "nsStyleStruct.h"
 #include "nsStyleConsts.h"
 #include "nsThemeConstants.h"
 #include "nsString.h"
-#include "nsUnitConversion.h"
 #include "nsPresContext.h"
 #include "nsIDeviceContext.h"
 #include "nsIStyleRule.h"
 #include "nsCRT.h"
 
 #include "nsCOMPtr.h"
 #include "nsIPresShell.h"
 #include "nsIFrame.h"
--- a/layout/style/nsStyleUtil.cpp
+++ b/layout/style/nsStyleUtil.cpp
@@ -34,17 +34,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include <math.h>
 #include "nsStyleUtil.h"
 #include "nsCRT.h"
 #include "nsStyleConsts.h"
-#include "nsUnitConversion.h"
 
 #include "nsGkAtoms.h"
 #include "nsILinkHandler.h"
 #include "nsILink.h"
 #include "nsIContent.h"
 #include "nsIDocument.h"
 #include "nsINameSpaceManager.h"
 #include "nsIURI.h"
--- a/layout/xul/base/src/nsBoxFrame.cpp
+++ b/layout/xul/base/src/nsBoxFrame.cpp
@@ -64,17 +64,16 @@
 // any number of syblings around the box. Basically any children in the reflow chain must have their caches cleared
 // so when asked for there current size they can relayout themselves. 
 
 #include "nsBoxLayoutState.h"
 #include "nsBoxFrame.h"
 #include "nsStyleContext.h"
 #include "nsPresContext.h"
 #include "nsCOMPtr.h"
-#include "nsUnitConversion.h"
 #include "nsINameSpaceManager.h"
 #include "nsGkAtoms.h"
 #include "nsIContent.h"
 #include "nsSpaceManager.h"
 #include "nsHTMLParts.h"
 #include "nsIViewManager.h"
 #include "nsIView.h"
 #include "nsIPresShell.h"
--- a/layout/xul/base/src/nsDeckFrame.cpp
+++ b/layout/xul/base/src/nsDeckFrame.cpp
@@ -42,17 +42,16 @@
 // See documentation in associated header file
 //
 
 #include "nsDeckFrame.h"
 #include "nsStyleContext.h"
 #include "nsPresContext.h"
 #include "nsIContent.h"
 #include "nsCOMPtr.h"
-#include "nsUnitConversion.h"
 #include "nsINameSpaceManager.h"
 #include "nsGkAtoms.h"
 #include "nsHTMLParts.h"
 #include "nsIPresShell.h"
 #include "nsCSSRendering.h"
 #include "nsIViewManager.h"
 #include "nsBoxLayoutState.h"
 #include "nsStackLayout.h"
--- a/layout/xul/base/src/nsScrollbarButtonFrame.cpp
+++ b/layout/xul/base/src/nsScrollbarButtonFrame.cpp
@@ -41,17 +41,16 @@
 //
 // See documentation in associated header file
 //
 
 #include "nsScrollbarButtonFrame.h"
 #include "nsPresContext.h"
 #include "nsIContent.h"
 #include "nsCOMPtr.h"
-#include "nsUnitConversion.h"
 #include "nsINameSpaceManager.h"
 #include "nsGkAtoms.h"
 #include "nsSliderFrame.h"
 #include "nsIScrollbarFrame.h"
 #include "nsIScrollbarMediator.h"
 #include "nsRepeatService.h"
 #include "nsGUIEvent.h"
 #include "nsILookAndFeel.h"
--- a/layout/xul/base/src/nsSliderFrame.cpp
+++ b/layout/xul/base/src/nsSliderFrame.cpp
@@ -43,17 +43,16 @@
 // See documentation in associated header file
 //
 
 #include "nsSliderFrame.h"
 #include "nsStyleContext.h"
 #include "nsPresContext.h"
 #include "nsIContent.h"
 #include "nsCOMPtr.h"
-#include "nsUnitConversion.h"
 #include "nsINameSpaceManager.h"
 #include "nsGkAtoms.h"
 #include "nsHTMLParts.h"
 #include "nsIPresShell.h"
 #include "nsCSSRendering.h"
 #include "nsIDOMEventTarget.h"
 #include "nsIViewManager.h"
 #include "nsIDOMMouseEvent.h"
--- a/layout/xul/base/src/nsStackFrame.cpp
+++ b/layout/xul/base/src/nsStackFrame.cpp
@@ -42,17 +42,16 @@
 // See documentation in associated header file
 //
 
 #include "nsStackFrame.h"
 #include "nsStyleContext.h"
 #include "nsPresContext.h"
 #include "nsIContent.h"
 #include "nsCOMPtr.h"
-#include "nsUnitConversion.h"
 #include "nsHTMLParts.h"
 #include "nsIPresShell.h"
 #include "nsCSSRendering.h"
 #include "nsBoxLayoutState.h"
 #include "nsStackLayout.h"
 #include "nsDisplayList.h"
 
 nsIFrame*
--- a/view/src/nsScrollPortView.cpp
+++ b/view/src/nsScrollPortView.cpp
@@ -33,17 +33,16 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsScrollPortView.h"
 #include "nsIWidget.h"
-#include "nsUnitConversion.h"
 #include "nsIDeviceContext.h"
 #include "nsGUIEvent.h"
 #include "nsWidgetsCID.h"
 #include "nsViewsCID.h"
 #include "nsIScrollableView.h"
 #include "nsILookAndFeel.h"
 #include "nsISupportsArray.h"
 #include "nsIScrollPositionListener.h"
--- a/view/src/nsViewManager.cpp
+++ b/view/src/nsViewManager.cpp
@@ -39,17 +39,16 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #define PL_ARENA_CONST_ALIGN_MASK (sizeof(void*)-1)
 #include "plarena.h"
 
 #include "nsAutoPtr.h"
 #include "nsViewManager.h"
-#include "nsUnitConversion.h"
 #include "nsIRenderingContext.h"
 #include "nsIDeviceContext.h"
 #include "nsGfxCIID.h"
 #include "nsIScrollableView.h"
 #include "nsView.h"
 #include "nsISupportsArray.h"
 #include "nsCOMPtr.h"
 #include "nsIServiceManager.h"
--- a/widget/src/beos/nsDragService.cpp
+++ b/widget/src/beos/nsDragService.cpp
@@ -43,17 +43,16 @@
 #include "nsIDocument.h"
 #include "nsIRegion.h"
 #include "nsITransferable.h"
 #include "nsIServiceManager.h"
 #include "nsISupportsPrimitives.h"
 #include "nsVoidArray.h"
 #include "nsXPIDLString.h"
 #include "nsPrimitiveHelpers.h"
-#include "nsUnitConversion.h"
 #include "nsWidgetsCID.h"
 #include "nsCRT.h"
 
 // if we want to do Image-dragging, also need to change Makefile.in
 // to add
 // 		-I$(topsrcdir)/gfx/src/beos \
 // in INCLUDES
 // and bug 294234 to be done.
--- a/widget/src/cocoa/nsScreenCocoa.mm
+++ b/widget/src/cocoa/nsScreenCocoa.mm
@@ -31,18 +31,16 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#include "nsUnitConversion.h"
-
 #include "nsScreenCocoa.h"
 #include "nsCocoaUtils.h"
 
 NS_IMPL_ISUPPORTS1(nsScreenCocoa, nsIScreen)
 
 nsScreenCocoa::nsScreenCocoa (NSScreen *screen)
 {
     mScreen = [screen retain];
--- a/widget/src/gtk2/nsDeviceContextSpecG.cpp
+++ b/widget/src/gtk2/nsDeviceContextSpecG.cpp
@@ -391,17 +391,16 @@ nsDeviceContextSpecGTK::~nsDeviceContext
   delete mPrintJob;
 }
 
 NS_IMPL_ISUPPORTS1(nsDeviceContextSpecGTK,
                    nsIDeviceContextSpec)
 
 #include "gfxPDFSurface.h"
 #include "gfxPSSurface.h"
-#include "nsUnitConversion.h"
 NS_IMETHODIMP nsDeviceContextSpecGTK::GetSurfaceForPrinter(gfxASurface **aSurface)
 {
   *aSurface = nsnull;
 
   const char *path;
   GetPath(&path);
 
   double width, height;
--- a/widget/src/windows/nsDeviceContextSpecWin.cpp
+++ b/widget/src/windows/nsDeviceContextSpecWin.cpp
@@ -51,17 +51,16 @@
 #include "nsIServiceManager.h"
 #include "nsReadableUtils.h"
 #include "nsStringEnumerator.h"
 
 #include "gfxPDFSurface.h"
 #include "gfxWindowsSurface.h"
 
 #include "nsIFileStreams.h"
-#include "nsUnitConversion.h"
 #include "nsIWindowWatcher.h"
 #include "nsIDOMWindow.h"
 
 // For NS_CopyNativeToUnicode
 #include "nsNativeCharsetUtils.h"
 
 // File Picker
 #include "nsILocalFile.h"
--- a/widget/src/xpwidgets/nsPrintOptionsImpl.cpp
+++ b/widget/src/xpwidgets/nsPrintOptionsImpl.cpp
@@ -34,17 +34,16 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsPrintOptionsImpl.h"
 #include "nsCoord.h"
-#include "nsUnitConversion.h"
 #include "nsReadableUtils.h"
 #include "nsPrintSettingsImpl.h"
 
 #include "nsIDOMWindow.h"
 #include "nsIServiceManager.h"
 #include "nsIDialogParamBlock.h"
 #include "nsXPCOM.h"
 #include "nsISupportsPrimitives.h"
--- a/widget/src/xpwidgets/nsPrintSettingsImpl.cpp
+++ b/widget/src/xpwidgets/nsPrintSettingsImpl.cpp
@@ -32,17 +32,16 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsPrintSettingsImpl.h"
 #include "nsCoord.h"
-#include "nsUnitConversion.h"
 #include "nsReadableUtils.h"
 #include "nsIPrintSession.h"
 
 NS_IMPL_ISUPPORTS1(nsPrintSettings, nsIPrintSettings)
 
 /** ---------------------------------------------------
  *  See documentation in nsPrintSettingsImpl.h
  *	@update 6/21/00 dwc
--- a/xpcom/ds/Makefile.in
+++ b/xpcom/ds/Makefile.in
@@ -96,17 +96,16 @@ EXPORTS		= \
 		nsMathUtils.h \
 		nsObserverService.h \
 		nsRecyclingAllocator.h \
 		nsStaticNameTable.h \
 		nsStaticAtom.h \
 		nsSupportsArray.h \
 		nsSupportsPrimitives.h \
 		nsTime.h \
-		nsUnitConversion.h \
 		nsVariant.h \
 		nsValueArray.h \
 		nsStringEnumerator.h \
 		nsHashPropertyBag.h \
 		nsWhitespaceTokenizer.h \
 		$(NULL)			
 
 XPIDLSRCS	= \
deleted file mode 100644
--- a/xpcom/ds/nsUnitConversion.h
+++ /dev/null
@@ -1,178 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 1998
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either of the GNU General Public License Version 2 or later (the "GPL"),
- * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-#ifndef nsUnitConversion_h__
-#define nsUnitConversion_h__
-
-#include "nscore.h"
-#include "nsCoord.h"
-#include "nsMathUtils.h"
-#include <math.h>
-#include <float.h>
-
-/// handy constants
-#define TWIPS_PER_POINT_INT           20
-#define TWIPS_PER_POINT_FLOAT         20.0f
-
-/*
- * Coord Rounding Functions
- */
-inline nscoord NSToCoordFloor(float aValue)
-{
-  return nscoord(NS_floorf(aValue));
-}
-
-inline nscoord NSToCoordCeil(float aValue)
-{
-  return nscoord(NS_ceilf(aValue));
-}
-
-inline nscoord NSToCoordRound(float aValue)
-{
-  return nscoord(NS_floorf(aValue + 0.5f));
-}
-
-/*
- * Int Rounding Functions
- */
-inline PRInt32 NSToIntFloor(float aValue)
-{
-  return PRInt32(NS_floorf(aValue));
-}
-
-inline PRInt32 NSToIntCeil(float aValue)
-{
-  return PRInt32(NS_ceilf(aValue));
-}
-
-inline PRInt32 NSToIntRound(float aValue)
-{
-  return NS_lroundf(aValue);
-}
-
-/* 
- * App Unit/Pixel conversions
- */
-inline nscoord NSFloatPixelsToAppUnits(float aPixels, PRInt32 aAppUnitsPerPixel)
-{
-  float product = aPixels * aAppUnitsPerPixel;
-  nscoord result;
-
-#ifdef NS_COORD_IS_FLOAT
-  // No need to bounds-check if converting float to float
-  result = NSToCoordRound(product);
-#else
-  // Bounds-check before converting out of float, to avoid overflow
-  if (product >= nscoord_MAX) {
-    NS_WARNING("Overflowed nscoord_MAX in conversion to nscoord");
-    result = nscoord_MAX;
-  } else if (product <= nscoord_MIN) {
-    NS_WARNING("Overflowed nscoord_MIN in conversion to nscoord");
-    result = nscoord_MIN;
-  } else {
-    result = NSToCoordRound(product);
-  }
-#endif
-
-  VERIFY_COORD(result);
-  return result;
-}
-
-inline nscoord NSIntPixelsToAppUnits(PRInt32 aPixels, PRInt32 aAppUnitsPerPixel)
-{
-  // The cast to nscoord makes sure we don't overflow if we ever change
-  // nscoord to float
-  nscoord r = aPixels * (nscoord)aAppUnitsPerPixel;
-  VERIFY_COORD(r);
-  return r;
-}
-
-inline float NSAppUnitsToFloatPixels(nscoord aAppUnits, PRInt32 aAppUnitsPerPixel)
-{
-  return (float(aAppUnits) / aAppUnitsPerPixel);
-}
-
-inline PRInt32 NSAppUnitsToIntPixels(nscoord aAppUnits, PRInt32 aAppUnitsPerPixel)
-{
-  return NSToIntRound(float(aAppUnits) / aAppUnitsPerPixel);
-}
-
-/* 
- * Twips/unit conversions
- */
-inline nscoord NSUnitsToTwips(float aValue, float aPointsPerUnit)
-{
-  return NSToCoordRound(aValue * aPointsPerUnit * TWIPS_PER_POINT_FLOAT);
-}
-
-inline float NSTwipsToUnits(nscoord aTwips, float aUnitsPerPoint)
-{
-  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), 72.0f)                      // 72 points per inch
-#define NS_FEET_TO_TWIPS(x)           NSUnitsToTwips((x), (72.0f * 12.0f))            // 12 inches per foot
-#define NS_MILES_TO_TWIPS(x)          NSUnitsToTwips((x), (72.0f * 12.0f * 5280.0f))  // 5280 feet per mile
-
-#define NS_MILLIMETERS_TO_TWIPS(x)    NSUnitsToTwips((x), (72.0f * 0.03937f))
-#define NS_CENTIMETERS_TO_TWIPS(x)    NSUnitsToTwips((x), (72.0f * 0.3937f))
-#define NS_METERS_TO_TWIPS(x)         NSUnitsToTwips((x), (72.0f * 39.37f))
-#define NS_KILOMETERS_TO_TWIPS(x)     NSUnitsToTwips((x), (72.0f * 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 / 72.0f)
-#define NS_TWIPS_TO_FEET(x)           NSTwipsToUnits((x), 1.0f / (72.0f * 12.0f))
-#define NS_TWIPS_TO_MILES(x)          NSTwipsToUnits((x), 1.0f / (72.0f * 12.0f * 5280.0f))
-
-#define NS_TWIPS_TO_MILLIMETERS(x)    NSTwipsToUnits((x), 1.0f / (72.0f * 0.03937f))
-#define NS_TWIPS_TO_CENTIMETERS(x)    NSTwipsToUnits((x), 1.0f / (72.0f * 0.3937f))
-#define NS_TWIPS_TO_METERS(x)         NSTwipsToUnits((x), 1.0f / (72.0f * 39.37f))
-#define NS_TWIPS_TO_KILOMETERS(x)     NSTwipsToUnits((x), 1.0f / (72.0f * 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