Bug 651017, part 1: minimize inclusion of ns*DeviceContext.h; move the printing error codes to nsIDeviceContextSpec.h; os2 small widget cleanup.
authorZack Weinberg <zackw@panix.com>
Sat, 16 Apr 2011 18:22:41 -0700
changeset 68306 a06a2b7fda72921efb5d5e0957fbbc5c6fa76afd
parent 68305 2b974a79020f0394a01a3acaa71a21c9666ee7ba
child 68307 b4efed6c459c3389b53d5c62f18248ac3fa7dfde
push idunknown
push userunknown
push dateunknown
bugs651017
milestone6.0a1
Bug 651017, part 1: minimize inclusion of ns*DeviceContext.h; move the printing error codes to nsIDeviceContextSpec.h; os2 small widget cleanup.
content/canvas/src/nsCanvasRenderingContext2D.cpp
content/events/src/nsEventStateManager.cpp
content/html/content/src/nsHTMLFontElement.cpp
docshell/base/nsDocShell.h
dom/base/nsScreen.cpp
embedding/browser/webBrowser/nsWebBrowser.cpp
embedding/components/windowwatcher/src/nsWindowWatcher.cpp
gfx/src/nsIDeviceContext.h
gfx/src/nsRenderingContext.h
layout/base/nsCSSFrameConstructor.cpp
layout/base/nsCSSRendering.cpp
layout/base/nsCSSRenderingBorders.cpp
layout/base/nsCaret.cpp
layout/base/nsDocumentViewer.cpp
layout/base/nsPresShell.cpp
layout/forms/nsComboboxControlFrame.cpp
layout/forms/nsImageControlFrame.cpp
layout/forms/nsListControlFrame.cpp
layout/forms/nsTextControlFrame.cpp
layout/generic/nsCanvasFrame.cpp
layout/generic/nsFrame.cpp
layout/generic/nsHTMLContainerFrame.cpp
layout/generic/nsHTMLContainerFrame.h
layout/generic/nsHTMLReflowState.cpp
layout/generic/nsImageFrame.cpp
layout/generic/nsPageContentFrame.cpp
layout/generic/nsPageFrame.cpp
layout/generic/nsSelection.cpp
layout/generic/nsSimplePageSequence.cpp
layout/generic/nsTextFrameThebes.cpp
layout/mathml/nsMathMLChar.cpp
layout/printing/nsPrintEngine.cpp
layout/style/StyleRule.cpp
layout/style/nsMediaFeatures.cpp
layout/style/nsRuleNode.cpp
layout/style/nsStyleStruct.cpp
layout/xul/base/src/nsBox.cpp
layout/xul/base/src/nsDocElementBoxFrame.cpp
layout/xul/base/src/nsImageBoxFrame.cpp
layout/xul/base/src/nsLeafBoxFrame.cpp
layout/xul/base/src/nsListBoxBodyFrame.cpp
layout/xul/base/src/nsMenuPopupFrame.cpp
layout/xul/base/src/nsTextBoxFrame.cpp
layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
view/src/nsView.cpp
widget/public/nsIDeviceContextSpec.h
widget/src/android/nsWindow.cpp
widget/src/cocoa/nsChildView.mm
widget/src/cocoa/nsNativeThemeCocoa.h
widget/src/gtk2/nsNativeThemeGTK.cpp
widget/src/gtk2/nsPSPrinters.cpp
widget/src/gtk2/nsWindow.cpp
widget/src/os2/nsWindow.cpp
widget/src/qt/nsNativeThemeQt.cpp
widget/src/qt/nsNativeThemeQt.h
widget/src/qt/nsWindow.cpp
widget/src/windows/nsNativeThemeWin.cpp
widget/src/windows/nsWindow.cpp
widget/src/windows/nsWindowGfx.cpp
--- a/content/canvas/src/nsCanvasRenderingContext2D.cpp
+++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp
@@ -71,17 +71,16 @@
 #include "nsComputedDOMStyle.h"
 #include "nsStyleSet.h"
 
 #include "nsPrintfCString.h"
 
 #include "nsReadableUtils.h"
 
 #include "nsColor.h"
-#include "nsIDeviceContext.h"
 #include "nsGfxCIID.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsIDocShell.h"
 #include "nsIDOMWindow.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIDocShellTreeNode.h"
--- a/content/events/src/nsEventStateManager.cpp
+++ b/content/events/src/nsEventStateManager.cpp
@@ -81,17 +81,16 @@
 #include "nsImageMapUtils.h"
 #include "nsIHTMLDocument.h"
 #include "nsINameSpaceManager.h"
 #include "nsIBaseWindow.h"
 #include "nsIView.h"
 #include "nsIViewManager.h"
 #include "nsISelection.h"
 #include "nsFrameSelection.h"
-#include "nsIDeviceContext.h"
 #include "nsIPrivateDOMEvent.h"
 #include "nsIDOMWindowInternal.h"
 #include "nsPIDOMWindow.h"
 #include "nsPIWindowRoot.h"
 #include "nsIDOMEventTarget.h"
 #include "nsIEnumerator.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIDocShellTreeNode.h"
--- a/content/html/content/src/nsHTMLFontElement.cpp
+++ b/content/html/content/src/nsHTMLFontElement.cpp
@@ -34,17 +34,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsCOMPtr.h"
 #include "nsIDOMHTMLFontElement.h"
 #include "nsIDOMEventTarget.h"
 #include "nsGenericHTMLElement.h"
 #include "nsGkAtoms.h"
-#include "nsIDeviceContext.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
 #include "nsMappedAttributes.h"
 #include "nsRuleData.h"
 #include "nsIDocument.h"
 
 class nsHTMLFontElement : public nsGenericHTMLElement,
                           public nsIDOMHTMLFontElement
--- a/docshell/base/nsDocShell.h
+++ b/docshell/base/nsDocShell.h
@@ -52,17 +52,16 @@
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIDocShellTreeNode.h"
 #include "nsIBaseWindow.h"
 #include "nsIScrollable.h"
 #include "nsITextScroll.h"
 #include "nsIDocShellTreeOwner.h"
 #include "nsIContentViewerContainer.h"
-#include "nsIDeviceContext.h"
 
 #include "nsDocLoader.h"
 #include "nsIURILoader.h"
 #include "nsIEditorDocShell.h"
 
 #include "nsWeakReference.h"
 
 // Local Includes
--- a/dom/base/nsScreen.cpp
+++ b/dom/base/nsScreen.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 "nscore.h"
 #include "nsScreen.h"
 #include "nsIDocShell.h"
-#include "nsIDeviceContext.h"
 #include "nsPresContext.h"
 #include "nsCOMPtr.h"
 #include "nsDOMClassInfo.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsLayoutUtils.h"
 
 //
 //  Screen class implementation
--- a/embedding/browser/webBrowser/nsWebBrowser.cpp
+++ b/embedding/browser/webBrowser/nsWebBrowser.cpp
@@ -71,17 +71,16 @@
 #include "nsCWebBrowserPersist.h"
 #include "nsIServiceManager.h"
 #include "nsAutoPtr.h"
 #include "nsFocusManager.h"
 #include "Layers.h"
 #include "gfxContext.h"
 
 // for painting the background window
-#include "nsIDeviceContext.h"
 #include "nsIRegion.h"
 #include "nsILookAndFeel.h"
 
 // Printing Includes
 #ifdef NS_PRINTING
 #include "nsIWebBrowserPrint.h"
 #include "nsIContentViewer.h"
 #endif
--- a/embedding/components/windowwatcher/src/nsWindowWatcher.cpp
+++ b/embedding/components/windowwatcher/src/nsWindowWatcher.cpp
@@ -79,17 +79,16 @@
 #include "nsIXPConnect.h"
 #include "nsPIDOMWindow.h"
 #include "nsIMarkupDocumentViewer.h"
 #include "nsIContentViewer.h"
 #include "nsIDocumentViewer.h"
 #include "nsIWindowProvider.h"
 #include "nsIMutableArray.h"
 #include "nsISupportsArray.h"
