Bug 392252 need new APIs for converting AppUnits to gfx usable pixels r=sharparrow1, sr+a=roc
authormasayuki@d-toybox.com
Wed, 22 Aug 2007 04:13:46 -0700
changeset 5147 4ad451e6679d0628edd39fba7f65c5cda34381f1
parent 5146 2caae0433db9a4df68254c67d99efdacb7ae7680
child 5148 a7a6da8d810b2822a0ce7225a156dc79e2580fa1
push idunknown
push userunknown
push dateunknown
reviewerssharparrow1, sr
bugs392252
milestone1.9a8pre
Bug 392252 need new APIs for converting AppUnits to gfx usable pixels r=sharparrow1, sr+a=roc
accessible/src/atk/Makefile.in
accessible/src/base/Makefile.in
accessible/src/mac/Makefile.in
accessible/src/msaa/Makefile.in
accessible/src/other/Makefile.in
accessible/src/xforms/Makefile.in
accessible/src/xul/Makefile.in
content/events/src/Makefile.in
content/html/content/src/Makefile.in
content/html/document/src/Makefile.in
content/svg/document/src/Makefile.in
content/xbl/src/Makefile.in
content/xml/content/src/Makefile.in
content/xml/document/src/Makefile.in
content/xtf/src/Makefile.in
content/xul/content/src/Makefile.in
content/xul/document/src/Makefile.in
content/xul/templates/src/Makefile.in
docshell/base/Makefile.in
docshell/build/Makefile.in
dom/src/base/Makefile.in
dom/src/offline/Makefile.in
dom/src/storage/Makefile.in
editor/composer/src/Makefile.in
editor/libeditor/base/Makefile.in
editor/libeditor/text/Makefile.in
editor/txtsvc/src/Makefile.in
embedding/browser/webBrowser/Makefile.in
embedding/components/find/src/Makefile.in
extensions/layout-debug/src/Makefile.in
gfx/public/nsIDeviceContext.h
gfx/src/Makefile.in
gfx/src/thebes/nsThebesFontMetrics.cpp
layout/base/nsCSSRendering.h
layout/base/nsLayoutUtils.cpp
layout/base/nsLayoutUtils.h
layout/base/nsPresContext.h
layout/base/nsPresShell.cpp
layout/generic/nsBlockFrame.cpp
layout/generic/nsHTMLContainerFrame.cpp
layout/generic/nsInlineFrame.cpp
layout/generic/nsTextFrameThebes.cpp
layout/inspector/src/Makefile.in
layout/printing/Makefile.in
layout/style/Makefile.in
layout/xul/base/src/nsTextBoxFrame.cpp
modules/oji/src/Makefile.in
modules/plugin/base/src/Makefile.in
toolkit/components/autocomplete/src/Makefile.in
toolkit/components/build/Makefile.in
toolkit/components/satchel/src/Makefile.in
toolkit/components/typeaheadfind/src/Makefile.in
uriloader/base/Makefile.in
xpfe/appshell/src/Makefile.in
xpfe/components/winhooks/Makefile.in
--- a/accessible/src/atk/Makefile.in
+++ b/accessible/src/atk/Makefile.in
@@ -45,16 +45,17 @@ MODULE = accessibility
 LIBRARY_NAME = accessibility_toolkit_s
 LIBXUL_LIBRARY = 1
 
 REQUIRES	= content \
 		  docshell \
 		  dom \
 		  editor \
 		  gfx \
+		  thebes \
 		  intl \
 		  layout \
 		  locale \
 		  necko \
 		  string \
 		  uriloader \
 		  view \
 		  webshell \
--- a/accessible/src/base/Makefile.in
+++ b/accessible/src/base/Makefile.in
@@ -49,16 +49,17 @@ LIBXUL_LIBRARY = 1
 REQUIRES	= appshell \
 		  commandhandler \
 		  composer \
 		  content \
 		  docshell \
 		  dom \
 		  editor \
 		  gfx \
+		  thebes \
 		  intl \
 		  layout \
 		  locale \
 		  necko \
 		  plugin \
 		  pref \
 		  string \
 		  unicharutil \
--- a/accessible/src/mac/Makefile.in
+++ b/accessible/src/mac/Makefile.in
@@ -46,16 +46,17 @@ LIBRARY_NAME = accessibility_toolkit_s
 LIBXUL_LIBRARY = 1
 
 REQUIRES	= content \
 		  layout \
 		  docshell \
 		  dom \
 		  editor \
 		  gfx \
+		  thebes \
 		  intl \
 		  locale \
 		  string \
 		  uriloader \
 		  view \
 		  widget \
 		  xpcom \
 		  necko \
--- a/accessible/src/msaa/Makefile.in
+++ b/accessible/src/msaa/Makefile.in
@@ -45,16 +45,17 @@ MODULE = accessibility
 LIBRARY_NAME = accessibility_toolkit_s
 LIBXUL_LIBRARY = 1
 
 REQUIRES	= content \
 		  docshell \
 		  dom \
 		  editor \
 		  gfx \
+		  thebes \
 		  htmlparser \
 		  intl \
 		  layout \
 		  locale \
 		  necko \
 		  plugin \
 		  pref \
 		  string \
--- a/accessible/src/other/Makefile.in
+++ b/accessible/src/other/Makefile.in
@@ -45,16 +45,17 @@ MODULE = accessibility
 LIBRARY_NAME = accessibility_toolkit_s
 LIBXUL_LIBRARY = 1
 
 REQUIRES	= content \
 		  docshell \
 		  dom \
 		  editor \
 		  gfx \
+		  thebes \
 		  htmlparser \
 		  intl \
 		  layout \
 		  locale \
 		  necko \
 		  plugin \
 		  pref \
 		  string \
--- a/accessible/src/xforms/Makefile.in
+++ b/accessible/src/xforms/Makefile.in
@@ -47,16 +47,17 @@ MODULE = accessibility
 LIBRARY_NAME = accessibility_xforms_s
 LIBXUL_LIBRARY = 1
 
 REQUIRES	= content \
       docshell \
       dom \
       editor \
       gfx \
+      thebes \
       intl \
       layout \
       locale \
       necko \
       pref \
       string \
       widget \
       xpcom \
--- a/accessible/src/xul/Makefile.in
+++ b/accessible/src/xul/Makefile.in
@@ -47,16 +47,17 @@ MODULE = accessibility
 LIBRARY_NAME = accessibility_xul_s
 LIBXUL_LIBRARY = 1
 
 REQUIRES	= content \
 		  docshell \
 		  dom \
 		  editor \
 		  gfx \
+		  thebes \
 		  intl \
 		  layout \
 		  locale \
 		  necko \
 		  pref \
 		  string \
 		  widget \
 		  xpcom \
--- a/content/events/src/Makefile.in
+++ b/content/events/src/Makefile.in
@@ -46,16 +46,17 @@ MODULE		= content
 LIBRARY_NAME	= gkconevents_s
 LIBXUL_LIBRARY  = 1
 REQUIRES	= xpcom \
 		  string \
 		  dom \
 		  js \
 		  locale \
 		  gfx \