-#include "nsIDeviceContext.h"
 #include "nsIDOMStorageObsolete.h"
 #include "nsIDOMStorage.h"
 #include "nsPIDOMStorage.h"
 #include "nsIWidget.h"
 #include "nsFocusManager.h"
 #include "nsIPresShell.h"
 #include "nsPresContext.h"
 
--- a/gfx/src/nsIDeviceContext.h
+++ b/gfx/src/nsIDeviceContext.h
@@ -36,143 +36,29 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsIDeviceContext_h___
 #define nsIDeviceContext_h___
 
 #include "nsISupports.h"
 #include "nsCoord.h"
-#include "nsRect.h"
 #include "gfxTypes.h"
 #include "nsStringFwd.h"
 
 class nsIView;
 class nsFontMetrics;
 class nsIWidget;
 class nsIDeviceContextSpec;
 class nsIAtom;
+class nsRect;
 class gfxUserFontSet;
 class nsRenderingContext;
-
 struct nsFont;
 
-//a cross platform way of specifying a native device context
-typedef void * nsNativeDeviceContext;
-
-/* error codes for printer device contexts */
-#define NS_ERROR_GFX_PRINTER_BASE (1) /* adjustable :-) */
-/* Unix: print command (lp/lpr) not found */
-#define NS_ERROR_GFX_PRINTER_CMD_NOT_FOUND          \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+1)
-/* Unix: print command returned an error */  
-#define NS_ERROR_GFX_PRINTER_CMD_FAILURE            \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+2)
-/* no printer available (e.g. cannot find _any_ printer) */
-#define NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE  \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+3)
-/* _specified_ (by name) printer not found */
-#define NS_ERROR_GFX_PRINTER_NAME_NOT_FOUND         \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+4)
-/* access to printer denied */
-#define NS_ERROR_GFX_PRINTER_ACCESS_DENIED          \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+5)
-/* invalid printer attribute (for example: unsupported paper size etc.) */
-#define NS_ERROR_GFX_PRINTER_INVALID_ATTRIBUTE      \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+6)
-/* printer not "ready" (offline ?) */
-#define NS_ERROR_GFX_PRINTER_PRINTER_NOT_READY     \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+8)
-/* printer out of paper */
-#define NS_ERROR_GFX_PRINTER_OUT_OF_PAPER           \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+9)
-/* generic printer I/O error */
-#define NS_ERROR_GFX_PRINTER_PRINTER_IO_ERROR       \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+10)
-/* print-to-file: could not open output file */
-#define NS_ERROR_GFX_PRINTER_COULD_NOT_OPEN_FILE    \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+11)
-/* print-to-file: I/O error while printing to file */
-#define NS_ERROR_GFX_PRINTER_FILE_IO_ERROR          \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+12)
-/* print preview: needs at least one printer */
-#define NS_ERROR_GFX_PRINTER_PRINTPREVIEW          \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+13)
-/* print: starting document */
-#define NS_ERROR_GFX_PRINTER_STARTDOC          \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+14)
-/* print: ending document */
-#define NS_ERROR_GFX_PRINTER_ENDDOC          \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+15)
-/* print: starting page */
-#define NS_ERROR_GFX_PRINTER_STARTPAGE          \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+16)
-/* print: ending page */
-#define NS_ERROR_GFX_PRINTER_ENDPAGE          \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+17)
-/* print: print while in print preview */
-#define NS_ERROR_GFX_PRINTER_PRINT_WHILE_PREVIEW          \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+18)
-/* requested page size not supported by printer */
-#define NS_ERROR_GFX_PRINTER_PAPER_SIZE_NOT_SUPPORTED \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+19)
-/* requested page orientation not supported */
-#define NS_ERROR_GFX_PRINTER_ORIENTATION_NOT_SUPPORTED \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+20)
-/* requested colorspace not supported (like printing "color" on a "grayscale"-only printer) */
-#define NS_ERROR_GFX_PRINTER_COLORSPACE_NOT_SUPPORTED \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+21)
-/* too many copies requested */
-#define NS_ERROR_GFX_PRINTER_TOO_MANY_COPIES \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+22)
-/* driver configuration error */
-#define NS_ERROR_GFX_PRINTER_DRIVER_CONFIGURATION_ERROR \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+23)
-/* The document is still being loaded, can't Print Preview */
-#define NS_ERROR_GFX_PRINTER_DOC_IS_BUSY_PP \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+24)
-/* The document was asked to be destroyed while we were preparing printing */
-#define NS_ERROR_GFX_PRINTER_DOC_WAS_DESTORYED \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+25)
-/* Cannot Print or Print Preview XUL Documents */
-#define NS_ERROR_GFX_PRINTER_NO_XUL \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+26)
-/* The toolkit no longer supports the Print Dialog (for embedders) */
-#define NS_ERROR_GFX_NO_PRINTDIALOG_IN_TOOLKIT \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+27)
-/* The was wasn't any Print Prompt service registered (this shouldn't happen) */
-#define NS_ERROR_GFX_NO_PRINTROMPTSERVICE \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+28)
-/* requested plex mode not supported by printer */
-#define NS_ERROR_GFX_PRINTER_PLEX_NOT_SUPPORTED \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+29)
-/* The document is still being loaded */
-#define NS_ERROR_GFX_PRINTER_DOC_IS_BUSY \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+30)
-/* Printing is not implemented */
-#define NS_ERROR_GFX_PRINTING_NOT_IMPLEMENTED \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+31)
-/* Cannot load the matching print module */
-#define NS_ERROR_GFX_COULD_NOT_LOAD_PRINT_MODULE \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+32)   
-/* requested resolution/quality mode not supported by printer */
-#define NS_ERROR_GFX_PRINTER_RESOLUTION_NOT_SUPPORTED \
-  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+33)
-      
-/**
- * Conts need for Print Preview
- */
-#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
-
 #define NS_IDEVICE_CONTEXT_IID   \
 { 0x30a9d22f, 0x8e51, 0x40af, \
   { 0xa1, 0xf5, 0x48, 0xe3, 0x00, 0xaa, 0xa9, 0x27 } }
 
   typedef enum {
     eSystemFont_Caption,         // css2
     eSystemFont_Icon,
     eSystemFont_Menu,
--- a/gfx/src/nsRenderingContext.h
+++ b/gfx/src/nsRenderingContext.h
@@ -42,16 +42,17 @@
 #include "nsAutoPtr.h"
 #include "nsCOMPtr.h"
 #include "nsIDeviceContext.h"
 #include "nsFontMetrics.h"
 #include "nsColor.h"
 #include "nsCoord.h"
 #include "gfxContext.h"
 
+struct nsPoint;
 class nsIntRegion;
 
 typedef enum {
     nsLineStyle_kNone   = 0,
     nsLineStyle_kSolid  = 1,
     nsLineStyle_kDashed = 2,
     nsLineStyle_kDotted = 3
 } nsLineStyle;
--- a/layout/base/nsCSSFrameConstructor.cpp
+++ b/layout/base/nsCSSFrameConstructor.cpp
@@ -79,17 +79,16 @@
 #include "nsISelectControlFrame.h"
 #include "nsIDOMCharacterData.h"
 #include "nsIDOMHTMLImageElement.h"
 #include "nsPlaceholderFrame.h"
 #include "nsTableRowGroupFrame.h"
 #include "nsStyleChangeList.h"
 #include "nsIFormControl.h"
 #include "nsCSSAnonBoxes.h"
-#include "nsIDeviceContext.h"
 #include "nsTextFragment.h"
 #include "nsIAnonymousContentCreator.h"
 #include "nsFrameManager.h"
 #include "nsLegendFrame.h"
 #include "nsIContentIterator.h"
 #include "nsBoxLayoutState.h"
 #include "nsBindingManager.h"
 #include "nsXBLBinding.h"
--- a/layout/base/nsCSSRendering.cpp
+++ b/layout/base/nsCSSRendering.cpp
@@ -52,17 +52,16 @@
 #include "nsRect.h"
 #include "nsIViewManager.h"
 #include "nsIPresShell.h"
 #include "nsFrameManager.h"
 #include "nsStyleContext.h"
 #include "nsGkAtoms.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsTransform2D.h"
-#include "nsIDeviceContext.h"
 #include "nsIContent.h"
 #include "nsIDocument.h"
 #include "nsIScrollableFrame.h"
 #include "imgIRequest.h"
 #include "imgIContainer.h"
 #include "nsCSSRendering.h"
 #include "nsCSSColorUtils.h"
 #include "nsITheme.h"
--- a/layout/base/nsCSSRenderingBorders.cpp
+++ b/layout/base/nsCSSRenderingBorders.cpp
@@ -43,17 +43,16 @@
 #include "nsPoint.h"
 #include "nsRect.h"
 #include "nsIViewManager.h"
 #include "nsFrameManager.h"
 #include "nsStyleContext.h"
 #include "nsGkAtoms.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsTransform2D.h"
-#include "nsIDeviceContext.h"
 #include "nsIContent.h"
 #include "nsIDocument.h"
 #include "nsIScrollableFrame.h"
 #include "imgIRequest.h"
 #include "imgIContainer.h"
 #include "nsCSSRendering.h"
 #include "nsCSSColorUtils.h"
 #include "nsITheme.h"
--- a/layout/base/nsCaret.cpp
+++ b/layout/base/nsCaret.cpp
@@ -52,17 +52,16 @@
 #include "nsIDOMNode.h"
 #include "nsIDOMRange.h"
 #include "nsISelection.h"
 #include "nsISelectionPrivate.h"
 #include "nsIDOMCharacterData.h"
 #include "nsIContent.h"
 #include "nsIPresShell.h"
 #include "nsRenderingContext.h"
-#include "nsIDeviceContext.h"
 #include "nsPresContext.h"
 #include "nsILookAndFeel.h"
 #include "nsBlockFrame.h"
 #include "nsISelectionController.h"
 #include "nsDisplayList.h"
 #include "nsCaret.h"
 #include "nsTextFrame.h"
 #include "nsXULPopupManager.h"
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -75,17 +75,16 @@
 #include "nsIDOMHTMLElement.h"
 #include "nsIDOMRange.h"
 #include "nsContentCID.h"
 #include "nsLayoutCID.h"
 #include "nsContentUtils.h"
 #include "nsLayoutStylesheetCache.h"
 
 #include "nsViewsCID.h"
-#include "nsIDeviceContext.h"
 #include "nsIDeviceContextSpec.h"
 #include "nsIViewManager.h"
 #include "nsIView.h"
 
 #include "nsIPageSequenceFrame.h"
 #include "nsIURL.h"
 #include "nsNetUtil.h"
 #include "nsIContentViewerEdit.h"
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -79,17 +79,16 @@
 #include "prmem.h"
 #include "prprf.h"
 #include "prinrval.h"
 #include "nsTArray.h"
 #include "nsCOMArray.h"
 #include "nsHashtable.h"
 #include "nsIViewObserver.h"
 #include "nsContainerFrame.h"
-#include "nsIDeviceContext.h"
 #include "nsEventStateManager.h"
 #include "nsDOMEvent.h"
 #include "nsGUIEvent.h"
 #include "nsHTMLParts.h"
 #include "nsContentUtils.h"
 #include "nsISelection.h"
 #include "nsISelectionController.h"
 #include "nsISelectionPrivate.h"
@@ -8076,17 +8075,16 @@ nsIPresShell::RemoveRefreshObserverExter
 // End of protected and private methods on the PresShell
 //------------------------------------------------------
 
 // Start of DEBUG only code
 
 #ifdef NS_DEBUG
 #include "nsViewsCID.h"
 #include "nsWidgetsCID.h"
-#include "nsIDeviceContext.h"
 #include "nsIURL.h"
 #include "nsILinkHandler.h"
 
 static NS_DEFINE_CID(kViewManagerCID, NS_VIEW_MANAGER_CID);
 
 static void
 LogVerifyMessage(nsIFrame* k1, nsIFrame* k2, const char* aMsg)
 {
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -51,17 +51,16 @@
 #include "nsIDOMElement.h"
 #include "nsIListControlFrame.h"
 #include "nsIDOMHTMLCollection.h" 
 #include "nsIDOMHTMLSelectElement.h" 
 #include "nsIDOMHTMLOptionElement.h" 
 #include "nsIDOMNSHTMLOptionCollectn.h" 
 #include "nsPIDOMWindow.h"
 #include "nsIPresShell.h"
-#include "nsIDeviceContext.h"
 #include "nsIView.h"
 #include "nsIViewManager.h"
 #include "nsEventDispatcher.h"
 #include "nsIEventStateManager.h"
 #include "nsIEventListenerManager.h"
 #include "nsIDOMNode.h"
 #include "nsIPrivateDOMEvent.h"
 #include "nsISelectControlFrame.h"
--- a/layout/forms/nsImageControlFrame.cpp
+++ b/layout/forms/nsImageControlFrame.cpp
@@ -41,17 +41,16 @@
 #include "nsHTMLParts.h"
 #include "nsPresContext.h"
 #include "nsIPresShell.h"
 #include "nsStyleContext.h"
 #include "nsLeafFrame.h"
 #include "nsCSSRendering.h"
 #include "nsISupports.h"
 #include "nsGkAtoms.h"
-#include "nsIDeviceContext.h"
 #include "nsStyleConsts.h"
 #include "nsFormControlFrame.h"
 #include "nsGUIEvent.h"
 #include "nsIServiceManager.h"
 #include "nsContainerFrame.h"
 #include "nsLayoutUtils.h"
 #ifdef ACCESSIBILITY
 #include "nsAccessibilityService.h"
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -40,23 +40,22 @@
 #include "nscore.h"
 #include "nsCOMPtr.h"
 #include "nsReadableUtils.h"
 #include "nsUnicharUtils.h"
 #include "nsListControlFrame.h"
 #include "nsFormControlFrame.h" // for COMPARE macro
 #include "nsGkAtoms.h"
 #include "nsIFormControl.h"
-#include "nsIDeviceContext.h" 
 #include "nsIDocument.h"
-#include "nsIDOMHTMLCollection.h" 
-#include "nsIDOMHTMLOptionsCollection.h" 
+#include "nsIDOMHTMLCollection.h"
+#include "nsIDOMHTMLOptionsCollection.h"
 #include "nsIDOMNSHTMLOptionCollectn.h"
 #include "nsIDOMHTMLSelectElement.h"
-#include "nsIDOMHTMLOptionElement.h" 
+#include "nsIDOMHTMLOptionElement.h"
 #include "nsComboboxControlFrame.h"
 #include "nsIViewManager.h"
 #include "nsIDOMHTMLOptGroupElement.h"
 #include "nsWidgetsCID.h"
 #include "nsIPresShell.h"
 #include "nsHTMLParts.h"
 #include "nsIDOMEventTarget.h"
 #include "nsEventDispatcher.h"
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -58,17 +58,16 @@
 #include "nsIEditorIMESupport.h"
 #include "nsIPhonetic.h"
 #include "nsIEditorObserver.h"
 #include "nsEditProperty.h"
 #include "nsIDOMHTMLTextAreaElement.h"
 #include "nsINameSpaceManager.h"
 #include "nsINodeInfo.h"
 #include "nsFormControlFrame.h" //for registering accesskeys
-#include "nsIDeviceContext.h" // to measure fonts
 
 #include "nsIContent.h"
 #include "nsIAtom.h"
 #include "nsPresContext.h"
 #include "nsRenderingContext.h"
 #include "nsGkAtoms.h"
 #include "nsLayoutUtils.h"
 #include "nsIComponentManager.h"
--- a/layout/generic/nsCanvasFrame.cpp
+++ b/layout/generic/nsCanvasFrame.cpp
@@ -44,17 +44,16 @@
 #include "nsCSSRendering.h"
 #include "nsPresContext.h"
 #include "nsStyleContext.h"
 #include "nsRenderingContext.h"
 #include "nsGUIEvent.h"
 #include "nsStyleConsts.h"
 #include "nsGkAtoms.h"
 #include "nsIEventStateManager.h"
-#include "nsIDeviceContext.h"
 #include "nsIPresShell.h"
 #include "nsIScrollPositionListener.h"
 #include "nsDisplayList.h"
 #include "nsAbsoluteContainingBlock.h"
 #include "nsCSSFrameConstructor.h"
 #include "nsFrameManager.h"
 
 // for focus
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -74,17 +74,16 @@
 #endif
 
 #include "nsIDOMText.h"
 #include "nsIDOMHTMLAnchorElement.h"
 #include "nsIDOMHTMLAreaElement.h"
 #include "nsIDOMHTMLImageElement.h"
 #include "nsIDOMHTMLHRElement.h"
 #include "nsIDOMHTMLInputElement.h"
-#include "nsIDeviceContext.h"
 #include "nsIEditorDocShell.h"
 #include "nsIEventStateManager.h"
 #include "nsISelection.h"
 #include "nsISelectionPrivate.h"
 #include "nsFrameSelection.h"
 #include "nsHTMLParts.h"
 #include "nsGkAtoms.h"
 #include "nsCSSAnonBoxes.h"
--- a/layout/generic/nsHTMLContainerFrame.cpp
+++ b/layout/generic/nsHTMLContainerFrame.cpp
@@ -55,17 +55,16 @@
 #include "nsIURL.h"
 #include "nsPlaceholderFrame.h"
 #include "nsHTMLParts.h"
 #include "nsIView.h"
 #include "nsIViewManager.h"
 #include "nsIDOMEvent.h"
 #include "nsWidgetsCID.h"
 #include "nsCOMPtr.h"
-#include "nsIDeviceContext.h"
 #include "gfxFont.h"
 #include "nsCSSFrameConstructor.h"
 #include "nsDisplayList.h"
 #include "nsBlockFrame.h"
 #include "nsLineBox.h"
 #include "nsDisplayList.h"
 #include "nsCSSRendering.h"
 
--- a/layout/generic/nsHTMLContainerFrame.h
+++ b/layout/generic/nsHTMLContainerFrame.h
@@ -37,31 +37,33 @@
 
 /* base class #2 for rendering objects that have child lists */
 
 #ifndef nsHTMLContainerFrame_h___
 #define nsHTMLContainerFrame_h___
 
 #include "nsContainerFrame.h"
 #include "gfxPoint.h"
-#include "nsIDeviceContext.h"
 
 class nsString;
 class nsAbsoluteFrame;
 class nsPlaceholderFrame;
 struct nsStyleDisplay;
 struct nsStylePosition;
 struct nsHTMLReflowMetrics;
 struct nsHTMLReflowState;
 class nsLineBox;
 
 // Some macros for container classes to do sanity checking on
 // width/height/x/y values computed during reflow.
+// NOTE: AppUnitsPerCSSPixel value hardwired here to remove the
+// dependency on nsIDeviceContext.h.  It doesn't matter if it's a
+// little off.
 #ifdef DEBUG
-#define CRAZY_W (1000000*nsIDeviceContext::AppUnitsPerCSSPixel())
+#define CRAZY_W (1000000*60)
 #define CRAZY_H CRAZY_W
 
 #define CRAZY_WIDTH(_x) (((_x) < -CRAZY_W) || ((_x) > CRAZY_W))
 #define CRAZY_HEIGHT(_y) (((_y) < -CRAZY_H) || ((_y) > CRAZY_H))
 #endif
 
 class nsDisplayTextDecoration;
 
--- a/layout/generic/nsHTMLReflowState.cpp
+++ b/layout/generic/nsHTMLReflowState.cpp
@@ -41,17 +41,16 @@
 #include "nsCOMPtr.h"
 #include "nsStyleConsts.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsFrame.h"
 #include "nsIContent.h"
 #include "nsGkAtoms.h"
 #include "nsPresContext.h"
 #include "nsIPresShell.h"
-#include "nsIDeviceContext.h"
 #include "nsFontMetrics.h"
 #include "nsBlockFrame.h"
 #include "nsLineBox.h"
 #include "nsImageFrame.h"
 #include "nsTableFrame.h"
 #include "nsTableCellFrame.h"
 #include "nsIServiceManager.h"
 #include "nsIPercentHeightObserver.h"
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -66,17 +66,16 @@
 #include "nsIServiceManager.h"
 #include "nsNetUtil.h"
 #include "nsHTMLContainerFrame.h"
 #include "prprf.h"
 #include "nsCSSRendering.h"
 #include "nsILink.h"
 #include "nsIDOMHTMLAnchorElement.h"
 #include "nsIDOMHTMLImageElement.h"
-#include "nsIDeviceContext.h"
 #include "nsINameSpaceManager.h"
 #include "nsTextFragment.h"
 #include "nsIDOMHTMLMapElement.h"
 #include "nsImageMapUtils.h"
 #include "nsIScriptSecurityManager.h"
 #ifdef ACCESSIBILITY
 #include "nsAccessibilityService.h"
 #endif
--- a/layout/generic/nsPageContentFrame.cpp
+++ b/layout/generic/nsPageContentFrame.cpp
@@ -39,17 +39,16 @@
 #include "nsPlaceholderFrame.h"
 #include "nsCSSFrameConstructor.h"
 #include "nsHTMLContainerFrame.h"
 #include "nsHTMLParts.h"
 #include "nsIContent.h"
 #include "nsPresContext.h"
 #include "nsGkAtoms.h"
 #include "nsIPresShell.h"
-#include "nsIDeviceContext.h"
 #include "nsReadableUtils.h"
 #include "nsSimplePageSequence.h"
 #include "nsDisplayList.h"
 
 nsIFrame*
 NS_NewPageContentFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
 {
   return new (aPresShell) nsPageContentFrame(aContext);
--- a/layout/generic/nsPageFrame.cpp
+++ b/layout/generic/nsPageFrame.cpp
@@ -37,17 +37,16 @@
 
 #include "nsPageFrame.h"
 #include "nsPresContext.h"
 #include "nsStyleContext.h"
 #include "nsRenderingContext.h"
 #include "nsGkAtoms.h"
 #include "nsIPresShell.h"
 #include "nsCSSFrameConstructor.h"
-#include "nsIDeviceContext.h"
 #include "nsReadableUtils.h"
 #include "nsPageContentFrame.h"
 #include "nsDisplayList.h"
 #include "nsLayoutUtils.h" // for function BinarySearchForPosition
 #include "nsCSSRendering.h"
 #include "nsSimplePageSequence.h" // for nsSharedPageData
 #include "nsTextFormatter.h" // for page number localization formatting
 #ifdef IBMBIDI
--- a/layout/generic/nsSelection.cpp
+++ b/layout/generic/nsSelection.cpp
@@ -89,17 +89,16 @@ static NS_DEFINE_CID(kFrameTraversalCID,
 #include "nsThreadUtils.h"
 
 //included for desired x position;
 #include "nsPresContext.h"
 #include "nsIPresShell.h"
 #include "nsCaret.h"
 
 
-#include "nsIDeviceContext.h"
 #include "nsITimer.h"
 #include "nsIServiceManager.h"
 #include "nsFrameManager.h"
 #include "nsIScrollableFrame.h"
 // notifications
 #include "nsIDOMDocument.h"
 #include "nsIDocument.h"
 
--- a/layout/generic/nsSimplePageSequence.cpp
+++ b/layout/generic/nsSimplePageSequence.cpp
@@ -36,17 +36,16 @@
  * ***** END LICENSE BLOCK ***** */
 #include "nsCOMPtr.h" 
 #include "nsReadableUtils.h"
 #include "nsSimplePageSequence.h"
 #include "nsPresContext.h"
 #include "gfxContext.h"
 #include "nsRenderingContext.h"
 #include "nsGkAtoms.h"
-#include "nsIDeviceContext.h"
 #include "nsIPresShell.h"
 #include "nsIPrintSettings.h"
 #include "nsPageFrame.h"
 #include "nsStyleConsts.h"
 #include "nsRegion.h"
 #include "nsCSSFrameConstructor.h"
 #include "nsContentUtils.h"
 #include "nsDisplayList.h"
--- a/layout/generic/nsTextFrameThebes.cpp
+++ b/layout/generic/nsTextFrameThebes.cpp
@@ -64,17 +64,16 @@
 #include "nsStyleContext.h"
 #include "nsCoord.h"
 #include "nsRenderingContext.h"
 #include "nsIPresShell.h"
 #include "nsITimer.h"
 #include "nsTArray.h"
 #include "nsIDOMText.h"
 #include "nsIDocument.h"
-#include "nsIDeviceContext.h"
 #include "nsCSSPseudoElements.h"
 #include "nsCSSFrameConstructor.h"
 #include "nsCompatibility.h"
 #include "nsCSSColorUtils.h"
 #include "nsLayoutUtils.h"
 #include "nsDisplayList.h"
 #include "nsFrame.h"
 #include "nsPlaceholderFrame.h"
--- a/layout/mathml/nsMathMLChar.cpp
+++ b/layout/mathml/nsMathMLChar.cpp
@@ -55,17 +55,16 @@
 #include "nsIComponentManager.h"
 #include "nsIPersistentProperties2.h"
 #include "nsIServiceManager.h"
 #include "nsIObserverService.h"
 #include "nsIObserver.h"
 #include "nsNetUtil.h"
 
 #include "nsILookAndFeel.h"
-#include "nsIDeviceContext.h"
 #include "nsCSSRendering.h"
 #include "prprf.h"         // For PR_snprintf()
 
 #include "nsDisplayList.h"
 
 #include "nsMathMLOperators.h"
 #include "nsMathMLChar.h"
 
--- a/layout/printing/nsPrintEngine.cpp
+++ b/layout/printing/nsPrintEngine.cpp
@@ -121,17 +121,16 @@ static const char kPrintingPromptService
 #include "nsContentCID.h"
 #include "nsLayoutCID.h"
 #include "nsContentUtils.h"
 #include "nsIPresShell.h"
 #include "nsLayoutUtils.h"
 
 #include "nsViewsCID.h"
 #include "nsWidgetsCID.h"
-#include "nsIDeviceContext.h"
 #include "nsIDeviceContextSpec.h"
 #include "nsIViewManager.h"
 #include "nsIView.h"
 #include "nsRenderingContext.h"
 
 #include "nsIPageSequenceFrame.h"
 #include "nsIURL.h"
 #include "nsIContentViewerEdit.h"
--- a/layout/style/StyleRule.cpp
+++ b/layout/style/StyleRule.cpp
@@ -46,17 +46,16 @@
 
 #include "mozilla/css/StyleRule.h"
 #include "mozilla/css/GroupRule.h"
 #include "mozilla/css/Declaration.h"
 #include "nsCSSStyleSheet.h"
 #include "mozilla/css/Loader.h"
 #include "nsIURL.h"
 #include "nsIDocument.h"
-#include "nsIDeviceContext.h"
 #include "nsIAtom.h"
 #include "nsCRT.h"
 #include "nsString.h"
 #include "nsStyleConsts.h"
 #include "nsStyleUtil.h"
 #include "nsIDOMCSSStyleSheet.h"
 #include "nsICSSStyleRuleDOMWrapper.h"
 #include "nsIDOMCSSStyleDeclaration.h"
--- a/layout/style/nsMediaFeatures.cpp
+++ b/layout/style/nsMediaFeatures.cpp
@@ -37,17 +37,16 @@
 
 /* the features that media queries can test */
 
 #include "nsMediaFeatures.h"
 #include "nsGkAtoms.h"
 #include "nsCSSKeywords.h"
 #include "nsStyleConsts.h"
 #include "nsPresContext.h"
-#include "nsIDeviceContext.h"
 #include "nsCSSValue.h"
 #include "nsIDocShell.h"
 #include "nsLayoutUtils.h"
 #include "nsILookAndFeel.h"
 #include "nsCSSRuleProcessor.h"
 
 static const PRInt32 kOrientationKeywords[] = {
   eCSSKeyword_portrait,                 NS_STYLE_ORIENTATION_PORTRAIT,
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -47,17 +47,16 @@
 /*
  * a node in the lexicographic tree of rules that match an element,
  * responsible for converting the rules' information into computed style
  */
 
 #include "nsRuleNode.h"
 #include "nscore.h"
 #include "nsIServiceManager.h"
-#include "nsIDeviceContext.h"
 #include "nsIWidget.h"
 #include "nsILookAndFeel.h"
 #include "nsIPresShell.h"
 #include "nsFontMetrics.h"
 #include "gfxFont.h"
 #include "nsStyleUtil.h"
 #include "nsCSSPseudoElements.h"
 #include "nsThemeConstants.h"
--- a/layout/style/nsStyleStruct.cpp
+++ b/layout/style/nsStyleStruct.cpp
@@ -46,17 +46,16 @@
  */
 
 #include "nsStyleStruct.h"
 #include "nsStyleStructInlines.h"
 #include "nsStyleConsts.h"
 #include "nsThemeConstants.h"
 #include "nsString.h"
 #include "nsPresContext.h"
-#include "nsIDeviceContext.h"
 #include "nsIWidget.h"
 #include "nsIStyleRule.h"
 #include "nsCRT.h"
 #include "nsCSSProps.h"
 
 #include "nsCOMPtr.h"
 #include "nsIFrame.h"
 #include "nsHTMLReflowState.h"
--- a/layout/xul/base/src/nsBox.cpp
+++ b/layout/xul/base/src/nsBox.cpp
@@ -46,17 +46,16 @@
 #include "nsHTMLContainerFrame.h"
 #include "nsINameSpaceManager.h"
 #include "nsGkAtoms.h"
 #include "nsFrameManager.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMNamedNodeMap.h"
 #include "nsIDOMAttr.h"
 #include "nsIDocument.h"
-#include "nsIDeviceContext.h"
 #include "nsITheme.h"
 #include "nsIServiceManager.h"
 #include "nsIBoxLayout.h"
 #include "FrameLayerBuilder.h"
 
 using namespace mozilla;
 
 #ifdef DEBUG_LAYOUT
--- a/layout/xul/base/src/nsDocElementBoxFrame.cpp
+++ b/layout/xul/base/src/nsDocElementBoxFrame.cpp
@@ -39,17 +39,16 @@
 #include "nsCSSRendering.h"
 #include "nsIDocument.h"
 #include "nsPageFrame.h"
 #include "nsGUIEvent.h"
 #include "nsIDOMEvent.h"
 #include "nsStyleConsts.h"
 #include "nsGkAtoms.h"
 #include "nsIEventStateManager.h"
-#include "nsIDeviceContext.h"
 #include "nsIPresShell.h"
 #include "nsBoxFrame.h"
 #include "nsStackLayout.h"
 #include "nsIAnonymousContentCreator.h"
 #include "nsINodeInfo.h"
 #include "nsIServiceManager.h"
 #include "nsNodeInfoManager.h"
 #include "nsContentCreatorFunctions.h"
--- a/layout/xul/base/src/nsImageBoxFrame.cpp
+++ b/layout/xul/base/src/nsImageBoxFrame.cpp
@@ -38,17 +38,16 @@
 //
 // Eric Vaughan
 // Netscape Communications
 //
 // See documentation in associated header file
 //
 
 #include "nsImageBoxFrame.h"
-#include "nsIDeviceContext.h"
 #include "nsGkAtoms.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsCOMPtr.h"
 #include "nsPresContext.h"
 #include "nsBoxLayoutState.h"
 
 #include "nsHTMLParts.h"
@@ -61,17 +60,16 @@
 #include "nsImageMap.h"
 #include "nsILinkHandler.h"
 #include "nsIURL.h"
 #include "nsILoadGroup.h"
 #include "nsHTMLContainerFrame.h"
 #include "prprf.h"
 #include "nsCSSRendering.h"
 #include "nsIDOMHTMLImageElement.h"
-#include "nsIDeviceContext.h"
 #include "nsINameSpaceManager.h"
 #include "nsTextFragment.h"
 #include "nsIDOMHTMLMapElement.h"
 #include "nsBoxLayoutState.h"
 #include "nsIDOMDocument.h"
 #include "nsTransform2D.h"
 #include "nsITheme.h"
 
--- a/layout/xul/base/src/nsLeafBoxFrame.cpp
+++ b/layout/xul/base/src/nsLeafBoxFrame.cpp
@@ -40,17 +40,16 @@
 // Netscape Communications
 //
 // See documentation in associated header file
 //
 
 #include "nsLeafBoxFrame.h"
 #include "nsBoxFrame.h"
 #include "nsCOMPtr.h"
-#include "nsIDeviceContext.h"
 #include "nsGkAtoms.h"
 #include "nsPresContext.h"
 #include "nsStyleContext.h"
 #include "nsIContent.h"
 #include "nsINameSpaceManager.h"
 #include "nsBoxLayoutState.h"
 #include "nsWidgetsCID.h"
 #include "nsIViewManager.h"
--- a/layout/xul/base/src/nsListBoxBodyFrame.cpp
+++ b/layout/xul/base/src/nsListBoxBodyFrame.cpp
@@ -53,17 +53,16 @@
 #include "nsIDOMElement.h"
 #include "nsIDOMNodeList.h"
 #include "nsCSSFrameConstructor.h"
 #include "nsIScrollableFrame.h"
 #include "nsIScrollbarFrame.h"
 #include "nsIView.h"
 #include "nsIViewManager.h"
 #include "nsStyleContext.h"
-#include "nsIDeviceContext.h"
 #include "nsFontMetrics.h"
 #include "nsITimer.h"
 #include "nsAutoPtr.h"
 #include "nsStyleSet.h"
 #include "nsIDOMNSDocument.h"
 #include "nsPIBoxObject.h"
 #include "nsINodeInfo.h"
 #include "nsLayoutUtils.h"
--- a/layout/xul/base/src/nsMenuPopupFrame.cpp
+++ b/layout/xul/base/src/nsMenuPopupFrame.cpp
@@ -55,17 +55,16 @@
 #include "nsMenuBarFrame.h"
 #include "nsPopupSetFrame.h"
 #include "nsEventDispatcher.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDOMScreen.h"
 #include "nsIPresShell.h"
 #include "nsFrameManager.h"
 #include "nsIDocument.h"
-#include "nsIDeviceContext.h"
 #include "nsRect.h"
 #include "nsILookAndFeel.h"
 #include "nsIComponentManager.h"
 #include "nsBoxLayoutState.h"
 #include "nsIScrollableFrame.h"
 #include "nsGUIEvent.h"
 #include "nsIRootBox.h"
 #include "nsIDocShellTreeItem.h"
--- a/layout/xul/base/src/nsTextBoxFrame.cpp
+++ b/layout/xul/base/src/nsTextBoxFrame.cpp
@@ -43,17 +43,16 @@
 // Netscape Communications
 //
 // See documentation in associated header file
 //
 
 #include "nsReadableUtils.h"
 #include "nsTextBoxFrame.h"
 #include "nsCOMPtr.h"
-#include "nsIDeviceContext.h"
 #include "nsGkAtoms.h"
 #include "nsPresContext.h"
 #include "nsRenderingContext.h"
 #include "nsStyleContext.h"
 #include "nsIContent.h"
 #include "nsINameSpaceManager.h"
 #include "nsBoxLayoutState.h"
 #include "nsMenuBarListener.h"
--- a/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
+++ b/layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
@@ -71,17 +71,16 @@
 #include "nsIDOMDocument.h"
 #include "nsIDOMNSDocument.h"
 #include "nsIDOMDocumentEvent.h"
 #include "nsIDOMXULElement.h"
 #include "nsIDocument.h"
 #include "nsIContent.h"
 #include "mozilla/css/StyleRule.h"
 #include "nsCSSRendering.h"
-#include "nsIDeviceContext.h"
 #include "nsIXULTemplateBuilder.h"
 #include "nsXPIDLString.h"
 #include "nsHTMLContainerFrame.h"
 #include "nsIView.h"
 #include "nsIViewManager.h"
 #include "nsWidgetsCID.h"
 #include "nsBoxFrame.h"
 #include "nsBoxObject.h"
--- a/view/src/nsView.cpp
+++ b/view/src/nsView.cpp
@@ -35,17 +35,16 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsView.h"
 #include "nsIWidget.h"
 #include "nsWidgetsCID.h"
 #include "nsViewManager.h"
 #include "nsGUIEvent.h"
-#include "nsIDeviceContext.h"
 #include "nsIComponentManager.h"
 #include "nsGfxCIID.h"
 #include "nsIRegion.h"
 #include "nsIInterfaceRequestor.h"
 
 //mmptemp
 
 static nsEventStatus HandleEvent(nsGUIEvent *aEvent);
--- a/widget/public/nsIDeviceContextSpec.h
+++ b/widget/public/nsIDeviceContextSpec.h
@@ -33,22 +33,20 @@
  * 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 nsIDeviceContextSpec_h___
 #define nsIDeviceContextSpec_h___
 
-#include "nsIDeviceContext.h"
-#include "prtypes.h"
+#include "nsISupports.h"
 
 class nsIWidget;
 class nsIPrintSettings;
-
 class gfxASurface;
 
 #define NS_IDEVICE_CONTEXT_SPEC_IID   \
 { 0x205c614f, 0x39f8, 0x42e1, \
 { 0x92, 0x53, 0x04, 0x9b, 0x48, 0xc3, 0xcb, 0xd8 } }
 
 class nsIDeviceContextSpec : public nsISupports
 {
@@ -65,20 +63,120 @@ public:
    NS_IMETHOD Init(nsIWidget *aWidget,
                    nsIPrintSettings* aPrintSettings,
                    PRBool aIsPrintPreview) = 0;
 
    NS_IMETHOD GetSurfaceForPrinter(gfxASurface **nativeSurface) = 0;
 
    NS_IMETHOD BeginDocument(PRUnichar*  aTitle,
                             PRUnichar*  aPrintToFileName,
-                            PRInt32     aStartPage, 
+                            PRInt32     aStartPage,
                             PRInt32     aEndPage) = 0;
 
    NS_IMETHOD EndDocument() = 0;
    NS_IMETHOD BeginPage() = 0;
    NS_IMETHOD EndPage() = 0;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsIDeviceContextSpec,
                               NS_IDEVICE_CONTEXT_SPEC_IID)
 
+/* error codes for printer device contexts */
+#define NS_ERROR_GFX_PRINTER_BASE (1) /* adjustable :-) */
+/* Unix: print command (lp/lpr) not found */
+#define NS_ERROR_GFX_PRINTER_CMD_NOT_FOUND          \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+1)
+/* Unix: print command returned an error */
+#define NS_ERROR_GFX_PRINTER_CMD_FAILURE            \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+2)
+/* no printer available (e.g. cannot find _any_ printer) */
+#define NS_ERROR_GFX_PRINTER_NO_PRINTER_AVAILABLE  \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+3)
+/* _specified_ (by name) printer not found */
+#define NS_ERROR_GFX_PRINTER_NAME_NOT_FOUND         \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+4)
+/* access to printer denied */
+#define NS_ERROR_GFX_PRINTER_ACCESS_DENIED          \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+5)
+/* invalid printer attribute (for example: unsupported paper size etc.) */
+#define NS_ERROR_GFX_PRINTER_INVALID_ATTRIBUTE      \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+6)
+/* printer not "ready" (offline ?) */
+#define NS_ERROR_GFX_PRINTER_PRINTER_NOT_READY     \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+8)
+/* printer out of paper */
+#define NS_ERROR_GFX_PRINTER_OUT_OF_PAPER           \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+9)
+/* generic printer I/O error */
+#define NS_ERROR_GFX_PRINTER_PRINTER_IO_ERROR       \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+10)
+/* print-to-file: could not open output file */
+#define NS_ERROR_GFX_PRINTER_COULD_NOT_OPEN_FILE    \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+11)
+/* print-to-file: I/O error while printing to file */
+#define NS_ERROR_GFX_PRINTER_FILE_IO_ERROR          \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+12)
+/* print preview: needs at least one printer */
+#define NS_ERROR_GFX_PRINTER_PRINTPREVIEW          \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+13)
+/* print: starting document */
+#define NS_ERROR_GFX_PRINTER_STARTDOC          \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+14)
+/* print: ending document */
+#define NS_ERROR_GFX_PRINTER_ENDDOC          \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+15)
+/* print: starting page */
+#define NS_ERROR_GFX_PRINTER_STARTPAGE          \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+16)
+/* print: ending page */
+#define NS_ERROR_GFX_PRINTER_ENDPAGE          \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+17)
+/* print: print while in print preview */
+#define NS_ERROR_GFX_PRINTER_PRINT_WHILE_PREVIEW          \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+18)
+/* requested page size not supported by printer */
+#define NS_ERROR_GFX_PRINTER_PAPER_SIZE_NOT_SUPPORTED \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+19)
+/* requested page orientation not supported */
+#define NS_ERROR_GFX_PRINTER_ORIENTATION_NOT_SUPPORTED \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+20)
+/* requested colorspace not supported (like printing "color" on a
+   "grayscale"-only printer) */
+#define NS_ERROR_GFX_PRINTER_COLORSPACE_NOT_SUPPORTED \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+21)
+/* too many copies requested */
+#define NS_ERROR_GFX_PRINTER_TOO_MANY_COPIES \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+22)
+/* driver configuration error */
+#define NS_ERROR_GFX_PRINTER_DRIVER_CONFIGURATION_ERROR \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+23)
+/* The document is still being loaded, can't Print Preview */
+#define NS_ERROR_GFX_PRINTER_DOC_IS_BUSY_PP \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+24)
+/* The document was asked to be destroyed while we were preparing printing */
+#define NS_ERROR_GFX_PRINTER_DOC_WAS_DESTORYED \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+25)
+/* Cannot Print or Print Preview XUL Documents */
+#define NS_ERROR_GFX_PRINTER_NO_XUL \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+26)
+/* The toolkit no longer supports the Print Dialog (for embedders) */
+#define NS_ERROR_GFX_NO_PRINTDIALOG_IN_TOOLKIT \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+27)
+/* The was wasn't any Print Prompt service registered (this shouldn't happen) */
+#define NS_ERROR_GFX_NO_PRINTROMPTSERVICE \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+28)
+/* requested plex mode not supported by printer */
+#define NS_ERROR_GFX_PRINTER_PLEX_NOT_SUPPORTED \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+29)
+/* The document is still being loaded */
+#define NS_ERROR_GFX_PRINTER_DOC_IS_BUSY \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+30)
+/* Printing is not implemented */
+#define NS_ERROR_GFX_PRINTING_NOT_IMPLEMENTED \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+31)
+/* Cannot load the matching print module */
+#define NS_ERROR_GFX_COULD_NOT_LOAD_PRINT_MODULE \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+32)
+/* requested resolution/quality mode not supported by printer */
+#define NS_ERROR_GFX_PRINTER_RESOLUTION_NOT_SUPPORTED \
+  NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_GFX,NS_ERROR_GFX_PRINTER_BASE+33)
+
 #endif
--- a/widget/src/android/nsWindow.cpp
+++ b/widget/src/android/nsWindow.cpp
@@ -48,17 +48,16 @@ using mozilla::dom::ContentParent;
 using mozilla::dom::ContentChild;
 using mozilla::unused;
 
 #include "nsAppShell.h"
 #include "nsIdleService.h"
 #include "nsWindow.h"
 #include "nsIObserverService.h"
 
-#include "nsIDeviceContext.h"
 #include "nsRenderingContext.h"
 #include "nsIDOMSimpleGestureEvent.h"
 
 #include "nsWidgetAtoms.h"
 #include "nsWidgetsCID.h"
 #include "nsGfxCIID.h"
 
 #include "gfxImageSurface.h"
--- a/widget/src/cocoa/nsChildView.mm
+++ b/widget/src/cocoa/nsChildView.mm
@@ -54,17 +54,16 @@
 #include "nsObjCExceptions.h"
 #include "nsCOMPtr.h"
 #include "nsToolkit.h"
 #include "nsCRT.h"
 #include "nsIPrefService.h"
 #include "nsIPrefBranch.h"
 
 #include "nsFontMetrics.h"
-#include "nsIDeviceContext.h"
 #include "nsIRegion.h"
 #include "nsIRollupListener.h"
 #include "nsIViewManager.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIServiceManager.h"
 #include "nsILocalFile.h"
 #include "nsILocalFileMac.h"
 #include "nsGfxCIID.h"
--- a/widget/src/cocoa/nsNativeThemeCocoa.h
+++ b/widget/src/cocoa/nsNativeThemeCocoa.h
@@ -40,22 +40,21 @@
 
 #import <Carbon/Carbon.h>
 #import <Cocoa/Cocoa.h>
 
 #include "nsITheme.h"
 #include "nsCOMPtr.h"
 #include "nsIAtom.h"
 #include "nsILookAndFeel.h"
-#include "nsIDeviceContext.h"
 #include "nsNativeTheme.h"
-
 #include "gfxASurface.h"
 
 @class CellDrawView;
+class nsIDeviceContext;
 
 class nsNativeThemeCocoa : private nsNativeTheme,
                            public nsITheme
 {
 public:
   nsNativeThemeCocoa();
   virtual ~nsNativeThemeCocoa();
 
@@ -90,17 +89,16 @@ public:
   PRBool WidgetIsContainer(PRUint8 aWidgetType);
   PRBool ThemeDrawsFocusForWidget(nsPresContext* aPresContext, nsIFrame* aFrame, PRUint8 aWidgetType);
   PRBool ThemeNeedsComboboxDropmarker();
   virtual Transparency GetWidgetTransparency(nsIFrame* aFrame, PRUint8 aWidgetType);
 
 protected:  
 
   nsresult GetSystemColor(PRUint8 aWidgetType, nsILookAndFeel::nsColorID& aColorID);
-  nsresult GetSystemFont(PRUint8 aWidgetType, nsSystemFontID& aFont);
   nsIntMargin RTLAwareMargin(const nsIntMargin& aMargin, nsIFrame* aFrame);
 
   // HITheme drawing routines
   void DrawFrame(CGContextRef context, HIThemeFrameKind inKind,
                  const HIRect& inBoxRect, PRBool inReadOnly,
                  nsEventStates inState);
   void DrawProgress(CGContextRef context, const HIRect& inBoxRect,
                     PRBool inIsIndeterminate, PRBool inIsHorizontal,
--- a/widget/src/gtk2/nsNativeThemeGTK.cpp
+++ b/widget/src/gtk2/nsNativeThemeGTK.cpp
@@ -48,17 +48,16 @@
 #include "nsIFrame.h"
 #include "nsIPresShell.h"
 #include "nsIDocument.h"
 #include "nsIContent.h"
 #include "nsIEventStateManager.h"
 #include "nsIViewManager.h"
 #include "nsINameSpaceManager.h"
 #include "nsILookAndFeel.h"
-#include "nsIDeviceContext.h"
 #include "nsGfxCIID.h"
 #include "nsTransform2D.h"
 #include "nsIMenuFrame.h"
 #include "prlink.h"
 #include "nsIDOMHTMLInputElement.h"
 #include "nsRenderingContext.h"
 #include "nsWidgetAtoms.h"
 #include "mozilla/Services.h"
--- a/widget/src/gtk2/nsPSPrinters.cpp
+++ b/widget/src/gtk2/nsPSPrinters.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 "nscore.h"
 #include "nsCUPSShim.h"
-#include "nsIDeviceContext.h"       // GFX error codes
 #include "nsIPrefBranch.h"
 #include "nsIPrefService.h"
 #include "nsIServiceManager.h"
 #include "nsPrintfCString.h"
 #include "nsPSPrinters.h"
 #include "nsReadableUtils.h"        // StringBeginsWith()
 #include "nsCUPSShim.h"
 
--- a/widget/src/gtk2/nsWindow.cpp
+++ b/widget/src/gtk2/nsWindow.cpp
@@ -41,17 +41,16 @@
 #ifdef MOZ_PLATFORM_MAEMO
 // needed to include hildon parts in gtk.h
 #define MAEMO_CHANGES
 #endif
 
 #include "prlink.h"
 #include "nsWindow.h"
 #include "nsGTKToolkit.h"
-#include "nsIDeviceContext.h"
 #include "nsIRollupListener.h"
 #include "nsIMenuRollup.h"
 #include "nsIDOMNode.h"
 
 #include "nsWidgetsCID.h"
 #include "nsDragService.h"
 #include "nsIDragSessionGTK.h"
 
--- a/widget/src/os2/nsWindow.cpp
+++ b/widget/src/os2/nsWindow.cpp
@@ -69,17 +69,16 @@
 #include "os2FrameWindow.h"
 #include "gfxContext.h"
 #include "gfxOS2Surface.h"
 #include "imgIContainer.h"
 #include "npapi.h"
 #include "nsDragService.h"
 #include "nsGfxCIID.h"
 #include "nsHashKeys.h"
-#include "nsIDeviceContext.h"
 #include "nsIMenuRollup.h"
 #include "nsIPrefService.h"
 #include "nsIRollupListener.h"
 #include "nsIScreenManager.h"
 #include "nsOS2Uni.h"
 #include "nsTHashtable.h"
 #include "nsToolkit.h"
 #include "nsWidgetAtoms.h"
@@ -359,53 +358,27 @@ NS_METHOD nsWindow::Create(nsIWidget* aP
       hParent = (HWND)aNativeParent;
       pParent = GetNSWindowPtr(hParent);
     } else {
       hParent = HWND_DESKTOP;
       pParent = 0;
     }
   }
 
-  // Save the event callback function.
-  mEventCallback = aHandleEventFunction;
-
-  // Make sure a device context exists.
-  if (aContext) {
-    mContext = aContext;
-    NS_ADDREF(mContext);
-  } else {
-    static NS_DEFINE_IID(kDeviceContextCID, NS_DEVICE_CONTEXT_CID);
-    nsresult rv = CallCreateInstance(kDeviceContextCID, &mContext);
-    NS_ENSURE_SUCCESS(rv, rv);
-    mContext->Init(nsnull);
-  }
-
-  // XXX Toolkit is obsolete & will be removed.
-  if (!mToolkit) {
-    if (aToolkit) {
-      mToolkit = aToolkit;
-    } else if (pParent) {
-      mToolkit = pParent->GetToolkit();
-    } else {
-      mToolkit = new nsToolkit;
-      mToolkit->Init(PR_GetCurrentThread());
-    }
-    NS_ADDREF(mToolkit);
-  }
+  BaseCreate(aParent, aRect, aHandleEventFunction,
+             aContext, aAppShell, aToolkit, aInitData);
+
 
 #ifdef DEBUG_FOCUS
   mWindowIdentifier = currentWindowIdentifier;
   currentWindowIdentifier++;
 #endif
 
   // Some basic initialization.
   if (aInitData) {
-    mWindowType = aInitData->mWindowType;
-    mBorderStyle = aInitData->mBorderStyle;
-
     // Suppress creation of a Thebes surface for windows that will never
     // be painted because they're always covered by another window.
     if (mWindowType == eWindowType_toplevel ||
         mWindowType == eWindowType_invisible) {
       mNoPaint = PR_TRUE;
     }
     // Popup windows should not have an nsWindow parent.
     else if (mWindowType == eWindowType_popup) {
--- a/widget/src/qt/nsNativeThemeQt.cpp
+++ b/widget/src/qt/nsNativeThemeQt.cpp
@@ -48,17 +48,16 @@
 #include <QStyleOptionButton>
 #include <QFlags>
 #include <QStyleOptionComboBox>
 
 #include "nsIFrame.h"
 
 #include "nsCoord.h"
 #include "nsNativeThemeQt.h"
-#include "nsIDeviceContext.h"
 #include "nsPresContext.h"
 
 #include "nsRect.h"
 #include "nsSize.h"
 #include "nsTransform2D.h"
 #include "nsThemeConstants.h"
 #include "nsILookAndFeel.h"
 #include "nsIServiceManager.h"
@@ -342,17 +341,17 @@ nsNativeThemeQt::DrawWidgetBackground(QP
         break;
     }
 
     qPainter->restore();
     return NS_OK;
 }
 
 NS_IMETHODIMP
-nsNativeThemeQt::GetWidgetBorder(nsIDeviceContext* aContext,
+nsNativeThemeQt::GetWidgetBorder(nsIDeviceContext* ,
                                  nsIFrame* aFrame,
                                  PRUint8 aWidgetType,
                                  nsIntMargin* aResult)
 {
     (*aResult).top = (*aResult).bottom = (*aResult).left = (*aResult).right = 0;
 
     QStyle* style = qApp->style();
     switch(aWidgetType) {
--- a/widget/src/qt/nsNativeThemeQt.h
+++ b/widget/src/qt/nsNativeThemeQt.h
@@ -41,24 +41,24 @@
 
 #include <QStyle>
 #include <QPalette>
 
 #include "nsITheme.h"
 #include "nsCOMPtr.h"
 #include "nsIAtom.h"
 #include "nsNativeTheme.h"
-#include "nsIDeviceContext.h"
 
 class QComboBox;
 class QStyleOptionButton;
 class QStyleOptionFrameV2;
 class QStyleOptionComboBox;
 class QRect;
 class nsIFrame;
+class nsIDeviceContext;
 
 class nsNativeThemeQt : private nsNativeTheme,
                         public nsITheme
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
 
   // The nsITheme interface.
--- a/widget/src/qt/nsWindow.cpp
+++ b/widget/src/qt/nsWindow.cpp
@@ -89,17 +89,16 @@ using namespace QtMobility;
 #include "nsWindow.h"
 #include "mozqwidget.h"
 
 #ifdef MOZ_ENABLE_QTMOBILITY
 #include "mozqorientationsensorfilter.h"
 #endif
 
 #include "nsToolkit.h"
-#include "nsIDeviceContext.h"
 #include "nsIdleService.h"
 #include "nsRenderingContext.h"
 #include "nsIRegion.h"
 #include "nsIRollupListener.h"
 #include "nsIMenuRollup.h"
 #include "nsWidgetsCID.h"
 #include "nsQtKeyUtils.h"
 #include "mozilla/Services.h"
--- a/widget/src/windows/nsNativeThemeWin.cpp
+++ b/widget/src/windows/nsNativeThemeWin.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 <windows.h>
 #include "nsNativeThemeWin.h"
 #include "nsRenderingContext.h"
-#include "nsIDeviceContext.h"
 #include "nsRect.h"
 #include "nsSize.h"
 #include "nsTransform2D.h"
 #include "nsThemeConstants.h"
 #include "nsIPresShell.h"
 #include "nsPresContext.h"
 #include "nsIContent.h"
 #include "nsIDocument.h"
--- a/widget/src/windows/nsWindow.cpp
+++ b/widget/src/windows/nsWindow.cpp
@@ -133,17 +133,16 @@
 #include "nsIMenuRollup.h"
 #include "nsIRegion.h"
 #include "nsIServiceManager.h"
 #include "nsIClipboard.h"
 #include "nsIMM32Handler.h"
 #include "nsILocalFile.h"
 #include "nsFontMetrics.h"
 #include "nsIFontEnumerator.h"
-#include "nsIDeviceContext.h"
 #include "nsILookAndFeel.h"
 #include "nsGUIEvent.h"
 #include "nsFont.h"
 #include "nsRect.h"
 #include "nsThreadUtils.h"
 #include "nsNativeCharsetUtils.h"
 #include "nsWidgetAtoms.h"
 #include "nsUnicharUtils.h"
--- a/widget/src/windows/nsWindowGfx.cpp
+++ b/widget/src/windows/nsWindowGfx.cpp
@@ -60,17 +60,16 @@ using mozilla::plugins::PluginInstancePa
 #include <windows.h>
 #include "nsIRegion.h"
 #include "gfxImageSurface.h"
 #include "gfxWindowsSurface.h"
 #include "gfxWindowsPlatform.h"
 #include "nsGfxCIID.h"
 #include "gfxContext.h"
 #include "nsRenderingContext.h"
-#include "nsIDeviceContext.h"
 #include "prmem.h"
 
 #include "LayerManagerOGL.h"
 #include "BasicLayers.h"
 #ifdef MOZ_ENABLE_D3D9_LAYER
 #include "LayerManagerD3D9.h"
 #endif
 #ifdef MOZ_ENABLE_D3D10_LAYER