+		  thebes \
 		  layout \
 		  widget \
 		  caps \
 		  xpconnect \
 		  webshell \
 		  docshell \
 		  pref \
 		  view \
--- a/content/html/content/src/Makefile.in
+++ b/content/html/content/src/Makefile.in
@@ -44,16 +44,17 @@ include $(DEPTH)/config/autoconf.mk
 
 MODULE		= content
 LIBRARY_NAME	= gkconhtmlcon_s
 LIBXUL_LIBRARY	= 1
 
 REQUIRES	= xpcom \
 		  string \
 		  gfx \
+		  thebes \
 		  layout \
 		  widget \
 		  dom \
 		  js \
 		  locale \
 		  unicharutil \
 		  webshell \
 		  uriloader \
--- a/content/html/document/src/Makefile.in
+++ b/content/html/document/src/Makefile.in
@@ -44,16 +44,17 @@ include $(DEPTH)/config/autoconf.mk
 
 MODULE		= content
 LIBRARY_NAME	= gkconhtmldoc_s
 LIBXUL_LIBRARY	= 1
 
 REQUIRES	= xpcom \
 		  string \
 		  gfx \
+		  thebes \
 		  layout \
 		  widget \
 		  dom \
 		  necko \
 		  htmlparser \
 		  locale \
 		  view \
 		  js \
--- a/content/svg/document/src/Makefile.in
+++ b/content/svg/document/src/Makefile.in
@@ -46,16 +46,17 @@ MODULE		= content
 LIBRARY_NAME	= gkconsvgdoc_s
 LIBXUL_LIBRARY	= 1
 REQUIRES	= content \
 		  layout \
 		  widget \
 		  xpcom \
 		  string \
 		  gfx \
+		  thebes \
 		  dom \
 		  webshell \
 		  htmlparser \
 		  lwbrk \
 		  necko \
 		  pref \
 		  js \
 		  caps \
--- a/content/xbl/src/Makefile.in
+++ b/content/xbl/src/Makefile.in
@@ -46,16 +46,17 @@ MODULE		= content
 LIBRARY_NAME	= gkconxbl_s
 LIBXUL_LIBRARY	= 1
 
 REQUIRES	= xpcom \
 		  string \
 		  js \
 		  dom \
 		  gfx \
+		  thebes \
 		  layout \
 		  xultmpl \
 		  widget \
 		  caps \
 		  htmlparser \
 		  necko \
 		  xpconnect \
 		  pref \
--- a/content/xml/content/src/Makefile.in
+++ b/content/xml/content/src/Makefile.in
@@ -46,16 +46,17 @@ MODULE		= content
 LIBRARY_NAME	= gkconxmlcon_s
 LIBXUL_LIBRARY	= 1
 
 REQUIRES	= xpcom \
 		  string \
 		  js \
 		  dom \
 		  gfx \
+		  thebes \
 		  layout \
 		  widget \
 		  necko \
 		  caps \
 		  webshell \
 		  docshell \
 		  htmlparser \
 		  xpconnect \
--- a/content/xml/document/src/Makefile.in
+++ b/content/xml/document/src/Makefile.in
@@ -46,16 +46,17 @@ MODULE		= content
 LIBRARY_NAME	= gkconxmldoc_s
 LIBXUL_LIBRARY	= 1
 
 REQUIRES	= xpcom \
 		  string \
 		  js \
 		  dom \
 		  gfx \
+		  thebes \
 		  layout \
 		  widget \
 		  caps \
 		  htmlparser \
 		  necko \
 		  view \
 		  imglib2 \
 		  docshell \
--- a/content/xtf/src/Makefile.in
+++ b/content/xtf/src/Makefile.in
@@ -45,16 +45,17 @@ include $(DEPTH)/config/autoconf.mk
 MODULE		= content
 LIBRARY_NAME	= gkcontentxtf_s
 LIBXUL_LIBRARY  = 1
 REQUIRES	= xpcom \
 		  string \
 		  layout \
 		  widget \
 		  gfx \
+		  thebes \
 		  dom \
 		  js \
 		  locale \
 		  pref \
 		  necko \
 		  xpconnect \
 		  webshell \
 		  unicharutil \
--- a/content/xul/content/src/Makefile.in
+++ b/content/xul/content/src/Makefile.in
@@ -47,16 +47,17 @@ MODULE		= xul
 ifdef MOZ_XUL
 LIBRARY_NAME	= gkconxulcon_s
 LIBXUL_LIBRARY	= 1
 endif
 
 REQUIRES	= xpcom \
 		  string \
 		  gfx \
+		  thebes \
 		  layout \
 		  content \
 		  widget \
 		  necko \
 		  dom \
 		  js \
 		  caps \
 		  rdf \
--- a/content/xul/document/src/Makefile.in
+++ b/content/xul/document/src/Makefile.in
@@ -46,16 +46,17 @@ MODULE		= xuldoc
 LIBRARY_NAME	= gkconxuldoc_s
 LIBXUL_LIBRARY	= 1
 
 REQUIRES	= xpcom \
 		  string \
 		  exthandler \
 		  mimetype \
 		  gfx \
+		  thebes \
 		  layout \
 		  content \
 		  widget \
 		  dom \
 		  rdf \
 		  js \
 		  xpconnect \
 		  caps \
--- a/content/xul/templates/src/Makefile.in
+++ b/content/xul/templates/src/Makefile.in
@@ -47,16 +47,17 @@ LIBRARY_NAME	= gkconxultmpl_s
 LIBXUL_LIBRARY	= 1
 
 REQUIRES	= xpcom \
 		  string \
 		  js \
 		  xpconnect \
 		  caps \
 		  gfx \
+		  thebes \
 		  layout \
 		  content \
 		  pref \
 		  widget \
 		  dom \
 		  rdf \
 		  necko \
 		  locale \
--- a/docshell/base/Makefile.in
+++ b/docshell/base/Makefile.in
@@ -51,16 +51,17 @@ LIBRARY_NAME	= basedocshell_s
 GRE_MODULE	= 1
 LIBXUL_LIBRARY	= 1
 
 REQUIRES	= xpcom \
 		  string \
 		  caps \
 		  necko \
 		  gfx \
+		  thebes \
 		  layout \
 		  content \
 		  dom \
 		  js \
 		  uriloader \
 		  exthandler \
 		  htmlparser \
 		  view \
--- a/docshell/build/Makefile.in
+++ b/docshell/build/Makefile.in
@@ -57,16 +57,17 @@ PACKAGE_FILE = docshell.pkg
 REQUIRES	= xpcom \
 		  string \
 		  dom \
 		  js \
 		  shistory \
 		  necko \
 		  nkcache \
 		  gfx \
+		  thebes \
 		  content \
 		  layout \
 		  webshell \
 		  widget \
 		  pref \
 		  view \
 		  intl \
 		  htmlparser \
--- a/dom/src/base/Makefile.in
+++ b/dom/src/base/Makefile.in
@@ -48,16 +48,17 @@ LIBXUL_LIBRARY	= 1
 
 REQUIRES	= xpcom \
 		  string \
 		  webbrwsr \
 		  commandhandler \
 		  js \
 		  widget \
 		  gfx \
+		  thebes \
 		  layout \
 		  content \
 		  caps \
 		  docshell \
 		  xpconnect \
 		  pref \
 		  oji \
 		  necko \
--- a/dom/src/offline/Makefile.in
+++ b/dom/src/offline/Makefile.in
@@ -46,16 +46,17 @@ MODULE         = dom
 LIBRARY_NAME   = jsdomoffline_s
 LIBXUL_LIBRARY = 1
 
 REQUIRES       = xpcom         \
 		 string        \
 		 content       \
 		 caps          \
 		 gfx           \
+		 thebes        \
 		 js            \
 		 layout        \
 		 locale        \
 		 necko         \
 		 nkcache       \
 		 pref          \
 		 prefetch      \
 		 widget        \
--- a/dom/src/storage/Makefile.in
+++ b/dom/src/storage/Makefile.in
@@ -46,16 +46,17 @@ MODULE         = dom
 LIBRARY_NAME   = jsdomstorage_s
 LIBXUL_LIBRARY = 1
 
 REQUIRES       = xpcom         \
                  string        \
                  content       \
                  caps          \
                  gfx           \
+                 thebes        \
                  js            \
                  layout        \
                  locale        \
                  necko         \
                  pref          \
                  unicharutil   \
                  widget        \
                  xpconnect     \
--- a/editor/composer/src/Makefile.in
+++ b/editor/composer/src/Makefile.in
@@ -60,16 +60,17 @@ REQUIRES	= xpcom \
 		  content \
 		  uriloader \
 		  txmgr \
 		  necko \
 		  pref \
 		  webshell \
 		  docshell \
 		  gfx \
+		  thebes \
 		  widget \
 		  xuldoc \
 		  txtsvc \
 		  imglib2 \
 		  commandhandler \
 		  composer \
 		  locale \
 		  $(NULL)
--- a/editor/libeditor/base/Makefile.in
+++ b/editor/libeditor/base/Makefile.in
@@ -54,16 +54,17 @@ REQUIRES	= xpcom \
 		  content \
 		  txmgr \
 		  txtsvc \
 		  htmlparser \
 		  necko \
 		  pref \
 		  view \
 		  gfx \
+		  thebes \
 		  widget \
 		  unicharutil \
 		  commandhandler \
 		  docshell \
 		  $(NULL)
 
 # Internal header files, needed by other editor sublibs:
 INTERNAL_HDR_DIR = ../internal
--- a/editor/libeditor/text/Makefile.in
+++ b/editor/libeditor/text/Makefile.in
@@ -54,16 +54,17 @@ REQUIRES	= xpcom \
 		  content \
 		  txmgr \
 		  txtsvc \
 		  htmlparser \
 		  necko \
 		  pref \
 		  lwbrk \
 		  gfx \
+		  thebes \
 		  widget \
 		  unicharutil \
 		  $(NULL)
 
 CPPSRCS		=                           \
 		nsPlaintextDataTransfer.cpp \
 		nsPlaintextEditor.cpp       \
 		nsTextEditUtils.cpp         \
--- a/editor/txtsvc/src/Makefile.in
+++ b/editor/txtsvc/src/Makefile.in
@@ -47,16 +47,17 @@ LIBRARY_NAME	= txtsvc_s
 FORCE_STATIC_LIB = 1
 MODULE_NAME	= nsTextServicesModule
 LIBXUL_LIBRARY	= 1
 
 REQUIRES	= xpcom \
 		  string \
 		  editor \
 		  gfx \
+		  thebes \
 		  layout \
 		  content \
 		  dom \
 		  widget \
 		  lwbrk \
 		  $(NULL)
 
 CPPSRCS		= \
--- a/embedding/browser/webBrowser/Makefile.in
+++ b/embedding/browser/webBrowser/Makefile.in
@@ -49,16 +49,17 @@ LIBRARY_NAME	= nsWebBrowser_s
 GRE_MODULE	= 1
 LIBXUL_LIBRARY	= 1
 
 REQUIRES	= xpcom \
 		  string \
 		  docshell \
 		  widget \
 		  gfx \
+		  thebes \
 		  layout \
 		  content \
 		  dom \
 		  js \
 		  necko \
 		  uriloader \
 		  shistory \
 		  webshell \
--- a/embedding/components/find/src/Makefile.in
+++ b/embedding/components/find/src/Makefile.in
@@ -46,16 +46,17 @@ MODULE		= find
 LIBRARY_NAME	= find_s
 LIBXUL_LIBRARY	= 1
 
 REQUIRES	= string \
 		  xpcom \
 		  dom \
 		  docshell \
 		  gfx \
+		  thebes \
 		  layout \
 		  editor \
 		  locale \
 		  content \
 		  widget \
 		  htmlparser \
 		  necko \
 		  unicharutil \
--- a/extensions/layout-debug/src/Makefile.in
+++ b/extensions/layout-debug/src/Makefile.in
@@ -50,16 +50,17 @@ MODULE_NAME	= nsLayoutDebugModule
 LIBXUL_LIBRARY = 1
 
 REQUIRES	= xpcom \
 		  string \
 		  windowwatcher \
 		  docshell \
 		  dom \
 		  gfx \
+		  thebes \
 		  content \
 		  necko \
 		  layout \
 		  widget \
 		  locale \
 		  view \
 		  pref \
 		  appshell \
--- a/gfx/public/nsIDeviceContext.h
+++ b/gfx/public/nsIDeviceContext.h
@@ -39,16 +39,18 @@
 #ifndef nsIDeviceContext_h___
 #define nsIDeviceContext_h___
 
 #include "nsISupports.h"
 #include "nsCoord.h"
 #include "nsRect.h"
 #include "nsIWidget.h"
 #include "nsIRenderingContext.h"
+// XXX we need only gfxTypes.h, but we cannot include it directly.
+#include "gfxPoint.h"
 
 class nsIView;
 class nsIFontMetrics;
 class nsIWidget;
 class nsIDeviceContextSpec;
 class nsIAtom;
 
 struct nsFont;
@@ -161,20 +163,20 @@ typedef void * nsNativeDeviceContext;
 #ifdef NS_PRINT_PREVIEW
 const PRUint8 kUseAltDCFor_NONE            = 0x00; // Do not use the AltDC for anything
 const PRUint8 kUseAltDCFor_FONTMETRICS     = 0x01; // Use it for only getting the font metrics
 const PRUint8 kUseAltDCFor_CREATERC_REFLOW = 0x02; // Use when creating RenderingContexts for Reflow
 const PRUint8 kUseAltDCFor_CREATERC_PAINT  = 0x04; // Use when creating RenderingContexts for Painting
 const PRUint8 kUseAltDCFor_SURFACE_DIM     = 0x08; // Use it for getting the Surface Dimensions
 #endif
 
-// 7353cfdf-964f-4c20-8729-b11729cc0000
+// 4dd372b6-ef19-4995-a7ac-ba3efd3f656f
 #define NS_IDEVICE_CONTEXT_IID   \
-{ 0x7353cfdf, 0x964f, 0x4c20, \
- { 0x87, 0x29, 0xb1, 0x17, 0x29, 0xcc, 0x00, 0x00 } }
+{ 0x4dd372b6, 0xef19, 0x4995, \
+ { 0xa7, 0xac, 0xba, 0x3e, 0xfd, 0x3f, 0x65, 0x6f } }
 
 //a cross platform way of specifying a native palette handle
 typedef void * nsPalette;
 
   //structure used to return information about a device's palette capabilities
   struct nsPaletteInfo {
      PRPackedBool  isPaletteDevice;
      PRUint16      sizePalette;  // number of entries in the palette
@@ -276,22 +278,34 @@ public:
 
   /**
    * Gets the number of app units in one CSS pixel; this number is global,
    * not unique to each device context.
    */
   static PRInt32 AppUnitsPerCSSPixel() { return 60; }
 
   /**
+   * Convert app units to CSS pixels which is used in gfx/thebes.
+   */
+  static gfxFloat AppUnitsToGfxCSSPixels(nscoord aAppUnits)
+  { return gfxFloat(aAppUnits) / AppUnitsPerCSSPixel(); }
+
+  /**
    * Gets the number of app units in one device pixel; this number is usually
    * a factor of AppUnitsPerCSSPixel(), although that is not guaranteed.
    */
   PRInt32 AppUnitsPerDevPixel() const { return mAppUnitsPerDevPixel; }
 
   /**
+   * Convert app units to device pixels which is used in gfx/thebes.
+   */
+  gfxFloat AppUnitsToGfxUnits(nscoord aAppUnits) const
+  { return gfxFloat(aAppUnits) / AppUnitsPerDevPixel(); }
+
+  /**
    * Gets the number of app units in one inch; this is the device's DPI
    * times AppUnitsPerDevPixel().
    */
   PRInt32 AppUnitsPerInch() const { return mAppUnitsPerInch; }
 
   /**
    * Fill in an nsFont based on the ID of a system font.  This function
    * may or may not fill in the size, so the size should be set to a
--- a/gfx/src/Makefile.in
+++ b/gfx/src/Makefile.in
@@ -54,16 +54,17 @@ REQUIRES	= xpcom \
 		  windowwatcher \
 		  dom \
 		  string \
 		  widget \
 		  locale \
 		  view \
 		  pref \
 		  unicharutil \
+		  thebes \
 		  $(NULL)
 
 DIRS        = shared
 
 ifdef MOZ_ENABLE_FREETYPE2
 DIRS        += freetype
 endif
 
--- a/gfx/src/thebes/nsThebesFontMetrics.cpp
+++ b/gfx/src/thebes/nsThebesFontMetrics.cpp
@@ -68,17 +68,17 @@ nsThebesFontMetrics::Init(const nsFont& 
     mFont = aFont;
     mLangGroup = aLangGroup;
     mDeviceContext = (nsThebesDeviceContext*)aContext;
     mP2A = mDeviceContext->AppUnitsPerDevPixel();
     mIsRightToLeft = PR_FALSE;
     mTextRunRTL = PR_FALSE;
 
     // work around layout giving us 0 sized fonts...
-    double size = NSAppUnitsToFloatPixels(aFont.size, mP2A);
+    gfxFloat size = gfxFloat(aFont.size) / mP2A;
     if (size == 0.0)
         size = 1.0;
 
     nsCString langGroup;
     if (aLangGroup) {
         const char* lg;
         mLangGroup->GetUTF8String(&lg);
         langGroup.Assign(lg);
--- a/layout/base/nsCSSRendering.h
+++ b/layout/base/nsCSSRendering.h
@@ -196,17 +196,17 @@ public:
    * aMapColor - color to evaluate
    * aIsPrinter - Is this a printing device
    * return - the transformed color
    */
   static nscolor TransformColor(nscolor  aMapColor,PRBool aNoBackGround);
 
   /**
    * Function for painting the decoration lines for the text.
-   * NOTE: aPt, aLineSize, aAscent, aOffset and aReferredHeight are non-rounded
+   * NOTE: aPt, aLineSize, aAscent, aOffset and aPreferredHeight are non-rounded
    *       device pixels, not app units.
    *   input:
    *     @param aGfxContext
    *     @param aColor            the color of the decoration line
    *     @param aPt               the top/left edge of the text
    *     @param aLineSize         the width and the height of the decoration
    *                              line
    *     @param aAscent           the ascent of the text
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -2136,63 +2136,61 @@ nsLayoutUtils::DrawImage(nsIRenderingCon
   nsCOMPtr<nsIImage> img(do_GetInterface(imgFrame));
   if (!img) return NS_ERROR_FAILURE;
 
   // twSrcRect is always in appunits (twips),
   // and has nothing to do with the current transform (it's a region
   // of the image)
   gfxRect pxSrc;
   if (aSourceRect) {
-    PRInt32 p2a = nsIDeviceContext::AppUnitsPerCSSPixel();
-    pxSrc.pos.x = NSAppUnitsToFloatPixels(aSourceRect->x, p2a);
-    pxSrc.pos.y = NSAppUnitsToFloatPixels(aSourceRect->y, p2a);
-    pxSrc.size.width = NSAppUnitsToFloatPixels(aSourceRect->width, p2a);
-    pxSrc.size.height = NSAppUnitsToFloatPixels(aSourceRect->height, p2a);
+    pxSrc.pos.x = nsIDeviceContext::AppUnitsToGfxCSSPixels(aSourceRect->x);
+    pxSrc.pos.y = nsIDeviceContext::AppUnitsToGfxCSSPixels(aSourceRect->y);
+    pxSrc.size.width = nsIDeviceContext::AppUnitsToGfxCSSPixels(aSourceRect->width);
+    pxSrc.size.height = nsIDeviceContext::AppUnitsToGfxCSSPixels(aSourceRect->height);
   } else {
     pxSrc.pos.x = pxSrc.pos.y = 0.0;
     PRInt32 w = 0, h = 0;
     aImage->GetWidth(&w);
     aImage->GetHeight(&h);
     pxSrc.size.width = gfxFloat(w);
     pxSrc.size.height = gfxFloat(h);
   }
 
   nsCOMPtr<nsIDeviceContext> dc;
   aRenderingContext->GetDeviceContext(*getter_AddRefs(dc));
-  PRInt32 d2a = dc->AppUnitsPerDevPixel();
 
   nsRefPtr<gfxContext> ctx = static_cast<gfxContext*>
                                         (aRenderingContext->GetNativeGraphicData(
       nsIRenderingContext::NATIVE_THEBES_CONTEXT));
 
   // the dest rect is affected by the current transform; that'll be
   // handled by Image::Draw(), when we actually set up the rectangle.
   
   // Snap the edges of where layout wants the image to the nearest
   // pixel, but then convert back to gfxFloats for the rest of the math.
   gfxRect pxDest;
   {
-    pxDest.pos.x = NSAppUnitsToFloatPixels(aDestRect.x, d2a);
-    pxDest.pos.y = NSAppUnitsToFloatPixels(aDestRect.y, d2a);
-    pxDest.size.width = NSAppUnitsToFloatPixels(aDestRect.width, d2a);
-    pxDest.size.height = NSAppUnitsToFloatPixels(aDestRect.height, d2a);
+    pxDest.pos.x = dc->AppUnitsToGfxUnits(aDestRect.x);
+    pxDest.pos.y = dc->AppUnitsToGfxUnits(aDestRect.y);
+    pxDest.size.width = dc->AppUnitsToGfxUnits(aDestRect.width);
+    pxDest.size.height = dc->AppUnitsToGfxUnits(aDestRect.height);
     if (ctx->UserToDevicePixelSnapped(pxDest))
       pxDest = ctx->DeviceToUser(pxDest);
   }
 
   // And likewise for the dirty rect.  (Is should be OK to round to
   // nearest rather than outwards, since any dirty rects coming from the
   // OS should be on pixel boundaries; the rest is other things it's
   // been intersected with, and we should be rounding those consistently.)
   gfxRect pxDirty;
   {
-    pxDirty.pos.x = NSAppUnitsToFloatPixels(dirtyRect.x, d2a);
-    pxDirty.pos.y = NSAppUnitsToFloatPixels(dirtyRect.y, d2a);
-    pxDirty.size.width = NSAppUnitsToFloatPixels(dirtyRect.width, d2a);
-    pxDirty.size.height = NSAppUnitsToFloatPixels(dirtyRect.height, d2a);
+    pxDirty.pos.x = dc->AppUnitsToGfxUnits(dirtyRect.x);
+    pxDirty.pos.y = dc->AppUnitsToGfxUnits(dirtyRect.y);
+    pxDirty.size.width = dc->AppUnitsToGfxUnits(dirtyRect.width);
+    pxDirty.size.height = dc->AppUnitsToGfxUnits(dirtyRect.height);
     if (ctx->UserToDevicePixelSnapped(pxDirty))
       pxDirty = ctx->DeviceToUser(pxDirty);
   }
 
   // Reduce the src rect to what's needed for the dirty rect.
   if (pxDirty.size.width != pxDest.size.width) {
     const gfxFloat ratio = pxSrc.size.width / pxDest.size.width;
     pxSrc.pos.x += (pxDirty.pos.x - pxDest.pos.x) * ratio;
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -655,20 +655,20 @@ public:
    * (the child of a scroll frame). In Gecko terms, it's approximately
    * equivalent to having a view, at least for simple HTML. However, views are
    * going away, so this is a cleaner definition.
    */
   static nsIFrame* GetClosestLayer(nsIFrame* aFrame);
 
   /**
    * Draw a single image.
-   *   @param aImage            The image.
    *   @param aRenderingContext Where to draw the image, set up with an
    *                            appropriate scale and transform for drawing in
    *                            app units (aDestRect).
+   *   @param aImage            The image.
    *   @param aDestRect         Where to draw the image (app units).
    *   @param aDirtyRect        Draw only within this region (rounded to the
    *                            nearest pixel); the intersection of
    *                            invalidation and clipping.
    *   @param aSourceRect       If null, draw the entire image so it fits in
    *                            aDestRect.  If non-null, the subregion of the
    *                            image that should be drawn (in app units, such
    *                            that converting it to CSS pixels yields image
--- a/layout/base/nsPresContext.h
+++ b/layout/base/nsPresContext.h
@@ -56,16 +56,18 @@
 #include "nsITimer.h"
 #include "nsCRT.h"
 #include "nsIPrintSettings.h"
 #include "nsPropertyTable.h"
 #include "nsGkAtoms.h"
 #include "nsIDocument.h"
 #include "nsInterfaceHashtable.h"
 #include "nsCycleCollectionParticipant.h"
+// XXX we need only gfxTypes.h, but we cannot include it directly.
+#include "gfxPoint.h"
 class nsImageLoader;
 #ifdef IBMBIDI
 class nsBidiPresUtils;
 #endif // IBMBIDI
 
 struct nsRect;
 
 class imgIRequest;
@@ -491,24 +493,30 @@ public:
   static PRInt32 AppUnitsToIntCSSPixels(nscoord aAppUnits)
   { return NSAppUnitsToIntPixels(aAppUnits,
                                  nsIDeviceContext::AppUnitsPerCSSPixel()); }
 
   static float AppUnitsToFloatCSSPixels(nscoord aAppUnits)
   { return NSAppUnitsToFloatPixels(aAppUnits,
                                    nsIDeviceContext::AppUnitsPerCSSPixel()); }
 
+  static gfxFloat AppUnitsToGfxCSSPixels(nscoord aAppUnits)
+  { return nsIDeviceContext::AppUnitsToGfxCSSPixels(aAppUnits); }
+
   nscoord DevPixelsToAppUnits(PRInt32 aPixels) const
   { return NSIntPixelsToAppUnits(aPixels,
                                  mDeviceContext->AppUnitsPerDevPixel()); }
 
   PRInt32 AppUnitsToDevPixels(nscoord aAppUnits) const
   { return NSAppUnitsToIntPixels(aAppUnits,
                                  mDeviceContext->AppUnitsPerDevPixel()); }
 
+  gfxFloat AppUnitsToGfxUnits(nscoord aAppUnits) const
+  { return mDeviceContext->AppUnitsToGfxUnits(aAppUnits); }
+
   nscoord TwipsToAppUnits(PRInt32 aTwips) const
   { return NSToCoordRound(NS_TWIPS_TO_INCHES(aTwips) *
                           mDeviceContext->AppUnitsPerInch()); }
 
   PRInt32 AppUnitsToTwips(nscoord aTwips) const
   { return NS_INCHES_TO_TWIPS((float)aTwips /
                               mDeviceContext->AppUnitsPerInch()); }
 
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -17,17 +17,17 @@
  *
  * 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):
  *   Steve Clark <buster@netscape.com>
- *   Håkan Waara <hwaara@chello.se>
+ *   HÃ¥kan Waara <hwaara@chello.se>
  *   Dan Rosen <dr@netscape.com>
  *   Daniel Glazman <glazman@netscape.com>
  *   Mats Palmgren <mats.palmgren@bredband.net>
  *
  * 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
@@ -4766,21 +4766,20 @@ PresShell::RenderDocument(const nsRect& 
 
     builder.EnterPresShell(rootFrame, rect);
 
     nsresult rv = rootFrame->BuildDisplayListForStackingContext(&builder, rect, &list);   
 
     builder.LeavePresShell(rootFrame, rect);
 
     if (NS_SUCCEEDED(rv)) {
-      nscoord appUnitsPerDevPixel = mPresContext->AppUnitsPerDevPixel();
       // Ensure that r.x,r.y gets drawn at (0,0)
       aThebesContext->Save();
-      aThebesContext->Translate(gfxPoint(-NSAppUnitsToFloatPixels(rect.x,appUnitsPerDevPixel),
-                                         -NSAppUnitsToFloatPixels(rect.y,appUnitsPerDevPixel)));
+      aThebesContext->Translate(gfxPoint(-mPresContext->AppUnitsToGfxUnits(rect.x),
+                                         -mPresContext->AppUnitsToGfxUnits(rect.y)));
 
       nsIDeviceContext* devCtx = mPresContext->DeviceContext();
       nsCOMPtr<nsIRenderingContext> rc;
       devCtx->CreateRenderingContextInstance(*getter_AddRefs(rc));
       rc->Init(devCtx, aThebesContext);
 
       nsRegion region(rect);
       list.OptimizeVisibility(&builder, &region);
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -5774,24 +5774,27 @@ nsBlockFrame::PaintTextDecorationLine(ns
   }
       
   // Only paint if we have a positive width
   if (width > 0) {
     const nsStyleVisibility* visibility = GetStyleVisibility();
     PRBool isRTL = visibility->mDirection == NS_STYLE_DIRECTION_RTL;
     nsRefPtr<gfxContext> ctx = (gfxContext*)
       aRenderingContext.GetNativeGraphicData(nsIRenderingContext::NATIVE_THEBES_CONTEXT);
-    gfxFloat a2p = 1.0 / PresContext()->AppUnitsPerDevPixel();
-    gfxPoint pt((start + aPt.x) * a2p, (aLine->mBounds.y + aPt.y) * a2p);
-    gfxSize size(width * a2p, aSize * a2p);
-    nsCSSRendering::PaintDecorationLine(ctx, aColor, pt, size,
-                                        aLine->GetAscent() * a2p, aOffset * a2p,
-                                        aSize * a2p, aDecoration,
-                                        NS_STYLE_BORDER_STYLE_SOLID,
-                                        isRTL);
+    PRInt32 app = PresContext()->AppUnitsPerDevPixel();
+    gfxPoint pt(PresContext()->AppUnitsToGfxUnits(start + aPt.x),
+                PresContext()->AppUnitsToGfxUnits(aLine->mBounds.y + aPt.y));
+    gfxSize size(PresContext()->AppUnitsToGfxUnits(width),
+                 PresContext()->AppUnitsToGfxUnits(aSize));
+    nsCSSRendering::PaintDecorationLine(
+      ctx, aColor, pt, size,
+      PresContext()->AppUnitsToGfxUnits(aLine->GetAscent()),
+      PresContext()->AppUnitsToGfxUnits(aOffset),
+      PresContext()->AppUnitsToGfxUnits(aSize),
+      aDecoration, NS_STYLE_BORDER_STYLE_SOLID, isRTL);
   }
 }
 
 #ifdef DEBUG
 static void DebugOutputDrawLine(PRInt32 aDepth, nsLineBox* aLine, PRBool aDrawn) {
   if (nsBlockFrame::gNoisyDamageRepair) {
     nsFrame::IndentBy(stdout, aDepth+1);
     nsRect lineArea = aLine->GetCombinedArea();
--- a/layout/generic/nsHTMLContainerFrame.cpp
+++ b/layout/generic/nsHTMLContainerFrame.cpp
@@ -209,22 +209,25 @@ nsHTMLContainerFrame::PaintTextDecoratio
       bp.side(side) = 0;
     }
   }
   const nsStyleVisibility* visibility = GetStyleVisibility();
   PRBool isRTL = visibility->mDirection == NS_STYLE_DIRECTION_RTL;
   nscoord innerWidth = mRect.width - bp.left - bp.right;
   nsRefPtr<gfxContext> ctx = (gfxContext*)
     aRenderingContext.GetNativeGraphicData(nsIRenderingContext::NATIVE_THEBES_CONTEXT);
-  gfxFloat a2p = 1.0 / PresContext()->AppUnitsPerDevPixel();
-  gfxPoint pt((bp.left + aPt.x) * a2p, (bp.top + aPt.y) * a2p);
-  gfxSize size(innerWidth * a2p, aSize * a2p);
-  nsCSSRendering::PaintDecorationLine(ctx, aColor, pt, size, aAscent * a2p,
-                                      aOffset * a2p, aSize * a2p, aDecoration,
-                                      NS_STYLE_BORDER_STYLE_SOLID, isRTL);
+  gfxPoint pt(PresContext()->AppUnitsToGfxUnits(bp.left + aPt.x),
+              PresContext()->AppUnitsToGfxUnits(bp.top + aPt.y));
+  gfxSize size(PresContext()->AppUnitsToGfxUnits(innerWidth),
+               PresContext()->AppUnitsToGfxUnits(aSize));
+  nsCSSRendering::PaintDecorationLine(
+    ctx, aColor, pt, size, PresContext()->AppUnitsToGfxUnits(aAscent),
+    PresContext()->AppUnitsToGfxUnits(aOffset),
+    PresContext()->AppUnitsToGfxUnits(aSize),
+    aDecoration, NS_STYLE_BORDER_STYLE_SOLID, isRTL);
 }
 
 void
 nsHTMLContainerFrame::GetTextDecorations(nsPresContext* aPresContext, 
                                          PRBool aIsBlock,
                                          PRUint8& aDecorations,
                                          nscolor& aUnderColor, 
                                          nscolor& aOverColor, 
--- a/layout/generic/nsInlineFrame.cpp
+++ b/layout/generic/nsInlineFrame.cpp
@@ -555,17 +555,17 @@ nsInlineFrame::ReflowFrames(nsPresContex
     // it).
     //
     // The height of our box is the sum of our font size plus the top
     // and bottom border and padding. The height of children do not
     // affect our height.
     fm->GetMaxAscent(aMetrics.ascent);
     fm->GetHeight(aMetrics.height);
     // Include the text-decoration lines to the height.
-    // Currently, only undeline is overflowable.
+    // Currently, only underline is overflowable.
     nscoord offset, size;
     fm->GetUnderline(offset, size);
     nscoord ascentAndUnderline =
       aPresContext->RoundAppUnitsToNearestDevPixels(aMetrics.ascent - offset) +
       aPresContext->RoundAppUnitsToNearestDevPixels(size);
     if (ascentAndUnderline > aMetrics.height)
       aMetrics.height = ascentAndUnderline;
   } else {
--- a/layout/generic/nsTextFrameThebes.cpp
+++ b/layout/generic/nsTextFrameThebes.cpp
@@ -3711,20 +3711,21 @@ nsTextFrame::GetSelectionDetails()
 }
 
 static void
 FillClippedRect(gfxContext* aCtx, nsPresContext* aPresContext,
                 nscolor aColor, const gfxRect& aDirtyRect, const gfxRect& aRect)
 {
   gfxRect r = aRect.Intersect(aDirtyRect);
   // For now, we need to put this in pixel coordinates
-  float t2p = 1.0f / aPresContext->AppUnitsPerDevPixel();
+  PRInt32 app = aPresContext->AppUnitsPerDevPixel();
   aCtx->NewPath();
   // pixel-snap
-  aCtx->Rectangle(gfxRect(r.X()*t2p, r.Y()*t2p, r.Width()*t2p, r.Height()*t2p), PR_TRUE);
+  aCtx->Rectangle(gfxRect(r.X() / app, r.Y() / app,
+                          r.Width() / app, r.Height() / app), PR_TRUE);
   aCtx->SetColor(gfxRGBA(aColor));
   aCtx->Fill();
 }
 
 void 
 nsTextFrame::PaintTextDecorations(gfxContext* aCtx, const gfxRect& aDirtyRect,
                                   const gfxPoint& aFramePt,
                                   nsTextPaintStyle& aTextPaintStyle,
@@ -3785,22 +3786,22 @@ nsTextFrame::PaintTextDecorations(gfxCon
       break;
     hasDecorations = context->HasTextDecorations();
   }
 
   if (!decorations)
     return;
 
   gfxFont::Metrics fontMetrics = GetFontMetrics(aProvider.GetFontGroup());
-  gfxFloat a2p = 1.0 / aTextPaintStyle.PresContext()->AppUnitsPerDevPixel();
+  PRInt32 app = aTextPaintStyle.PresContext()->AppUnitsPerDevPixel();
 
   // XXX aFramePt is in AppUnits, shouldn't it be nsFloatPoint?
-  gfxPoint pt(aFramePt.x * a2p, aFramePt.y * a2p);
-  gfxSize size(GetRect().width * a2p, 0);
-  gfxFloat ascent = mAscent * a2p;
+  gfxPoint pt(aFramePt.x / app, aFramePt.y / app);
+  gfxSize size(GetRect().width / app, 0);
+  gfxFloat ascent = mAscent / app;
 
   if (decorations & NS_FONT_DECORATION_OVERLINE) {
     size.height = fontMetrics.underlineSize;
     nsCSSRendering::PaintDecorationLine(
       aCtx, overColor, pt, size, ascent, ascent, size.height,
       NS_STYLE_TEXT_DECORATION_OVERLINE, NS_STYLE_BORDER_STYLE_SOLID,
       mTextRun->IsRightToLeft());
   }
@@ -4169,23 +4170,23 @@ nsTextFrame::PaintTextSelectionDecoratio
                              aProvider, mTextRun);
   gfxFloat xOffset, hyphenWidth;
   PRUint32 offset, length;
   SelectionType type;
   while (iterator.GetNextSegment(&xOffset, &offset, &length, &hyphenWidth, &type)) {
     gfxFloat advance = hyphenWidth +
       mTextRun->GetAdvanceWidth(offset, length, &aProvider);
     if (type == aSelectionType) {
-      gfxFloat a2p = 1.0 / aTextPaintStyle.PresContext()->AppUnitsPerDevPixel();
+      PRInt32 app = aTextPaintStyle.PresContext()->AppUnitsPerDevPixel();
       // XXX aTextBaselinePt is in AppUnits, shouldn't it be nsFloatPoint?
-      gfxPoint pt((aTextBaselinePt.x + xOffset) * a2p,
-                  (aTextBaselinePt.y - mAscent) * a2p);
-      gfxFloat width = PR_ABS(advance) * a2p;
+      gfxPoint pt((aTextBaselinePt.x + xOffset) / app,
+                  (aTextBaselinePt.y - mAscent) / app);
+      gfxFloat width = PR_ABS(advance) / app;
       DrawSelectionDecorations(aCtx, aSelectionType, aTextPaintStyle,
-                               pt, width, mAscent * a2p, decorationMetrics,
+                               pt, width, mAscent / app, decorationMetrics,
                                mTextRun->IsRightToLeft());
     }
     iterator.UpdateWithAdvance(advance);
   }
 }
 
 PRBool
 nsTextFrame::PaintTextWithSelection(gfxContext* aCtx,
--- a/layout/inspector/src/Makefile.in
+++ b/layout/inspector/src/Makefile.in
@@ -45,16 +45,17 @@ include $(DEPTH)/config/autoconf.mk
 MODULE = inspector
 LIBRARY_NAME = inspector_s
 LIBXUL_LIBRARY = 1
 
 REQUIRES	= xpcom \
 		  string \
 		  dom \
 		  gfx \
+		  thebes \
 		  layout \
 		  content \
 		  widget \
 		  locale \
 		  necko \
 		  docshell \
 		  view \
 		  webshell \
--- a/layout/printing/Makefile.in
+++ b/layout/printing/Makefile.in
@@ -48,16 +48,17 @@ LIBRARY_NAME	= gkprinting_s
 LIBXUL_LIBRARY	= 1
 
 REQUIRES	= xpcom \
 		  string \
 		  content \
 		  dom \
 		  widget \
 		  gfx \
+		  thebes \
 		  view \
 		  necko \
 		  webshell \
 		  docshell \
 		  uriloader \
 		  webbrwsr \
 		  locale \
 		  intl \
--- a/layout/style/Makefile.in
+++ b/layout/style/Makefile.in
@@ -51,16 +51,17 @@ MODULE		= layout
 LIBRARY_NAME	= gkstyle_s
 LIBXUL_LIBRARY	= 1
 
 REQUIRES	= xpcom \
 		  string \
 		  dom \
 		  content \
 		  gfx \
+		  thebes \
 		  widget \
 		  caps \
 		  locale \
 		  unicharutil \
 		  js \
 		  necko \
 		  mimetype \
 		  webshell \
--- a/layout/xul/base/src/nsTextBoxFrame.cpp
+++ b/layout/xul/base/src/nsTextBoxFrame.cpp
@@ -447,24 +447,24 @@ nsTextBoxFrame::PaintTitle(nsIRenderingC
     nscoord offset;
     nscoord size;
     nscoord baseline;
     fontMet->GetMaxAscent(baseline);
     PRBool isRTL = vis->mDirection == NS_STYLE_DIRECTION_RTL;
 
     nsRefPtr<gfxContext> ctx = (gfxContext*)
       aRenderingContext.GetNativeGraphicData(nsIRenderingContext::NATIVE_THEBES_CONTEXT);
-    gfxFloat a2p = 1.0 / presContext->AppUnitsPerDevPixel();
-    gfxPoint pt(textRect.x * a2p, textRect.y * a2p);
-    gfxFloat width = textRect.width * a2p;
-    gfxFloat baselinePixel = baseline * a2p;
+    gfxPoint pt(presContext->AppUnitsToGfxUnits(textRect.x),
+                presContext->AppUnitsToGfxUnits(textRect.y));
+    gfxFloat width = presContext->AppUnitsToGfxUnits(textRect.width);
+    gfxFloat baselinePixel = presContext->AppUnitsToGfxUnits(baseline);
     if (decorations & (NS_FONT_DECORATION_OVERLINE | NS_FONT_DECORATION_UNDERLINE)) {
       fontMet->GetUnderline(offset, size);
-      gfxFloat offsetPixel = offset * a2p;
-      gfxFloat sizePixel = size * a2p;
+      gfxFloat offsetPixel = presContext->AppUnitsToGfxUnits(offset);
+      gfxFloat sizePixel = presContext->AppUnitsToGfxUnits(size);
       if (decorations & NS_FONT_DECORATION_OVERLINE) {
         nsCSSRendering::PaintDecorationLine(ctx, overColor,
                                             pt, gfxSize(width, sizePixel),
                                             baselinePixel, baselinePixel,
                                             sizePixel,
                                             NS_STYLE_TEXT_DECORATION_OVERLINE,
                                             NS_STYLE_BORDER_STYLE_SOLID,
                                             isRTL);
@@ -476,18 +476,18 @@ nsTextBoxFrame::PaintTitle(nsIRenderingC
                                             sizePixel,
                                             NS_STYLE_TEXT_DECORATION_UNDERLINE,
                                             NS_STYLE_BORDER_STYLE_SOLID,
                                             isRTL);
       }
     }
     if (decorations & NS_FONT_DECORATION_LINE_THROUGH) {
       fontMet->GetStrikeout(offset, size);
-      gfxFloat offsetPixel = offset * a2p;
-      gfxFloat sizePixel = size * a2p;
+      gfxFloat offsetPixel = presContext->AppUnitsToGfxUnits(offset);
+      gfxFloat sizePixel = presContext->AppUnitsToGfxUnits(size);
       nsCSSRendering::PaintDecorationLine(ctx, underColor,
                                           pt, gfxSize(width, sizePixel),
                                           baselinePixel, offsetPixel,
                                           sizePixel,
                                           NS_STYLE_TEXT_DECORATION_LINE_THROUGH,
                                           NS_STYLE_BORDER_STYLE_SOLID,
                                           isRTL);
     }
--- a/modules/oji/src/Makefile.in
+++ b/modules/oji/src/Makefile.in
@@ -59,16 +59,17 @@ REQUIRES	= xpcom \
 		  caps \
 		  pref \
 		  necko \
 		  dom \
 		  widget \
 		  xpconnect \
 		  windowwatcher \
 		  gfx \
+		  thebes \
 		  content \
 		  layout \
 		  docshell \
 		  webbrwsr \
 		  intl \
 		  locale \
 		  $(NULL)
 
--- a/modules/plugin/base/src/Makefile.in
+++ b/modules/plugin/base/src/Makefile.in
@@ -61,16 +61,17 @@ REQUIRES	= xpcom \
 		  pref \
 		  necko \
 		  caps \
 		  intl \
 		  uconv \
 		  unicharutil \
 		  dom \
 		  gfx \
+		  thebes \
 		  content \
 		  widget \
 		  mimetype \
 		  oji \
 		  exthandler \
 		  docshell \
 		  windowwatcher \
 		  imglib2 \
--- a/toolkit/components/autocomplete/src/Makefile.in
+++ b/toolkit/components/autocomplete/src/Makefile.in
@@ -56,16 +56,17 @@ REQUIRES =	xpcom \
 		dom \
 		layout \
 		unicharutil \
 		toolkitcomps \
 		widget \
 		content \
 		view \
 		gfx \
+		thebes \
 		locale \
 		necko \
 	 	$(NULL)
 
 CPPSRCS = nsAutoCompleteController.cpp \
           nsAutoCompleteSimpleResult.cpp \
           $(NULL)
 
--- a/toolkit/components/build/Makefile.in
+++ b/toolkit/components/build/Makefile.in
@@ -76,16 +76,17 @@ REQUIRES = 	\
 		windowwatcher \
 		uriloader \
 		xpinstall \
 		xulapp \
 		embed_base \
 		content \
 		find \
 		gfx \
+		thebes \
 		locale \
 		unicharutil \
 		xuldoc \
 		alerts \
 		url-classifier \
 		feeds \
 		storage \
 		$(NULL)
--- a/toolkit/components/satchel/src/Makefile.in
+++ b/toolkit/components/satchel/src/Makefile.in
@@ -54,16 +54,17 @@ REQUIRES =	\
 		xpcom \
 		string \
 		autocomplete \
 		uriloader \
 		dom \
 		layout \
 		docshell \
 		gfx \
+		thebes \
 		necko \
 		widget \
 		content \
 		view \
 		locale \
 		unicharutil \
 		intl \
 		pref \
--- a/toolkit/components/typeaheadfind/src/Makefile.in
+++ b/toolkit/components/typeaheadfind/src/Makefile.in
@@ -50,16 +50,17 @@ LIBXUL_LIBRARY = 1
 PACKAGE_FILE = typeaheadfind.pkg
 
 REQUIRES	= content \
 		  docshell \
 		  dom \
 		  editor \
 		  find \
 		  gfx \
+		  thebes \
 		  layout \
 		  locale \
 		  necko \
 		  pref \
 		  string \
 		  unicharutil \
 		  uriloader \
 		  view \
--- a/uriloader/base/Makefile.in
+++ b/uriloader/base/Makefile.in
@@ -50,16 +50,17 @@ LIBXUL_LIBRARY  = 1
 REQUIRES	= xpcom \
 		  string \
 		  necko \
 		  dom \
 		  exthandler \
 		  js \
 		  docshell \
 		  gfx \
+		  thebes \
 		  layout \
 		  content \
 		  widget \
 		  caps \
 		  intl \
 		  xpconnect \
 		  mimetype \
 		  locale \
--- a/xpfe/appshell/src/Makefile.in
+++ b/xpfe/appshell/src/Makefile.in
@@ -54,16 +54,17 @@ LIBXUL_LIBRARY	= 1
 PACKAGE_FILE = appshell.pkg
 
 REQUIRES	= xpcom \
 		  string \
 		  widget \
 		  docshell \
 		  webshell \
 		  gfx \
+		  thebes \
 		  layout \
 		  content \
 		  dom \
 		  necko \
 		  uriloader \
 		  js \
 		  locale \
 		  webbrwsr \
--- a/xpfe/components/winhooks/Makefile.in
+++ b/xpfe/components/winhooks/Makefile.in
@@ -59,16 +59,17 @@ REQUIRES	= \
 		  intl \
 		  appshell \
 		  necko \
 		  layout \
 		  content \
 		  widget \
 		  imglib2 \
 		  gfx \
+		  thebes \
 		  locale \
 		  xulapp \
 		  embed_base \
 		  $(NULL)
 
 FORCE_STATIC_LIB = 1
 
 ifdef MOZ_XUL_APP