Bug 266236 part 3: Mechanical rename of nsIRenderingContext and nsThebesRenderingContext to nsRenderingContext. Mechanical substitution of nsRefPtr<nsRenderingContext> for nsCOMPtr<nsRenderingContext>.
authorJan Küchler <jan@kuechler-wuppertal.de>
Thu, 07 Apr 2011 18:04:40 -0700
changeset 68366 f54747d3a9087414d41d7c8894b8c67fa52c4474
parent 68365 1c1bfa98f6005c20776388a6814950aa531d5893
child 68367 2723b4329877e70869363bb4c0cfdc75fde37c08
push idunknown
push userunknown
push dateunknown
bugs266236
milestone6.0a1
Bug 266236 part 3: Mechanical rename of nsIRenderingContext and nsThebesRenderingContext to nsRenderingContext. Mechanical substitution of nsRefPtr<nsRenderingContext> for nsCOMPtr<nsRenderingContext>.
accessible/src/msaa/nsTextAccessibleWrap.cpp
accessible/src/msaa/nsTextAccessibleWrap.h
content/canvas/public/nsICanvasElementExternal.h
content/canvas/src/nsCanvasRenderingContext2D.cpp
content/html/content/public/nsHTMLCanvasElement.h
content/html/content/src/nsHTMLAudioElement.cpp
content/html/content/src/nsHTMLMediaElement.cpp
content/html/content/src/nsHTMLVideoElement.cpp
content/media/nsMediaDecoder.cpp
embedding/browser/webBrowser/nsWebBrowser.cpp
gfx/layers/basic/BasicLayers.cpp
gfx/src/nsIDeviceContext.h
gfx/src/nsIThebesFontMetrics.h
gfx/src/nsITheme.h
gfx/src/nsRenderingContext.cpp
gfx/src/nsRenderingContext.h
gfx/src/nsThebesDeviceContext.cpp
gfx/src/nsThebesDeviceContext.h
gfx/src/nsThebesFontMetrics.cpp
gfx/src/nsThebesFontMetrics.h
layout/base/FrameLayerBuilder.cpp
layout/base/nsBidiPresUtils.cpp
layout/base/nsBidiPresUtils.h
layout/base/nsCSSRendering.cpp
layout/base/nsCSSRendering.h
layout/base/nsCaret.cpp
layout/base/nsCaret.h
layout/base/nsDisplayList.cpp
layout/base/nsDisplayList.h
layout/base/nsDocumentViewer.cpp
layout/base/nsIPresShell.h
layout/base/nsLayoutUtils.cpp
layout/base/nsLayoutUtils.h
layout/base/nsPresContext.cpp
layout/base/nsPresContext.h
layout/base/nsPresShell.cpp
layout/forms/nsButtonFrameRenderer.cpp
layout/forms/nsButtonFrameRenderer.h
layout/forms/nsComboboxControlFrame.cpp
layout/forms/nsComboboxControlFrame.h
layout/forms/nsFieldSetFrame.cpp
layout/forms/nsFileControlFrame.cpp
layout/forms/nsFileControlFrame.h
layout/forms/nsGfxCheckboxControlFrame.cpp
layout/forms/nsGfxRadioControlFrame.cpp
layout/forms/nsHTMLButtonControlFrame.cpp
layout/forms/nsHTMLButtonControlFrame.h
layout/forms/nsImageControlFrame.cpp
layout/forms/nsIsIndexFrame.cpp
layout/forms/nsIsIndexFrame.h
layout/forms/nsListControlFrame.cpp
layout/forms/nsListControlFrame.h
layout/forms/nsSelectsAreaFrame.cpp
layout/forms/nsTextControlFrame.cpp
layout/forms/nsTextControlFrame.h
layout/generic/nsBRFrame.cpp
layout/generic/nsBlockFrame.cpp
layout/generic/nsBlockFrame.h
layout/generic/nsBulletFrame.cpp
layout/generic/nsBulletFrame.h
layout/generic/nsCanvasFrame.cpp
layout/generic/nsCanvasFrame.h
layout/generic/nsColumnSetFrame.cpp
layout/generic/nsContainerFrame.cpp
layout/generic/nsContainerFrame.h
layout/generic/nsFirstLetterFrame.cpp
layout/generic/nsFirstLetterFrame.h
layout/generic/nsFrame.cpp
layout/generic/nsFrame.h
layout/generic/nsFrameSetFrame.cpp
layout/generic/nsFrameSetFrame.h
layout/generic/nsGfxScrollFrame.cpp
layout/generic/nsGfxScrollFrame.h
layout/generic/nsHTMLCanvasFrame.cpp
layout/generic/nsHTMLCanvasFrame.h
layout/generic/nsHTMLContainerFrame.cpp
layout/generic/nsHTMLReflowMetrics.h
layout/generic/nsHTMLReflowState.cpp
layout/generic/nsHTMLReflowState.h
layout/generic/nsIFrame.h
layout/generic/nsIScrollableFrame.h
layout/generic/nsImageFrame.cpp
layout/generic/nsImageFrame.h
layout/generic/nsImageMap.cpp
layout/generic/nsImageMap.h
layout/generic/nsInlineFrame.cpp
layout/generic/nsInlineFrame.h
layout/generic/nsLeafFrame.cpp
layout/generic/nsLeafFrame.h
layout/generic/nsLineLayout.cpp
layout/generic/nsObjectFrame.cpp
layout/generic/nsObjectFrame.h
layout/generic/nsPageContentFrame.cpp
layout/generic/nsPageContentFrame.h
layout/generic/nsPageFrame.cpp
layout/generic/nsPageFrame.h
layout/generic/nsPlaceholderFrame.cpp
layout/generic/nsPlaceholderFrame.h
layout/generic/nsSimplePageSequence.cpp
layout/generic/nsSimplePageSequence.h
layout/generic/nsSubDocumentFrame.cpp
layout/generic/nsSubDocumentFrame.h
layout/generic/nsTextFrame.h
layout/generic/nsTextFrameThebes.cpp
layout/generic/nsVideoFrame.cpp
layout/generic/nsVideoFrame.h
layout/generic/nsViewportFrame.cpp
layout/generic/nsViewportFrame.h
layout/inspector/src/inFlasher.cpp
layout/inspector/src/inFlasher.h
layout/inspector/src/inLayoutUtils.h
layout/mathml/nsIMathMLFrame.h
layout/mathml/nsMathMLChar.cpp
layout/mathml/nsMathMLChar.h
layout/mathml/nsMathMLContainerFrame.cpp
layout/mathml/nsMathMLContainerFrame.h
layout/mathml/nsMathMLForeignFrameWrapper.cpp
layout/mathml/nsMathMLFrame.cpp
layout/mathml/nsMathMLFrame.h
layout/mathml/nsMathMLTokenFrame.cpp
layout/mathml/nsMathMLTokenFrame.h
layout/mathml/nsMathMLmactionFrame.cpp
layout/mathml/nsMathMLmactionFrame.h
layout/mathml/nsMathMLmencloseFrame.cpp
layout/mathml/nsMathMLmencloseFrame.h
layout/mathml/nsMathMLmfencedFrame.cpp
layout/mathml/nsMathMLmfencedFrame.h
layout/mathml/nsMathMLmfracFrame.cpp
layout/mathml/nsMathMLmfracFrame.h
layout/mathml/nsMathMLmmultiscriptsFrame.cpp
layout/mathml/nsMathMLmmultiscriptsFrame.h
layout/mathml/nsMathMLmoFrame.cpp
layout/mathml/nsMathMLmoFrame.h
layout/mathml/nsMathMLmoverFrame.cpp
layout/mathml/nsMathMLmoverFrame.h
layout/mathml/nsMathMLmpaddedFrame.cpp
layout/mathml/nsMathMLmpaddedFrame.h
layout/mathml/nsMathMLmphantomFrame.cpp
layout/mathml/nsMathMLmrootFrame.cpp
layout/mathml/nsMathMLmrootFrame.h
layout/mathml/nsMathMLmrowFrame.cpp
layout/mathml/nsMathMLmspaceFrame.cpp
layout/mathml/nsMathMLmstyleFrame.cpp
layout/mathml/nsMathMLmsubFrame.cpp
layout/mathml/nsMathMLmsubFrame.h
layout/mathml/nsMathMLmsubsupFrame.cpp
layout/mathml/nsMathMLmsubsupFrame.h
layout/mathml/nsMathMLmsupFrame.cpp
layout/mathml/nsMathMLmsupFrame.h
layout/mathml/nsMathMLmtableFrame.cpp
layout/mathml/nsMathMLmunderFrame.cpp
layout/mathml/nsMathMLmunderFrame.h
layout/mathml/nsMathMLmunderoverFrame.cpp
layout/mathml/nsMathMLmunderoverFrame.h
layout/printing/nsPrintEngine.cpp
layout/printing/nsPrintEngine.h
layout/svg/base/src/nsSVGForeignObjectFrame.cpp
layout/svg/base/src/nsSVGIntegrationUtils.cpp
layout/svg/base/src/nsSVGIntegrationUtils.h
layout/svg/base/src/nsSVGOuterSVGFrame.cpp
layout/svg/base/src/nsSVGOuterSVGFrame.h
layout/svg/base/src/nsSVGUtils.cpp
layout/svg/base/src/nsSVGUtils.h
layout/tables/BasicTableLayoutStrategy.cpp
layout/tables/BasicTableLayoutStrategy.h
layout/tables/FixedTableLayoutStrategy.cpp
layout/tables/FixedTableLayoutStrategy.h
layout/tables/nsITableLayoutStrategy.h
layout/tables/nsTableCellFrame.cpp
layout/tables/nsTableCellFrame.h
layout/tables/nsTableFrame.cpp
layout/tables/nsTableFrame.h
layout/tables/nsTableOuterFrame.cpp
layout/tables/nsTableOuterFrame.h
layout/tables/nsTablePainter.cpp
layout/tables/nsTablePainter.h
layout/tables/nsTableRowFrame.cpp
layout/tables/nsTableRowGroupFrame.cpp
layout/xul/base/src/nsBox.cpp
layout/xul/base/src/nsBoxFrame.cpp
layout/xul/base/src/nsBoxFrame.h
layout/xul/base/src/nsBoxLayoutState.cpp
layout/xul/base/src/nsBoxLayoutState.h
layout/xul/base/src/nsDocElementBoxFrame.cpp
layout/xul/base/src/nsGroupBoxFrame.cpp
layout/xul/base/src/nsIBoxLayout.h
layout/xul/base/src/nsImageBoxFrame.cpp
layout/xul/base/src/nsImageBoxFrame.h
layout/xul/base/src/nsLeafBoxFrame.cpp
layout/xul/base/src/nsLeafBoxFrame.h
layout/xul/base/src/nsListBoxBodyFrame.cpp
layout/xul/base/src/nsRootBoxFrame.cpp
layout/xul/base/src/nsSplitterFrame.cpp
layout/xul/base/src/nsTextBoxFrame.cpp
layout/xul/base/src/nsTextBoxFrame.h
layout/xul/base/src/tree/src/nsTreeBodyFrame.cpp
layout/xul/base/src/tree/src/nsTreeBodyFrame.h
tools/trace-malloc/types.dat
view/public/nsIViewManager.h
view/public/nsIViewObserver.h
widget/public/nsGUIEvent.h
widget/public/nsIWidget.h
widget/src/android/nsWindow.cpp
widget/src/cocoa/nsNativeThemeCocoa.h
widget/src/cocoa/nsNativeThemeCocoa.mm
widget/src/gtk2/nsNativeThemeGTK.cpp
widget/src/gtk2/nsNativeThemeGTK.h
widget/src/gtk2/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/nsNativeThemeWin.h
widget/src/windows/nsWindowGfx.cpp
widget/src/xpwidgets/nsBaseDragService.h
--- a/accessible/src/msaa/nsTextAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsTextAccessibleWrap.cpp
@@ -31,29 +31,24 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-// NOTE: alphabetically ordered
 #include "nsTextAccessibleWrap.h"
 #include "ISimpleDOMText_i.c"
 
 #include "nsCoreUtils.h"
 #include "nsDocAccessible.h"
-
+#include "nsIFrame.h"
 #include "nsIThebesFontMetrics.h"
-#include "nsIFrame.h"
 #include "nsPresContext.h"
-#include "nsIPresShell.h"
-#include "nsIRenderingContext.h"
-#include "nsIComponentManager.h"
 
 #include "gfxFont.h"
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsTextAccessibleWrap Accessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsTextAccessibleWrap::
--- a/accessible/src/msaa/nsTextAccessibleWrap.h
+++ b/accessible/src/msaa/nsTextAccessibleWrap.h
@@ -39,17 +39,17 @@
 #ifndef _nsTextAccessibleWrap_H_
 #define _nsTextAccessibleWrap_H_
 
 #include "nsTextAccessible.h"
 #include "ISimpleDOMText.h"
 #include "nsRect.h"
 
 class nsIFrame;
-class nsIRenderingContext;
+class nsRenderingContext;
 
 class nsTextAccessibleWrap : public nsTextAccessible, 
                              public ISimpleDOMText
 {
 public:
   nsTextAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell);
   virtual ~nsTextAccessibleWrap() {}
 
--- a/content/canvas/public/nsICanvasElementExternal.h
+++ b/content/canvas/public/nsICanvasElementExternal.h
@@ -43,17 +43,17 @@
 
 class gfxContext;
 class nsIFrame;
 struct gfxRect;
 
 #define NS_ICANVASELEMENTEXTERNAL_IID \
   { 0x51870f54, 0x6c4c, 0x469a, {0xad, 0x46, 0xf0, 0xa9, 0x8e, 0x32, 0xa7, 0xe2 } }
 
-class nsIRenderingContext;
+class nsRenderingContext;
 class nsICanvasRenderingContextInternal;
 
 struct _cairo_surface;
 
 /*
  * This interface contains methods that are needed outside of the content/layout
  * modules, specifically widget.  It should eventually go away when we support
  * libxul builds, and nsHTMLCanvasElement be used directly.
--- a/content/canvas/src/nsCanvasRenderingContext2D.cpp
+++ b/content/canvas/src/nsCanvasRenderingContext2D.cpp
@@ -71,17 +71,17 @@
 #include "nsComputedDOMStyle.h"
 #include "nsStyleSet.h"
 
 #include "nsPrintfCString.h"
 
 #include "nsReadableUtils.h"
 
 #include "nsColor.h"
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.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"
--- a/content/html/content/public/nsHTMLCanvasElement.h
+++ b/content/html/content/public/nsHTMLCanvasElement.h
@@ -43,17 +43,17 @@
 #include "nsGkAtoms.h"
 #include "nsSize.h"
 #include "nsIFrame.h"
 #include "nsIDocument.h"
 #include "nsIDOMDocument.h"
 #include "nsDOMError.h"
 #include "nsNodeInfoManager.h"
 
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 
 #include "nsICanvasRenderingContextInternal.h"
 #include "nsICanvasElementExternal.h"
 #include "nsIDOMCanvasRenderingContext2D.h"
 #include "nsLayoutUtils.h"
 
 #include "Layers.h"
 
--- a/content/html/content/src/nsHTMLAudioElement.cpp
+++ b/content/html/content/src/nsHTMLAudioElement.cpp
@@ -56,17 +56,17 @@
 
 #include "nsIScriptSecurityManager.h"
 #include "nsIXPConnect.h"
 #include "jsapi.h"
 #include "jscntxt.h"
 #include "jstypedarray.h"
 #include "nsJSUtils.h"
 
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "nsITimer.h"
 
 #include "nsEventDispatcher.h"
 #include "nsIDOMDocumentEvent.h"
 #include "nsIDOMProgressEvent.h"
 
 using namespace mozilla::dom;
 
--- a/content/html/content/src/nsHTMLMediaElement.cpp
+++ b/content/html/content/src/nsHTMLMediaElement.cpp
@@ -60,17 +60,17 @@
 #include "nsIThreadInternal.h"
 #include "nsContentUtils.h"
 
 #include "nsFrameManager.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsIXPConnect.h"
 #include "jsapi.h"
 
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "nsITimer.h"
 
 #include "nsEventDispatcher.h"
 #include "nsIDOMDocumentEvent.h"
 #include "nsMediaError.h"
 #include "nsICategoryManager.h"
 #include "nsCharSeparatedTokenizer.h"
 #include "nsMediaStream.h"
--- a/content/html/content/src/nsHTMLVideoElement.cpp
+++ b/content/html/content/src/nsHTMLVideoElement.cpp
@@ -53,17 +53,17 @@
 #include "nsXPCOMStrings.h"
 #include "prlock.h"
 #include "nsThreadUtils.h"
 
 #include "nsIScriptSecurityManager.h"
 #include "nsIXPConnect.h"
 #include "jsapi.h"
 
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "nsITimer.h"
 
 #include "nsEventDispatcher.h"
 #include "nsIDOMDocumentEvent.h"
 #include "nsIDOMProgressEvent.h"
 #include "nsMediaError.h"
 
 using namespace mozilla::dom;
--- a/content/media/nsMediaDecoder.cpp
+++ b/content/media/nsMediaDecoder.cpp
@@ -42,17 +42,17 @@
 #include "prlog.h"
 #include "prmem.h"
 #include "nsIFrame.h"
 #include "nsIDocument.h"
 #include "nsThreadUtils.h"
 #include "nsIDOMHTMLMediaElement.h"
 #include "nsNetUtil.h"
 #include "nsHTMLMediaElement.h"
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "gfxContext.h"
 #include "nsPresContext.h"
 #include "nsDOMError.h"
 #include "nsDisplayList.h"
 #ifdef MOZ_SVG
 #include "nsSVGEffects.h"
 #endif
 
--- a/embedding/browser/webBrowser/nsWebBrowser.cpp
+++ b/embedding/browser/webBrowser/nsWebBrowser.cpp
@@ -71,17 +71,17 @@
 #include "nsCWebBrowserPersist.h"
 #include "nsIServiceManager.h"
 #include "nsAutoPtr.h"
 #include "nsFocusManager.h"
 #include "Layers.h"
 #include "gfxContext.h"
 
 // for painting the background window
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "nsIDeviceContext.h"
 #include "nsIRegion.h"
 #include "nsILookAndFeel.h"
 
 // Printing Includes
 #ifdef NS_PRINTING
 #include "nsIWebBrowserPrint.h"
 #include "nsIContentViewer.h"
--- a/gfx/layers/basic/BasicLayers.cpp
+++ b/gfx/layers/basic/BasicLayers.cpp
@@ -43,17 +43,17 @@
 #include "mozilla/layers/PLayersParent.h"
 #include "ipc/ShadowLayerChild.h"
 
 #include "BasicLayers.h"
 #include "ImageLayers.h"
 
 #include "nsTArray.h"
 #include "nsGUIEvent.h"
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "gfxContext.h"
 #include "gfxImageSurface.h"
 #include "gfxPattern.h"
 #include "gfxPlatform.h"
 #include "gfxUtils.h"
 #include "ThebesLayerBuffer.h"
 #include "nsIWidget.h"
 #include "ReadbackProcessor.h"
--- a/gfx/src/nsIDeviceContext.h
+++ b/gfx/src/nsIDeviceContext.h
@@ -215,39 +215,39 @@ public:
   NS_IMETHOD  InitForPrinting(nsIDeviceContextSpec* aDevSpec) = 0;
 
   /**
    * Create a rendering context and initialize it from an nsIView
    * @param aView view to initialize context from
    * @param aContext out parameter for new rendering context
    * @return error status
    */
-  NS_IMETHOD  CreateRenderingContext(nsIView *aView, nsIRenderingContext *&aContext) = 0;
+  NS_IMETHOD  CreateRenderingContext(nsIView *aView, nsRenderingContext *&aContext) = 0;
 
   /**
    * Create a rendering context and initialize it from an nsIWidget
    * @param aWidget widget to initialize context from
    * @param aContext out parameter for new rendering context
    * @return error status
    */
-  NS_IMETHOD  CreateRenderingContext(nsIWidget *aWidget, nsIRenderingContext *&aContext) = 0;
+  NS_IMETHOD  CreateRenderingContext(nsIWidget *aWidget, nsRenderingContext *&aContext) = 0;
 
   /**
    * Create a rendering context and initialize it.
    * @param aContext out parameter for new rendering context
    * @return error status
    */
-  NS_IMETHOD  CreateRenderingContext(nsIRenderingContext *&aContext) = 0;
+  NS_IMETHOD  CreateRenderingContext(nsRenderingContext *&aContext) = 0;
 
   /**
    * Create an uninitalised rendering context.
    * @param aContext out parameter for new rendering context
    * @return error status
    */
-  NS_IMETHOD  CreateRenderingContextInstance(nsIRenderingContext *&aContext) = 0;
+  NS_IMETHOD  CreateRenderingContextInstance(nsRenderingContext *&aContext) = 0;
 
   /**
    * We are in the process of creating the native widget for aWidget.
    * Do any device-specific processing required to initialize the
    * native widget for this device. A pointer to some platform-specific data is
    * returned in aOut.
    *
    * GTK2 calls this to get the required visual for the window.
--- a/gfx/src/nsIThebesFontMetrics.h
+++ b/gfx/src/nsIThebesFontMetrics.h
@@ -46,20 +46,20 @@ class gfxFontGroup;
 class nsRenderingContext;
 
 class nsIThebesFontMetrics : public nsIFontMetrics {
 public:
     // Get the width for this string.  aWidth will be updated with the
     // width in points, not twips.  Callers must convert it if they
     // want it in another format.
     virtual nsresult GetWidth(const char* aString, PRUint32 aLength,
-                              nscoord& aWidth, nsThebesRenderingContext *aContext) = 0;
+                              nscoord& aWidth, nsRenderingContext *aContext) = 0;
     virtual nsresult GetWidth(const PRUnichar* aString, PRUint32 aLength,
                               nscoord& aWidth, PRInt32 *aFontID,
-                              nsThebesRenderingContext *aContext) = 0;
+                              nsRenderingContext *aContext) = 0;
 
     // Get the text dimensions for this string
     virtual nsresult GetTextDimensions(const PRUnichar* aString,
                                        PRUint32 aLength,
                                        nsTextDimensions& aDimensions, 
                                        PRInt32* aFontID) = 0;
     virtual nsresult GetTextDimensions(const char*         aString,
                                        PRInt32             aLength,
@@ -79,39 +79,39 @@ public:
                                        PRInt32&            aNumCharsFit,
                                        nsTextDimensions&   aLastWordDimensions,
                                        PRInt32*            aFontID) = 0;
 
     // Draw a string using this font handle on the surface passed in.  
     virtual nsresult DrawString(const char *aString, PRUint32 aLength,
                                 nscoord aX, nscoord aY,
                                 const nscoord* aSpacing,
-                                nsThebesRenderingContext *aContext) = 0;
+                                nsRenderingContext *aContext) = 0;
     virtual nsresult DrawString(const PRUnichar* aString, PRUint32 aLength,
                                 nscoord aX, nscoord aY,
                                 PRInt32 aFontID,
                                 const nscoord* aSpacing,
-                                nsThebesRenderingContext *aContext) = 0;
+                                nsRenderingContext *aContext) = 0;
     virtual nsresult DrawString(const PRUnichar* aString, PRUint32 aLength,
                                 nscoord aX, nscoord aY,
-                                nsIRenderingContext *aContext,
-                                nsIRenderingContext *aTextRunConstructionContext) = 0;
+                                nsRenderingContext *aContext,
+                                nsRenderingContext *aTextRunConstructionContext) = 0;
 
 #ifdef MOZ_MATHML
     // These two functions get the bounding metrics for this handle,
     // updating the aBoundingMetrics in Points.  This means that the
     // caller will have to update them to twips before passing it
     // back.
     virtual nsresult GetBoundingMetrics(const char *aString, PRUint32 aLength,
-                                        nsThebesRenderingContext *aContext,
+                                        nsRenderingContext *aContext,
                                         nsBoundingMetrics &aBoundingMetrics) = 0;
     // aCachedOffset will be updated with a new offset.
     virtual nsresult GetBoundingMetrics(const PRUnichar *aString,
                                         PRUint32 aLength,
-                                        nsThebesRenderingContext *aContext,
+                                        nsRenderingContext *aContext,
                                         nsBoundingMetrics &aBoundingMetrics) = 0;
 #endif /* MOZ_MATHML */
 
     // Set the direction of the text rendering
     virtual nsresult SetRightToLeftText(PRBool aIsRTL) = 0;
     virtual PRBool GetRightToLeftText() = 0;
     virtual void SetTextRunRTL(PRBool aIsRTL) = 0;
 
--- a/gfx/src/nsITheme.h
+++ b/gfx/src/nsITheme.h
@@ -46,17 +46,17 @@
 #include "nsColor.h"
 
 struct nsRect;
 struct nsIntRect;
 struct nsIntSize;
 struct nsFont;
 struct nsIntMargin;
 class nsPresContext;
-class nsIRenderingContext;
+class nsRenderingContext;
 class nsIDeviceContext;
 class nsIFrame;
 class nsIContent;
 class nsIAtom;
 class nsIWidget;
 
 // IID for the nsITheme interface
 // {887e8902-db6b-41b4-8481-a80f49c5a93a}
@@ -90,17 +90,17 @@ public:
   /**
    * Draw the actual theme background.
    * @param aContext the context to draw into
    * @param aFrame the frame for the widget that we're drawing
    * @param aWidgetType the -moz-appearance value to draw
    * @param aRect the rectangle defining the area occupied by the widget
    * @param aDirtyRect the rectangle that needs to be drawn
    */
-  NS_IMETHOD DrawWidgetBackground(nsIRenderingContext* aContext,
+  NS_IMETHOD DrawWidgetBackground(nsRenderingContext* aContext,
                                   nsIFrame* aFrame,
                                   PRUint8 aWidgetType,
                                   const nsRect& aRect,
                                   const nsRect& aDirtyRect) = 0;
 
   /**
    * XXX Unused. This is only here because the interface is frozen for 2.0.
    */
@@ -145,17 +145,17 @@ public:
   { return PR_FALSE; }
 
   /**
    * Get the minimum border-box size of a widget, in *pixels* (in
    * |aResult|).  If |aIsOverridable| is set to true, this size is a
    * minimum size; if false, this size is the only valid size for the
    * widget.
    */
-  NS_IMETHOD GetMinimumWidgetSize(nsIRenderingContext* aContext,
+  NS_IMETHOD GetMinimumWidgetSize(nsRenderingContext* aContext,
                                   nsIFrame* aFrame,
                                   PRUint8 aWidgetType,
                                   nsIntSize* aResult,
                                   PRBool* aIsOverridable)=0;
 
 
   enum Transparency {
     eOpaque = 0,
--- a/gfx/src/nsRenderingContext.cpp
+++ b/gfx/src/nsRenderingContext.cpp
@@ -103,17 +103,17 @@ static PRInt32 FindSafeLength(nsRenderin
                               const char *aString, PRUint32 aLength,
                               PRUint32 aMaxChunkLength)
 {
     // Since it's ASCII, we don't need to worry about clusters or RTL
     return PR_MIN(aLength, aMaxChunkLength);
 }
 
 //////////////////////////////////////////////////////////////////////
-//// nsIRenderingContext
+//// nsRenderingContext
 
 nsresult
 nsRenderingContext::Init(nsIDeviceContext* aContext, gfxASurface *aThebesSurface)
 {
     PR_LOG(gThebesGFXLog, PR_LOG_DEBUG, ("## %p nsTRC::Init ctx %p thebesSurface %p\n", this, aContext, aThebesSurface));
 
     mDeviceContext = aContext;
     mWidget = nsnull;
--- a/gfx/src/nsThebesDeviceContext.cpp
+++ b/gfx/src/nsThebesDeviceContext.cpp
@@ -45,17 +45,17 @@
 #include "nsUnicharUtils.h"
 
 #include "nsIServiceManager.h"
 #include "nsIPrefService.h"
 #include "nsCRT.h"
 #include "mozilla/Services.h"
 
 #include "nsThebesDeviceContext.h"
-#include "nsThebesRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "gfxUserFontSet.h"
 #include "gfxPlatform.h"
 
 #include "nsIWidget.h"
 #include "nsIView.h"
 #include "nsILookAndFeel.h"
 
 #include "gfxImageSurface.h"
@@ -706,36 +706,36 @@ nsThebesDeviceContext::Init(nsIWidget *a
 
     mScreenManager = do_GetService("@mozilla.org/gfx/screenmanager;1");
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsThebesDeviceContext::CreateRenderingContext(nsIView *aView,
-                                              nsIRenderingContext *&aContext)
+                                              nsRenderingContext *&aContext)
 {
     // This is currently only called by the caret code
     NS_ENSURE_ARG_POINTER(aView);
     NS_PRECONDITION(aView->HasWidget(), "View has no widget!");
 
     nsCOMPtr<nsIWidget> widget;
     widget = aView->GetWidget();
 
     return CreateRenderingContext(widget, aContext);
 }
 
 NS_IMETHODIMP
 nsThebesDeviceContext::CreateRenderingContext(nsIWidget *aWidget,
-                                              nsIRenderingContext *&aContext)
+                                              nsRenderingContext *&aContext)
 {
     nsresult rv;
 
     aContext = nsnull;
-    nsCOMPtr<nsIRenderingContext> pContext;
+    nsRefPtr<nsRenderingContext> pContext;
     rv = CreateRenderingContextInstance(*getter_AddRefs(pContext));
     if (NS_SUCCEEDED(rv)) {
         nsRefPtr<gfxASurface> surface(aWidget->GetThebesSurface());
         if (surface)
             rv = pContext->Init(this, surface);
         else
             rv = NS_ERROR_FAILURE;
 
@@ -744,22 +744,22 @@ nsThebesDeviceContext::CreateRenderingCo
             NS_ADDREF(aContext);
         }
     }
 
     return rv;
 }
 
 NS_IMETHODIMP
-nsThebesDeviceContext::CreateRenderingContext(nsIRenderingContext *&aContext)
+nsThebesDeviceContext::CreateRenderingContext(nsRenderingContext *&aContext)
 {
     nsresult rv = NS_OK;
 
     aContext = nsnull;
-    nsCOMPtr<nsIRenderingContext> pContext;
+    nsRefPtr<nsRenderingContext> pContext;
     rv = CreateRenderingContextInstance(*getter_AddRefs(pContext));
     if (NS_SUCCEEDED(rv)) {
         if (mPrintingSurface)
             rv = pContext->Init(this, mPrintingSurface);
         else
             rv = NS_ERROR_FAILURE;
 
         if (NS_SUCCEEDED(rv)) {
@@ -768,19 +768,19 @@ nsThebesDeviceContext::CreateRenderingCo
             NS_ADDREF(aContext);
         }
     }
 
     return rv;
 }
 
 NS_IMETHODIMP
-nsThebesDeviceContext::CreateRenderingContextInstance(nsIRenderingContext *&aContext)
+nsThebesDeviceContext::CreateRenderingContextInstance(nsRenderingContext *&aContext)
 {
-    nsCOMPtr<nsIRenderingContext> renderingContext = new nsThebesRenderingContext();
+    nsRefPtr<nsRenderingContext> renderingContext = new nsRenderingContext();
     if (!renderingContext)
         return NS_ERROR_OUT_OF_MEMORY;
 
     aContext = renderingContext;
     NS_ADDREF(aContext);
 
     return NS_OK;
 }
--- a/gfx/src/nsThebesDeviceContext.h
+++ b/gfx/src/nsThebesDeviceContext.h
@@ -78,20 +78,20 @@ public:
 
     static void Shutdown();
 
     NS_DECL_ISUPPORTS
     NS_DECL_NSIOBSERVER
 
     NS_IMETHOD Init(nsIWidget *aWidget);
     NS_IMETHOD InitForPrinting(nsIDeviceContextSpec *aDevSpec);
-    NS_IMETHOD CreateRenderingContext(nsIView *aView, nsIRenderingContext *&aContext);
-    NS_IMETHOD CreateRenderingContext(nsIWidget *aWidget, nsIRenderingContext *&aContext);
-    NS_IMETHOD CreateRenderingContext(nsIRenderingContext *&aContext);
-    NS_IMETHOD CreateRenderingContextInstance(nsIRenderingContext *&aContext);
+    NS_IMETHOD CreateRenderingContext(nsIView *aView, nsRenderingContext *&aContext);
+    NS_IMETHOD CreateRenderingContext(nsIWidget *aWidget, nsRenderingContext *&aContext);
+    NS_IMETHOD CreateRenderingContext(nsRenderingContext *&aContext);
+    NS_IMETHOD CreateRenderingContextInstance(nsRenderingContext *&aContext);
 
     NS_IMETHOD GetMetricsFor(const nsFont& aFont, nsIAtom* aLanguage,
                              gfxUserFontSet* aUserFontSet,
                              nsIFontMetrics*& aMetrics);
     NS_IMETHOD GetMetricsFor(const nsFont& aFont,
                              gfxUserFontSet* aUserFontSet,
                              nsIFontMetrics*& aMetrics);
 
--- a/gfx/src/nsThebesFontMetrics.cpp
+++ b/gfx/src/nsThebesFontMetrics.cpp
@@ -291,17 +291,17 @@ public:
     virtual void GetSpacing(PRUint32 aStart, PRUint32 aLength,
                             Spacing* aSpacing) {
         NS_ERROR("This shouldn't be called because we never enable spacing");
     }
 };
 
 nsresult 
 nsThebesFontMetrics::GetWidth(const char* aString, PRUint32 aLength, nscoord& aWidth,
-                              nsThebesRenderingContext *aContext)
+                              nsRenderingContext *aContext)
 {
     if (aLength == 0) {
         aWidth = 0;
         return NS_OK;
     }
 
     // callers that hit this should not be so stupid
     if ((aLength == 1) && (aString[0] == ' '))
@@ -315,17 +315,17 @@ nsThebesFontMetrics::GetWidth(const char
     aWidth = NSToCoordRound(textRun->GetAdvanceWidth(0, aLength, &provider));
 
     return NS_OK;
 }
 
 nsresult
 nsThebesFontMetrics::GetWidth(const PRUnichar* aString, PRUint32 aLength,
                               nscoord& aWidth, PRInt32 *aFontID,
-                              nsThebesRenderingContext *aContext)
+                              nsRenderingContext *aContext)
 {
     if (aLength == 0) {
         aWidth = 0;
         return NS_OK;
     }
 
     // callers that hit this should not be so stupid
     if ((aLength == 1) && (aString[0] == ' '))
@@ -378,17 +378,17 @@ nsThebesFontMetrics::GetTextDimensions(c
     return NS_OK;
 }
 
 // Draw a string using this font handle on the surface passed in.  
 nsresult
 nsThebesFontMetrics::DrawString(const char *aString, PRUint32 aLength,
                                 nscoord aX, nscoord aY,
                                 const nscoord* aSpacing,
-                                nsThebesRenderingContext *aContext)
+                                nsRenderingContext *aContext)
 {
     if (aLength == 0)
         return NS_OK;
 
     NS_ASSERTION(!aSpacing, "Spacing not supported here");
     StubPropertyProvider provider;
     AutoTextRun textRun(this, aContext, aString, aLength);
     if (!textRun.get())
@@ -400,18 +400,18 @@ nsThebesFontMetrics::DrawString(const ch
     textRun->Draw(aContext->ThebesContext(), pt, 0, aLength,
                   &provider, nsnull);
     return NS_OK;
 }
 
 nsresult
 nsThebesFontMetrics::DrawString(const PRUnichar* aString, PRUint32 aLength,
                                 nscoord aX, nscoord aY,
-                                nsIRenderingContext *aContext,
-                                nsIRenderingContext *aTextRunConstructionContext)
+                                nsRenderingContext *aContext,
+                                nsRenderingContext *aTextRunConstructionContext)
 {
     if (aLength == 0)
         return NS_OK;
 
     StubPropertyProvider provider;
     AutoTextRun textRun(this, aTextRunConstructionContext, aString, aLength);
     if (!textRun.get())
         return NS_ERROR_FAILURE;
@@ -423,17 +423,17 @@ nsThebesFontMetrics::DrawString(const PR
                   &provider, nsnull);
     return NS_OK;
 }
 
 #ifdef MOZ_MATHML
 
 static void
 GetTextRunBoundingMetrics(gfxTextRun *aTextRun, PRUint32 aStart, PRUint32 aLength,
-                          nsThebesRenderingContext *aContext,
+                          nsRenderingContext *aContext,
                           nsBoundingMetrics &aBoundingMetrics)
 {
     StubPropertyProvider provider;
     gfxTextRun::Metrics theMetrics =
         aTextRun->MeasureText(aStart, aLength, gfxFont::TIGHT_HINTED_OUTLINE_EXTENTS,
                               aContext->ThebesContext(), &provider);
         // note that TIGHT_HINTED_OUTLINE_EXTENTS can be expensive (on Windows)
         // but this is only used for MathML positioning so it's not critical
@@ -442,17 +442,17 @@ GetTextRunBoundingMetrics(gfxTextRun *aT
     aBoundingMetrics.rightBearing = NSToCoordCeil(theMetrics.mBoundingBox.XMost());
     aBoundingMetrics.width = NSToCoordRound(theMetrics.mAdvanceWidth);
     aBoundingMetrics.ascent = NSToCoordCeil(- theMetrics.mBoundingBox.Y());
     aBoundingMetrics.descent = NSToCoordCeil(theMetrics.mBoundingBox.YMost());
 }
 
 nsresult
 nsThebesFontMetrics::GetBoundingMetrics(const char *aString, PRUint32 aLength,
-                                        nsThebesRenderingContext *aContext,
+                                        nsRenderingContext *aContext,
                                         nsBoundingMetrics &aBoundingMetrics)
 {
     if (aLength == 0) {
         aBoundingMetrics.Clear();
         return NS_OK;
     }
 
     AutoTextRun textRun(this, aContext, aString, aLength);
@@ -460,17 +460,17 @@ nsThebesFontMetrics::GetBoundingMetrics(
         return NS_ERROR_FAILURE;
 
     GetTextRunBoundingMetrics(textRun.get(), 0, aLength, aContext, aBoundingMetrics);
     return NS_OK;
 }
 
 nsresult
 nsThebesFontMetrics::GetBoundingMetrics(const PRUnichar *aString, PRUint32 aLength,
-                                        nsThebesRenderingContext *aContext,
+                                        nsRenderingContext *aContext,
                                         nsBoundingMetrics &aBoundingMetrics)
 {
     if (aLength == 0) {
         aBoundingMetrics.Clear();
         return NS_OK;
     }
 
     AutoTextRun textRun(this, aContext, aString, aLength);
--- a/gfx/src/nsThebesFontMetrics.h
+++ b/gfx/src/nsThebesFontMetrics.h
@@ -35,17 +35,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef NSTHEBESFONTMETRICS__H__
 #define NSTHEBESFONTMETRICS__H__
 
 #include "nsIThebesFontMetrics.h"
-#include "nsThebesRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "nsCOMPtr.h"
 #include "nsThebesDeviceContext.h"
 #include "nsIAtom.h"
 
 #include "gfxFont.h"
 #include "gfxTextRunCache.h"
 
 class nsThebesFontMetrics : public nsIThebesFontMetrics
@@ -78,20 +78,20 @@ public:
     NS_IMETHOD  GetLanguage(nsIAtom** aLanguage);
     NS_IMETHOD  GetFontHandle(nsFontHandle &aHandle);
     NS_IMETHOD  GetAveCharWidth(nscoord& aAveCharWidth);
     NS_IMETHOD  GetSpaceWidth(nscoord& aSpaceCharWidth);
     virtual PRInt32 GetMaxStringLength();
 
 
     virtual nsresult GetWidth(const char* aString, PRUint32 aLength, nscoord& aWidth,
-                              nsThebesRenderingContext *aContext);
+                              nsRenderingContext *aContext);
     virtual nsresult GetWidth(const PRUnichar* aString, PRUint32 aLength,
                               nscoord& aWidth, PRInt32 *aFontID,
-                              nsThebesRenderingContext *aContext);
+                              nsRenderingContext *aContext);
 
     // Get the text dimensions for this string
     virtual nsresult GetTextDimensions(const PRUnichar* aString,
                                        PRUint32 aLength,
                                        nsTextDimensions& aDimensions, 
                                        PRInt32* aFontID);
     virtual nsresult GetTextDimensions(const char*         aString,
                                        PRInt32             aLength,
@@ -111,40 +111,40 @@ public:
                                        PRInt32&            aNumCharsFit,
                                        nsTextDimensions&   aLastWordDimensions,
                                        PRInt32*            aFontID);
 
     // Draw a string using this font handle on the surface passed in.  
     virtual nsresult DrawString(const char *aString, PRUint32 aLength,
                                 nscoord aX, nscoord aY,
                                 const nscoord* aSpacing,
-                                nsThebesRenderingContext *aContext);
+                                nsRenderingContext *aContext);
     virtual nsresult DrawString(const PRUnichar* aString, PRUint32 aLength,
                                 nscoord aX, nscoord aY,
                                 PRInt32 aFontID,
                                 const nscoord* aSpacing,
-                                nsThebesRenderingContext *aContext)
+                                nsRenderingContext *aContext)
     {
       NS_ASSERTION(!aSpacing, "Spacing not supported here");
       return DrawString(aString, aLength, aX, aY, aContext, aContext);
     }
     virtual nsresult DrawString(const PRUnichar* aString, PRUint32 aLength,
                                 nscoord aX, nscoord aY,
-                                nsIRenderingContext *aContext,
-                                nsIRenderingContext *aTextRunConstructionContext);
+                                nsRenderingContext *aContext,
+                                nsRenderingContext *aTextRunConstructionContext);
 
 #ifdef MOZ_MATHML
     // These two functions get the bounding metrics for this handle,
     // updating the aBoundingMetrics in app units.
     virtual nsresult GetBoundingMetrics(const char *aString, PRUint32 aLength,
-                                        nsThebesRenderingContext *aContext,
+                                        nsRenderingContext *aContext,
                                         nsBoundingMetrics &aBoundingMetrics);
     virtual nsresult GetBoundingMetrics(const PRUnichar *aString,
                                         PRUint32 aLength,
-                                        nsThebesRenderingContext *aContext,
+                                        nsRenderingContext *aContext,
                                         nsBoundingMetrics &aBoundingMetrics);
 #endif /* MOZ_MATHML */
 
     // Set the direction of the text rendering
     virtual nsresult SetRightToLeftText(PRBool aIsRTL);
     virtual PRBool GetRightToLeftText();
     virtual void SetTextRunRTL(PRBool aIsRTL) { mTextRunRTL = aIsRTL; }
 
@@ -157,25 +157,25 @@ public:
     }
 
 protected:
 
     const gfxFont::Metrics& GetMetrics() const;
 
     class AutoTextRun {
     public:
-        AutoTextRun(nsThebesFontMetrics* aMetrics, nsIRenderingContext* aRC,
+        AutoTextRun(nsThebesFontMetrics* aMetrics, nsRenderingContext* aRC,
                     const char* aString, PRInt32 aLength) {
             mTextRun = gfxTextRunCache::MakeTextRun(
                 reinterpret_cast<const PRUint8*>(aString), aLength,
                 aMetrics->mFontGroup, aRC->ThebesContext(),
                 aMetrics->mP2A,
                 ComputeFlags(aMetrics));
         }
-        AutoTextRun(nsThebesFontMetrics* aMetrics, nsIRenderingContext* aRC,
+        AutoTextRun(nsThebesFontMetrics* aMetrics, nsRenderingContext* aRC,
                     const PRUnichar* aString, PRInt32 aLength) {
             mTextRun = gfxTextRunCache::MakeTextRun(
                 aString, aLength, aMetrics->mFontGroup,
                 aRC->ThebesContext(),
                 aMetrics->mP2A,
                 ComputeFlags(aMetrics));
         }
         gfxTextRun* operator->() { return mTextRun.get(); }
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -1886,17 +1886,17 @@ FrameLayerBuilder::DrawThebesLayer(Thebe
         visible = newVisible;
       }
     }
     if (!cdi->mClip.IsRectClippedByRoundedCorner(cdi->mItem->GetVisibleRect())) {
       cdi->mClip.RemoveRoundedCorners();
     }
   }
 
-  nsRefPtr<nsIRenderingContext> rc;
+  nsRefPtr<nsRenderingContext> rc;
   nsresult rv =
     presContext->DeviceContext()->CreateRenderingContextInstance(*getter_AddRefs(rc));
   if (NS_FAILED(rv))
     return;
   rc->Init(presContext->DeviceContext(), aContext);
 
   Clip currentClip;
   PRBool setClipRect = PR_FALSE;
--- a/layout/base/nsBidiPresUtils.cpp
+++ b/layout/base/nsBidiPresUtils.cpp
@@ -39,17 +39,17 @@
  * ***** END LICENSE BLOCK ***** */
 
 #ifdef IBMBIDI
 
 #include "nsBidiPresUtils.h"
 #include "nsTextFragment.h"
 #include "nsGkAtoms.h"
 #include "nsPresContext.h"
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "nsIServiceManager.h"
 #include "nsFrameManager.h"
 #include "nsBidiUtils.h"
 #include "nsCSSFrameConstructor.h"
 #include "nsHTMLContainerFrame.h"
 #include "nsInlineFrame.h"
 #include "nsPlaceholderFrame.h"
 #include "nsContainerFrame.h"
@@ -1753,18 +1753,18 @@ nsresult nsBidiPresUtils::ProcessText(co
   if (aWidth) {
     *aWidth = totalWidth;
   }
   return NS_OK;
 }
 
 class NS_STACK_CLASS nsIRenderingContextBidiProcessor : public nsBidiPresUtils::BidiProcessor {
 public:
-  nsIRenderingContextBidiProcessor(nsIRenderingContext* aCtx,
-                                   nsIRenderingContext* aTextRunConstructionContext,
+  nsIRenderingContextBidiProcessor(nsRenderingContext* aCtx,
+                                   nsRenderingContext* aTextRunConstructionContext,
                                    const nsPoint&       aPt)
     : mCtx(aCtx), mTextRunConstructionContext(aTextRunConstructionContext), mPt(aPt) { }
 
   ~nsIRenderingContextBidiProcessor()
   {
     mCtx->SetRightToLeftText(PR_FALSE);
   }
 
@@ -1789,30 +1789,30 @@ public:
   {
     nsCOMPtr<nsIFontMetrics> metrics = mCtx->GetFontMetrics();
     nsIThebesFontMetrics* fm = static_cast<nsIThebesFontMetrics*>(metrics.get());
     fm->DrawString(mText, mLength, mPt.x + aXOffset, mPt.y,
                    mCtx, mTextRunConstructionContext);
   }
 
 private:
-  nsIRenderingContext* mCtx;
-  nsIRenderingContext* mTextRunConstructionContext;
+  nsRenderingContext* mCtx;
+  nsRenderingContext* mTextRunConstructionContext;
   nsPoint mPt;
   const PRUnichar* mText;
   PRInt32 mLength;
   nsBidiDirection mDirection;
 };
 
 nsresult nsBidiPresUtils::ProcessTextForRenderingContext(const PRUnichar*       aText,
                                                          PRInt32                aLength,
                                                          nsBidiDirection        aBaseDirection,
                                                          nsPresContext*         aPresContext,
-                                                         nsIRenderingContext&   aRenderingContext,
-                                                         nsIRenderingContext&   aTextRunConstructionContext,
+                                                         nsRenderingContext&   aRenderingContext,
+                                                         nsRenderingContext&   aTextRunConstructionContext,
                                                          Mode                   aMode,
                                                          nscoord                aX,
                                                          nscoord                aY,
                                                          nsBidiPositionResolve* aPosResolve,
                                                          PRInt32                aPosResolveCount,
                                                          nscoord*               aWidth)
 {
   nsIRenderingContextBidiProcessor processor(&aRenderingContext, &aTextRunConstructionContext, nsPoint(aX, aY));
--- a/layout/base/nsBidiPresUtils.h
+++ b/layout/base/nsBidiPresUtils.h
@@ -221,32 +221,32 @@ public:
    * @param aY the y-coordinate to render the string
    * @param[in,out] aPosResolve array of logical positions to resolve into visual positions; can be nsnull if this functionality is not required
    * @param aPosResolveCount number of items in the aPosResolve array
    */
   static nsresult RenderText(const PRUnichar*       aText,
                              PRInt32                aLength,
                              nsBidiDirection        aBaseDirection,
                              nsPresContext*         aPresContext,
-                             nsIRenderingContext&   aRenderingContext,
-                             nsIRenderingContext&   aTextRunConstructionContext,
+                             nsRenderingContext&    aRenderingContext,
+                             nsRenderingContext&    aTextRunConstructionContext,
                              nscoord                aX,
                              nscoord                aY,
                              nsBidiPositionResolve* aPosResolve = nsnull,
                              PRInt32                aPosResolveCount = 0)
   {
     return ProcessTextForRenderingContext(aText, aLength, aBaseDirection, aPresContext, aRenderingContext,
                                           aTextRunConstructionContext, MODE_DRAW, aX, aY, aPosResolve, aPosResolveCount, nsnull);
   }
   
   static nscoord MeasureTextWidth(const PRUnichar*     aText,
                                   PRInt32              aLength,
                                   nsBidiDirection      aBaseDirection,
                                   nsPresContext*       aPresContext,
-                                  nsIRenderingContext& aRenderingContext)
+                                  nsRenderingContext&  aRenderingContext)
   {
     nscoord length;
     nsresult rv = ProcessTextForRenderingContext(aText, aLength, aBaseDirection, aPresContext,
                                                  aRenderingContext, aRenderingContext,
                                                  MODE_MEASURE, 0, 0, nsnull, 0, &length);
     return NS_SUCCEEDED(rv) ? length : 0;
   }
 
@@ -346,18 +346,18 @@ public:
                                   nsBidiLevel aBaseDirection,
                                   PRBool aOverride);
 
 private:
   static nsresult ProcessTextForRenderingContext(const PRUnichar*       aText,
                                                  PRInt32                aLength,
                                                  nsBidiDirection        aBaseDirection,
                                                  nsPresContext*         aPresContext,
-                                                 nsIRenderingContext&   aRenderingContext,
-                                                 nsIRenderingContext&   aTextRunConstructionContext,
+                                                 nsRenderingContext&    aRenderingContext,
+                                                 nsRenderingContext&    aTextRunConstructionContext,
                                                  Mode                   aMode,
                                                  nscoord                aX, // DRAW only
                                                  nscoord                aY, // DRAW only
                                                  nsBidiPositionResolve* aPosResolve,  /* may be null */
                                                  PRInt32                aPosResolveCount,
                                                  nscoord*               aWidth /* may be null */);
 
   /**
--- a/layout/base/nsCSSRendering.cpp
+++ b/layout/base/nsCSSRendering.cpp
@@ -114,17 +114,17 @@ public:
    * intrinsic size so we have to pass in a default that they will use.
    */
   nsSize ComputeSize(const nsSize& aDefault);
   /**
    * Draws the image to the target rendering context.
    * @see nsLayoutUtils::DrawImage() for other parameters
    */
   void Draw(nsPresContext*       aPresContext,
-            nsIRenderingContext& aRenderingContext,
+            nsRenderingContext& aRenderingContext,
             const nsRect&        aDest,
             const nsRect&        aFill,
             const nsPoint&       aAnchor,
             const nsRect&        aDirty);
 
 private:
   nsIFrame*                 mForFrame;
   const nsStyleImage*       mImage;
@@ -353,23 +353,23 @@ protected:
     nsBlockInFlowLineIterator it1(mBlockFrame, aFrame1, &isValid1);
     nsBlockInFlowLineIterator it2(mBlockFrame, aFrame2, &isValid2);
     return isValid1 && isValid2 && it1.GetLine() == it2.GetLine();
   }
 };
 
 /* Local functions */
 static void DrawBorderImage(nsPresContext* aPresContext,
-                            nsIRenderingContext& aRenderingContext,
+                            nsRenderingContext& aRenderingContext,
                             nsIFrame* aForFrame,
                             const nsRect& aBorderArea,
                             const nsStyleBorder& aStyleBorder,
                             const nsRect& aDirtyRect);
 
-static void DrawBorderImageComponent(nsIRenderingContext& aRenderingContext,
+static void DrawBorderImageComponent(nsRenderingContext& aRenderingContext,
                                      nsIFrame* aForFrame,
                                      imgIContainer* aImage,
                                      const nsRect& aDirtyRect,
                                      const nsRect& aFill,
                                      const nsIntRect& aSrc,
                                      PRUint8 aHFill,
                                      PRUint8 aVFill,
                                      const nsSize& aUnitSize,
@@ -467,17 +467,17 @@ nsCSSRendering::ComputePixelRadii(const 
   (*oBorderRadii)[C_BR] = gfxSize(radii[NS_CORNER_BOTTOM_RIGHT_X],
                                   radii[NS_CORNER_BOTTOM_RIGHT_Y]);
   (*oBorderRadii)[C_BL] = gfxSize(radii[NS_CORNER_BOTTOM_LEFT_X],
                                   radii[NS_CORNER_BOTTOM_LEFT_Y]);
 }
 
 void
 nsCSSRendering::PaintBorder(nsPresContext* aPresContext,
-                            nsIRenderingContext& aRenderingContext,
+                            nsRenderingContext& aRenderingContext,
                             nsIFrame* aForFrame,
                             const nsRect& aDirtyRect,
                             const nsRect& aBorderArea,
                             nsStyleContext* aStyleContext,
                             PRIntn aSkipSides)
 {
   nsStyleContext *styleIfVisited = aStyleContext->GetStyleIfVisited();
   const nsStyleBorder *styleBorder = aStyleContext->GetStyleBorder();
@@ -508,17 +508,17 @@ nsCSSRendering::PaintBorder(nsPresContex
 
 #ifdef DEBUG
   newStyleBorder.mImageTracked = false;
 #endif
 }
 
 void
 nsCSSRendering::PaintBorderWithStyleBorder(nsPresContext* aPresContext,
-                                           nsIRenderingContext& aRenderingContext,
+                                           nsRenderingContext& aRenderingContext,
                                            nsIFrame* aForFrame,
                                            const nsRect& aDirtyRect,
                                            const nsRect& aBorderArea,
                                            const nsStyleBorder& aStyleBorder,
                                            nsStyleContext* aStyleContext,
                                            PRIntn aSkipSides)
 {
   nsMargin            border;
@@ -659,17 +659,17 @@ GetOutlineInnerRect(nsIFrame* aFrame)
   // FIXME (bug 599652): We probably want something narrower than either
   // overflow rect here, but for now use the visual overflow in order to
   // be consistent with ComputeOutlineAndEffectsRect in nsFrame.cpp.
   return aFrame->GetVisualOverflowRect();
 }
 
 void
 nsCSSRendering::PaintOutline(nsPresContext* aPresContext,
-                             nsIRenderingContext& aRenderingContext,
+                             nsRenderingContext& aRenderingContext,
                              nsIFrame* aForFrame,
                              const nsRect& aDirtyRect,
                              const nsRect& aBorderArea,
                              nsStyleContext* aStyleContext)
 {
   nscoord             twipsRadii[8];
 
   // Get our style context's color struct.
@@ -788,17 +788,17 @@ nsCSSRendering::PaintOutline(nsPresConte
 
   ctx->Restore();
 
   SN();
 }
 
 void
 nsCSSRendering::PaintFocus(nsPresContext* aPresContext,
-                           nsIRenderingContext& aRenderingContext,
+                           nsRenderingContext& aRenderingContext,
                            const nsRect& aFocusRect,
                            nscolor aColor)
 {
   nscoord oneCSSPixel = nsPresContext::CSSPixelsToAppUnits(1);
   nscoord oneDevPixel = aPresContext->DevPixelsToAppUnits(1);
 
   gfxRect focusRect(nsLayoutUtils::RectToGfxRect(aFocusRect, oneDevPixel));
 
@@ -1068,17 +1068,17 @@ nsCSSRendering::FindBackground(nsPresCon
 void
 nsCSSRendering::DidPaint()
 {
   gInlineBGData->Reset();
 }
 
 void
 nsCSSRendering::PaintBoxShadowOuter(nsPresContext* aPresContext,
-                                    nsIRenderingContext& aRenderingContext,
+                                    nsRenderingContext& aRenderingContext,
                                     nsIFrame* aForFrame,
                                     const nsRect& aFrameArea,
                                     const nsRect& aDirtyRect)
 {
   const nsStyleBorder* styleBorder = aForFrame->GetStyleBorder();
   nsCSSShadowArray* shadows = styleBorder->mBoxShadow;
   if (!shadows)
     return;
@@ -1194,17 +1194,17 @@ nsCSSRendering::PaintBoxShadowOuter(nsPr
     // before doing this.
     if (nativeTheme) {
       // We don't clip the border-box from the shadow, nor any other box.
       // We assume that the native theme is going to paint over the shadow.
 
       // Draw the widget shape
       gfxContextMatrixAutoSaveRestore save(shadowContext);
       nsIDeviceContext* devCtx = aPresContext->DeviceContext();
-      nsCOMPtr<nsIRenderingContext> wrapperCtx;
+      nsRefPtr<nsRenderingContext> wrapperCtx;
       devCtx->CreateRenderingContextInstance(*getter_AddRefs(wrapperCtx));
       wrapperCtx->Init(devCtx, shadowContext);
       wrapperCtx->Translate(nsPoint(shadowItem->mXOffset, shadowItem->mYOffset));
 
       nsRect nativeRect;
       nativeRect.IntersectRect(frameRect, aDirtyRect);
 
       aPresContext->GetTheme()->DrawWidgetBackground(wrapperCtx, aForFrame,
@@ -1260,17 +1260,17 @@ nsCSSRendering::PaintBoxShadowOuter(nsPr
 
     blurringArea.DoPaint();
     renderContext->Restore();
   }
 }
 
 void
 nsCSSRendering::PaintBoxShadowInner(nsPresContext* aPresContext,
-                                    nsIRenderingContext& aRenderingContext,
+                                    nsRenderingContext& aRenderingContext,
                                     nsIFrame* aForFrame,
                                     const nsRect& aFrameArea,
                                     const nsRect& aDirtyRect)
 {
   const nsStyleBorder* styleBorder = aForFrame->GetStyleBorder();
   nsCSSShadowArray* shadows = styleBorder->mBoxShadow;
   if (!shadows)
     return;
@@ -1425,17 +1425,17 @@ nsCSSRendering::PaintBoxShadowInner(nsPr
 
     blurringArea.DoPaint();
     renderContext->Restore();
   }
 }
 
 void
 nsCSSRendering::PaintBackground(nsPresContext* aPresContext,
-                                nsIRenderingContext& aRenderingContext,
+                                nsRenderingContext& aRenderingContext,
                                 nsIFrame* aForFrame,
                                 const nsRect& aDirtyRect,
                                 const nsRect& aBorderArea,
                                 PRUint32 aFlags,
                                 nsRect* aBGClipRect)
 {
   NS_PRECONDITION(aForFrame,
                   "Frame is expected to be provided to PaintBackground");
@@ -1919,17 +1919,17 @@ FindTileStart(nscoord aDirtyCoord, nscoo
 {
   NS_ASSERTION(aTileDim > 0, "Non-positive tile dimension");
   double multiples = NS_floor(double(aDirtyCoord - aTilePos)/aTileDim);
   return NSToCoordRound(multiples*aTileDim + aTilePos);
 }
 
 void
 nsCSSRendering::PaintGradient(nsPresContext* aPresContext,
-                              nsIRenderingContext& aRenderingContext,
+                              nsRenderingContext& aRenderingContext,
                               nsStyleGradient* aGradient,
                               const nsRect& aDirtyRect,
                               const nsRect& aOneCellArea,
                               const nsRect& aFillArea)
 {
   if (aOneCellArea.IsEmpty())
     return;
 
@@ -2243,17 +2243,17 @@ PrepareBackgroundLayer(nsPresContext* aP
                        PRUint32 aFlags,
                        const nsRect& aBorderArea,
                        const nsRect& aBGClipRect,
                        const nsStyleBackground& aBackground,
                        const nsStyleBackground::Layer& aLayer);
 
 void
 nsCSSRendering::PaintBackgroundWithSC(nsPresContext* aPresContext,
-                                      nsIRenderingContext& aRenderingContext,
+                                      nsRenderingContext& aRenderingContext,
                                       nsIFrame* aForFrame,
                                       const nsRect& aDirtyRect,
                                       const nsRect& aBorderArea,
                                       nsStyleContext* aBackgroundSC,
                                       const nsStyleBorder& aBorder,
                                       PRUint32 aFlags,
                                       nsRect* aBGClipRect)
 {
@@ -2728,17 +2728,17 @@ nsCSSRendering::GetBackgroundLayerRect(n
   BackgroundLayerState state =
       PrepareBackgroundLayer(aPresContext, aForFrame, 0, aBorderArea,
                              aBorderArea, aBackground, aLayer);
   return state.mFillArea;
 }
 
 static void
 DrawBorderImage(nsPresContext*       aPresContext,
-                nsIRenderingContext& aRenderingContext,
+                nsRenderingContext& aRenderingContext,
                 nsIFrame*            aForFrame,
                 const nsRect&        aBorderArea,
                 const nsStyleBorder& aStyleBorder,
                 const nsRect&        aDirtyRect)
 {
   NS_PRECONDITION(aStyleBorder.IsBorderImageLoaded(),
                   "drawing border image that isn't successfully loaded");
 
@@ -2935,17 +2935,17 @@ DrawBorderImage(nsPresContext*       aPr
                                destArea, subArea,
                                fillStyleH, fillStyleV,
                                unitSize, aStyleBorder, i * (RIGHT + 1) + j);
     }
   }
 }
 
 static void
-DrawBorderImageComponent(nsIRenderingContext& aRenderingContext,
+DrawBorderImageComponent(nsRenderingContext& aRenderingContext,
                          nsIFrame*            aForFrame,
                          imgIContainer*       aImage,
                          const nsRect&        aDirtyRect,
                          const nsRect&        aFill,
                          const nsIntRect&     aSrc,
                          PRUint8              aHFill,
                          PRUint8              aVFill,
                          const nsSize&        aUnitSize,
@@ -3071,17 +3071,17 @@ SetPoly(const nsRect& aRect,
   poly[2].y = aRect.y + aRect.height;
   poly[3].x = aRect.x;
   poly[3].y = aRect.y + aRect.height;
   poly[4].x = aRect.x;
   poly[4].y = aRect.y;
 }
 
 static void
-DrawSolidBorderSegment(nsIRenderingContext& aContext,
+DrawSolidBorderSegment(nsRenderingContext& aContext,
                        nsRect               aRect,
                        nscoord              aTwipsPerPixel,
                        PRUint8              aStartBevelSide = 0,
                        nscoord              aStartBevelOffset = 0,
                        PRUint8              aEndBevelSide = 0,
                        nscoord              aEndBevelOffset = 0)
 {
 
@@ -3161,17 +3161,17 @@ GetDashInfo(nscoord  aBorderLength,
       nscoord half = RoundIntToPixel(extra / 2, aTwipsPerPixel);
       aStartDashLength += half;
       aEndDashLength += (extra - half);
     }
   }
 }
 
 void
-nsCSSRendering::DrawTableBorderSegment(nsIRenderingContext&     aContext,
+nsCSSRendering::DrawTableBorderSegment(nsRenderingContext&     aContext,
                                        PRUint8                  aBorderStyle,
                                        nscolor                  aBorderColor,
                                        const nsStyleBackground* aBGColor,
                                        const nsRect&            aBorder,
                                        PRInt32                  aAppUnitsPerCSSPixel,
                                        PRUint8                  aStartBevelSide,
                                        nscoord                  aStartBevelOffset,
                                        PRUint8                  aEndBevelSide,
@@ -3921,17 +3921,17 @@ ImageRenderer::ComputeSize(const nsSize&
       break;
   }
 
   return mSize;
 }
 
 void
 ImageRenderer::Draw(nsPresContext*       aPresContext,
-                         nsIRenderingContext& aRenderingContext,
+                         nsRenderingContext& aRenderingContext,
                          const nsRect&        aDest,
                          const nsRect&        aFill,
                          const nsPoint&       aAnchor,
                          const nsRect&        aDirty)
 {
   if (!mIsReady) {
     NS_NOTREACHED("Ensure PrepareImage() has returned true before calling me");
     return;
--- a/layout/base/nsCSSRendering.h
+++ b/layout/base/nsCSSRendering.h
@@ -35,17 +35,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 /* utility functions for drawing borders and backgrounds */
 
 #ifndef nsCSSRendering_h___
 #define nsCSSRendering_h___
 
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "nsStyleConsts.h"
 #include "gfxBlur.h"
 #include "gfxContext.h"
 #include "gfxImageSurface.h"
 
 struct nsPoint;
 class nsStyleContext;
 class nsPresContext;
@@ -57,86 +57,86 @@ struct nsCSSRendering {
   static nsresult Init();
   
   /**
    * Clean up any static variables used by nsCSSRendering.
    */
   static void Shutdown();
   
   static void PaintBoxShadowInner(nsPresContext* aPresContext,
-                                  nsIRenderingContext& aRenderingContext,
+                                  nsRenderingContext& aRenderingContext,
                                   nsIFrame* aForFrame,
                                   const nsRect& aFrameArea,
                                   const nsRect& aDirtyRect);
 
   static void PaintBoxShadowOuter(nsPresContext* aPresContext,
-                                  nsIRenderingContext& aRenderingContext,
+                                  nsRenderingContext& aRenderingContext,
                                   nsIFrame* aForFrame,
                                   const nsRect& aFrameArea,
                                   const nsRect& aDirtyRect);
 
   static void ComputePixelRadii(const nscoord *aAppUnitsRadii,
                                 nscoord aAppUnitsPerPixel,
                                 gfxCornerSizes *oBorderRadii);
 
   /**
    * Render the border for an element using css rendering rules
    * for borders. aSkipSides is a bitmask of the sides to skip
    * when rendering. If 0 then no sides are skipped.
    */
   static void PaintBorder(nsPresContext* aPresContext,
-                          nsIRenderingContext& aRenderingContext,
+                          nsRenderingContext& aRenderingContext,
                           nsIFrame* aForFrame,
                           const nsRect& aDirtyRect,
                           const nsRect& aBorderArea,
                           nsStyleContext* aStyleContext,
                           PRIntn aSkipSides = 0);
 
   /**
    * Like PaintBorder, but taking an nsStyleBorder argument instead of
    * getting it from aStyleContext.
    */
   static void PaintBorderWithStyleBorder(nsPresContext* aPresContext,
-                                         nsIRenderingContext& aRenderingContext,
+                                         nsRenderingContext& aRenderingContext,
                                          nsIFrame* aForFrame,
                                          const nsRect& aDirtyRect,
                                          const nsRect& aBorderArea,
                                          const nsStyleBorder& aBorderStyle,
                                          nsStyleContext* aStyleContext,
                                          PRIntn aSkipSides = 0);
 
 
   /**
    * Render the outline for an element using css rendering rules
    * for borders. aSkipSides is a bitmask of the sides to skip
    * when rendering. If 0 then no sides are skipped.
    */
   static void PaintOutline(nsPresContext* aPresContext,
-                          nsIRenderingContext& aRenderingContext,
+                          nsRenderingContext& aRenderingContext,
                           nsIFrame* aForFrame,
                           const nsRect& aDirtyRect,
                           const nsRect& aBorderArea,
                           nsStyleContext* aStyleContext);
 
   /**
    * Render keyboard focus on an element.
    * |aFocusRect| is the outer rectangle of the focused element.
    * Uses a fixed style equivalent to "1px dotted |aColor|".
    * Not used for controls, because the native theme may differ.
    */
   static void PaintFocus(nsPresContext* aPresContext,
-                         nsIRenderingContext& aRenderingContext,
+                         nsRenderingContext& aRenderingContext,
                          const nsRect& aFocusRect,
                          nscolor aColor);
 
   /**
    * Render a gradient for an element.
    */
   static void PaintGradient(nsPresContext* aPresContext,
-                            nsIRenderingContext& aRenderingContext,
+                            nsRenderingContext& aRenderingContext,
                             nsStyleGradient* aGradient,
                             const nsRect& aDirtyRect,
                             const nsRect& aOneCellArea,
                             const nsRect& aFillArea);
 
   /**
    * Find the frame whose background style should be used to draw the
    * canvas background. aForFrame must be the frame for the root element
@@ -229,30 +229,30 @@ struct nsCSSRendering {
     PAINTBG_SYNC_DECODE_IMAGES = 0x02,
     /**
      * When this flag is passed, painting will go to the screen so we can
      * take advantage of the fact that it will be clipped to the viewport.
      */
     PAINTBG_TO_WINDOW = 0x04
   };
   static void PaintBackground(nsPresContext* aPresContext,
-                              nsIRenderingContext& aRenderingContext,
+                              nsRenderingContext& aRenderingContext,
                               nsIFrame* aForFrame,
                               const nsRect& aDirtyRect,
                               const nsRect& aBorderArea,
                               PRUint32 aFlags,
                               nsRect* aBGClipRect = nsnull);
 
   /**
    * Same as |PaintBackground|, except using the provided style structs.
    * This short-circuits the code that ensures that the root element's
    * background is drawn on the canvas.
    */
   static void PaintBackgroundWithSC(nsPresContext* aPresContext,
-                                    nsIRenderingContext& aRenderingContext,
+                                    nsRenderingContext& aRenderingContext,
                                     nsIFrame* aForFrame,
                                     const nsRect& aDirtyRect,
                                     const nsRect& aBorderArea,
                                     nsStyleContext *aStyleContext,
                                     const nsStyleBorder& aBorder,
                                     PRUint32 aFlags,
                                     nsRect* aBGClipRect = nsnull);
 
@@ -270,17 +270,17 @@ struct nsCSSRendering {
   /**
    * Called by the presShell when painting is finished, so we can clear our
    * inline background data cache.
    */
   static void DidPaint();
 
   // Draw a border segment in the table collapsing border model without
   // beveling corners
-  static void DrawTableBorderSegment(nsIRenderingContext& aContext,
+  static void DrawTableBorderSegment(nsRenderingContext& aContext,
                                      PRUint8              aBorderStyle,  
                                      nscolor              aBorderColor,
                                      const nsStyleBackground* aBGColor,
                                      const nsRect&        aBorderRect,
                                      PRInt32              aAppUnitsPerCSSPixel,
                                      PRUint8              aStartBevelSide = 0,
                                      nscoord              aStartBevelOffset = 0,
                                      PRUint8              aEndBevelSide = 0,
--- a/layout/base/nsCaret.cpp
+++ b/layout/base/nsCaret.cpp
@@ -52,17 +52,17 @@
 #include "nsIDOMNode.h"
 #include "nsIDOMRange.h"
 #include "nsIFontMetrics.h"
 #include "nsISelection.h"
 #include "nsISelectionPrivate.h"
 #include "nsIDOMCharacterData.h"
 #include "nsIContent.h"
 #include "nsIPresShell.h"
-#include "nsIRenderingContext.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"
@@ -521,17 +521,17 @@ void nsCaret::UpdateCaretPosition()
 
   // A trick! Make the DrawCaret code recalculate the caret's current
   // position.
   mDrawn = PR_FALSE;
   DrawCaret(PR_FALSE);
 }
 
 void nsCaret::PaintCaret(nsDisplayListBuilder *aBuilder,
-                         nsIRenderingContext *aCtx,
+                         nsRenderingContext *aCtx,
                          nsIFrame* aForFrame,
                          const nsPoint &aOffset)
 {
   NS_ASSERTION(mDrawn, "The caret shouldn't be drawing");
 
   const nsRect drawCaretRect = mCaretRect + aOffset;
   PRInt32 contentOffset;
 
--- a/layout/base/nsCaret.h
+++ b/layout/base/nsCaret.h
@@ -43,17 +43,17 @@
 #define nsCaret_h__
 
 #include "nsCoord.h"
 #include "nsISelectionListener.h"
 #include "nsITimer.h"
 #include "nsWeakPtr.h"
 #include "nsFrameSelection.h"
 
-class nsIRenderingContext;
+class nsRenderingContext;
 class nsDisplayListBuilder;
 
 //-----------------------------------------------------------------------------
 class nsCaret : public nsISelectionListener
 {
   public:
 
                   nsCaret();
@@ -165,17 +165,17 @@ class nsCaret : public nsISelectionListe
      *  caret is in reflows and is moved).
      */
     void      UpdateCaretPosition();
 
     /** PaintCaret
      *  Actually paint the caret onto the given rendering context.
      */
     void      PaintCaret(nsDisplayListBuilder *aBuilder,
-                         nsIRenderingContext *aCtx,
+                         nsRenderingContext *aCtx,
                          nsIFrame *aForFrame,
                          const nsPoint &aOffset);
     /**
      * Sets whether the caret should only be visible in nodes that are not
      * user-modify: read-only, or whether it should be visible in all nodes.
      *
      * @param aIgnoreUserModify PR_TRUE to have the cursor visible in all nodes,
      *                          PR_FALSE to have it visible in all nodes except
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -494,28 +494,28 @@ nsDisplayList::ComputeVisibilityForSubli
   mForceTransparentSurface = forceTransparentSurface;
 #ifdef DEBUG
   mDidComputeVisibility = PR_TRUE;
 #endif
   return anyVisible;
 }
 
 void nsDisplayList::PaintRoot(nsDisplayListBuilder* aBuilder,
-                              nsIRenderingContext* aCtx,
+                              nsRenderingContext* aCtx,
                               PRUint32 aFlags) const {
   PaintForFrame(aBuilder, aCtx, aBuilder->ReferenceFrame(), aFlags);
 }
 
 /**
  * We paint by executing a layer manager transaction, constructing a
  * single layer representing the display list, and then making it the
  * root of the layer manager, drawing into the ThebesLayers.
  */
 void nsDisplayList::PaintForFrame(nsDisplayListBuilder* aBuilder,
-                                  nsIRenderingContext* aCtx,
+                                  nsRenderingContext* aCtx,
                                   nsIFrame* aForFrame,
                                   PRUint32 aFlags) const {
   NS_ASSERTION(mDidComputeVisibility,
                "Must call ComputeVisibility before calling Paint");
 
   nsRefPtr<LayerManager> layerManager;
   bool allowRetaining = false;
   bool doBeginTransaction = true;
@@ -813,17 +813,17 @@ PRBool nsDisplayItem::RecomputeVisibilit
 
   PRBool forceTransparentBackground;
   nsRegion opaque = TreatAsOpaque(this, aBuilder, &forceTransparentBackground);
   aBuilder->SubtractFromVisibleRegion(aVisibleRegion, opaque);
   return PR_TRUE;
 }
 
 void nsDisplaySolidColor::Paint(nsDisplayListBuilder* aBuilder,
-                                nsIRenderingContext* aCtx) {
+                                nsRenderingContext* aCtx) {
   aCtx->SetColor(mColor);
   aCtx->FillRect(mVisibleRect);
 }
 
 PRBool
 nsDisplaySolidColor::ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                        nsRegion* aVisibleRegion,
                                        const nsRect& aAllowVisibleRegionExpansion,
@@ -1222,17 +1222,17 @@ nsDisplayBackground::ShouldFixToViewport
   nsIScrollableFrame* scrollable = do_QueryFrame(rootScrollFrame);
   nsRect scrollport = scrollable->GetScrollPortRect() +
     aBuilder->ToReferenceFrame(rootScrollFrame);
   return bounds.Contains(scrollport);
 }
 
 void
 nsDisplayBackground::Paint(nsDisplayListBuilder* aBuilder,
-                           nsIRenderingContext* aCtx) {
+                           nsRenderingContext* aCtx) {
   nsPoint offset = ToReferenceFrame();
   PRUint32 flags = aBuilder->GetBackgroundPaintFlags();
   nsDisplayItem* nextItem = GetAbove();
   if (nextItem && nextItem->GetUnderlyingFrame() == mFrame &&
       nextItem->GetType() == TYPE_BORDER) {
     flags |= nsCSSRendering::PAINTBG_WILL_PAINT_BORDER;
   }
   nsCSSRendering::PaintBackground(mFrame->PresContext(), *aCtx, mFrame,
@@ -1257,17 +1257,17 @@ nsDisplayBackground::GetBounds(nsDisplay
 
 nsRect
 nsDisplayOutline::GetBounds(nsDisplayListBuilder* aBuilder) {
   return mFrame->GetVisualOverflowRectRelativeToSelf() + ToReferenceFrame();
 }
 
 void
 nsDisplayOutline::Paint(nsDisplayListBuilder* aBuilder,
-                        nsIRenderingContext* aCtx) {
+                        nsRenderingContext* aCtx) {
   // TODO join outlines together
   nsPoint offset = ToReferenceFrame();
   nsCSSRendering::PaintOutline(mFrame->PresContext(), *aCtx, mFrame,
                                mVisibleRect,
                                nsRect(offset, mFrame->GetSize()),
                                mFrame->GetStyleContext());
 }
 
@@ -1307,17 +1307,17 @@ nsDisplayEventReceiver::HitTest(nsDispla
     return;
   }
 
   aOutFrames->AppendElement(mFrame);
 }
 
 void
 nsDisplayCaret::Paint(nsDisplayListBuilder* aBuilder,
-                      nsIRenderingContext* aCtx) {
+                      nsRenderingContext* aCtx) {
   // Note: Because we exist, we know that the caret is visible, so we don't
   // need to check for the caret's visibility.
   mCaret->PaintCaret(aBuilder, aCtx, mFrame, ToReferenceFrame());
 }
 
 PRBool
 nsDisplayBorder::ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                    nsRegion* aVisibleRegion,
@@ -1344,17 +1344,17 @@ nsDisplayBorder::ComputeVisibility(nsDis
     return PR_FALSE;
   }
 
   return PR_TRUE;
 }
 
 void
 nsDisplayBorder::Paint(nsDisplayListBuilder* aBuilder,
-                       nsIRenderingContext* aCtx) {
+                       nsRenderingContext* aCtx) {
   nsPoint offset = ToReferenceFrame();
   nsCSSRendering::PaintBorder(mFrame->PresContext(), *aCtx, mFrame,
                               mVisibleRect,
                               nsRect(offset, mFrame->GetSize()),
                               mFrame->GetStyleContext(),
                               mFrame->GetSkipSides());
 }
 
@@ -1393,17 +1393,17 @@ ComputeDisjointRectangles(const nsRegion
       break;
 
     accumulated = *r;
   }
 }
 
 void
 nsDisplayBoxShadowOuter::Paint(nsDisplayListBuilder* aBuilder,
-                               nsIRenderingContext* aCtx) {
+                               nsRenderingContext* aCtx) {
   nsPoint offset = ToReferenceFrame();
   nsRect borderRect = nsRect(offset, mFrame->GetSize());
   nsPresContext* presContext = mFrame->PresContext();
   nsAutoTArray<nsRect,10> rects;
   ComputeDisjointRectangles(mVisibleRegion, &rects);
 
   for (PRUint32 i = 0; i < rects.Length(); ++i) {
     aCtx->PushState();
@@ -1446,17 +1446,17 @@ nsDisplayBoxShadowOuter::ComputeVisibili
   if (!hasBorderRadii)
     return PR_FALSE;
 
   return !RoundedRectContainsRect(frameRect, twipsRadii, visibleBounds);
 }
 
 void
 nsDisplayBoxShadowInner::Paint(nsDisplayListBuilder* aBuilder,
-                               nsIRenderingContext* aCtx) {
+                               nsRenderingContext* aCtx) {
   nsPoint offset = ToReferenceFrame();
   nsRect borderRect = nsRect(offset, mFrame->GetSize());
   nsPresContext* presContext = mFrame->PresContext();
   nsAutoTArray<nsRect,10> rects;
   ComputeDisjointRectangles(mVisibleRegion, &rects);
 
   for (PRUint32 i = 0; i < rects.Length(); ++i) {
     aCtx->PushState();
@@ -1542,17 +1542,17 @@ PRBool nsDisplayWrapList::IsUniform(nsDi
 PRBool nsDisplayWrapList::IsVaryingRelativeToMovingFrame(nsDisplayListBuilder* aBuilder,
                                                          nsIFrame* aFrame) {
   NS_WARNING("nsDisplayWrapList::IsVaryingRelativeToMovingFrame called unexpectedly");
   // We could try to do something but let's conservatively just return PR_TRUE.
   return PR_TRUE;
 }
 
 void nsDisplayWrapList::Paint(nsDisplayListBuilder* aBuilder,
-                              nsIRenderingContext* aCtx) {
+                              nsRenderingContext* aCtx) {
   NS_ERROR("nsDisplayWrapList should have been flattened away for painting");
 }
 
 PRBool nsDisplayWrapList::ChildrenCanBeInactive(nsDisplayListBuilder* aBuilder,
                                                 LayerManager* aManager,
                                                 const nsDisplayList& aList,
                                                 nsIFrame* aActiveScrolledRoot) {
   for (nsDisplayItem* i = aList.GetBottom(); i; i = i->GetAbove()) {
@@ -1881,17 +1881,17 @@ nsRect nsDisplayClip::GetBounds(nsDispla
 
 #ifdef NS_BUILD_REFCNT_LOGGING
 nsDisplayClip::~nsDisplayClip() {
   MOZ_COUNT_DTOR(nsDisplayClip);
 }
 #endif
 
 void nsDisplayClip::Paint(nsDisplayListBuilder* aBuilder,
-                          nsIRenderingContext* aCtx) {
+                          nsRenderingContext* aCtx) {
   NS_ERROR("nsDisplayClip should have been flattened away for painting");
 }
 
 PRBool nsDisplayClip::ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                         nsRegion* aVisibleRegion,
                                         const nsRect& aAllowVisibleRegionExpansion,
                                         PRBool& aContainsRootContentDocBG) {
   nsRegion clipped;
@@ -2054,17 +2054,17 @@ void nsDisplayZoom::HitTest(nsDisplayLis
     rect.width = rect.height = 1;
   } else {
     rect = aRect.ConvertAppUnitsRoundOut(mParentAPD, mAPD);
   }
   mList.HitTest(aBuilder, rect, aState, aOutFrames);
 }
 
 void nsDisplayZoom::Paint(nsDisplayListBuilder* aBuilder,
-                          nsIRenderingContext* aCtx)
+                          nsRenderingContext* aCtx)
 {
   mList.PaintForFrame(aBuilder, aCtx, mFrame, nsDisplayList::PAINT_DEFAULT);
 }
 
 PRBool nsDisplayZoom::ComputeVisibility(nsDisplayListBuilder *aBuilder,
                                         nsRegion *aVisibleRegion,
                                         const nsRect& aAllowVisibleRegionExpansion,
                                         PRBool& aContainsRootContentDocBG)
@@ -2565,17 +2565,17 @@ nsDisplaySVGEffects::HitTest(nsDisplayLi
   nsPoint rectCenter(aRect.x + aRect.width / 2, aRect.y + aRect.height / 2);
   if (nsSVGIntegrationUtils::HitTestFrameForEffects(mEffectsFrame,
       rectCenter - aBuilder->ToReferenceFrame(mEffectsFrame))) {
     mList.HitTest(aBuilder, aRect, aState, aOutFrames);
   }
 }
 
 void nsDisplaySVGEffects::Paint(nsDisplayListBuilder* aBuilder,
-                                nsIRenderingContext* aCtx)
+                                nsRenderingContext* aCtx)
 {
   nsSVGIntegrationUtils::PaintFramesWithEffects(aCtx,
           mEffectsFrame, mVisibleRect, aBuilder, &mList);
 }
 
 PRBool nsDisplaySVGEffects::ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                               nsRegion* aVisibleRegion,
                                               const nsRect& aAllowVisibleRegionExpansion,
--- a/layout/base/nsDisplayList.h
+++ b/layout/base/nsDisplayList.h
@@ -56,17 +56,17 @@
 #include "nsRegion.h"
 #include "FrameLayerBuilder.h"
 #include "nsThemeConstants.h"
 
 #include <stdlib.h>
 
 class nsIPresShell;
 class nsIContent;
-class nsIRenderingContext;
+class nsRenderingContext;
 class nsIDeviceContext;
 class nsDisplayTableItem;
 class nsDisplayItem;
 
 /*
  * An nsIFrame can have many different visual parts. For example an image frame
  * can have a background, border, and outline, the image itself, and a
  * translucent selection overlay. In general these parts can be drawn at
@@ -692,17 +692,17 @@ public:
   virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder,
                                    LayerManager* aManager)
   { return mozilla::LAYER_NONE; }
   /**
    * Actually paint this item to some rendering context.
    * Content outside mVisibleRect need not be painted.
    * aCtx must be set up as for nsDisplayList::Paint.
    */
-  virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx) {}
+  virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx) {}
   /**
    * Get the layer drawn by this display item. Call this only if
    * GetLayerState() returns something other than LAYER_NONE.
    * If GetLayerState returned LAYER_NONE then Paint will be called
    * instead.
    * This is called while aManager is in the construction phase.
    * 
    * The caller (nsDisplayList) is responsible for setting the visible
@@ -1071,23 +1071,23 @@ public:
    * tree.
    */
   enum {
     PAINT_DEFAULT = 0,
     PAINT_USE_WIDGET_LAYERS = 0x01,
     PAINT_FLUSH_LAYERS = 0x02,
     PAINT_EXISTING_TRANSACTION = 0x04
   };
-  void PaintRoot(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx,
+  void PaintRoot(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx,
                  PRUint32 aFlags) const;
   /**
    * Like PaintRoot, but used for internal display sublists.
    * aForFrame is the frame that the list is associated with.
    */
-  void PaintForFrame(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx,
+  void PaintForFrame(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx,
                      nsIFrame* aForFrame, PRUint32 aFlags) const;
   /**
    * Get the bounds. Takes the union of the bounds of all children.
    */
   nsRect GetBounds(nsDisplayListBuilder* aBuilder) const;
   /**
    * Find the topmost display item that returns a non-null frame, and return
    * the frame.
@@ -1253,17 +1253,17 @@ private:
  * 
  * This should not be used for display items which are created frequently,
  * because each item is one or two pointers bigger than an item from a
  * custom display item class could be, and fractionally slower. However it does
  * save code size. We use this for infrequently-used item types.
  */
 class nsDisplayGeneric : public nsDisplayItem {
 public:
-  typedef void (* PaintCallback)(nsIFrame* aFrame, nsIRenderingContext* aCtx,
+  typedef void (* PaintCallback)(nsIFrame* aFrame, nsRenderingContext* aCtx,
                                  const nsRect& aDirtyRect, nsPoint aFramePt);
 
   nsDisplayGeneric(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
                    PaintCallback aPaint, const char* aName, Type aType)
     : nsDisplayItem(aBuilder, aFrame), mPaint(aPaint)
 #ifdef DEBUG
       , mName(aName)
 #endif
@@ -1272,17 +1272,17 @@ public:
     MOZ_COUNT_CTOR(nsDisplayGeneric);
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayGeneric() {
     MOZ_COUNT_DTOR(nsDisplayGeneric);
   }
 #endif
   
-  virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx) {
+  virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx) {
     mPaint(mFrame, aCtx, mVisibleRect, ToReferenceFrame());
   }
   NS_DISPLAY_DECL_NAME(mName, mType)
 
   virtual nsRect GetComponentAlphaBounds(nsDisplayListBuilder* aBuilder) {
     if (mType == nsDisplayItem::TYPE_HEADER_FOOTER)
       return GetBounds(aBuilder);
     return nsRect();
@@ -1321,19 +1321,19 @@ public:
     MOZ_COUNT_CTOR(nsDisplayReflowCount);
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayReflowCount() {
     MOZ_COUNT_DTOR(nsDisplayReflowCount);
   }
 #endif
   
-  virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx) {
+  virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx) {
     nsPoint pt = ToReferenceFrame();
-    nsIRenderingContext::AutoPushTranslation translate(aCtx, pt);
+    nsRenderingContext::AutoPushTranslation translate(aCtx, pt);
     mFrame->PresContext()->PresShell()->PaintCount(mFrameName, aCtx,
                                                       mFrame->PresContext(),
                                                       mFrame, mColor);
   }
   NS_DISPLAY_DECL_NAME("nsDisplayReflowCount", TYPE_REFLOW_COUNT)
 protected:
   const char* mFrameName;
   nscolor mColor;
@@ -1392,17 +1392,17 @@ public:
     MOZ_COUNT_DTOR(nsDisplayCaret);
   }
 #endif
 
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder) {
     // The caret returns a rect in the coordinates of mFrame.
     return mCaret->GetCaretRect() + ToReferenceFrame();
   }
-  virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
+  virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx);
   NS_DISPLAY_DECL_NAME("Caret", TYPE_CARET)
 protected:
   nsRefPtr<nsCaret> mCaret;
 };
 
 /**
  * The standard display item to paint the CSS borders of a frame.
  */
@@ -1415,17 +1415,17 @@ public:
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayBorder() {
     MOZ_COUNT_DTOR(nsDisplayBorder);
   }
 #endif
 
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
-  virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
+  virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx);
   virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                    nsRegion* aVisibleRegion,
                                    const nsRect& aAllowVisibleRegionExpansion,
                                    PRBool& aContainsRootContentDocBG);
   NS_DISPLAY_DECL_NAME("Border", TYPE_BORDER)
 
 protected:
   PRPackedBool mSnappingEnabled;
@@ -1473,17 +1473,17 @@ public:
   }
 
   virtual PRBool IsUniform(nsDisplayListBuilder* aBuilder, nscolor* aColor)
   {
     *aColor = mColor;
     return PR_TRUE;
   }
 
-  virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
+  virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx);
 
   virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                    nsRegion* aVisibleRegion,
                                    const nsRect& aAllowVisibleRegionExpansion,
                                    PRBool& aContainsRootContentDocBG);
 
   PRBool IsRootContentDocBackground() {
     return mIsRootContentDocBackground;
@@ -1517,17 +1517,17 @@ public:
                                    PRBool& aContainsRootContentDocBG);
   virtual nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
                                    PRBool* aForceTransparentSurface = nsnull);
   virtual PRBool IsVaryingRelativeToMovingFrame(nsDisplayListBuilder* aBuilder,
                                                 nsIFrame* aFrame);
   virtual PRBool IsUniform(nsDisplayListBuilder* aBuilder, nscolor* aColor);
   virtual PRBool ShouldFixToViewport(nsDisplayListBuilder* aBuilder);
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
-  virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
+  virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx);
   NS_DISPLAY_DECL_NAME("Background", TYPE_BACKGROUND)
 protected:
   nsRegion GetInsideClipRegion(nsPresContext* aPresContext, PRUint8 aClip,
                                const nsRect& aRect);
 
   /* Used to cache mFrame->IsThemed() since it isn't a cheap call */
   PRPackedBool mIsThemed;
   PRPackedBool mSnappingEnabled;
@@ -1544,17 +1544,17 @@ public:
     MOZ_COUNT_CTOR(nsDisplayBoxShadowOuter);
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayBoxShadowOuter() {
     MOZ_COUNT_DTOR(nsDisplayBoxShadowOuter);
   }
 #endif
 
-  virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
+  virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx);
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
   virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                    nsRegion* aVisibleRegion,
                                    const nsRect& aAllowVisibleRegionExpansion,
                                    PRBool& aContainsRootContentDocBG);
   NS_DISPLAY_DECL_NAME("BoxShadowOuter", TYPE_BOX_SHADOW_OUTER)
 
 private:
@@ -1571,17 +1571,17 @@ public:
     MOZ_COUNT_CTOR(nsDisplayBoxShadowInner);
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayBoxShadowInner() {
     MOZ_COUNT_DTOR(nsDisplayBoxShadowInner);
   }
 #endif
 
-  virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
+  virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx);
   virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                    nsRegion* aVisibleRegion,
                                    const nsRect& aAllowVisibleRegionExpansion,
                                    PRBool& aContainsRootContentDocBG);
   NS_DISPLAY_DECL_NAME("BoxShadowInner", TYPE_BOX_SHADOW_INNER)
 
 private:
   nsRegion mVisibleRegion;
@@ -1598,17 +1598,17 @@ public:
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayOutline() {
     MOZ_COUNT_DTOR(nsDisplayOutline);
   }
 #endif
 
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
-  virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
+  virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx);
   virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                    nsRegion* aVisibleRegion,
                                    const nsRect& aAllowVisibleRegionExpansion,
                                    PRBool& aContainsRootContentDocBG);
   NS_DISPLAY_DECL_NAME("Outline", TYPE_OUTLINE)
 };
 
 /**
@@ -1661,17 +1661,17 @@ public:
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames);
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
   virtual nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
                                    PRBool* aForceTransparentSurface = nsnull);
   virtual PRBool IsUniform(nsDisplayListBuilder* aBuilder, nscolor* aColor);
   virtual PRBool IsVaryingRelativeToMovingFrame(nsDisplayListBuilder* aBuilder,
                                                 nsIFrame* aFrame);
-  virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
+  virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx);
   virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                    nsRegion* aVisibleRegion,
                                    const nsRect& aAllowVisibleRegionExpansion,
                                    PRBool& aContainsRootContentDocBG);
   virtual PRBool TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem) {
     NS_WARNING("This list should already have been flattened!!!");
     return PR_FALSE;
   }
@@ -1876,17 +1876,17 @@ public:
                 nsDisplayItem* aItem, const nsRect& aRect);
   nsDisplayClip(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
                 nsDisplayList* aList, const nsRect& aRect);
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayClip();
 #endif
   
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
-  virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
+  virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx);
   virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                    nsRegion* aVisibleRegion,
                                    const nsRect& aAllowVisibleRegionExpansion,
                                    PRBool& aContainsRootContentDocBG);
   virtual PRBool TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem);
   NS_DISPLAY_DECL_NAME("Clip", TYPE_CLIP)
   virtual PRUint32 GetPerFrameKey() { return 0; }
   
@@ -1959,17 +1959,17 @@ public:
   nsDisplayZoom(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
                 nsDisplayList* aList,
                 PRInt32 aAPD, PRInt32 aParentAPD);
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayZoom();
 #endif
   
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
-  virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
+  virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx);
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames);
   virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                    nsRegion* aVisibleRegion,
                                    const nsRect& aAllowVisibleRegionExpansion,
                                    PRBool& aContainsRootContentDocBG);
   NS_DISPLAY_DECL_NAME("Zoom", TYPE_ZOOM)
 
@@ -1997,17 +1997,17 @@ public:
   
   virtual nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
                                    PRBool* aForceTransparentSurface = nsnull);
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames);
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder) {
     return mBounds + aBuilder->ToReferenceFrame(mEffectsFrame);
   }
-  virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
+  virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx);
   virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                    nsRegion* aVisibleRegion,
                                    const nsRect& aAllowVisibleRegionExpansion,
                                    PRBool& aContainsRootContentDocBG);  
   virtual PRBool TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem);
   NS_DISPLAY_DECL_NAME("SVGEffects", TYPE_SVG_EFFECTS)
 
   nsIFrame* GetEffectsFrame() { return mEffectsFrame; }
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -3288,17 +3288,17 @@ NS_IMETHODIMP DocumentViewerImpl::SizeTo
    // because it won't change some sizes that a style change reflow will.
    mDocument->FlushPendingNotifications(Flush_Layout);
 
   nsIFrame *root = presShell->GetRootFrame();
   NS_ENSURE_TRUE(root, NS_ERROR_FAILURE);
 
   nscoord prefWidth;
   {
-    nsCOMPtr<nsIRenderingContext> rcx =
+    nsRefPtr<nsRenderingContext> rcx =
       presShell->GetReferenceRenderingContext();
     NS_ENSURE_TRUE(rcx, NS_ERROR_FAILURE);
     prefWidth = root->GetPrefWidth(rcx);
   }
 
   nsresult rv = presShell->ResizeReflow(prefWidth, NS_UNCONSTRAINEDSIZE);
   NS_ENSURE_SUCCESS(rv, rv);
 
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -72,17 +72,17 @@
 
 class nsIContent;
 class nsIDocument;
 class nsIFrame;
 class nsPresContext;
 class nsStyleSet;
 class nsIViewManager;
 class nsIView;
-class nsIRenderingContext;
+class nsRenderingContext;
 class nsIPageSequenceFrame;
 class nsAString;
 class nsCaret;
 class nsFrameSelection;
 class nsFrameManager;
 class nsILayoutHistoryState;
 class nsIReflowCallback;
 class nsIDOMNode;
@@ -499,17 +499,17 @@ public:
 
   virtual NS_HIDDEN_(void) ClearFrameRefs(nsIFrame* aFrame) = 0;
 
   /**
    * Get a reference rendering context. This is a context that should not
    * be rendered to, but is suitable for measuring text and performing
    * other non-rendering operations.
    */
-  virtual already_AddRefed<nsIRenderingContext> GetReferenceRenderingContext() = 0;
+  virtual already_AddRefed<nsRenderingContext> GetReferenceRenderingContext() = 0;
 
   /**
    * Informs the pres shell that the document is now at the anchor with
    * the given name.  If |aScroll| is true, scrolls the view of the
    * document so that the anchor with the specified name is displayed at
    * the top of the window.  If |aAnchorName| is empty, then this informs
    * the pres shell that there is no current target, and |aScroll| must
    * be false.
@@ -798,17 +798,17 @@ public:
   static void SetVerifyReflowEnable(PRBool aEnabled);
 
   virtual nsIFrame* GetAbsoluteContainingBlock(nsIFrame* aFrame);
 
 #ifdef MOZ_REFLOW_PERF
   virtual NS_HIDDEN_(void) DumpReflows() = 0;
   virtual NS_HIDDEN_(void) CountReflows(const char * aName, nsIFrame * aFrame) = 0;
   virtual NS_HIDDEN_(void) PaintCount(const char * aName,
-                                      nsIRenderingContext* aRenderingContext,
+                                      nsRenderingContext* aRenderingContext,
                                       nsPresContext * aPresContext,
                                       nsIFrame * aFrame,
                                       PRUint32 aColor) = 0;
   virtual NS_HIDDEN_(void) SetPaintFrameCount(PRBool aOn) = 0;
   virtual PRBool IsPaintingFrameCounts() = 0;
 #endif
 
 #ifdef DEBUG
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -1396,17 +1396,17 @@ GetNextPage(nsIFrame* aPageContentFrame)
   nsIFrame* f = nextPageFrame->GetFirstChild(nsnull);
   NS_ASSERTION(f, "pageFrame has no page content frame!");
   NS_ASSERTION(f->GetType() == nsGkAtoms::pageContentFrame,
                "pageFrame's child is not page content!");
   return f;
 }
 
 nsresult
-nsLayoutUtils::PaintFrame(nsIRenderingContext* aRenderingContext, nsIFrame* aFrame,
+nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFrame,
                           const nsRegion& aDirtyRegion, nscolor aBackstop,
                           PRUint32 aFlags)
 {
   if (aFlags & PAINT_WIDGET_LAYERS) {
     nsIView* view = aFrame->GetView();
     if (!(view && view->GetWidget() && GetDisplayRootFrame(aFrame) == aFrame)) {
       aFlags &= ~PAINT_WIDGET_LAYERS;
       NS_ASSERTION(aRenderingContext, "need a rendering context");
@@ -1687,17 +1687,17 @@ nsLayoutUtils::GetZIndex(nsIFrame* aFram
  * @param "aBaseWidth" contains the width in twips of the portion
  * of the text that has already been measured, and aBaseInx contains
  * the index of the text that has already been measured.
  *
  * @param aTextWidth returns the (in twips) the length of the text that falls
  * before the cursor aIndex contains the index of the text where the cursor falls
  */
 PRBool
-nsLayoutUtils::BinarySearchForPosition(nsIRenderingContext* aRendContext,
+nsLayoutUtils::BinarySearchForPosition(nsRenderingContext* aRendContext,
                         const PRUnichar* aText,
                         PRInt32    aBaseWidth,
                         PRInt32    aBaseInx,
                         PRInt32    aStartInx,
                         PRInt32    aEndInx,
                         PRInt32    aCursorPos,
                         PRInt32&   aIndex,
                         PRInt32&   aTextWidth)
@@ -2120,17 +2120,17 @@ GetPercentHeight(const nsStyleCoord& aSt
 
 // Handles only -moz-max-content and -moz-min-content, and
 // -moz-fit-content for min-width and max-width, since the others
 // (-moz-fit-content for width, and -moz-available) have no effect on
 // intrinsic widths.
 enum eWidthProperty { PROP_WIDTH, PROP_MAX_WIDTH, PROP_MIN_WIDTH };
 static PRBool
 GetIntrinsicCoord(const nsStyleCoord& aStyle,
-                  nsIRenderingContext* aRenderingContext,
+                  nsRenderingContext* aRenderingContext,
                   nsIFrame* aFrame,
                   eWidthProperty aProperty,
                   nscoord& aResult)
 {
   NS_PRECONDITION(aProperty == PROP_WIDTH || aProperty == PROP_MAX_WIDTH ||
                   aProperty == PROP_MIN_WIDTH, "unexpected property");
   if (aStyle.GetUnit() != eStyleUnit_Enumerated)
     return PR_FALSE;
@@ -2165,17 +2165,17 @@ GetIntrinsicCoord(const nsStyleCoord& aS
 
 #undef  DEBUG_INTRINSIC_WIDTH
 
 #ifdef DEBUG_INTRINSIC_WIDTH
 static PRInt32 gNoiseIndent = 0;
 #endif
 
 /* static */ nscoord
-nsLayoutUtils::IntrinsicForContainer(nsIRenderingContext *aRenderingContext,
+nsLayoutUtils::IntrinsicForContainer(nsRenderingContext *aRenderingContext,
                                      nsIFrame *aFrame,
                                      IntrinsicWidthType aType)
 {
   NS_PRECONDITION(aFrame, "null frame");
   NS_PRECONDITION(aType == MIN_WIDTH || aType == PREF_WIDTH, "bad type");
 
 #ifdef DEBUG_INTRINSIC_WIDTH
   nsFrame::IndentBy(stdout, gNoiseIndent);
@@ -2410,17 +2410,17 @@ nsLayoutUtils::ComputeWidthDependentValu
   NS_ASSERTION(aCoord.GetUnit() == eStyleUnit_None ||
                aCoord.GetUnit() == eStyleUnit_Auto,
                "unexpected width value");
   return 0;
 }
 
 /* static */ nscoord
 nsLayoutUtils::ComputeWidthValue(
-                 nsIRenderingContext* aRenderingContext,
+                 nsRenderingContext* aRenderingContext,
                  nsIFrame*            aFrame,
                  nscoord              aContainingBlockWidth,
                  nscoord              aContentEdgeToBoxSizing,
                  nscoord              aBoxSizingToMarginEdge,
                  const nsStyleCoord&  aCoord)
 {
   NS_PRECONDITION(aFrame, "non-null frame expected");
   NS_PRECONDITION(aRenderingContext, "non-null rendering context expected");
@@ -2498,17 +2498,17 @@ nsLayoutUtils::ComputeHeightDependentVal
                "unexpected height value");
   return 0;
 }
 
 #define MULDIV(a,b,c) (nscoord(PRInt64(a) * PRInt64(b) / PRInt64(c)))
 
 /* static */ nsSize
 nsLayoutUtils::ComputeSizeWithIntrinsicDimensions(
-                   nsIRenderingContext* aRenderingContext, nsIFrame* aFrame,
+                   nsRenderingContext* aRenderingContext, nsIFrame* aFrame,
                    const nsIFrame::IntrinsicSize& aIntrinsicSize,
                    nsSize aIntrinsicRatio, nsSize aCBSize,
                    nsSize aMargin, nsSize aBorder, nsSize aPadding)
 {
   const nsStylePosition *stylePos = aFrame->GetStylePosition();
   // Handle intrinsic sizes and their interaction with
   // {min-,max-,}{width,height} according to the rules in
   // http://www.w3.org/TR/CSS21/visudet.html#min-max-widths
@@ -2767,39 +2767,39 @@ nsLayoutUtils::ComputeSizeWithIntrinsicD
     }
   }
 
   return nsSize(width, height);
 }
 
 /* static */ nscoord
 nsLayoutUtils::MinWidthFromInline(nsIFrame* aFrame,
-                                  nsIRenderingContext* aRenderingContext)
+                                  nsRenderingContext* aRenderingContext)
 {
   nsIFrame::InlineMinWidthData data;
   DISPLAY_MIN_WIDTH(aFrame, data.prevLines);
   aFrame->AddInlineMinWidth(aRenderingContext, &data);
   data.ForceBreak(aRenderingContext);
   return data.prevLines;
 }
 
 /* static */ nscoord
 nsLayoutUtils::PrefWidthFromInline(nsIFrame* aFrame,
-                                   nsIRenderingContext* aRenderingContext)
+                                   nsRenderingContext* aRenderingContext)
 {
   nsIFrame::InlinePrefWidthData data;
   DISPLAY_PREF_WIDTH(aFrame, data.prevLines);
   aFrame->AddInlinePrefWidth(aRenderingContext, &data);
   data.ForceBreak(aRenderingContext);
   return data.prevLines;
 }
 
 void
 nsLayoutUtils::DrawString(const nsIFrame*      aFrame,
-                          nsIRenderingContext* aContext,
+                          nsRenderingContext* aContext,
                           const PRUnichar*     aString,
                           PRInt32              aLength,
                           nsPoint              aPoint,
                           PRUint8              aDirection)
 {
 #ifdef IBMBIDI
   nsresult rv = NS_ERROR_FAILURE;
   nsPresContext* presContext = aFrame->PresContext();
@@ -2819,17 +2819,17 @@ nsLayoutUtils::DrawString(const nsIFrame
   {
     aContext->SetTextRunRTL(PR_FALSE);
     aContext->DrawString(aString, aLength, aPoint.x, aPoint.y);
   }
 }
 
 nscoord
 nsLayoutUtils::GetStringWidth(const nsIFrame*      aFrame,
-                              nsIRenderingContext* aContext,
+                              nsRenderingContext* aContext,
                               const PRUnichar*     aString,
                               PRInt32              aLength)
 {
 #ifdef IBMBIDI
   nsPresContext* presContext = aFrame->PresContext();
   if (presContext->BidiEnabled()) {
     const nsStyleVisibility* vis = aFrame->GetStyleVisibility();
     nsBidiDirection direction =
@@ -3252,17 +3252,17 @@ ComputeSnappedImageDrawingParameters(gfx
     return SnappedImageDrawingParameters();
 
   return SnappedImageDrawingParameters(transform, finalFillRect, intSubimage,
                                        didSnap);
 }
 
 
 static nsresult
-DrawImageInternal(nsIRenderingContext* aRenderingContext,
+DrawImageInternal(nsRenderingContext* aRenderingContext,
                   imgIContainer*       aImage,
                   GraphicsFilter       aGraphicsFilter,
                   const nsRect&        aDest,
                   const nsRect&        aFill,
                   const nsPoint&       aAnchor,
                   const nsRect&        aDirty,
                   const nsIntSize&     aImageSize,
                   PRUint32             aImageFlags)
@@ -3285,17 +3285,17 @@ DrawImageInternal(nsIRenderingContext* a
 
   aImage->Draw(ctx, aGraphicsFilter, drawingParams.mUserSpaceToImageSpace,
                drawingParams.mFillRect, drawingParams.mSubimage, aImageSize,
                aImageFlags);
   return NS_OK;
 }
 
 /* static */ void
-nsLayoutUtils::DrawPixelSnapped(nsIRenderingContext* aRenderingContext,
+nsLayoutUtils::DrawPixelSnapped(nsRenderingContext* aRenderingContext,
                                 gfxDrawable*         aDrawable,
                                 GraphicsFilter       aFilter,
                                 const nsRect&        aDest,
                                 const nsRect&        aFill,
                                 const nsPoint&       aAnchor,
                                 const nsRect&        aDirty)
 {
   nsCOMPtr<nsIDeviceContext> dc = aRenderingContext->GetDeviceContext();
@@ -3327,17 +3327,17 @@ nsLayoutUtils::DrawPixelSnapped(nsIRende
 
   gfxUtils::DrawPixelSnapped(ctx, aDrawable,
                              drawingParams.mUserSpaceToImageSpace, subimage,
                              sourceRect, imageRect, drawingParams.mFillRect,
                              gfxASurface::ImageFormatARGB32, aFilter);
 }
 
 /* static */ nsresult
-nsLayoutUtils::DrawSingleUnscaledImage(nsIRenderingContext* aRenderingContext,
+nsLayoutUtils::DrawSingleUnscaledImage(nsRenderingContext* aRenderingContext,
                                        imgIContainer*       aImage,
                                        GraphicsFilter       aGraphicsFilter,
                                        const nsPoint&       aDest,
                                        const nsRect*        aDirty,
                                        PRUint32             aImageFlags,
                                        const nsRect*        aSourceArea)
 {
   nsIntSize imageSize;
@@ -3363,17 +3363,17 @@ nsLayoutUtils::DrawSingleUnscaledImage(n
   // translation but we don't want to actually tile the image.
   fill.IntersectRect(fill, dest);
   return DrawImageInternal(aRenderingContext, aImage, aGraphicsFilter,
                            dest, fill, aDest, aDirty ? *aDirty : dest,
                            imageSize, aImageFlags);
 }
 
 /* static */ nsresult
-nsLayoutUtils::DrawSingleImage(nsIRenderingContext* aRenderingContext,
+nsLayoutUtils::DrawSingleImage(nsRenderingContext* aRenderingContext,
                                imgIContainer*       aImage,
                                GraphicsFilter       aGraphicsFilter,
                                const nsRect&        aDest,
                                const nsRect&        aDirty,
                                PRUint32             aImageFlags,
                                const nsRect*        aSourceArea)
 {
   nsIntSize imageSize;
@@ -3445,17 +3445,17 @@ nsLayoutUtils::ComputeSizeForDrawing(img
                                          float(ratio.width));
       aGotHeight = PR_TRUE;
     }
   }
 }
 
 
 /* static */ nsresult
-nsLayoutUtils::DrawImage(nsIRenderingContext* aRenderingContext,
+nsLayoutUtils::DrawImage(nsRenderingContext* aRenderingContext,
                          imgIContainer*       aImage,
                          GraphicsFilter       aGraphicsFilter,
                          const nsRect&        aDest,
                          const nsRect&        aFill,
                          const nsPoint&       aAnchor,
                          const nsRect&        aDirty,
                          PRUint32             aImageFlags)
 {
@@ -3488,17 +3488,17 @@ nsLayoutUtils::GetWholeImageDestination(
   nscoord appUnitsPerCSSPixel = nsIDeviceContext::AppUnitsPerCSSPixel();
   nscoord wholeSizeX = NSToCoordRound(aWholeImageSize.width*appUnitsPerCSSPixel*scaleX);
   nscoord wholeSizeY = NSToCoordRound(aWholeImageSize.height*appUnitsPerCSSPixel*scaleY);
   return nsRect(aDestArea.TopLeft() - nsPoint(destOffsetX, destOffsetY),
                 nsSize(wholeSizeX, wholeSizeY));
 }
 
 void
-nsLayoutUtils::SetFontFromStyle(nsIRenderingContext* aRC, nsStyleContext* aSC)
+nsLayoutUtils::SetFontFromStyle(nsRenderingContext* aRC, nsStyleContext* aSC)
 {
   const nsStyleFont* font = aSC->GetStyleFont();
   const nsStyleVisibility* visibility = aSC->GetStyleVisibility();
 
   aRC->SetFont(font->mFont, visibility->mLanguage,
                aSC->PresContext()->GetUserFontSet());
 }
 
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -625,17 +625,17 @@ public:
    * maanger
    * 3) PAINT_WIDGET_LAYERS is not set and aRenderingContext is non-null;
    * we paint by construct a BasicLayerManager and calling
    * BeginTransactionWithTarget on it. This is desirable if we're doing
    * something like drawWindow in a mode where what gets rendered doesn't
    * necessarily correspond to what's visible in the window; we don't
    * want to mess up the widget's layer tree.
    */
-  static nsresult PaintFrame(nsIRenderingContext* aRenderingContext, nsIFrame* aFrame,
+  static nsresult PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFrame,
                              const nsRegion& aDirtyRegion, nscolor aBackstop,
                              PRUint32 aFlags = 0);
 
   /**
    * Compute the used z-index of aFrame; returns zero for elements to which
    * z-index does not apply, and for z-index:auto
    */
   static PRInt32 GetZIndex(nsIFrame* aFrame);
@@ -648,17 +648,17 @@ public:
    * @param "aBaseWidth" contains the width in twips of the portion
    * of the text that has already been measured, and aBaseInx contains
    * the index of the text that has already been measured.
    *
    * @param aTextWidth returns the (in twips) the length of the text that falls
    * before the cursor aIndex contains the index of the text where the cursor falls
    */
   static PRBool
-  BinarySearchForPosition(nsIRenderingContext* acx,
+  BinarySearchForPosition(nsRenderingContext* acx,
                           const PRUnichar* aText,
                           PRInt32    aBaseWidth,
                           PRInt32    aBaseInx,
                           PRInt32    aStartInx,
                           PRInt32    aEndInx,
                           PRInt32    aCursorPos,
                           PRInt32&   aIndex,
                           PRInt32&   aTextWidth);
@@ -804,17 +804,17 @@ public:
 
   /**
    * Get the contribution of aFrame to its containing block's intrinsic
    * width.  This considers the child's intrinsic width, its 'width',
    * 'min-width', and 'max-width' properties, and its padding, border,
    * and margin.
    */
   enum IntrinsicWidthType { MIN_WIDTH, PREF_WIDTH };
-  static nscoord IntrinsicForContainer(nsIRenderingContext* aRenderingContext,
+  static nscoord IntrinsicForContainer(nsRenderingContext* aRenderingContext,
                                        nsIFrame* aFrame,
                                        IntrinsicWidthType aType);
 
   /*
    * Convert nsStyleCoord to nscoord when percentages depend on the
    * containing block width.
    */
   static nscoord ComputeWidthDependentValue(
@@ -834,17 +834,17 @@ public:
    * @param aContainingBlockWidth Width of aFrame's containing block.
    * @param aContentEdgeToBoxSizing The sum of any left/right padding and
    *          border that goes inside the rect chosen by -moz-box-sizing.
    * @param aBoxSizingToMarginEdge The sum of any left/right padding, border,
    *          and margin that goes outside the rect chosen by -moz-box-sizing.
    * @param aCoord The width value to compute.
    */
   static nscoord ComputeWidthValue(
-                   nsIRenderingContext* aRenderingContext,
+                   nsRenderingContext* aRenderingContext,
                    nsIFrame*            aFrame,
                    nscoord              aContainingBlockWidth,
                    nscoord              aContentEdgeToBoxSizing,
                    nscoord              aBoxSizingToMarginEdge,
                    const nsStyleCoord&  aCoord);
 
   /*
    * Convert nsStyleCoord to nscoord when percentages depend on the
@@ -899,38 +899,38 @@ public:
   }
 
   /*
    * Calculate the used values for 'width' and 'height' for a replaced element.
    *
    *   http://www.w3.org/TR/CSS21/visudet.html#min-max-widths
    */
   static nsSize ComputeSizeWithIntrinsicDimensions(
-                    nsIRenderingContext* aRenderingContext, nsIFrame* aFrame,
+                    nsRenderingContext* aRenderingContext, nsIFrame* aFrame,
                     const nsIFrame::IntrinsicSize& aIntrinsicSize,
                     nsSize aIntrinsicRatio, nsSize aCBSize,
                     nsSize aMargin, nsSize aBorder, nsSize aPadding);
 
   // Implement nsIFrame::GetPrefWidth in terms of nsIFrame::AddInlinePrefWidth
   static nscoord PrefWidthFromInline(nsIFrame* aFrame,
-                                     nsIRenderingContext* aRenderingContext);
+                                     nsRenderingContext* aRenderingContext);
 
   // Implement nsIFrame::GetMinWidth in terms of nsIFrame::AddInlineMinWidth
   static nscoord MinWidthFromInline(nsIFrame* aFrame,
-                                    nsIRenderingContext* aRenderingContext);
+                                    nsRenderingContext* aRenderingContext);
 
   static void DrawString(const nsIFrame*      aFrame,
-                         nsIRenderingContext* aContext,
+                         nsRenderingContext* aContext,
                          const PRUnichar*     aString,
                          PRInt32              aLength,
                          nsPoint              aPoint,
                          PRUint8              aDirection = NS_STYLE_DIRECTION_INHERIT);
 
   static nscoord GetStringWidth(const nsIFrame*      aFrame,
-                                nsIRenderingContext* aContext,
+                                nsRenderingContext* aContext,
                                 const PRUnichar*     aString,
                                 PRInt32              aLength);
 
   /**
    * Gets the baseline to vertically center text from a font within a
    * line of specified height.
    *
    * Returns the baseline position relative to the top of the line.
@@ -1017,17 +1017,17 @@ public:
    *   @param aDest             Where one copy of the image should mapped to.
    *   @param aFill             The area to be filled with copies of the
    *                            image.
    *   @param aAnchor           A point in aFill which we will ensure is
    *                            pixel-aligned in the output.
    *   @param aDirty            Pixels outside this area may be skipped.
    *   @param aImageFlags       Image flags of the imgIContainer::FLAG_* variety
    */
-  static nsresult DrawImage(nsIRenderingContext* aRenderingContext,
+  static nsresult DrawImage(nsRenderingContext* aRenderingContext,
                             imgIContainer*       aImage,
                             GraphicsFilter       aGraphicsFilter,
                             const nsRect&        aDest,
                             const nsRect&        aFill,
                             const nsPoint&       aAnchor,
                             const nsRect&        aDirty,
                             PRUint32             aImageFlags);
 
@@ -1047,17 +1047,17 @@ public:
    *   @param aFilter           The graphics filter we should draw with.
    *   @param aDest             Where one copy of the image should mapped to.
    *   @param aFill             The area to be filled with copies of the
    *                            image.
    *   @param aAnchor           A point in aFill which we will ensure is
    *                            pixel-aligned in the output.
    *   @param aDirty            Pixels outside this area may be skipped.
    */
-  static void DrawPixelSnapped(nsIRenderingContext* aRenderingContext,
+  static void DrawPixelSnapped(nsRenderingContext* aRenderingContext,
                                gfxDrawable*         aDrawable,
                                GraphicsFilter       aFilter,
                                const nsRect&        aDest,
                                const nsRect&        aFill,
                                const nsPoint&       aAnchor,
                                const nsRect&        aDirty);
 
   /**
@@ -1071,17 +1071,17 @@ public:
    *   @param aDirty            If non-null, then pixels outside this area may
    *                            be skipped.
    *   @param aImageFlags       Image flags of the imgIContainer::FLAG_* variety
    *   @param aSourceArea       If non-null, this area is extracted from
    *                            the image and drawn at aDest. It's
    *                            in appunits. For best results it should
    *                            be aligned with image pixels.
    */
-  static nsresult DrawSingleUnscaledImage(nsIRenderingContext* aRenderingContext,
+  static nsresult DrawSingleUnscaledImage(nsRenderingContext* aRenderingContext,
                                           imgIContainer*       aImage,
                                           GraphicsFilter       aGraphicsFilter,
                                           const nsPoint&       aDest,
                                           const nsRect*        aDirty,
                                           PRUint32             aImageFlags,
                                           const nsRect*        aSourceArea = nsnull);
 
   /**
@@ -1094,17 +1094,17 @@ public:
    *   @param aDest             The area that the image should fill
    *   @param aDirty            Pixels outside this area may be skipped.
    *   @param aSourceArea       If non-null, this area is extracted from
    *                            the image and drawn in aDest. It's
    *                            in appunits. For best results it should
    *                            be aligned with image pixels.
    *   @param aImageFlags       Image flags of the imgIContainer::FLAG_* variety
    */
-  static nsresult DrawSingleImage(nsIRenderingContext* aRenderingContext,
+  static nsresult DrawSingleImage(nsRenderingContext* aRenderingContext,
                                   imgIContainer*       aImage,
                                   GraphicsFilter       aGraphicsFilter,
                                   const nsRect&        aDest,
                                   const nsRect&        aDirty,
                                   PRUint32             aImageFlags,
                                   const nsRect*        aSourceArea = nsnull);
 
   /**
@@ -1135,17 +1135,17 @@ public:
    */
   static nsRect GetWholeImageDestination(const nsIntSize& aWholeImageSize,
                                          const nsRect& aImageSourceArea,
                                          const nsRect& aDestArea);
 
   /**
    * Set the font on aRC based on the style in aSC
    */
-  static void SetFontFromStyle(nsIRenderingContext* aRC, nsStyleContext* aSC);
+  static void SetFontFromStyle(nsRenderingContext* aRC, nsStyleContext* aSC);
 
   /**
    * Determine if any corner radius is of nonzero size
    *   @param aCorners the |nsStyleCorners| object to check
    *   @return PR_TRUE unless all the coordinates are 0%, 0 or null.
    *
    * A corner radius with one dimension zero and one nonzero is
    * treated as a nonzero-radius corner, even though it will end up
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -47,17 +47,17 @@
 #include "nsIDocShell.h"
 #include "nsIContentViewer.h"
 #include "nsIDocumentViewer.h"
 #include "nsPIDOMWindow.h"
 #include "nsStyleSet.h"
 #include "nsImageLoader.h"
 #include "nsIContent.h"
 #include "nsIFrame.h"
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "nsIURL.h"
 #include "nsIDocument.h"
 #include "nsStyleContext.h"
 #include "nsILookAndFeel.h"
 #include "nsWidgetsCID.h"
 #include "nsIComponentManager.h"
 #include "nsIURIContentListener.h"
 #include "nsIInterfaceRequestor.h"
--- a/layout/base/nsPresContext.h
+++ b/layout/base/nsPresContext.h
@@ -104,17 +104,17 @@ class nsObjectFrame;
 class nsTransitionManager;
 #ifdef MOZ_CSS_ANIMATIONS
 class nsAnimationManager;
 #endif
 class nsRefreshDriver;
 class imgIContainer;
 
 #ifdef MOZ_REFLOW_PERF
-class nsIRenderingContext;
+class nsRenderingContext;
 #endif
 
 enum nsWidgetType {
   eWidgetType_Button  	= 1,
   eWidgetType_Checkbox	= 2,
   eWidgetType_Radio			= 3,
   eWidgetType_Text			= 4
 };
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -136,17 +136,17 @@
 #include "prenv.h"
 #include "nsIAttribute.h"
 #include "nsIGlobalHistory2.h"
 #include "nsDisplayList.h"
 #include "nsIRegion.h"
 #include "nsRegion.h"
 
 #ifdef MOZ_REFLOW_PERF
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "nsIFontMetrics.h"
 #endif
 
 #include "nsIReflowCallback.h"
 
 #include "nsPIDOMWindow.h"
 #include "nsFocusManager.h"
 #include "nsIPluginInstance.h"
@@ -402,17 +402,17 @@ public:
   void ClearGrandTotals();
   void DisplayTotals(const char * aStr);
   void DisplayHTMLTotals(const char * aStr);
   void DisplayDiffsInTotals(const char * aStr);
 
   void Add(const char * aName, nsIFrame * aFrame);
   ReflowCounter * LookUp(const char * aName);
 
-  void PaintCount(const char * aName, nsIRenderingContext* aRenderingContext, nsPresContext* aPresContext, nsIFrame * aFrame, PRUint32 aColor);
+  void PaintCount(const char * aName, nsRenderingContext* aRenderingContext, nsPresContext* aPresContext, nsIFrame * aFrame, PRUint32 aColor);
 
   FILE * GetOutFile() { return mFD; }
 
   PLHashTable * GetIndiFrameHT() { return mIndiFrameCounts; }
 
   void SetPresContext(nsPresContext * aPresContext) { mPresContext = aPresContext; } // weak reference
   void SetPresShell(nsIPresShell* aPresShell) { mPresShell= aPresShell; } // weak reference
 
@@ -768,17 +768,17 @@ public:
 
   /**
    * Post a callback that should be handled after reflow has finished.
    */
   virtual NS_HIDDEN_(nsresult) PostReflowCallback(nsIReflowCallback* aCallback);
   virtual NS_HIDDEN_(void) CancelReflowCallback(nsIReflowCallback* aCallback);
 
   virtual NS_HIDDEN_(void) ClearFrameRefs(nsIFrame* aFrame);
-  virtual NS_HIDDEN_(already_AddRefed<nsIRenderingContext>) GetReferenceRenderingContext();
+  virtual NS_HIDDEN_(already_AddRefed<nsRenderingContext>) GetReferenceRenderingContext();
   virtual NS_HIDDEN_(nsresult) GoToAnchor(const nsAString& aAnchorName, PRBool aScroll);
   virtual NS_HIDDEN_(nsresult) ScrollToAnchor();
 
   virtual NS_HIDDEN_(nsresult) ScrollContentIntoView(nsIContent* aContent,
                                                      PRIntn      aVPercent,
                                                      PRIntn      aHPercent,
                                                      PRUint32    aFlags);
   virtual PRBool ScrollFrameRectIntoView(nsIFrame*     aFrame,
@@ -925,17 +925,17 @@ public:
   NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED
 
   NS_DECL_NSIOBSERVER
 
 #ifdef MOZ_REFLOW_PERF
   virtual NS_HIDDEN_(void) DumpReflows();
   virtual NS_HIDDEN_(void) CountReflows(const char * aName, nsIFrame * aFrame);
   virtual NS_HIDDEN_(void) PaintCount(const char * aName,
-                                      nsIRenderingContext* aRenderingContext,
+                                      nsRenderingContext* aRenderingContext,
                                       nsPresContext* aPresContext,
                                       nsIFrame * aFrame,
                                       PRUint32 aColor);
   virtual NS_HIDDEN_(void) SetPaintFrameCount(PRBool aOn);
   virtual PRBool IsPaintingFrameCounts();
 #endif
 
 #ifdef DEBUG
@@ -3746,23 +3746,23 @@ PresShell::ClearFrameRefs(nsIFrame* aFra
     if (weakFrame->GetFrame() == aFrame) {
       // This removes weakFrame from mWeakFrames.
       weakFrame->Clear(this);
     }
     weakFrame = prev;
   }
 }
 
-already_AddRefed<nsIRenderingContext>
+already_AddRefed<nsRenderingContext>
 PresShell::GetReferenceRenderingContext()
 {
   NS_TIME_FUNCTION_MIN(1.0);
 
   nsIDeviceContext* devCtx = mPresContext->DeviceContext();
-  nsRefPtr<nsIRenderingContext> rc;
+  nsRefPtr<nsRenderingContext> rc;
   if (mPresContext->IsScreen()) {
     devCtx->CreateRenderingContextInstance(*getter_AddRefs(rc));
     if (rc) {
       rc->Init(devCtx, gfxPlatform::GetPlatform()->ScreenReferenceSurface());
     }
   } else {
     devCtx->CreateRenderingContext(*getter_AddRefs(rc));
   }
@@ -5276,17 +5276,17 @@ PresShell::RenderDocument(const nsRect& 
 
   // Since canvas APIs use floats to set up their matrices, we may have
   // some slight inaccuracy here. Adjust matrix components that are
   // integers up to the accuracy of floats to be those integers.
   aThebesContext->NudgeCurrentMatrixToIntegers();
 
   AutoSaveRestoreRenderingState _(this);
 
-  nsCOMPtr<nsIRenderingContext> rc;
+  nsRefPtr<nsRenderingContext> rc;
   devCtx->CreateRenderingContextInstance(*getter_AddRefs(rc));
   rc->Init(devCtx, aThebesContext);
 
   PRBool wouldFlushRetainedLayers = PR_FALSE;
   PRUint32 flags = nsLayoutUtils::PAINT_IGNORE_SUPPRESSION;
   if (aThebesContext->CurrentMatrix().HasNonIntegerTranslation()) {
     flags |= nsLayoutUtils::PAINT_IN_TRANSFORM;
   }
@@ -5601,17 +5601,17 @@ PresShell::PaintRangePaintInfo(nsTArray<
   }
 
   // clear the image
   gfxContext context(surface);
   context.SetOperator(gfxContext::OPERATOR_CLEAR);
   context.Rectangle(gfxRect(0, 0, pixelArea.width, pixelArea.height));
   context.Fill();
 
-  nsCOMPtr<nsIRenderingContext> rc;
+  nsRefPtr<nsRenderingContext> rc;
   deviceContext->CreateRenderingContextInstance(*getter_AddRefs(rc));
   rc->Init(deviceContext, surface);
 
   if (aRegion) {
     // Convert aRegion from CSS pixels to dev pixels
     nsIntRegion region =
       aRegion->ToAppUnits(nsPresContext::AppUnitsPerCSSPixel())
         .ToOutsidePixels(pc->AppUnitsPerDevPixel());
@@ -5639,17 +5639,17 @@ PresShell::PaintRangePaintInfo(nsTArray<
   frameSelection->SetDisplaySelection(nsISelectionController::SELECTION_HIDDEN);
 
   // next, paint each range in the selection
   PRInt32 count = aItems->Length();
   for (PRInt32 i = 0; i < count; i++) {
     RangePaintInfo* rangeInfo = (*aItems)[i];
     // the display lists paint relative to the offset from the reference
     // frame, so translate the rendering context
-    nsIRenderingContext::AutoPushTranslation
+    nsRenderingContext::AutoPushTranslation
       translate(rc, rangeInfo->mRootOffset);
 
     aArea.MoveBy(-rangeInfo->mRootOffset.x, -rangeInfo->mRootOffset.y);
     nsRegion visible(aArea);
     rangeInfo->mList.ComputeVisibilityForRoot(&rangeInfo->mBuilder, &visible);
     rangeInfo->mList.PaintRoot(&rangeInfo->mBuilder, rc, nsDisplayList::PAINT_DEFAULT);
     aArea.MoveBy(rangeInfo->mRootOffset.x, rangeInfo->mRootOffset.y);
   }
@@ -7633,17 +7633,17 @@ PresShell::DoReflow(nsIFrame* target, PR
 
   if (mReflowContinueTimer) {
     mReflowContinueTimer->Cancel();
     mReflowContinueTimer = nsnull;
   }
 
   nsIFrame* rootFrame = FrameManager()->GetRootFrame();
 
-  nsCOMPtr<nsIRenderingContext> rcx = GetReferenceRenderingContext();
+  nsRefPtr<nsRenderingContext> rcx = GetReferenceRenderingContext();
   if (!rcx) {
     NS_NOTREACHED("CreateRenderingContext failure");
     return PR_FALSE;
   }
 
 #ifdef DEBUG
   mCurrentReflowRoot = target;
 #endif
@@ -8585,17 +8585,17 @@ PresShell::CountReflows(const char * aNa
   if (mReflowCountMgr) {
     mReflowCountMgr->Add(aName, aFrame);
   }
 }
 
 //-------------------------------------------------------------
 void
 PresShell::PaintCount(const char * aName,
-                      nsIRenderingContext* aRenderingContext,
+                      nsRenderingContext* aRenderingContext,
                       nsPresContext* aPresContext,
                       nsIFrame * aFrame,
                       PRUint32 aColor)
 {
   if (mReflowCountMgr) {
     mReflowCountMgr->PaintCount(aName, aRenderingContext, aPresContext, aFrame, aColor);
   }
 }
@@ -8775,17 +8775,17 @@ void ReflowCountMgr::Add(const char * aN
       counter->mCount++;
       counter->mCounter.Add(1);
     }
   }
 }
 
 //------------------------------------------------------------------
 void ReflowCountMgr::PaintCount(const char *    aName, 
-                                nsIRenderingContext* aRenderingContext, 
+                                nsRenderingContext* aRenderingContext, 
                                 nsPresContext* aPresContext, 
                                 nsIFrame*       aFrame, 
                                 PRUint32        aColor)
 {
   if (mPaintFrameByFrameCounts && 
       nsnull != mIndiFrameCounts && 
       aFrame != nsnull) {
     char * key = new char[16];
--- a/layout/forms/nsButtonFrameRenderer.cpp
+++ b/layout/forms/nsButtonFrameRenderer.cpp
@@ -30,17 +30,17 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsButtonFrameRenderer.h"
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "nsCSSRendering.h"
 #include "nsPresContext.h"
 #include "nsGkAtoms.h"
 #include "nsCSSPseudoElements.h"
 #include "nsINameSpaceManager.h"
 #include "nsStyleSet.h"
 #include "nsDisplayList.h"
 #include "nsITheme.h"
@@ -101,31 +101,31 @@ public:
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayButtonBoxShadowOuter() {
     MOZ_COUNT_DTOR(nsDisplayButtonBoxShadowOuter);
   }
 #endif  
   
   virtual void Paint(nsDisplayListBuilder* aBuilder,
-                     nsIRenderingContext* aCtx);
+                     nsRenderingContext* aCtx);
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
   NS_DISPLAY_DECL_NAME("ButtonBoxShadowOuter", TYPE_BUTTON_BOX_SHADOW_OUTER)
 private:
   nsButtonFrameRenderer* mBFR;
 };
 
 nsRect
 nsDisplayButtonBoxShadowOuter::GetBounds(nsDisplayListBuilder* aBuilder) {
   return mFrame->GetVisualOverflowRect() + ToReferenceFrame();
 }
 
 void
 nsDisplayButtonBoxShadowOuter::Paint(nsDisplayListBuilder* aBuilder,
-                                     nsIRenderingContext* aCtx) {
+                                     nsRenderingContext* aCtx) {
   nsRect frameRect = nsRect(ToReferenceFrame(), mFrame->GetSize());
 
   nsRect buttonRect;
   mBFR->GetButtonRect(frameRect, buttonRect);
 
   nsCSSRendering::PaintBoxShadowOuter(mFrame->PresContext(), *aCtx, mFrame,
                                       buttonRect, mVisibleRect);
 }
@@ -143,17 +143,17 @@ public:
   }
 #endif  
   
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames) {
     aOutFrames->AppendElement(mFrame);
   }
   virtual void Paint(nsDisplayListBuilder* aBuilder,
-                     nsIRenderingContext* aCtx);
+                     nsRenderingContext* aCtx);
   NS_DISPLAY_DECL_NAME("ButtonBorderBackground", TYPE_BUTTON_BORDER_BACKGROUND)
 private:
   nsButtonFrameRenderer* mBFR;
 };
 
 class nsDisplayButtonForeground : public nsDisplayItem {
 public:
   nsDisplayButtonForeground(nsDisplayListBuilder* aBuilder,
@@ -163,36 +163,36 @@ public:
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayButtonForeground() {
     MOZ_COUNT_DTOR(nsDisplayButtonForeground);
   }
 #endif  
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
-                     nsIRenderingContext* aCtx);
+                     nsRenderingContext* aCtx);
   NS_DISPLAY_DECL_NAME("ButtonForeground", TYPE_BUTTON_FOREGROUND)
 private:
   nsButtonFrameRenderer* mBFR;
 };
 
 void nsDisplayButtonBorderBackground::Paint(nsDisplayListBuilder* aBuilder,
-                                            nsIRenderingContext* aCtx)
+                                            nsRenderingContext* aCtx)
 {
   NS_ASSERTION(mFrame, "No frame?");
   nsPresContext* pc = mFrame->PresContext();
   nsRect r = nsRect(ToReferenceFrame(), mFrame->GetSize());
   
   // draw the border and background inside the focus and outline borders
   mBFR->PaintBorderAndBackground(pc, *aCtx, mVisibleRect, r,
                                  aBuilder->GetBackgroundPaintFlags());
 }
 
 void nsDisplayButtonForeground::Paint(nsDisplayListBuilder* aBuilder,
-                                      nsIRenderingContext* aCtx)
+                                      nsRenderingContext* aCtx)
 {
   nsPresContext *presContext = mFrame->PresContext();
   const nsStyleDisplay *disp = mFrame->GetStyleDisplay();
   if (!mFrame->IsThemed(disp) ||
       !presContext->GetTheme()->ThemeDrawsFocusForWidget(presContext, mFrame, disp->mAppearance)) {
     // draw the focus and outline borders
     nsRect r = nsRect(ToReferenceFrame(), mFrame->GetSize());
     mBFR->PaintOutlineAndFocusBorders(presContext, *aCtx, mVisibleRect, r);
@@ -215,17 +215,17 @@ nsButtonFrameRenderer::DisplayButton(nsD
   NS_ENSURE_SUCCESS(rv, rv);
 
   return aForeground->AppendNewToTop(new (aBuilder)
       nsDisplayButtonForeground(aBuilder, this));
 }
 
 void
 nsButtonFrameRenderer::PaintOutlineAndFocusBorders(nsPresContext* aPresContext,
-          nsIRenderingContext& aRenderingContext,
+          nsRenderingContext& aRenderingContext,
           const nsRect& aDirtyRect,
           const nsRect& aRect)
 {
   // once we have all that we'll draw the focus if we have it. We will
   // need to draw 2 focuses, the inner and the outer. This is so we
   // can do any kind of look and feel. Some buttons have focus on the
   // outside like mac and motif. While others like windows have it
   // inside (dotted line).  Usually only one will be specifed. But I
@@ -250,17 +250,17 @@ nsButtonFrameRenderer::PaintOutlineAndFo
     nsCSSRendering::PaintBorder(aPresContext, aRenderingContext, mFrame,
                                 aDirtyRect, rect, mInnerFocusStyle);
   }
 }
 
 
 void
 nsButtonFrameRenderer::PaintBorderAndBackground(nsPresContext* aPresContext,
-          nsIRenderingContext& aRenderingContext,
+          nsRenderingContext& aRenderingContext,
           const nsRect& aDirtyRect,
           const nsRect& aRect,
           PRUint32 aBGFlags)
 
 {
   // get the button rect this is inside the focus and outline rects
   nsRect buttonRect;
   GetButtonRect(aRect, buttonRect);
--- a/layout/forms/nsButtonFrameRenderer.h
+++ b/layout/forms/nsButtonFrameRenderer.h
@@ -63,22 +63,22 @@ public:
   /**
    * Create display list items for the button
    */
   nsresult DisplayButton(nsDisplayListBuilder* aBuilder,
                          nsDisplayList* aBackground, nsDisplayList* aForeground);
 
 
   void PaintOutlineAndFocusBorders(nsPresContext* aPresContext,
-                                   nsIRenderingContext& aRenderingContext,
+                                   nsRenderingContext& aRenderingContext,
                                    const nsRect& aDirtyRect,
                                    const nsRect& aRect);
 
   void PaintBorderAndBackground(nsPresContext* aPresContext,
-                                nsIRenderingContext& aRenderingContext,
+                                nsRenderingContext& aRenderingContext,
                                 const nsRect& aDirtyRect,
                                 const nsRect& aRect,
                                 PRUint32 aBGFlags);
 
   void SetFrame(nsFrame* aFrame, nsPresContext* aPresContext);
  
   void SetDisabled(PRBool aDisabled, PRBool notify);
 
--- a/layout/forms/nsComboboxControlFrame.cpp
+++ b/layout/forms/nsComboboxControlFrame.cpp
@@ -553,17 +553,17 @@ static void printSize(char * aDesc, nsco
 }
 #endif
 
 //-------------------------------------------------------------------
 //-- Main Reflow for the Combobox
 //-------------------------------------------------------------------
 
 nscoord
-nsComboboxControlFrame::GetIntrinsicWidth(nsIRenderingContext* aRenderingContext,
+nsComboboxControlFrame::GetIntrinsicWidth(nsRenderingContext* aRenderingContext,
                                           nsLayoutUtils::IntrinsicWidthType aType)
 {
   // get the scrollbar width, we'll use this later
   nscoord scrollbarWidth = 0;
   nsPresContext* presContext = PresContext();
   if (mListControlFrame) {
     nsIScrollableFrame* scrollable = do_QueryFrame(mListControlFrame);
     NS_ASSERTION(scrollable, "List must be a scrollable frame");
@@ -597,26 +597,26 @@ nsComboboxControlFrame::GetIntrinsicWidt
   if (!IsThemed() || presContext->GetTheme()->ThemeNeedsComboboxDropmarker())
     displayWidth += scrollbarWidth;
 
   return displayWidth;
 
 }
 
 nscoord
-nsComboboxControlFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
+nsComboboxControlFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord minWidth;
   DISPLAY_MIN_WIDTH(this, minWidth);
   minWidth = GetIntrinsicWidth(aRenderingContext, nsLayoutUtils::MIN_WIDTH);
   return minWidth;
 }
 
 nscoord
-nsComboboxControlFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
+nsComboboxControlFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord prefWidth;
   DISPLAY_PREF_WIDTH(this, prefWidth);
   prefWidth = GetIntrinsicWidth(aRenderingContext, nsLayoutUtils::PREF_WIDTH);
   return prefWidth;
 }
 
 NS_IMETHODIMP 
@@ -1343,22 +1343,22 @@ public:
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayComboboxFocus() {
     MOZ_COUNT_DTOR(nsDisplayComboboxFocus);
   }
 #endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
-                     nsIRenderingContext* aCtx);
+                     nsRenderingContext* aCtx);
   NS_DISPLAY_DECL_NAME("ComboboxFocus", TYPE_COMBOBOX_FOCUS)
 };
 
 void nsDisplayComboboxFocus::Paint(nsDisplayListBuilder* aBuilder,
-                                   nsIRenderingContext* aCtx)
+                                   nsRenderingContext* aCtx)
 {
   static_cast<nsComboboxControlFrame*>(mFrame)
     ->PaintFocus(*aCtx, ToReferenceFrame());
 }
 
 NS_IMETHODIMP
 nsComboboxControlFrame::BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                                          const nsRect&           aDirtyRect,
@@ -1396,17 +1396,17 @@ nsComboboxControlFrame::BuildDisplayList
         NS_ENSURE_SUCCESS(rv, rv);
       }
     }
   }
 
   return DisplaySelectionOverlay(aBuilder, aLists.Content());
 }
 
-void nsComboboxControlFrame::PaintFocus(nsIRenderingContext& aRenderingContext,
+void nsComboboxControlFrame::PaintFocus(nsRenderingContext& aRenderingContext,
                                         nsPoint aPt)
 {
   /* Do we need to do anything? */
   nsEventStates eventStates = mContent->IntrinsicState();
   if (eventStates.HasState(NS_EVENT_STATE_DISABLED) || mFocused != this)
     return;
 
   aRenderingContext.PushState();
--- a/layout/forms/nsComboboxControlFrame.h
+++ b/layout/forms/nsComboboxControlFrame.h
@@ -102,34 +102,34 @@ public:
   virtual void AppendAnonymousContentTo(nsBaseContentList& aElements,
                                         PRUint32 aFilter);
   virtual nsIFrame* CreateFrameFor(nsIContent* aContent);
 
 #ifdef ACCESSIBILITY
   virtual already_AddRefed<nsAccessible> CreateAccessible();
 #endif
 
-  virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
+  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
 
-  virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
+  virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
 
   NS_IMETHOD Reflow(nsPresContext*          aCX,
                     nsHTMLReflowMetrics&     aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus&          aStatus);
 
   NS_IMETHOD HandleEvent(nsPresContext* aPresContext,
                          nsGUIEvent* aEvent,
                          nsEventStatus* aEventStatus);
 
   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                               const nsRect&           aDirtyRect,
                               const nsDisplayListSet& aLists);
 
-  void PaintFocus(nsIRenderingContext& aRenderingContext, nsPoint aPt);
+  void PaintFocus(nsRenderingContext& aRenderingContext, nsPoint aPt);
 
   // XXXbz this is only needed to prevent the quirk percent height stuff from
   // leaking out of the combobox.  We may be able to get rid of this as more
   // things move to IsFrameOfType.
   virtual nsIAtom* GetType() const;
 
   virtual PRBool IsFrameOfType(PRUint32 aFlags) const
   {
@@ -221,17 +221,17 @@ public:
 
 protected:
 
   // Utilities
   nsresult ReflowDropdown(nsPresContext*          aPresContext, 
                           const nsHTMLReflowState& aReflowState);
 
   // Helper for GetMinWidth/GetPrefWidth
-  nscoord GetIntrinsicWidth(nsIRenderingContext* aRenderingContext,
+  nscoord GetIntrinsicWidth(nsRenderingContext* aRenderingContext,
                             nsLayoutUtils::IntrinsicWidthType aType);
 protected:
   class RedisplayTextEvent;
   friend class RedisplayTextEvent;
 
   class RedisplayTextEvent : public nsRunnable {
   public:
     NS_DECL_NSIRUNNABLE
--- a/layout/forms/nsFieldSetFrame.cpp
+++ b/layout/forms/nsFieldSetFrame.cpp
@@ -69,36 +69,36 @@ public:
   NS_DECL_FRAMEARENA_HELPERS
 
   nsFieldSetFrame(nsStyleContext* aContext);
 
   NS_IMETHOD SetInitialChildList(nsIAtom*       aListName,
                                  nsFrameList&   aChildList);
 
   NS_HIDDEN_(nscoord)
-    GetIntrinsicWidth(nsIRenderingContext* aRenderingContext,
+    GetIntrinsicWidth(nsRenderingContext* aRenderingContext,
                       nsLayoutUtils::IntrinsicWidthType);
-  virtual nscoord GetMinWidth(nsIRenderingContext* aRenderingContext);
-  virtual nscoord GetPrefWidth(nsIRenderingContext* aRenderingContext);
-  virtual nsSize ComputeSize(nsIRenderingContext *aRenderingContext,
+  virtual nscoord GetMinWidth(nsRenderingContext* aRenderingContext);
+  virtual nscoord GetPrefWidth(nsRenderingContext* aRenderingContext);
+  virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
                              nsSize aCBSize, nscoord aAvailableWidth,
                              nsSize aMargin, nsSize aBorder, nsSize aPadding,
                              PRBool aShrinkWrap);
   virtual nscoord GetBaseline() const;
 
   NS_IMETHOD Reflow(nsPresContext*           aPresContext,
                     nsHTMLReflowMetrics&     aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus&          aStatus);
                                
   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                               const nsRect&           aDirtyRect,
                               const nsDisplayListSet& aLists);
 
-  void PaintBorderBackground(nsIRenderingContext& aRenderingContext,
+  void PaintBorderBackground(nsRenderingContext& aRenderingContext,
     nsPoint aPt, const nsRect& aDirtyRect, PRUint32 aBGFlags);
 
   NS_IMETHOD AppendFrames(nsIAtom*       aListName,
                           nsFrameList&   aFrameList);
   NS_IMETHOD InsertFrames(nsIAtom*       aListName,
                           nsIFrame*      aPrevFrame,
                           nsFrameList&   aFrameList);
   NS_IMETHOD RemoveFrame(nsIAtom*       aListName,
@@ -185,32 +185,32 @@ public:
   virtual ~nsDisplayFieldSetBorderBackground() {
     MOZ_COUNT_DTOR(nsDisplayFieldSetBorderBackground);
   }
 #endif
 
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames);
   virtual void Paint(nsDisplayListBuilder* aBuilder,
-                     nsIRenderingContext* aCtx);
+                     nsRenderingContext* aCtx);
   NS_DISPLAY_DECL_NAME("FieldSetBorderBackground", TYPE_FIELDSET_BORDER_BACKGROUND)
 };
 
 void nsDisplayFieldSetBorderBackground::HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                                                 HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames)
 {
   // aPt is guaranteed to be in this item's bounds. We do the hit test based on the
   // frame bounds even though our background doesn't cover the whole frame.
   // It's not clear whether this is correct.
   aOutFrames->AppendElement(mFrame);
 }
 
 void
 nsDisplayFieldSetBorderBackground::Paint(nsDisplayListBuilder* aBuilder,
-                                         nsIRenderingContext* aCtx)
+                                         nsRenderingContext* aCtx)
 {
   static_cast<nsFieldSetFrame*>(mFrame)->
     PaintBorderBackground(*aCtx, ToReferenceFrame(),
                           mVisibleRect, aBuilder->GetBackgroundPaintFlags());
 }
 
 NS_IMETHODIMP
 nsFieldSetFrame::BuildDisplayList(nsDisplayListBuilder*   aBuilder,
@@ -262,17 +262,17 @@ nsFieldSetFrame::BuildDisplayList(nsDisp
   // this moves mContentFrame's border/background display items to our
   // BorderBackground() list, which isn't really correct, but it's OK because
   // mContentFrame is anonymous and can't have its own border and background.
   contentDisplayItems.MoveTo(aLists);
   return NS_OK;
 }
 
 void
-nsFieldSetFrame::PaintBorderBackground(nsIRenderingContext& aRenderingContext,
+nsFieldSetFrame::PaintBorderBackground(nsRenderingContext& aRenderingContext,
     nsPoint aPt, const nsRect& aDirtyRect, PRUint32 aBGFlags)
 {
   PRIntn skipSides = GetSkipSides();
   const nsStyleBorder* borderStyle = GetStyleBorder();
        
   nscoord topBorder = borderStyle->GetActualBorderWidth(NS_SIDE_TOP);
   nscoord yoff = 0;
   nsPresContext* presContext = PresContext();
@@ -344,17 +344,17 @@ nsFieldSetFrame::PaintBorderBackground(n
     nsCSSRendering::PaintBorder(presContext, aRenderingContext, this,
                                 aDirtyRect,
                                 nsRect(aPt, mRect.Size()),
                                 mStyleContext, skipSides);
   }
 }
 
 nscoord
-nsFieldSetFrame::GetIntrinsicWidth(nsIRenderingContext* aRenderingContext,
+nsFieldSetFrame::GetIntrinsicWidth(nsRenderingContext* aRenderingContext,
                                    nsLayoutUtils::IntrinsicWidthType aType)
 {
   nscoord legendWidth = 0;
   nscoord contentWidth = 0;
   if (mLegendFrame) {
     legendWidth =
       nsLayoutUtils::IntrinsicForContainer(aRenderingContext, mLegendFrame,
                                            aType);
@@ -366,37 +366,37 @@ nsFieldSetFrame::GetIntrinsicWidth(nsIRe
                                            aType);
   }
       
   return NS_MAX(legendWidth, contentWidth);
 }
 
 
 nscoord
-nsFieldSetFrame::GetMinWidth(nsIRenderingContext* aRenderingContext)
+nsFieldSetFrame::GetMinWidth(nsRenderingContext* aRenderingContext)
 {
   nscoord result = 0;
   DISPLAY_MIN_WIDTH(this, result);
 
   result = GetIntrinsicWidth(aRenderingContext, nsLayoutUtils::MIN_WIDTH);
   return result;
 }
 
 nscoord
-nsFieldSetFrame::GetPrefWidth(nsIRenderingContext* aRenderingContext)
+nsFieldSetFrame::GetPrefWidth(nsRenderingContext* aRenderingContext)
 {
   nscoord result = 0;
   DISPLAY_PREF_WIDTH(this, result);
 
   result = GetIntrinsicWidth(aRenderingContext, nsLayoutUtils::PREF_WIDTH);
   return result;
 }
 
 /* virtual */ nsSize
-nsFieldSetFrame::ComputeSize(nsIRenderingContext *aRenderingContext,
+nsFieldSetFrame::ComputeSize(nsRenderingContext *aRenderingContext,
                              nsSize aCBSize, nscoord aAvailableWidth,
                              nsSize aMargin, nsSize aBorder, nsSize aPadding,
                              PRBool aShrinkWrap)
 {
   nsSize result =
     nsHTMLContainerFrame::ComputeSize(aRenderingContext, aCBSize,
                                       aAvailableWidth,
                                       aMargin, aBorder, aPadding, aShrinkWrap);
--- a/layout/forms/nsFileControlFrame.cpp
+++ b/layout/forms/nsFileControlFrame.cpp
@@ -494,17 +494,17 @@ nsFileControlFrame::BrowseMouseListener:
     return NS_OK;
   
   nsHTMLInputElement* input =
     nsHTMLInputElement::FromContent(mFrame->GetContent());
   return input ? input->FireAsyncClickHandler() : NS_OK;
 }
 
 nscoord
-nsFileControlFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
+nsFileControlFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord result;
   DISPLAY_MIN_WIDTH(this, result);
 
   // Our min width is our pref width
   result = GetPrefWidth(aRenderingContext);
   return result;
 }
--- a/layout/forms/nsFileControlFrame.h
+++ b/layout/forms/nsFileControlFrame.h
@@ -66,17 +66,17 @@ public:
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS
 
   // nsIFormControlFrame
   virtual nsresult SetFormProperty(nsIAtom* aName, const nsAString& aValue);
   virtual nsresult GetFormProperty(nsIAtom* aName, nsAString& aValue) const;
   virtual void SetFocus(PRBool aOn, PRBool aRepaint);
 
-  virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
+  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
   
   NS_IMETHOD Reflow(nsPresContext*          aCX,
                     nsHTMLReflowMetrics&     aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus&          aStatus);
 
   virtual void DestroyFrom(nsIFrame* aDestructRoot);
 
--- a/layout/forms/nsGfxCheckboxControlFrame.cpp
+++ b/layout/forms/nsGfxCheckboxControlFrame.cpp
@@ -45,17 +45,17 @@
 #include "nsIServiceManager.h"
 #include "nsIDOMHTMLInputElement.h"
 #include "nsDisplayList.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsIDOMHTMLInputElement.h"
 
 static void
 PaintCheckMark(nsIFrame* aFrame,
-               nsIRenderingContext* aCtx,
+               nsRenderingContext* aCtx,
                const nsRect& aDirtyRect,
                nsPoint aPt)
 {
   nsRect rect(aPt, aFrame->GetSize());
   rect.Deflate(aFrame->GetUsedBorderAndPadding());
 
   // Points come from the coordinates on a 7X7 unit box centered at 0,0
   const PRInt32 checkPolygonX[] = { -3, -1,  3,  3, -1, -3 };
@@ -78,17 +78,17 @@ PaintCheckMark(nsIFrame* aFrame,
   }
 
   aCtx->SetColor(aFrame->GetStyleColor()->mColor);
   aCtx->FillPolygon(paintPolygon, checkNumPoints);
 }
 
 static void
 PaintIndeterminateMark(nsIFrame* aFrame,
-                       nsIRenderingContext* aCtx,
+                       nsRenderingContext* aCtx,
                        const nsRect& aDirtyRect,
                        nsPoint aPt)
 {
   nsRect rect(aPt, aFrame->GetSize());
   rect.Deflate(aFrame->GetUsedBorderAndPadding());
 
   rect.y += (rect.height - rect.height/4) / 2;
   rect.height /= 4;
--- a/layout/forms/nsGfxRadioControlFrame.cpp
+++ b/layout/forms/nsGfxRadioControlFrame.cpp
@@ -77,17 +77,17 @@ nsGfxRadioControlFrame::CreateAccessible
   return nsnull;
 }
 #endif
 
 //--------------------------------------------------------------
 // Draw the dot for a non-native radio button in the checked state.
 static void
 PaintCheckedRadioButton(nsIFrame* aFrame,
-                        nsIRenderingContext* aCtx,
+                        nsRenderingContext* aCtx,
                         const nsRect& aDirtyRect,
                         nsPoint aPt)
 {
   // The dot is an ellipse 2px on all sides smaller than the content-box,
   // drawn in the foreground color.
   nsRect rect(aPt, aFrame->GetSize());
   rect.Deflate(aFrame->GetUsedBorderAndPadding());
   rect.Deflate(nsPresContext::CSSPixelsToAppUnits(2),
--- a/layout/forms/nsHTMLButtonControlFrame.cpp
+++ b/layout/forms/nsHTMLButtonControlFrame.cpp
@@ -38,17 +38,17 @@
 #include "nsHTMLButtonControlFrame.h"
 
 #include "nsCOMPtr.h"
 #include "nsHTMLContainerFrame.h"
 #include "nsIFormControlFrame.h"
 #include "nsHTMLParts.h"
 #include "nsIFormControl.h"
 
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "nsPresContext.h"
 #include "nsIPresShell.h"
 #include "nsStyleContext.h"
 #include "nsLeafFrame.h"
 #include "nsCSSRendering.h"
 #include "nsISupports.h"
 #include "nsGkAtoms.h"
 #include "nsCSSAnonBoxes.h"
@@ -193,33 +193,33 @@ nsHTMLButtonControlFrame::BuildDisplayLi
   nsresult rv = DisplayOutline(aBuilder, aLists);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // to draw border when selected in editor
   return DisplaySelectionOverlay(aBuilder, aLists.Content());
 }
 
 nscoord
-nsHTMLButtonControlFrame::GetMinWidth(nsIRenderingContext* aRenderingContext)
+nsHTMLButtonControlFrame::GetMinWidth(nsRenderingContext* aRenderingContext)
 {
   nscoord result;
   DISPLAY_MIN_WIDTH(this, result);
 
   nsIFrame* kid = mFrames.FirstChild();
   result = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
                                                 kid,
                                                 nsLayoutUtils::MIN_WIDTH);
 
   result += mRenderer.GetAddedButtonBorderAndPadding().LeftRight();
 
   return result;
 }
 
 nscoord
-nsHTMLButtonControlFrame::GetPrefWidth(nsIRenderingContext* aRenderingContext)
+nsHTMLButtonControlFrame::GetPrefWidth(nsRenderingContext* aRenderingContext)
 {
   nscoord result;
   DISPLAY_PREF_WIDTH(this, result);
   
   nsIFrame* kid = mFrames.FirstChild();
   result = nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
                                                 kid,
                                                 nsLayoutUtils::PREF_WIDTH);
--- a/layout/forms/nsHTMLButtonControlFrame.h
+++ b/layout/forms/nsHTMLButtonControlFrame.h
@@ -46,17 +46,17 @@
 #include "nsStyleContext.h"
 #include "nsLeafFrame.h"
 #include "nsCSSRendering.h"
 #include "nsISupports.h"
 #include "nsStyleConsts.h"
 #include "nsIComponentManager.h"
 #include "nsButtonFrameRenderer.h"
 
-class nsIRenderingContext;
+class nsRenderingContext;
 class nsPresContext;
 
 class nsHTMLButtonControlFrame : public nsHTMLContainerFrame,
                                  public nsIFormControlFrame 
 {
 public:
   nsHTMLButtonControlFrame(nsStyleContext* aContext);
   ~nsHTMLButtonControlFrame();
@@ -65,19 +65,19 @@ public:
 
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS
 
   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                               const nsRect&           aDirtyRect,
                               const nsDisplayListSet& aLists);
 
-  virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
+  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
 
-  virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
+  virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
 
   NS_IMETHOD Reflow(nsPresContext*          aPresContext,
                     nsHTMLReflowMetrics&     aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus&          aStatus);
 
   virtual PRBool IsContainingBlock() const;
   
--- a/layout/forms/nsImageControlFrame.cpp
+++ b/layout/forms/nsImageControlFrame.cpp
@@ -34,17 +34,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsCOMPtr.h"
 #include "nsImageFrame.h"
 #include "nsIFormControlFrame.h"
 #include "nsIFormControl.h"
 #include "nsHTMLParts.h"
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.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"
--- a/layout/forms/nsIsIndexFrame.cpp
+++ b/layout/forms/nsIsIndexFrame.cpp
@@ -254,17 +254,17 @@ NS_QUERYFRAME_HEAD(nsIsIndexFrame)
   NS_QUERYFRAME_ENTRY(nsIStatefulFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsBlockFrame)
 
 NS_IMPL_ISUPPORTS2(nsIsIndexFrame::KeyListener,
                    nsIDOMKeyListener,
                    nsIDOMEventListener)
 
 nscoord
-nsIsIndexFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
+nsIsIndexFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord result;
   DISPLAY_MIN_WIDTH(this, result);
 
   // Our min width is our pref width; the rest of our reflow is
   // happily handled by nsBlockFrame
   result = GetPrefWidth(aRenderingContext);
   return result;
--- a/layout/forms/nsIsIndexFrame.h
+++ b/layout/forms/nsIsIndexFrame.h
@@ -78,17 +78,17 @@ private:
     nsIsIndexFrame* mOwner;
   };
 
 public:
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS
 
   // nsIFormControlFrame
-  virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
+  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
   
   virtual PRBool IsLeaf() const;
 
 #ifdef NS_DEBUG
   NS_IMETHOD GetFrameName(nsAString& aResult) const;
 #endif
   NS_IMETHOD AttributeChanged(PRInt32         aNameSpaceID,
                               nsIAtom*        aAttribute,
--- a/layout/forms/nsListControlFrame.cpp
+++ b/layout/forms/nsListControlFrame.cpp
@@ -257,17 +257,17 @@ nsListControlFrame::BuildDisplayList(nsD
 
 /**
  * This is called by the SelectsAreaFrame, which is the same
  * as the frame returned by GetOptionsContainer. It's the frame which is
  * scrolled by us.
  * @param aPt the offset of this frame, relative to the rendering reference
  * frame
  */
-void nsListControlFrame::PaintFocus(nsIRenderingContext& aRC, nsPoint aPt)
+void nsListControlFrame::PaintFocus(nsRenderingContext& aRC, nsPoint aPt)
 {
   if (mFocused != this) return;
 
   // The mEndSelectionIndex is what is currently being selected
   // use the selected index if this is kNothingSelected
   PRInt32 focusedIndex;
   if (mEndSelectionIndex == kNothingSelected) {
     focusedIndex = GetSelectedIndex();
@@ -481,33 +481,33 @@ nsListControlFrame::CalcHeightOfARow()
   if (heightOfARow == 0 && GetNumberOfOptions() == 0) {
     heightOfARow = CalcFallbackRowHeight();
   }
 
   return heightOfARow;
 }
 
 nscoord
-nsListControlFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
+nsListControlFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord result;
   DISPLAY_PREF_WIDTH(this, result);
 
   // Always add scrollbar widths to the pref-width of the scrolled
   // content. Combobox frames depend on this happening in the dropdown,
   // and standalone listboxes are overflow:scroll so they need it too.
   result = GetScrolledFrame()->GetPrefWidth(aRenderingContext);
   result = NSCoordSaturatingAdd(result,
           GetDesiredScrollbarSizes(PresContext(), aRenderingContext).LeftRight());
 
   return result;
 }
 
 nscoord
-nsListControlFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
+nsListControlFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord result;
   DISPLAY_MIN_WIDTH(this, result);
 
   // Always add scrollbar widths to the min-width of the scrolled
   // content. Combobox frames depend on this happening in the dropdown,
   // and standalone listboxes are overflow:scroll so they need it too.
   result = GetScrolledFrame()->GetMinWidth(aRenderingContext);
--- a/layout/forms/nsListControlFrame.h
+++ b/layout/forms/nsListControlFrame.h
@@ -83,18 +83,18 @@ public:
     // nsIFrame
   NS_IMETHOD HandleEvent(nsPresContext* aPresContext,
                          nsGUIEvent* aEvent,
                          nsEventStatus* aEventStatus);
   
   NS_IMETHOD SetInitialChildList(nsIAtom*        aListName,
                                  nsFrameList&    aChildList);
 
-  virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
-  virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
+  virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
+  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
 
   NS_IMETHOD Reflow(nsPresContext*          aCX,
                     nsHTMLReflowMetrics&     aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus&          aStatus);
 
   NS_IMETHOD Init(nsIContent*      aContent,
                    nsIFrame*        aParent,
@@ -233,17 +233,17 @@ public:
   // Helper
   PRBool IsFocused() { return this == mFocused; }
 
   /**
    * Function to paint the focus rect when our nsSelectsAreaFrame is painting.
    * @param aPt the offset of this frame, relative to the rendering reference
    * frame
    */
-  void PaintFocus(nsIRenderingContext& aRC, nsPoint aPt);
+  void PaintFocus(nsRenderingContext& aRC, nsPoint aPt);
   /**
    * If this frame IsFocused(), invalidates an area that includes anything
    * that PaintFocus will or could have painted --- basically the whole
    * GetOptionsContainer, plus some extra stuff if there are no options. This
    * must be called every time mEndSelectionIndex changes.
    */
   void InvalidateFocus();
 
--- a/layout/forms/nsSelectsAreaFrame.cpp
+++ b/layout/forms/nsSelectsAreaFrame.cpp
@@ -177,17 +177,17 @@ public:
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder) {
     // override bounds because the list item focus ring may extend outside
     // the nsSelectsAreaFrame
     nsListControlFrame* listFrame = GetEnclosingListFrame(GetUnderlyingFrame());
     return listFrame->GetVisualOverflowRect() +
            aBuilder->ToReferenceFrame(listFrame);
   }
   virtual void Paint(nsDisplayListBuilder* aBuilder,
-                     nsIRenderingContext* aCtx) {
+                     nsRenderingContext* aCtx) {
     nsListControlFrame* listFrame = GetEnclosingListFrame(GetUnderlyingFrame());
     // listFrame must be non-null or we wouldn't get called.
     listFrame->PaintFocus(*aCtx, aBuilder->ToReferenceFrame(listFrame));
   }
   NS_DISPLAY_DECL_NAME("ListFocus", TYPE_LIST_FOCUS)
 };
 
 NS_IMETHODIMP
--- a/layout/forms/nsTextControlFrame.cpp
+++ b/layout/forms/nsTextControlFrame.cpp
@@ -216,17 +216,17 @@ nsTextControlFrame::DestroyFrom(nsIFrame
 
 nsIAtom*
 nsTextControlFrame::GetType() const 
 { 
   return nsGkAtoms::textInputFrame;
 }
 
 nsresult
-nsTextControlFrame::CalcIntrinsicSize(nsIRenderingContext* aRenderingContext,
+nsTextControlFrame::CalcIntrinsicSize(nsRenderingContext* aRenderingContext,
                                       nsSize&              aIntrinsicSize)
 {
   // Get leading and the Average/MaxAdvance char width 
   nscoord lineHeight  = 0;
   nscoord charWidth   = 0;
   nscoord charMaxAdvance  = 0;
 
   nsCOMPtr<nsIFontMetrics> fontMet;
@@ -461,29 +461,29 @@ nsTextControlFrame::AppendAnonymousConte
   NS_ASSERTION(txtCtrl, "Content not a text control element");
 
   aElements.MaybeAppendElement(txtCtrl->GetRootEditorNode());
   if (!(aFilter & nsIContent::eSkipPlaceholderContent))
     aElements.MaybeAppendElement(txtCtrl->GetPlaceholderNode());
 }
 
 nscoord
-nsTextControlFrame::GetMinWidth(nsIRenderingContext* aRenderingContext)
+nsTextControlFrame::GetMinWidth(nsRenderingContext* aRenderingContext)
 {
   // Our min width is just our preferred width if we have auto width.
   nscoord result;
   DISPLAY_MIN_WIDTH(this, result);
 
   result = GetPrefWidth(aRenderingContext);
 
   return result;
 }
 
 nsSize
-nsTextControlFrame::ComputeAutoSize(nsIRenderingContext *aRenderingContext,
+nsTextControlFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
                                     nsSize aCBSize, nscoord aAvailableWidth,
                                     nsSize aMargin, nsSize aBorder,
                                     nsSize aPadding, PRBool aShrinkWrap)
 {
   nsSize autoSize;
   nsresult rv = CalcIntrinsicSize(aRenderingContext, autoSize);
   if (NS_FAILED(rv)) {
     // What now?
--- a/layout/forms/nsTextControlFrame.h
+++ b/layout/forms/nsTextControlFrame.h
@@ -74,18 +74,18 @@ public:
   virtual void DestroyFrom(nsIFrame* aDestructRoot);
 
   virtual nsIScrollableFrame* GetScrollTargetFrame() {
     if (!IsScrollable())
       return nsnull;
     return do_QueryFrame(GetFirstChild(nsnull));
   }
 
-  virtual nscoord GetMinWidth(nsIRenderingContext* aRenderingContext);
-  virtual nsSize ComputeAutoSize(nsIRenderingContext *aRenderingContext,
+  virtual nscoord GetMinWidth(nsRenderingContext* aRenderingContext);
+  virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext,
                                  nsSize aCBSize, nscoord aAvailableWidth,
                                  nsSize aMargin, nsSize aBorder,
                                  nsSize aPadding, PRBool aShrinkWrap);
 
   NS_IMETHOD Reflow(nsPresContext*          aPresContext,
                     nsHTMLReflowMetrics&     aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus&          aStatus);
@@ -362,17 +362,17 @@ protected:
    * We call this when we are being destroyed or removed from the PFM.
    * @param aPresContext the current pres context
    */
   void PreDestroy();
 
   // Compute our intrinsic size.  This does not include any borders, paddings,
   // etc.  Just the size of our actual area for the text (and the scrollbars,
   // for <textarea>).
-  nsresult CalcIntrinsicSize(nsIRenderingContext* aRenderingContext,
+  nsresult CalcIntrinsicSize(nsRenderingContext* aRenderingContext,
                              nsSize&              aIntrinsicSize);
 
   nsresult ScrollSelectionIntoView();
 
 private:
   //helper methods
   nsresult SetSelectionInternal(nsIDOMNode *aStartNode, PRInt32 aStartOffset,
                                 nsIDOMNode *aEndNode, PRInt32 aEndOffset);
--- a/layout/generic/nsBRFrame.cpp
+++ b/layout/generic/nsBRFrame.cpp
@@ -40,17 +40,17 @@
 #include "nsCOMPtr.h"
 #include "nsFrame.h"
 #include "nsHTMLParts.h"
 #include "nsPresContext.h"
 #include "nsLineLayout.h"
 #include "nsStyleConsts.h"
 #include "nsGkAtoms.h"
 #include "nsIFontMetrics.h"
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "nsLayoutUtils.h"
 
 #ifdef ACCESSIBILITY
 #include "nsIServiceManager.h"
 #include "nsAccessibilityService.h"
 #endif
 
 //FOR SELECTION
@@ -73,22 +73,22 @@ public:
                                      PRBool aRespectClusters = PR_TRUE);
   virtual PRBool PeekOffsetWord(PRBool aForward, PRBool aWordSelectEatSpace, PRBool aIsKeyboardSelect,
                                 PRInt32* aOffset, PeekWordState* aState);
 
   NS_IMETHOD Reflow(nsPresContext* aPresContext,
                     nsHTMLReflowMetrics& aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus& aStatus);
-  virtual void AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
+  virtual void AddInlineMinWidth(nsRenderingContext *aRenderingContext,
                                  InlineMinWidthData *aData);
-  virtual void AddInlinePrefWidth(nsIRenderingContext *aRenderingContext,
+  virtual void AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
                                   InlinePrefWidthData *aData);
-  virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
-  virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
+  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
+  virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
   virtual nsIAtom* GetType() const;
   virtual nscoord GetBaseline() const;
 
   virtual PRBool IsFrameOfType(PRUint32 aFlags) const
   {
     return nsFrame::IsFrameOfType(aFlags & ~(nsIFrame::eReplaced |
                                              nsIFrame::eLineParticipant));
   }
@@ -189,39 +189,39 @@ BRFrame::Reflow(nsPresContext* aPresCont
 
   aMetrics.SetOverflowAreasToDesiredBounds();
 
   NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);
   return NS_OK;
 }
 
 /* virtual */ void
-BRFrame::AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
+BRFrame::AddInlineMinWidth(nsRenderingContext *aRenderingContext,
                            nsIFrame::InlineMinWidthData *aData)
 {
   aData->ForceBreak(aRenderingContext);
 }
 
 /* virtual */ void
-BRFrame::AddInlinePrefWidth(nsIRenderingContext *aRenderingContext,
+BRFrame::AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
                             nsIFrame::InlinePrefWidthData *aData)
 {
   aData->ForceBreak(aRenderingContext);
 }
 
 /* virtual */ nscoord
-BRFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
+BRFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord result = 0;
   DISPLAY_MIN_WIDTH(this, result);
   return result;
 }
 
 /* virtual */ nscoord
-BRFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
+BRFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord result = 0;
   DISPLAY_PREF_WIDTH(this, result);
   return result;
 }
 
 nsIAtom*
 BRFrame::GetType() const
--- a/layout/generic/nsBlockFrame.cpp
+++ b/layout/generic/nsBlockFrame.cpp
@@ -696,17 +696,17 @@ nsBlockFrame::MarkIntrinsicWidthsDirty()
       frame->AddStateBits(NS_BLOCK_NEEDS_BIDI_RESOLUTION);
     }
   }
 
   nsBlockFrameSuper::MarkIntrinsicWidthsDirty();
 }
 
 /* virtual */ nscoord
-nsBlockFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
+nsBlockFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
 {
   nsIFrame* firstInFlow = GetFirstContinuation();
   if (firstInFlow != this)
     return firstInFlow->GetMinWidth(aRenderingContext);
 
   DISPLAY_MIN_WIDTH(this, mMinWidth);
   if (mMinWidth != NS_INTRINSIC_WIDTH_UNKNOWN)
     return mMinWidth;
@@ -773,17 +773,17 @@ nsBlockFrame::GetMinWidth(nsIRenderingCo
   }
   data.ForceBreak(aRenderingContext);
 
   mMinWidth = data.prevLines;
   return mMinWidth;
 }
 
 /* virtual */ nscoord
-nsBlockFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
+nsBlockFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
 {
   nsIFrame* firstInFlow = GetFirstContinuation();
   if (firstInFlow != this)
     return firstInFlow->GetPrefWidth(aRenderingContext);
 
   DISPLAY_PREF_WIDTH(this, mPrefWidth);
 
   if (mPrefWidth != NS_INTRINSIC_WIDTH_UNKNOWN)
@@ -2363,17 +2363,17 @@ nsBlockFrame::ReflowDirtyLines(nsBlockRe
       // There are no lines so we have to fake up some y motion so that
       // we end up with *some* height.
 
       if (metrics.ascent == nsHTMLReflowMetrics::ASK_FOR_BASELINE &&
           !nsLayoutUtils::GetFirstLineBaseline(mBullet, &metrics.ascent)) {
         metrics.ascent = metrics.height;
       }
 
-      nsIRenderingContext *rc = aState.mReflowState.rendContext;
+      nsRenderingContext *rc = aState.mReflowState.rendContext;
       nsLayoutUtils::SetFontFromStyle(rc, GetStyleContext());
       nsCOMPtr<nsIFontMetrics> fm = rc->GetFontMetrics();
 
       nscoord minAscent =
         nsLayoutUtils::GetCenteredFontBaseline(fm, aState.mMinLineHeight);
       nscoord minDescent = aState.mMinLineHeight - minAscent;
 
       aState.mY += NS_MAX(minAscent, metrics.ascent) +
--- a/layout/generic/nsBlockFrame.h
+++ b/layout/generic/nsBlockFrame.h
@@ -257,18 +257,18 @@ public:
   virtual void GetBulletText(nsAString& aText) const;
 
   /**
    * Return true if there's a bullet.
    */
   virtual bool HasBullet() const;
 
   virtual void MarkIntrinsicWidthsDirty();
-  virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
-  virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
+  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
+  virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
 
   virtual nsRect ComputeTightBounds(gfxContext* aContext) const;
   
   NS_IMETHOD Reflow(nsPresContext*          aPresContext,
                     nsHTMLReflowMetrics&     aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus&          aStatus);
 
--- a/layout/generic/nsBulletFrame.cpp
+++ b/layout/generic/nsBulletFrame.cpp
@@ -42,17 +42,17 @@
 #include "nsGkAtoms.h"
 #include "nsHTMLParts.h"
 #include "nsHTMLContainerFrame.h"
 #include "nsIFontMetrics.h"
 #include "nsGenericHTMLElement.h"
 #include "nsPresContext.h"
 #include "nsIPresShell.h"
 #include "nsIDocument.h"
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "nsILoadGroup.h"
 #include "nsIURL.h"
 #include "nsNetUtil.h"
 #include "prprf.h"
 #include "nsDisplayList.h"
 
 #include "imgILoader.h"
 #include "imgIContainer.h"
@@ -229,27 +229,27 @@ public:
   {
     return mFrame->GetVisualOverflowRect() + ToReferenceFrame();
   }
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames) {
     aOutFrames->AppendElement(mFrame);
   }
   virtual void Paint(nsDisplayListBuilder* aBuilder,
-                     nsIRenderingContext* aCtx);
+                     nsRenderingContext* aCtx);
   NS_DISPLAY_DECL_NAME("Bullet", TYPE_BULLET)
 
   virtual nsRect GetComponentAlphaBounds(nsDisplayListBuilder* aBuilder)
   {
     return GetBounds(aBuilder);
   }
 };
 
 void nsDisplayBullet::Paint(nsDisplayListBuilder* aBuilder,
-                            nsIRenderingContext* aCtx)
+                            nsRenderingContext* aCtx)
 {
   static_cast<nsBulletFrame*>(mFrame)->
     PaintBullet(*aCtx, ToReferenceFrame(), mVisibleRect);
 }
 
 NS_IMETHODIMP
 nsBulletFrame::BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                                 const nsRect&           aDirtyRect,
@@ -260,17 +260,17 @@ nsBulletFrame::BuildDisplayList(nsDispla
 
   DO_GLOBAL_REFLOW_COUNT_DSP("nsBulletFrame");
   
   return aLists.Content()->AppendNewToTop(
       new (aBuilder) nsDisplayBullet(aBuilder, this));
 }
 
 void
-nsBulletFrame::PaintBullet(nsIRenderingContext& aRenderingContext, nsPoint aPt,
+nsBulletFrame::PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt,
                            const nsRect& aDirtyRect)
 {
   const nsStyleList* myList = GetStyleList();
   PRUint8 listStyleType = myList->mListStyleType;
 
   if (myList->GetListStyleImage() && mImageRequest) {
     PRUint32 status;
     mImageRequest->GetImageStatus(&status);
@@ -1306,17 +1306,17 @@ nsBulletFrame::GetListItemText(const nsS
   return success;
 }
 
 #define MIN_BULLET_SIZE 1
 
 
 void
 nsBulletFrame::GetDesiredSize(nsPresContext*  aCX,
-                              nsIRenderingContext *aRenderingContext,
+                              nsRenderingContext *aRenderingContext,
                               nsHTMLReflowMetrics& aMetrics)
 {
   // Reset our padding.  If we need it, we'll set it below.
   mPadding.SizeTo(0, 0, 0, 0);
   
   const nsStyleList* myList = GetStyleList();
   nscoord ascent;
 
@@ -1458,26 +1458,26 @@ nsBulletFrame::Reflow(nsPresContext* aPr
   aMetrics.SetOverflowAreasToDesiredBounds();
 
   aStatus = NS_FRAME_COMPLETE;
   NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);
   return NS_OK;
 }
 
 /* virtual */ nscoord
-nsBulletFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
+nsBulletFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
 {
   nsHTMLReflowMetrics metrics;
   DISPLAY_MIN_WIDTH(this, metrics.width);
   GetDesiredSize(PresContext(), aRenderingContext, metrics);
   return metrics.width;
 }
 
 /* virtual */ nscoord
-nsBulletFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
+nsBulletFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
 {
   nsHTMLReflowMetrics metrics;
   DISPLAY_PREF_WIDTH(this, metrics.width);
   GetDesiredSize(PresContext(), aRenderingContext, metrics);
   return metrics.width;
 }
 
 
--- a/layout/generic/nsBulletFrame.h
+++ b/layout/generic/nsBulletFrame.h
@@ -68,18 +68,18 @@ public:
   NS_IMETHOD GetFrameName(nsAString& aResult) const;
 #endif
 
   // nsIHTMLReflow
   NS_IMETHOD Reflow(nsPresContext* aPresContext,
                     nsHTMLReflowMetrics& aMetrics,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus& aStatus);
-  virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
-  virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
+  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
+  virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
 
   // nsBulletFrame
   PRInt32 SetListItemOrdinal(PRInt32 aNextOrdinal, PRBool* aChanged);
 
 
   NS_IMETHOD OnStartContainer(imgIRequest *aRequest, imgIContainer *aImage);
   NS_IMETHOD OnDataAvailable(imgIRequest *aRequest,
                              PRBool aCurrentFrame,
@@ -94,26 +94,26 @@ public:
   static PRBool AppendCounterText(PRInt32 aListStyleType,
                                   PRInt32 aOrdinal,
                                   nsString& aResult);
 
   /* get list item text, with '.' */
   PRBool GetListItemText(const nsStyleList& aStyleList,
                          nsString& aResult);
                          
-  void PaintBullet(nsIRenderingContext& aRenderingContext, nsPoint aPt,
+  void PaintBullet(nsRenderingContext& aRenderingContext, nsPoint aPt,
                    const nsRect& aDirtyRect);
   
   virtual PRBool IsEmpty();
   virtual PRBool IsSelfEmpty();
   virtual nscoord GetBaseline() const;
 
 protected:
   void GetDesiredSize(nsPresContext* aPresContext,
-                      nsIRenderingContext *aRenderingContext,
+                      nsRenderingContext *aRenderingContext,
                       nsHTMLReflowMetrics& aMetrics);
 
   void GetLoadGroup(nsPresContext *aPresContext, nsILoadGroup **aLoadGroup);
 
   nsMargin mPadding;
   nsCOMPtr<imgIRequest> mImageRequest;
   nsCOMPtr<imgIDecoderObserver> mListener;
 
--- a/layout/generic/nsCanvasFrame.cpp
+++ b/layout/generic/nsCanvasFrame.cpp
@@ -39,17 +39,17 @@
 
 #include "nsCanvasFrame.h"
 #include "nsIServiceManager.h"
 #include "nsHTMLParts.h"
 #include "nsHTMLContainerFrame.h"
 #include "nsCSSRendering.h"
 #include "nsPresContext.h"
 #include "nsStyleContext.h"
-#include "nsIRenderingContext.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"
@@ -248,17 +248,17 @@ nsRect nsCanvasFrame::CanvasArea() const
     nsRect portRect = scrollableFrame->GetScrollPortRect();
     result.UnionRect(result, nsRect(nsPoint(0, 0), portRect.Size()));
   }
   return result;
 }
 
 void
 nsDisplayCanvasBackground::Paint(nsDisplayListBuilder* aBuilder,
-                                 nsIRenderingContext* aCtx)
+                                 nsRenderingContext* aCtx)
 {
   nsCanvasFrame* frame = static_cast<nsCanvasFrame*>(mFrame);
   nsPoint offset = ToReferenceFrame();
   nsRect bgClipRect = frame->CanvasArea() + offset;
 
   if (NS_GET_A(mExtraBackgroundColor) > 0) {
     aCtx->SetColor(mExtraBackgroundColor);
     aCtx->FillRect(bgClipRect);
@@ -290,17 +290,17 @@ public:
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder)
   {
     // This is an overestimate, but that's not a problem.
     nsCanvasFrame* frame = static_cast<nsCanvasFrame*>(mFrame);
     return frame->CanvasArea() + ToReferenceFrame();
   }
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
-                     nsIRenderingContext* aCtx)
+                     nsRenderingContext* aCtx)
   {
     nsCanvasFrame* frame = static_cast<nsCanvasFrame*>(mFrame);
     frame->PaintFocus(*aCtx, ToReferenceFrame());
   }
 
   NS_DISPLAY_DECL_NAME("CanvasFocus", TYPE_CANVAS_FOCUS)
 };
 
@@ -363,17 +363,17 @@ nsCanvasFrame::BuildDisplayList(nsDispla
   if (!GetStyleVisibility()->IsVisible())
     return NS_OK;
   
   return aLists.Outlines()->AppendNewToTop(new (aBuilder)
       nsDisplayCanvasFocus(aBuilder, this));
 }
 
 void
-nsCanvasFrame::PaintFocus(nsIRenderingContext& aRenderingContext, nsPoint aPt)
+nsCanvasFrame::PaintFocus(nsRenderingContext& aRenderingContext, nsPoint aPt)
 {
   nsRect focusRect(aPt, GetSize());
 
   nsIScrollableFrame *scrollableFrame = do_QueryFrame(GetParent());
   if (scrollableFrame) {
     nsRect portRect = scrollableFrame->GetScrollPortRect();
     focusRect.width = portRect.width;
     focusRect.height = portRect.height;
@@ -391,29 +391,29 @@ nsCanvasFrame::PaintFocus(nsIRenderingCo
     return;
   }
 
   nsCSSRendering::PaintFocus(PresContext(), aRenderingContext,
                              focusRect, color->mColor);
 }
 
 /* virtual */ nscoord
-nsCanvasFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
+nsCanvasFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord result;
   DISPLAY_MIN_WIDTH(this, result);
   if (mFrames.IsEmpty())
     result = 0;
   else
     result = mFrames.FirstChild()->GetMinWidth(aRenderingContext);
   return result;
 }
 
 /* virtual */ nscoord
-nsCanvasFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
+nsCanvasFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord result;
   DISPLAY_PREF_WIDTH(this, result);
   if (mFrames.IsEmpty())
     result = 0;
   else
     result = mFrames.FirstChild()->GetPrefWidth(aRenderingContext);
   return result;
--- a/layout/generic/nsCanvasFrame.h
+++ b/layout/generic/nsCanvasFrame.h
@@ -38,17 +38,17 @@
 /* rendering object that goes directly inside the document's scrollbars */
 
 #ifndef nsCanvasFrame_h___
 #define nsCanvasFrame_h___
 
 
 #include "nsHTMLContainerFrame.h"
 #include "nsStyleContext.h"
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "nsGUIEvent.h"
 #include "nsGkAtoms.h"
 #include "nsIScrollPositionListener.h"
 #include "nsDisplayList.h"
 #include "nsAbsoluteContainingBlock.h"
 
 class nsPresContext;
 
@@ -84,18 +84,18 @@ public:
                           nsIFrame*       aPrevFrame,
                           nsFrameList&    aFrameList);
   NS_IMETHOD RemoveFrame(nsIAtom*        aListName,
                          nsIFrame*       aOldFrame);
 
   virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
   virtual nsFrameList GetChildList(nsIAtom* aListName) const;
 
-  virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
-  virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
+  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
+  virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
   NS_IMETHOD Reflow(nsPresContext*          aPresContext,
                     nsHTMLReflowMetrics&     aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus&          aStatus);
   virtual PRBool IsContainingBlock() const { return PR_TRUE; }
   virtual PRBool IsFrameOfType(PRUint32 aFlags) const
   {
     return nsHTMLContainerFrame::IsFrameOfType(aFlags &
@@ -106,17 +106,17 @@ public:
    *  @param aHasFocus PR_TRUE to show focus ring, PR_FALSE to hide it
    */
   NS_IMETHOD SetHasFocus(PRBool aHasFocus);
 
   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                               const nsRect&           aDirtyRect,
                               const nsDisplayListSet& aLists);
 
-  void PaintFocus(nsIRenderingContext& aRenderingContext, nsPoint aPt);
+  void PaintFocus(nsRenderingContext& aRenderingContext, nsPoint aPt);
 
   // nsIScrollPositionListener
   virtual void ScrollPositionWillChange(nscoord aX, nscoord aY);
   virtual void ScrollPositionDidChange(nscoord aX, nscoord aY) {}
 
   /**
    * Get the "type" of the frame
    *
@@ -219,17 +219,17 @@ public:
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames)
   {
     // We need to override so we don't consider border-radius.
     aOutFrames->AppendElement(mFrame);
   }
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
-                     nsIRenderingContext* aCtx);
+                     nsRenderingContext* aCtx);
 
   void SetExtraBackgroundColor(nscolor aColor)
   {
     mExtraBackgroundColor = aColor;
   }
 
   NS_DISPLAY_DECL_NAME("CanvasBackground", TYPE_CANVAS_BACKGROUND)
 
--- a/layout/generic/nsColumnSetFrame.cpp
+++ b/layout/generic/nsColumnSetFrame.cpp
@@ -69,18 +69,18 @@ public:
   NS_IMETHOD  AppendFrames(nsIAtom*        aListName,
                            nsFrameList&    aFrameList);
   NS_IMETHOD  InsertFrames(nsIAtom*        aListName,
                            nsIFrame*       aPrevFrame,
                            nsFrameList&    aFrameList);
   NS_IMETHOD  RemoveFrame(nsIAtom*        aListName,
                           nsIFrame*       aOldFrame);
 
-  virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);  
-  virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
+  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);  
+  virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
 
   virtual nsIFrame* GetContentInsertionFrame() {
     nsIFrame* frame = GetFirstChild(nsnull);
 
     // if no children return nsnull
     if (!frame)
       return nsnull;
 
@@ -95,17 +95,17 @@ public:
   }
 
   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                               const nsRect&           aDirtyRect,
                               const nsDisplayListSet& aLists);
 
   virtual nsIAtom* GetType() const;
 
-  virtual void PaintColumnRule(nsIRenderingContext* aCtx,
+  virtual void PaintColumnRule(nsRenderingContext* aCtx,
                                const nsRect&        aDirtyRect,
                                const nsPoint&       aPt);
 
 #ifdef DEBUG
   NS_IMETHOD GetFrameName(nsAString& aResult) const {
     return MakeFrameName(NS_LITERAL_STRING("ColumnSet"), aResult);
   }
 #endif
@@ -204,24 +204,24 @@ nsColumnSetFrame::nsColumnSetFrame(nsSty
 
 nsIAtom*
 nsColumnSetFrame::GetType() const
 {
   return nsGkAtoms::columnSetFrame;
 }
 
 static void
-PaintColumnRule(nsIFrame* aFrame, nsIRenderingContext* aCtx,
+PaintColumnRule(nsIFrame* aFrame, nsRenderingContext* aCtx,
                 const nsRect& aDirtyRect, nsPoint aPt)
 {
   static_cast<nsColumnSetFrame*>(aFrame)->PaintColumnRule(aCtx, aDirtyRect, aPt);
 }
 
 void
-nsColumnSetFrame::PaintColumnRule(nsIRenderingContext* aCtx,
+nsColumnSetFrame::PaintColumnRule(nsRenderingContext* aCtx,
                                   const nsRect& aDirtyRect,
                                   const nsPoint& aPt)
 {
   nsIFrame* child = mFrames.FirstChild();
   if (!child)
     return;  // no columns
 
   nsIFrame* nextSibling = child->GetNextSibling();
@@ -449,17 +449,17 @@ static void MoveChildTo(nsIFrame* aParen
   r -= aChild->GetPosition();
   aChild->SetPosition(aOrigin);
   r += aOrigin;
   aParent->Invalidate(r);
   PlaceFrameView(aChild);
 }
 
 nscoord
-nsColumnSetFrame::GetMinWidth(nsIRenderingContext *aRenderingContext) {
+nsColumnSetFrame::GetMinWidth(nsRenderingContext *aRenderingContext) {
   nscoord width = 0;
   DISPLAY_MIN_WIDTH(this, width);
   if (mFrames.FirstChild()) {
     width = mFrames.FirstChild()->GetMinWidth(aRenderingContext);
   }
   const nsStyleColumn* colStyle = GetStyleColumn();
   nscoord colWidth;
   if (colStyle->mColumnWidth.GetUnit() == eStyleUnit_Coord) {
@@ -480,17 +480,17 @@ nsColumnSetFrame::GetMinWidth(nsIRenderi
     width = NS_MAX(width, colWidth);
   }
   // XXX count forced column breaks here? Maybe we should return the child's
   // min-width times the minimum number of columns.
   return width;
 }
 
 nscoord
-nsColumnSetFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext) {
+nsColumnSetFrame::GetPrefWidth(nsRenderingContext *aRenderingContext) {
   // Our preferred width is our desired column width, if specified, otherwise
   // the child's preferred width, times the number of columns, plus the width
   // of any required column gaps
   // XXX what about forced column breaks here?
   nscoord result = 0;
   DISPLAY_PREF_WIDTH(this, result);
   const nsStyleColumn* colStyle = GetStyleColumn();
   nscoord colGap = GetColumnGap(this, colStyle);
--- a/layout/generic/nsContainerFrame.cpp
+++ b/layout/generic/nsContainerFrame.cpp
@@ -39,17 +39,17 @@
 
 /* base class #1 for rendering objects that have child lists */
 
 #include "nsContainerFrame.h"
 #include "nsHTMLContainerFrame.h"
 #include "nsIContent.h"
 #include "nsIDocument.h"
 #include "nsPresContext.h"
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "nsStyleContext.h"
 #include "nsRect.h"
 #include "nsPoint.h"
 #include "nsGUIEvent.h"
 #include "nsStyleConsts.h"
 #include "nsIView.h"
 #include "nsHTMLContainerFrame.h"
 #include "nsFrameManager.h"
@@ -590,17 +590,17 @@ static nscoord GetCoord(const nsStyleCoo
 {
   if (aCoord.ConvertsToLength()) {
     return nsRuleNode::ComputeCoordPercentCalc(aCoord, 0);
   }
   return aIfNotCoord;
 }
 
 void
-nsContainerFrame::DoInlineIntrinsicWidth(nsIRenderingContext *aRenderingContext,
+nsContainerFrame::DoInlineIntrinsicWidth(nsRenderingContext *aRenderingContext,
                                          InlineIntrinsicWidthData *aData,
                                          nsLayoutUtils::IntrinsicWidthType aType)
 {
   if (GetPrevInFlow())
     return; // Already added.
 
   NS_PRECONDITION(aType == nsLayoutUtils::MIN_WIDTH ||
                   aType == nsLayoutUtils::PREF_WIDTH, "bad type");
@@ -672,17 +672,17 @@ nsContainerFrame::DoInlineIntrinsicWidth
       // clamp negative calc() to 0
       NS_MAX(GetCoord(stylePadding->mPadding.Get(endSide), 0), 0) +
       styleBorder->GetActualBorderWidth(endSide) +
       GetCoord(styleMargin->mMargin.Get(endSide), 0);
   }
 }
 
 /* virtual */ nsSize
-nsContainerFrame::ComputeAutoSize(nsIRenderingContext *aRenderingContext,
+nsContainerFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
                                   nsSize aCBSize, nscoord aAvailableWidth,
                                   nsSize aMargin, nsSize aBorder,
                                   nsSize aPadding, PRBool aShrinkWrap)
 {
   nsSize result(0xdeadbeef, NS_UNCONSTRAINEDSIZE);
   nscoord availBased = aAvailableWidth - aMargin.width - aBorder.width -
                        aPadding.width;
   // replaced elements always shrink-wrap
--- a/layout/generic/nsContainerFrame.h
+++ b/layout/generic/nsContainerFrame.h
@@ -146,25 +146,25 @@ public:
   // @param aStyleContext can be null, in which case the frame's style context is used
   static void SyncFrameViewProperties(nsPresContext*  aPresContext,
                                       nsIFrame*        aFrame,
                                       nsStyleContext*  aStyleContext,
                                       nsIView*         aView,
                                       PRUint32         aFlags = 0);
 
   // Used by both nsInlineFrame and nsFirstLetterFrame.
-  void DoInlineIntrinsicWidth(nsIRenderingContext *aRenderingContext,
+  void DoInlineIntrinsicWidth(nsRenderingContext *aRenderingContext,
                               InlineIntrinsicWidthData *aData,
                               nsLayoutUtils::IntrinsicWidthType aType);
 
   /**
    * This is the CSS block concept of computing 'auto' widths, which most
    * classes derived from nsContainerFrame want.
    */
-  virtual nsSize ComputeAutoSize(nsIRenderingContext *aRenderingContext,
+  virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext,
                                  nsSize aCBSize, nscoord aAvailableWidth,
                                  nsSize aMargin, nsSize aBorder,
                                  nsSize aPadding, PRBool aShrinkWrap);
 
   /**
    * Invokes the WillReflow() function, positions the frame and its view (if
    * requested), and then calls Reflow(). If the reflow succeeds and the child
    * frame is complete, deletes any next-in-flows using DeleteNextInFlowChild()
--- a/layout/generic/nsFirstLetterFrame.cpp
+++ b/layout/generic/nsFirstLetterFrame.cpp
@@ -132,47 +132,47 @@ nsFirstLetterFrame::GetChildFrameContain
   }
   else
     return nsFrame::GetChildFrameContainingOffset(inContentOffset, inHint, outFrameContentOffset, outChildFrame);
 }
 
 // Needed for non-floating first-letter frames and for the continuations
 // following the first-letter that we also use nsFirstLetterFrame for.
 /* virtual */ void
-nsFirstLetterFrame::AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
+nsFirstLetterFrame::AddInlineMinWidth(nsRenderingContext *aRenderingContext,
                                       nsIFrame::InlineMinWidthData *aData)
 {
   DoInlineIntrinsicWidth(aRenderingContext, aData, nsLayoutUtils::MIN_WIDTH);
 }
 
 // Needed for non-floating first-letter frames and for the continuations
 // following the first-letter that we also use nsFirstLetterFrame for.
 /* virtual */ void
-nsFirstLetterFrame::AddInlinePrefWidth(nsIRenderingContext *aRenderingContext,
+nsFirstLetterFrame::AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
                                        nsIFrame::InlinePrefWidthData *aData)
 {
   DoInlineIntrinsicWidth(aRenderingContext, aData, nsLayoutUtils::PREF_WIDTH);
 }
 
 // Needed for floating first-letter frames.
 /* virtual */ nscoord
-nsFirstLetterFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
+nsFirstLetterFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
 {
   return nsLayoutUtils::MinWidthFromInline(this, aRenderingContext);
 }
 
 // Needed for floating first-letter frames.
 /* virtual */ nscoord
-nsFirstLetterFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
+nsFirstLetterFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
 {
   return nsLayoutUtils::PrefWidthFromInline(this, aRenderingContext);
 }
 
 /* virtual */ nsSize
-nsFirstLetterFrame::ComputeSize(nsIRenderingContext *aRenderingContext,
+nsFirstLetterFrame::ComputeSize(nsRenderingContext *aRenderingContext,
                                 nsSize aCBSize, nscoord aAvailableWidth,
                                 nsSize aMargin, nsSize aBorder, nsSize aPadding,
                                 PRBool aShrinkWrap)
 {
   if (GetPrevInFlow()) {
     // We're wrapping the text *after* the first letter, so behave like an
     // inline frame.
     return nsSize(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
--- a/layout/generic/nsFirstLetterFrame.h
+++ b/layout/generic/nsFirstLetterFrame.h
@@ -65,23 +65,23 @@ public:
   virtual PRBool IsFrameOfType(PRUint32 aFlags) const
   {
     if (!GetStyleDisplay()->IsFloating())
       aFlags = aFlags & ~(nsIFrame::eLineParticipant);
     return nsFirstLetterFrameSuper::IsFrameOfType(aFlags &
       ~(nsIFrame::eBidiInlineContainer));
   }
 
-  virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
-  virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
-  virtual void AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
+  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
+  virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
+  virtual void AddInlineMinWidth(nsRenderingContext *aRenderingContext,
                                  InlineMinWidthData *aData);
-  virtual void AddInlinePrefWidth(nsIRenderingContext *aRenderingContext,
+  virtual void AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
                                   InlinePrefWidthData *aData);
-  virtual nsSize ComputeSize(nsIRenderingContext *aRenderingContext,
+  virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
                              nsSize aCBSize, nscoord aAvailableWidth,
                              nsSize aMargin, nsSize aBorder, nsSize aPadding,
                              PRBool aShrinkWrap);
   NS_IMETHOD Reflow(nsPresContext*          aPresContext,
                     nsHTMLReflowMetrics&     aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus&          aStatus);
 
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -975,24 +975,24 @@ public:
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplaySelectionOverlay() {
     MOZ_COUNT_DTOR(nsDisplaySelectionOverlay);
   }
 #endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
-                     nsIRenderingContext* aCtx);
+                     nsRenderingContext* aCtx);
   NS_DISPLAY_DECL_NAME("SelectionOverlay", TYPE_SELECTION_OVERLAY)
 private:
   PRInt16 mSelectionValue;
 };
 
 void nsDisplaySelectionOverlay::Paint(nsDisplayListBuilder* aBuilder,
-                                      nsIRenderingContext* aCtx)
+                                      nsRenderingContext* aCtx)
 {
   nscolor color = NS_RGB(255, 255, 255);
   
   nsILookAndFeel::nsColorID colorID;
   nsresult result;
   if (mSelectionValue == nsISelectionController::SELECTION_ON) {
     colorID = nsILookAndFeel::eColor_TextSelectBackground;
   } else if (mSelectionValue == nsISelectionController::SELECTION_ATTENTION) {
@@ -1358,28 +1358,28 @@ BuildDisplayListWithOverflowClip(nsDispl
   NS_ENSURE_SUCCESS(rv, rv);
   rv = aBuilder->DisplayCaret(aFrame, aDirtyRect, aSet.Content());
   NS_ENSURE_SUCCESS(rv, rv);
 
   return aFrame->OverflowClip(aBuilder, set, aSet, aClipRect, aClipRadii);
 }
 
 #ifdef NS_DEBUG
-static void PaintDebugBorder(nsIFrame* aFrame, nsIRenderingContext* aCtx,
+static void PaintDebugBorder(nsIFrame* aFrame, nsRenderingContext* aCtx,
      const nsRect& aDirtyRect, nsPoint aPt) {
   nsRect r(aPt, aFrame->GetSize());
   if (aFrame->HasView()) {
     aCtx->SetColor(NS_RGB(0,0,255));
   } else {
     aCtx->SetColor(NS_RGB(255,0,0));
   }
   aCtx->DrawRect(r);
 }
 
-static void PaintEventTargetBorder(nsIFrame* aFrame, nsIRenderingContext* aCtx,
+static void PaintEventTargetBorder(nsIFrame* aFrame, nsRenderingContext* aCtx,
      const nsRect& aDirtyRect, nsPoint aPt) {
   nsRect r(aPt, aFrame->GetSize());
   aCtx->SetColor(NS_RGB(128,0,128));
   aCtx->DrawRect(r);
 }
 
 static void
 DisplayDebugBorders(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
@@ -3113,33 +3113,33 @@ nsFrame::MarkIntrinsicWidthsDirty()
     SizeNeedsRecalc(metrics->mBlockPrefSize);
     SizeNeedsRecalc(metrics->mBlockMinSize);
     CoordNeedsRecalc(metrics->mFlex);
     CoordNeedsRecalc(metrics->mAscent);
   }
 }
 
 /* virtual */ nscoord
-nsFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
+nsFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord result = 0;
   DISPLAY_MIN_WIDTH(this, result);
   return result;
 }
 
 /* virtual */ nscoord
-nsFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
+nsFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord result = 0;
   DISPLAY_PREF_WIDTH(this, result);
   return result;
 }
 
 /* virtual */ void
-nsFrame::AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
+nsFrame::AddInlineMinWidth(nsRenderingContext *aRenderingContext,
                            nsIFrame::InlineMinWidthData *aData)
 {
   NS_ASSERTION(GetParent(), "Must have a parent if we get here!");
   PRBool canBreak = !CanContinueTextRun() &&
     GetParent()->GetStyleText()->WhiteSpaceCanWrap();
   
   if (canBreak)
     aData->OptionallyBreak(aRenderingContext);
@@ -3149,28 +3149,28 @@ nsFrame::AddInlineMinWidth(nsIRenderingC
   aData->currentLine += nsLayoutUtils::IntrinsicForContainer(aRenderingContext,
                             this, nsLayoutUtils::MIN_WIDTH);
   aData->atStartOfLine = PR_FALSE;
   if (canBreak)
     aData->OptionallyBreak(aRenderingContext);
 }
 
 /* virtual */ void
-nsFrame::AddInlinePrefWidth(nsIRenderingContext *aRenderingContext,
+nsFrame::AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
                             nsIFrame::InlinePrefWidthData *aData)
 {
   aData->trailingWhitespace = 0;
   aData->skipWhitespace = PR_FALSE;
   nscoord myPref = nsLayoutUtils::IntrinsicForContainer(aRenderingContext, 
                        this, nsLayoutUtils::PREF_WIDTH);
   aData->currentLine = NSCoordSaturatingAdd(aData->currentLine, myPref);
 }
 
 void
-nsIFrame::InlineMinWidthData::ForceBreak(nsIRenderingContext *aRenderingContext)
+nsIFrame::InlineMinWidthData::ForceBreak(nsRenderingContext *aRenderingContext)
 {
   currentLine -= trailingWhitespace;
   prevLines = NS_MAX(prevLines, currentLine);
   currentLine = trailingWhitespace = 0;
 
   for (PRUint32 i = 0, i_end = floats.Length(); i != i_end; ++i) {
     nsIFrame *floatFrame = floats[i];
     nscoord float_min =
@@ -3180,34 +3180,34 @@ nsIFrame::InlineMinWidthData::ForceBreak
       prevLines = float_min;
   }
   floats.Clear();
   trailingTextFrame = nsnull;
   skipWhitespace = PR_TRUE;
 }
 
 void
-nsIFrame::InlineMinWidthData::OptionallyBreak(nsIRenderingContext *aRenderingContext,
+nsIFrame::InlineMinWidthData::OptionallyBreak(nsRenderingContext *aRenderingContext,
                                               nscoord aHyphenWidth)
 {
   trailingTextFrame = nsnull;
 
   // If we can fit more content into a smaller width by staying on this
   // line (because we're still at a negative offset due to negative
   // text-indent or negative margin), don't break.  Otherwise, do the
   // same as ForceBreak.  it doesn't really matter when we accumulate
   // floats.
   if (currentLine + aHyphenWidth < 0 || atStartOfLine)
     return;
   currentLine += aHyphenWidth;
   ForceBreak(aRenderingContext);
 }
 
 void
-nsIFrame::InlinePrefWidthData::ForceBreak(nsIRenderingContext *aRenderingContext)
+nsIFrame::InlinePrefWidthData::ForceBreak(nsRenderingContext *aRenderingContext)
 {
   if (floats.Length() != 0) {
             // preferred widths accumulated for floats that have already
             // been cleared past
     nscoord floats_done = 0,
             // preferred widths accumulated for floats that have not yet
             // been cleared past
             floats_cur_left = 0,
@@ -3255,17 +3255,17 @@ nsIFrame::InlinePrefWidthData::ForceBrea
     NSCoordSaturatingSubtract(currentLine, trailingWhitespace, nscoord_MAX);
   prevLines = NS_MAX(prevLines, currentLine);
   currentLine = trailingWhitespace = 0;
   skipWhitespace = PR_TRUE;
 }
 
 static void
 AddCoord(const nsStyleCoord& aStyle,
-         nsIRenderingContext* aRenderingContext,
+         nsRenderingContext* aRenderingContext,
          nsIFrame* aFrame,
          nscoord* aCoord, float* aPercent,
          PRBool aClampNegativeToZero)
 {
   switch (aStyle.GetUnit()) {
     case eStyleUnit_Coord: {
       NS_ASSERTION(!aClampNegativeToZero || aStyle.GetCoordValue() >= 0,
                    "unexpected negative value");
@@ -3292,17 +3292,17 @@ AddCoord(const nsStyleCoord& aStyle,
     }
     default: {
       return;
     }
   }
 }
 
 /* virtual */ nsIFrame::IntrinsicWidthOffsetData
-nsFrame::IntrinsicWidthOffsets(nsIRenderingContext* aRenderingContext)
+nsFrame::IntrinsicWidthOffsets(nsRenderingContext* aRenderingContext)
 {
   IntrinsicWidthOffsetData result;
 
   const nsStyleMargin *styleMargin = GetStyleMargin();
   AddCoord(styleMargin->mMargin.GetLeft(), aRenderingContext, this,
            &result.hMargin, &result.hPctMargin, PR_FALSE);
   AddCoord(styleMargin->mMargin.GetRight(), aRenderingContext, this,
            &result.hMargin, &result.hPctMargin, PR_FALSE);
@@ -3347,17 +3347,17 @@ nsFrame::GetIntrinsicSize()
 
 /* virtual */ nsSize
 nsFrame::GetIntrinsicRatio()
 {
   return nsSize(0, 0);
 }
 
 /* virtual */ nsSize
-nsFrame::ComputeSize(nsIRenderingContext *aRenderingContext,
+nsFrame::ComputeSize(nsRenderingContext *aRenderingContext,
                      nsSize aCBSize, nscoord aAvailableWidth,
                      nsSize aMargin, nsSize aBorder, nsSize aPadding,
                      PRBool aShrinkWrap)
 {
   nsSize result = ComputeAutoSize(aRenderingContext, aCBSize, aAvailableWidth,
                                   aMargin, aBorder, aPadding, aShrinkWrap);
   nsSize boxSizingAdjust(0,0);
   const nsStylePosition *stylePos = GetStylePosition();
@@ -3482,17 +3482,17 @@ nsFrame::ComputeSimpleTightBounds(gfxCon
        child = child->GetNextSibling();
     }
     childList = GetAdditionalChildListName(listIndex++);
   } while (childList);
   return r;
 }
 
 /* virtual */ nsSize
-nsFrame::ComputeAutoSize(nsIRenderingContext *aRenderingContext,
+nsFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
                          nsSize aCBSize, nscoord aAvailableWidth,
                          nsSize aMargin, nsSize aBorder, nsSize aPadding,
                          PRBool aShrinkWrap)
 {
   // Use basic shrink-wrapping as a default implementation.
   nsSize result(0xdeadbeef, NS_UNCONSTRAINEDSIZE);
 
   // don't bother setting it if the result won't be used
@@ -3500,17 +3500,17 @@ nsFrame::ComputeAutoSize(nsIRenderingCon
     nscoord availBased = aAvailableWidth - aMargin.width - aBorder.width -
                          aPadding.width;
     result.width = ShrinkWidthToFit(aRenderingContext, availBased);
   }
   return result;
 }
 
 nscoord
-nsFrame::ShrinkWidthToFit(nsIRenderingContext *aRenderingContext,
+nsFrame::ShrinkWidthToFit(nsRenderingContext *aRenderingContext,
                           nscoord aWidthInCB)
 {
   nscoord result;
   nscoord minWidth = GetMinWidth(aRenderingContext);
   if (minWidth > aWidthInCB) {
     result = minWidth;
   } else {
     nscoord prefWidth = GetPrefWidth(aRenderingContext);
@@ -6656,17 +6656,17 @@ nsFrame::RefreshSizeCache(nsBoxLayoutSta
   // 3) Minimum size. This is a toughy. We can pass the block a flag asking for the max element
   //    size. That would give us the width. Unfortunately you can only ask for a maxElementSize
   //    during an incremental reflow. So on other reflows we will just have to use 0.
   //    The min height on the other hand is fairly easy we need to get the largest
   //    line height. This can be done with the line iterator.
 
   // if we do have a rendering context
   nsresult rv = NS_OK;
-  nsIRenderingContext* rendContext = aState.GetRenderingContext();
+  nsRenderingContext* rendContext = aState.GetRenderingContext();
   if (rendContext) {
     nsPresContext* presContext = aState.PresContext();
 
     // If we don't have any HTML constraints and it's a resize, then nothing in the block
     // could have changed, so no refresh is necessary.
     nsBoxLayoutMetrics* metrics = BoxMetrics();
     if (!DoesNeedRecalc(metrics->mBlockPrefSize))
       return NS_OK;
@@ -6872,17 +6872,17 @@ nsFrame::GetBoxAscent(nsBoxLayoutState& 
   return metrics->mAscent;
 }
 
 nsresult
 nsFrame::DoLayout(nsBoxLayoutState& aState)
 {
   nsRect ourRect(mRect);
 
-  nsIRenderingContext* rendContext = aState.GetRenderingContext();
+  nsRenderingContext* rendContext = aState.GetRenderingContext();
   nsPresContext* presContext = aState.PresContext();
   nsHTMLReflowMetrics desiredSize;
   nsresult rv = NS_OK;
  
   if (rendContext) {
 
     rv = BoxReflow(aState, presContext, desiredSize, rendContext,
                    ourRect.x, ourRect.y, ourRect.width, ourRect.height);
@@ -6928,17 +6928,17 @@ nsFrame::DoLayout(nsBoxLayoutState& aSta
 
   return rv;
 }
 
 nsresult
 nsFrame::BoxReflow(nsBoxLayoutState&        aState,
                    nsPresContext*           aPresContext,
                    nsHTMLReflowMetrics&     aDesiredSize,
-                   nsIRenderingContext*     aRenderingContext,
+                   nsRenderingContext*     aRenderingContext,
                    nscoord                  aX,
                    nscoord                  aY,
                    nscoord                  aWidth,
                    nscoord                  aHeight,
                    PRBool                   aMoveFrame)
 {
   DO_GLOBAL_REFLOW_COUNT("nsBoxToBlockAdaptor");
 
--- a/layout/generic/nsFrame.h
+++ b/layout/generic/nsFrame.h
@@ -268,28 +268,28 @@ public:
   NS_IMETHOD GetParentStyleContextFrame(nsPresContext* aPresContext,
                                         nsIFrame**      aProviderFrame,
                                         PRBool*         aIsChild);
 
   virtual PRBool IsEmpty();
   virtual PRBool IsSelfEmpty();
 
   virtual void MarkIntrinsicWidthsDirty();
-  virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
-  virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
-  virtual void AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
+  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
+  virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
+  virtual void AddInlineMinWidth(nsRenderingContext *aRenderingContext,
                                  InlineMinWidthData *aData);
-  virtual void AddInlinePrefWidth(nsIRenderingContext *aRenderingContext,
+  virtual void AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
                                   InlinePrefWidthData *aData);
   virtual IntrinsicWidthOffsetData
-    IntrinsicWidthOffsets(nsIRenderingContext* aRenderingContext);
+    IntrinsicWidthOffsets(nsRenderingContext* aRenderingContext);
   virtual IntrinsicSize GetIntrinsicSize();
   virtual nsSize GetIntrinsicRatio();
 
-  virtual nsSize ComputeSize(nsIRenderingContext *aRenderingContext,
+  virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
                              nsSize aCBSize, nscoord aAvailableWidth,
                              nsSize aMargin, nsSize aBorder, nsSize aPadding,
                              PRBool aShrinkWrap);
 
   // Compute tight bounds assuming this frame honours its border, background
   // and outline, its children's tight bounds, and nothing else.
   nsRect ComputeSimpleTightBounds(gfxContext* aContext) const;
   
@@ -303,26 +303,26 @@ public:
    * override only ComputeAutoSize, and frames that cannot do so need to
    * override ComputeSize to enforce their width/height invariants.
    *
    * Implementations may optimize by returning a garbage width if
    * GetStylePosition()->mWidth.GetUnit() != eStyleUnit_Auto, and
    * likewise for height, since in such cases the result is guaranteed
    * to be unused.
    */
-  virtual nsSize ComputeAutoSize(nsIRenderingContext *aRenderingContext,
+  virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext,
                                  nsSize aCBSize, nscoord aAvailableWidth,
                                  nsSize aMargin, nsSize aBorder,
                                  nsSize aPadding, PRBool aShrinkWrap);
 
   /**
    * Utility function for ComputeAutoSize implementations.  Return
    * max(GetMinWidth(), min(aWidthInCB, GetPrefWidth()))
    */
-  nscoord ShrinkWidthToFit(nsIRenderingContext *aRenderingContext,
+  nscoord ShrinkWidthToFit(nsRenderingContext *aRenderingContext,
                            nscoord aWidthInCB);
 
   NS_IMETHOD  WillReflow(nsPresContext* aPresContext);
   NS_IMETHOD  Reflow(nsPresContext*          aPresContext,
                      nsHTMLReflowMetrics&     aDesiredSize,
                      const nsHTMLReflowState& aReflowState,
                      nsReflowStatus&          aStatus);
   NS_IMETHOD  DidReflow(nsPresContext*           aPresContext,
@@ -613,17 +613,17 @@ protected:
 
   // Fire DOM event. If no aContent argument use frame's mContent.
   void FireDOMEvent(const nsAString& aDOMEventName, nsIContent *aContent = nsnull);
 
 private:
   nsresult BoxReflow(nsBoxLayoutState& aState,
                      nsPresContext*    aPresContext,
                      nsHTMLReflowMetrics&     aDesiredSize,
-                     nsIRenderingContext* aRenderingContext,
+                     nsRenderingContext* aRenderingContext,
                      nscoord aX,
                      nscoord aY,
                      nscoord aWidth,
                      nscoord aHeight,
                      PRBool aMoveFrame = PR_TRUE);
 
   NS_IMETHODIMP RefreshSizeCache(nsBoxLayoutState& aState);
 
--- a/layout/generic/nsFrameSetFrame.cpp
+++ b/layout/generic/nsFrameSetFrame.cpp
@@ -57,17 +57,17 @@
 #include "nsStyleCoord.h"
 #include "nsStyleConsts.h"
 #include "nsStyleContext.h"
 #include "nsHTMLParts.h"
 #include "nsILookAndFeel.h"
 #include "nsWidgetsCID.h"
 #include "nsIComponentManager.h"
 #include "nsGUIEvent.h"
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "nsIServiceManager.h"
 #include "nsIDOMMutationEvent.h"
 #include "nsINameSpaceManager.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsAutoPtr.h"
 #include "nsStyleSet.h"
 #include "mozilla/dom/Element.h"
 #include "nsDisplayList.h"
@@ -138,17 +138,17 @@ public:
                     nsHTMLReflowMetrics&     aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus&          aStatus);
 
   PRBool GetVisibility() { return mVisibility || mVisibilityOverride; }
   void SetVisibility(PRBool aVisibility);
   void SetColor(nscolor aColor);
 
-  void PaintBorder(nsIRenderingContext& aRenderingContext, nsPoint aPt);
+  void PaintBorder(nsRenderingContext& aRenderingContext, nsPoint aPt);
 
 protected:
   nsHTMLFramesetBorderFrame(nsStyleContext* aContext, PRInt32 aWidth, PRBool aVertical, PRBool aVisible);
   virtual ~nsHTMLFramesetBorderFrame();
   virtual nscoord GetIntrinsicWidth();
   virtual nscoord GetIntrinsicHeight();
 
   // the prev and next neighbors are indexes into the row (for a horizontal border) or col (for
@@ -1655,46 +1655,46 @@ public:
 
   // REVIEW: see old GetFrameForPoint
   // Receives events in its bounds
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames) {
     aOutFrames->AppendElement(mFrame);
   }
   virtual void Paint(nsDisplayListBuilder* aBuilder,
-                     nsIRenderingContext* aCtx);
+                     nsRenderingContext* aCtx);
   NS_DISPLAY_DECL_NAME("FramesetBorder", TYPE_FRAMESET_BORDER)
 };
 
 void nsDisplayFramesetBorder::Paint(nsDisplayListBuilder* aBuilder,
-                                    nsIRenderingContext* aCtx)
+                                    nsRenderingContext* aCtx)
 {
   static_cast<nsHTMLFramesetBorderFrame*>(mFrame)->
     PaintBorder(*aCtx, ToReferenceFrame());
 }
 
 NS_IMETHODIMP
 nsHTMLFramesetBorderFrame::BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                                             const nsRect&           aDirtyRect,
                                             const nsDisplayListSet& aLists)
 {
   return aLists.Content()->AppendNewToTop(
       new (aBuilder) nsDisplayFramesetBorder(aBuilder, this));
 }
 
-void nsHTMLFramesetBorderFrame::PaintBorder(nsIRenderingContext& aRenderingContext,
+void nsHTMLFramesetBorderFrame::PaintBorder(nsRenderingContext& aRenderingContext,
                                             nsPoint aPt)
 {
   nscolor WHITE    = NS_RGB(255, 255, 255);
   nscolor bgColor  = NS_RGB(200,200,200);
   nscolor fgColor  = NS_RGB(0,0,0);
   nscolor hltColor = NS_RGB(255,255,255);
   nscolor sdwColor = NS_RGB(128,128,128);
 
-  nsIRenderingContext::AutoPushTranslation
+  nsRenderingContext::AutoPushTranslation
     translate(&aRenderingContext, aPt);
 
   {
     nsCOMPtr<nsILookAndFeel> lookAndFeel = do_GetService(kLookAndFeelCID);
     if (lookAndFeel) {
       lookAndFeel->GetColor(nsILookAndFeel::eColor_WidgetBackground,  bgColor);
       lookAndFeel->GetColor(nsILookAndFeel::eColor_WidgetForeground,  fgColor);
       lookAndFeel->GetColor(nsILookAndFeel::eColor_Widget3DShadow,    sdwColor);
@@ -1852,22 +1852,22 @@ public:
     MOZ_COUNT_CTOR(nsDisplayFramesetBlank);
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayFramesetBlank() {
     MOZ_COUNT_DTOR(nsDisplayFramesetBlank);
   }
 #endif
 
-  virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
+  virtual void Paint(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx);
   NS_DISPLAY_DECL_NAME("FramesetBlank", TYPE_FRAMESET_BLANK)
 };
 
 void nsDisplayFramesetBlank::Paint(nsDisplayListBuilder* aBuilder,
-                                   nsIRenderingContext* aCtx)
+                                   nsRenderingContext* aCtx)
 {
   nscolor white = NS_RGB(255,255,255);
   aCtx->SetColor(white);
   aCtx->FillRect(mVisibleRect);
 }
 
 #ifdef DEBUG
 NS_IMETHODIMP nsHTMLFramesetBlankFrame::List(FILE*   out, 
--- a/layout/generic/nsFrameSetFrame.h
+++ b/layout/generic/nsFrameSetFrame.h
@@ -45,17 +45,17 @@
 #include "nsColor.h"
 #include "nsIObserver.h"
 #include "nsWeakPtr.h"
 #include "nsIFrameSetElement.h"
 
 class  nsIContent;
 class  nsIFrame;
 class  nsPresContext;
-class  nsIRenderingContext;
+class  nsRenderingContext;
 struct nsRect;
 struct nsHTMLReflowState;
 struct nsSize;
 class  nsIAtom;
 class  nsHTMLFramesetBorderFrame;
 class  nsGUIEvent;
 class  nsHTMLFramesetFrame;
 
--- a/layout/generic/nsGfxScrollFrame.cpp
+++ b/layout/generic/nsGfxScrollFrame.cpp
@@ -743,41 +743,41 @@ nsHTMLScrollFrame::PlaceScrollArea(const
   nsContainerFrame::SyncFrameViewAfterReflow(scrolledFrame->PresContext(),
                                              scrolledFrame,
                                              scrolledFrame->GetView(),
                                              scrolledArea,
                                              0);
 }
 
 nscoord
-nsHTMLScrollFrame::GetIntrinsicVScrollbarWidth(nsIRenderingContext *aRenderingContext)
+nsHTMLScrollFrame::GetIntrinsicVScrollbarWidth(nsRenderingContext *aRenderingContext)
 {
   nsGfxScrollFrameInner::ScrollbarStyles ss = GetScrollbarStyles();
   if (ss.mVertical != NS_STYLE_OVERFLOW_SCROLL || !mInner.mVScrollbarBox)
     return 0;
 
   // Don't need to worry about reflow depth here since it's
   // just for scrollbars
   nsBoxLayoutState bls(PresContext(), aRenderingContext, 0);
   nsSize vScrollbarPrefSize(0, 0);
   GetScrollbarMetrics(bls, mInner.mVScrollbarBox,
                       nsnull, &vScrollbarPrefSize, PR_TRUE);
   return vScrollbarPrefSize.width;
 }
 
 /* virtual */ nscoord
-nsHTMLScrollFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
+nsHTMLScrollFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord result = mInner.mScrolledFrame->GetMinWidth(aRenderingContext);
   DISPLAY_MIN_WIDTH(this, result);
   return result + GetIntrinsicVScrollbarWidth(aRenderingContext);
 }
 
 /* virtual */ nscoord
-nsHTMLScrollFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
+nsHTMLScrollFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord result = mInner.mScrolledFrame->GetPrefWidth(aRenderingContext);
   DISPLAY_PREF_WIDTH(this, result);
   return NSCoordSaturatingAdd(result, GetIntrinsicVScrollbarWidth(aRenderingContext));
 }
 
 NS_IMETHODIMP
 nsHTMLScrollFrame::GetPadding(nsMargin& aMargin)
--- a/layout/generic/nsGfxScrollFrame.h
+++ b/layout/generic/nsGfxScrollFrame.h
@@ -367,24 +367,24 @@ public:
                                PRBool aAssumeHScroll,
                                PRBool aAssumeVScroll,
                                nsHTMLReflowMetrics* aMetrics,
                                PRBool aFirstPass);
   nsresult ReflowContents(ScrollReflowState* aState,
                           const nsHTMLReflowMetrics& aDesiredSize);
   void PlaceScrollArea(const ScrollReflowState& aState,
                        const nsPoint& aScrollPosition);
-  nscoord GetIntrinsicVScrollbarWidth(nsIRenderingContext *aRenderingContext);
+  nscoord GetIntrinsicVScrollbarWidth(nsRenderingContext *aRenderingContext);
 
   virtual PRBool GetBorderRadii(nscoord aRadii[8]) const {
     return mInner.GetBorderRadii(aRadii);
   }
 
-  virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
-  virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
+  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
+  virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
   NS_IMETHOD GetPadding(nsMargin& aPadding);
   virtual PRBool IsCollapsed(nsBoxLayoutState& aBoxLayoutState);
   
   NS_IMETHOD Reflow(nsPresContext*          aPresContext,
                     nsHTMLReflowMetrics&     aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus&          aStatus);
 
@@ -440,17 +440,17 @@ public:
   }
   virtual nsMargin GetActualScrollbarSizes() const {
     return mInner.GetActualScrollbarSizes();
   }
   virtual nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState) {
     return mInner.GetDesiredScrollbarSizes(aState);
   }
   virtual nsMargin GetDesiredScrollbarSizes(nsPresContext* aPresContext,
-          nsIRenderingContext* aRC) {
+          nsRenderingContext* aRC) {
     nsBoxLayoutState bls(aPresContext, aRC, 0);
     return GetDesiredScrollbarSizes(&bls);
   }
   virtual nsRect GetScrollPortRect() const {
     return mInner.GetScrollPortRect();
   }
   virtual nsPoint GetScrollPosition() const {
     return mInner.GetScrollPosition();
@@ -580,17 +580,17 @@ public:
   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                               const nsRect&           aDirtyRect,
                               const nsDisplayListSet& aLists) {
     return mInner.BuildDisplayList(aBuilder, aDirtyRect, aLists);
   }
 
   // XXXldb Is this actually used?
 #if 0
-  virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
+  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
 #endif
 
   // Because there can be only one child frame, these two function return
   // NS_ERROR_FAILURE
   NS_IMETHOD AppendFrames(nsIAtom*        aListName,
                           nsFrameList&    aFrameList);
   NS_IMETHOD InsertFrames(nsIAtom*        aListName,
                           nsIFrame*       aPrevFrame,
@@ -675,17 +675,17 @@ public:
   }
   virtual nsMargin GetActualScrollbarSizes() const {
     return mInner.GetActualScrollbarSizes();
   }
   virtual nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState) {
     return mInner.GetDesiredScrollbarSizes(aState);
   }
   virtual nsMargin GetDesiredScrollbarSizes(nsPresContext* aPresContext,
-          nsIRenderingContext* aRC) {
+          nsRenderingContext* aRC) {
     nsBoxLayoutState bls(aPresContext, aRC, 0);
     return GetDesiredScrollbarSizes(&bls);
   }
   virtual nsRect GetScrollPortRect() const {
     return mInner.GetScrollPortRect();
   }
   virtual nsPoint GetScrollPosition() const {
     return mInner.GetScrollPosition();
--- a/layout/generic/nsHTMLCanvasFrame.cpp
+++ b/layout/generic/nsHTMLCanvasFrame.cpp
@@ -151,27 +151,27 @@ nsHTMLCanvasFrame::GetCanvasSize()
   } else {
     NS_NOTREACHED("couldn't get canvas size");
   }
 
   return size;
 }
 
 /* virtual */ nscoord
-nsHTMLCanvasFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
+nsHTMLCanvasFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
 {
   // XXX The caller doesn't account for constraints of the height,
   // min-height, and max-height properties.
   nscoord result = nsPresContext::CSSPixelsToAppUnits(GetCanvasSize().width);
   DISPLAY_MIN_WIDTH(this, result);
   return result;
 }
 
 /* virtual */ nscoord
-nsHTMLCanvasFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
+nsHTMLCanvasFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
 {
   // XXX The caller doesn't account for constraints of the height,
   // min-height, and max-height properties.
   nscoord result = nsPresContext::CSSPixelsToAppUnits(GetCanvasSize().width);
   DISPLAY_PREF_WIDTH(this, result);
   return result;
 }
 
@@ -179,17 +179,17 @@ nsHTMLCanvasFrame::GetPrefWidth(nsIRende
 nsHTMLCanvasFrame::GetIntrinsicRatio()
 {
   nsIntSize size(GetCanvasSize());
   return nsSize(nsPresContext::CSSPixelsToAppUnits(size.width),
                 nsPresContext::CSSPixelsToAppUnits(size.height));
 }
 
 /* virtual */ nsSize
-nsHTMLCanvasFrame::ComputeSize(nsIRenderingContext *aRenderingContext,
+nsHTMLCanvasFrame::ComputeSize(nsRenderingContext *aRenderingContext,
                                nsSize aCBSize, nscoord aAvailableWidth,
                                nsSize aMargin, nsSize aBorder, nsSize aPadding,
                                PRBool aShrinkWrap)
 {
   nsIntSize size = GetCanvasSize();
 
   IntrinsicSize intrinsicSize;
   intrinsicSize.width.SetCoordValue(nsPresContext::CSSPixelsToAppUnits(size.width));
--- a/layout/generic/nsHTMLCanvasFrame.h
+++ b/layout/generic/nsHTMLCanvasFrame.h
@@ -72,21 +72,21 @@ public:
 
   already_AddRefed<Layer> BuildLayer(nsDisplayListBuilder* aBuilder,
                                      LayerManager* aManager,
                                      nsDisplayItem* aItem);
 
   /* get the size of the canvas's image */
   nsIntSize GetCanvasSize();
 
-  virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
-  virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
+  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
+  virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
   virtual nsSize GetIntrinsicRatio();
 
-  virtual nsSize ComputeSize(nsIRenderingContext *aRenderingContext,
+  virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
                              nsSize aCBSize, nscoord aAvailableWidth,
                              nsSize aMargin, nsSize aBorder, nsSize aPadding,
                              PRBool aShrinkWrap);
 
   NS_IMETHOD Reflow(nsPresContext*          aPresContext,
                     nsHTMLReflowMetrics&     aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus&          aStatus);
--- a/layout/generic/nsHTMLContainerFrame.cpp
+++ b/layout/generic/nsHTMLContainerFrame.cpp
@@ -35,17 +35,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 /* base class #2 for rendering objects that have child lists */
 
 #include "nsHTMLContainerFrame.h"
 #include "nsFirstLetterFrame.h"
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "nsPresContext.h"
 #include "nsIPresShell.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsIContent.h"
 #include "nsGkAtoms.h"
 #include "nsLayoutUtils.h"
 #include "nsCSSAnonBoxes.h"
@@ -82,17 +82,17 @@ public:
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayTextDecoration() {
     MOZ_COUNT_DTOR(nsDisplayTextDecoration);
   }
 #endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
-                     nsIRenderingContext* aCtx);
+                     nsRenderingContext* aCtx);
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
   NS_DISPLAY_DECL_NAME("TextDecoration", TYPE_TEXT_DECORATION)
 
   virtual PRUint32 GetPerFrameKey()
   {
     return TYPE_TEXT_DECORATION | (mDecoration << TYPE_BITS);
   }
 
@@ -100,17 +100,17 @@ private:
   nsLineBox* mLine;
   nscolor    mColor;
   PRUint8    mDecoration;
   PRUint8    mStyle;
 };
 
 void
 nsDisplayTextDecoration::Paint(nsDisplayListBuilder* aBuilder,
-                               nsIRenderingContext* aCtx)
+                               nsRenderingContext* aCtx)
 {
   nsCOMPtr<nsIFontMetrics> fm;
   nsLayoutUtils::GetFontMetricsForFrame(mFrame, getter_AddRefs(fm));
   nsIThebesFontMetrics* tfm = static_cast<nsIThebesFontMetrics*>(fm.get());
   gfxFontGroup* fontGroup = tfm->GetThebesFontGroup();
   gfxFont* firstFont = fontGroup->GetFontAt(0);
   if (!firstFont)
     return; // OOM
@@ -168,30 +168,30 @@ public:
       mOverlineStyle(aOverlineStyle), mStrikeThroughStyle(aStrikeThroughStyle) {
     MOZ_COUNT_CTOR(nsDisplayTextShadow);
   }
   virtual ~nsDisplayTextShadow() {
     MOZ_COUNT_DTOR(nsDisplayTextShadow);
   }
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
-                     nsIRenderingContext* aCtx);
+                     nsRenderingContext* aCtx);
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
   NS_DISPLAY_DECL_NAME("TextShadowContainer", TYPE_TEXT_SHADOW)
 private:
   nsLineBox*    mLine;
   PRUint8       mDecorationFlags;
   PRUint8       mUnderlineStyle;
   PRUint8       mOverlineStyle;
   PRUint8       mStrikeThroughStyle;
 };
 
 void
 nsDisplayTextShadow::Paint(nsDisplayListBuilder* aBuilder,
-                           nsIRenderingContext* aCtx)
+                           nsRenderingContext* aCtx)
 {
   nsCOMPtr<nsIFontMetrics> fm;
   nsLayoutUtils::GetFontMetricsForFrame(mFrame, getter_AddRefs(fm));
   nsIThebesFontMetrics* tfm = static_cast<nsIThebesFontMetrics*>(fm.get());
   gfxFontGroup* fontGroup = tfm->GetThebesFontGroup();
   gfxFont* firstFont = fontGroup->GetFontAt(0);
   if (!firstFont)
     return; // OOM
--- a/layout/generic/nsHTMLReflowMetrics.h
+++ b/layout/generic/nsHTMLReflowMetrics.h
@@ -40,17 +40,17 @@
 #ifndef nsHTMLReflowMetrics_h___
 #define nsHTMLReflowMetrics_h___
 
 #include <stdio.h>
 #include "nsISupports.h"
 #include "nsMargin.h"
 #include "nsRect.h"
 // for MOZ_MATHML
-#include "nsIRenderingContext.h" //to get struct nsBoundingMetrics
+#include "nsRenderingContext.h" //to get struct nsBoundingMetrics
 
 //----------------------------------------------------------------------
 
 // Option flags
 #ifdef MOZ_MATHML
 #define NS_REFLOW_CALC_BOUNDING_METRICS  0x0001
 #endif
 
--- a/layout/generic/nsHTMLReflowState.cpp
+++ b/layout/generic/nsHTMLReflowState.cpp
@@ -42,17 +42,17 @@
 #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 "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "nsIFontMetrics.h"
 #include "nsBlockFrame.h"
 #include "nsLineBox.h"
 #include "nsImageFrame.h"
 #include "nsTableFrame.h"
 #include "nsTableCellFrame.h"
 #include "nsIServiceManager.h"
 #include "nsIPercentHeightObserver.h"
@@ -82,17 +82,17 @@ enum eNormalLineHeightControl {
 };
 
 static eNormalLineHeightControl sNormalLineHeightControl = eUninitialized;
 
 // Initialize a <b>root</b> reflow state with a rendering context to
 // use for measuring things.
 nsHTMLReflowState::nsHTMLReflowState(nsPresContext*       aPresContext,
                                      nsIFrame*            aFrame,
-                                     nsIRenderingContext* aRenderingContext,
+                                     nsRenderingContext* aRenderingContext,
                                      const nsSize&        aAvailableSpace)
   : nsCSSOffsetState(aFrame, aRenderingContext)
   , mBlockDelta(0)
   , mReflowDepth(0)
 {
   NS_PRECONDITION(aPresContext, "no pres context");
   NS_PRECONDITION(aRenderingContext, "no rendering context");
   NS_PRECONDITION(aFrame, "no frame");
--- a/layout/generic/nsHTMLReflowState.h
+++ b/layout/generic/nsHTMLReflowState.h
@@ -40,17 +40,17 @@
 #ifndef nsHTMLReflowState_h___
 #define nsHTMLReflowState_h___
 
 #include "nsMargin.h"
 #include "nsStyleCoord.h"
 #include "nsIFrame.h"
 
 class nsPresContext;
-class nsIRenderingContext;
+class nsRenderingContext;
 class nsFloatManager;
 class nsLineLayout;
 class nsIPercentHeightObserver;
 
 struct nsStyleDisplay;
 struct nsStyleVisibility;
 struct nsStylePosition;
 struct nsStyleBorder;
@@ -142,35 +142,35 @@ typedef PRUint32  nsCSSFrameType;
 // A base class of nsHTMLReflowState that computes only the padding,
 // border, and margin, since those values are needed more often.
 struct nsCSSOffsetState {
 public:
   // the frame being reflowed
   nsIFrame*           frame;
 
   // rendering context to use for measurement
-  nsIRenderingContext* rendContext;
+  nsRenderingContext* rendContext;
 
   // Computed margin values
   nsMargin         mComputedMargin;
 
   // Cached copy of the border + padding values
   nsMargin         mComputedBorderPadding;
 
   // Computed padding values
   nsMargin         mComputedPadding;
 
   // Callers using this constructor must call InitOffsets on their own.
-  nsCSSOffsetState(nsIFrame *aFrame, nsIRenderingContext *aRenderingContext)
+  nsCSSOffsetState(nsIFrame *aFrame, nsRenderingContext *aRenderingContext)
     : frame(aFrame)
     , rendContext(aRenderingContext)
   {
   }
 
-  nsCSSOffsetState(nsIFrame *aFrame, nsIRenderingContext *aRenderingContext,
+  nsCSSOffsetState(nsIFrame *aFrame, nsRenderingContext *aRenderingContext,
                    nscoord aContainingBlockWidth)
     : frame(aFrame)
     , rendContext(aRenderingContext)
   {
     InitOffsets(aContainingBlockWidth);
   }
 
 #ifdef DEBUG
@@ -372,17 +372,17 @@ public:
   // Note: The copy constructor is written by the compiler automatically. You
   // can use that and then override specific values if you want, or you can
   // call Init as desired...
 
   // Initialize a <b>root</b> reflow state with a rendering context to
   // use for measuring things.
   nsHTMLReflowState(nsPresContext*           aPresContext,
                     nsIFrame*                aFrame,
-                    nsIRenderingContext*     aRenderingContext,
+                    nsRenderingContext*     aRenderingContext,
                     const nsSize&            aAvailableSpace);
 
   // Initialize a reflow state for a child frames reflow. Some state
   // is copied from the parent reflow state; the remaining state is
   // computed. 
   nsHTMLReflowState(nsPresContext*           aPresContext,
                     const nsHTMLReflowState& aParentReflowState,
                     nsIFrame*                aFrame,
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -80,17 +80,17 @@
  */
 
 struct nsHTMLReflowState;
 class nsHTMLReflowCommand;
 
 class nsIAtom;
 class nsPresContext;
 class nsIPresShell;
-class nsIRenderingContext;
+class nsRenderingContext;
 class nsIView;
 class nsIWidget;
 class nsIDOMRange;
 class nsISelectionController;
 class nsBoxLayoutState;
 class nsIBoxLayout;
 class nsILineIterator;
 #ifdef ACCESSIBILITY
@@ -1401,25 +1401,25 @@ public:
    * Note that many frames will cache the result of this function call
    * unless MarkIntrinsicWidthsDirty is called.
    *
    * It is not acceptable for a frame to mark itself dirty when this
    * method is called.
    *
    * This method must not return a negative value.
    */
-  virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext) = 0;
+  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext) = 0;
 
   /**
    * Get the intrinsic width of the frame.  This must be greater than or
    * equal to the intrinsic minimum width.
    *
    * Otherwise, all the comments for |GetMinWidth| above apply.
    */
-  virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext) = 0;
+  virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext) = 0;
 
   /**
    * |InlineIntrinsicWidth| represents the intrinsic width information
    * in inline layout.  Code that determines the intrinsic width of a
    * region of inline layout accumulates the result into this structure.
    * This pattern is needed because we need to maintain state
    * information about whitespace (for both collapsing and trimming).
    */
@@ -1466,36 +1466,36 @@ public:
       : trailingTextFrame(nsnull)
       , atStartOfLine(PR_TRUE)
     {}
 
     // We need to distinguish forced and optional breaks for cases where the
     // current line total is negative.  When it is, we need to ignore
     // optional breaks to prevent min-width from ending up bigger than
     // pref-width.
-    void ForceBreak(nsIRenderingContext *aRenderingContext);
+    void ForceBreak(nsRenderingContext *aRenderingContext);
 
     // If the break here is actually taken, aHyphenWidth must be added to the
     // width of the current line.
-    void OptionallyBreak(nsIRenderingContext *aRenderingContext,
+    void OptionallyBreak(nsRenderingContext *aRenderingContext,
                          nscoord aHyphenWidth = 0);
 
     // The last text frame processed so far in the current line, when
     // the last characters in that text frame are relevant for line
     // break opportunities.
     nsIFrame *trailingTextFrame;
 
     // Whether we're currently at the start of the line.  If we are, we
     // can't break (for example, between the text-indent and the first
     // word).
     PRBool atStartOfLine;
   };
 
   struct InlinePrefWidthData : public InlineIntrinsicWidthData {
-    void ForceBreak(nsIRenderingContext *aRenderingContext);
+    void ForceBreak(nsRenderingContext *aRenderingContext);
   };
 
   /**
    * Add the intrinsic minimum width of a frame in a way suitable for
    * use in inline layout to an |InlineIntrinsicWidthData| object that
    * represents the intrinsic width information of all the previous
    * frames in the inline layout region.
    *
@@ -1508,48 +1508,48 @@ public:
    * is responsible for adding padding, border, and margin and for
    * considering the effects of 'width', 'min-width', and 'max-width'.
    *
    * This may be called on any frame.  Frames that do not participate in
    * line breaking can inherit the default implementation on nsFrame,
    * which calls |GetMinWidth|.
    */
   virtual void
-  AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
+  AddInlineMinWidth(nsRenderingContext *aRenderingContext,
                     InlineMinWidthData *aData) = 0;
 
   /**
    * Add the intrinsic preferred width of a frame in a way suitable for
    * use in inline layout to an |InlineIntrinsicWidthData| object that
    * represents the intrinsic width information of all the previous
    * frames in the inline layout region.
    *
    * All the comments for |AddInlineMinWidth| and |GetPrefWidth| apply,
    * except that this fills in an |InlineIntrinsicWidthData| structure
    * based on using all *mandatory* breakpoints within the frame.
    */
   virtual void
-  AddInlinePrefWidth(nsIRenderingContext *aRenderingContext,
+  AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
                      InlinePrefWidthData *aData) = 0;
 
   /**
    * Return the horizontal components of padding, border, and margin
    * that contribute to the intrinsic width that applies to the parent.
    */
   struct IntrinsicWidthOffsetData {
     nscoord hPadding, hBorder, hMargin;
     float hPctPadding, hPctMargin;
 
     IntrinsicWidthOffsetData()
       : hPadding(0), hBorder(0), hMargin(0)
       , hPctPadding(0.0f), hPctMargin(0.0f)
     {}
   };
   virtual IntrinsicWidthOffsetData
-    IntrinsicWidthOffsets(nsIRenderingContext* aRenderingContext) = 0;
+    IntrinsicWidthOffsets(nsRenderingContext* aRenderingContext) = 0;
 
   /*
    * For replaced elements only. Gets the intrinsic dimensions of this element.
    * The dimensions may only be one of the following three types:
    *
    *   eStyleUnit_Coord   - a length in app units
    *   eStyleUnit_Percent - a percentage of the available space
    *   eStyleUnit_None    - the element has no intrinsic size in this dimension
@@ -1620,17 +1620,17 @@ public:
    * @param aPadding  The sum of the vertical / horizontal margins of
    *                  the frame, including actual values resulting from
    *                  percentages.
    * @param aShrinkWrap  Whether the frame is in a context where
    *                     non-replaced blocks should shrink-wrap (e.g.,
    *                     it's floating, absolutely positioned, or
    *                     inline-block).
    */
-  virtual nsSize ComputeSize(nsIRenderingContext *aRenderingContext,
+  virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
                              nsSize aCBSize, nscoord aAvailableWidth,
                              nsSize aMargin, nsSize aBorder, nsSize aPadding,
                              PRBool aShrinkWrap) = 0;
 
   /**
    * Compute a tight bounding rectangle for the frame. This is a rectangle
    * that encloses the pixels that are actually drawn. We're allowed to be
    * conservative and currently we don't try very hard. The rectangle is
--- a/layout/generic/nsIScrollableFrame.h
+++ b/layout/generic/nsIScrollableFrame.h
@@ -95,17 +95,17 @@ public:
    */
   virtual nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState) = 0;
   /**
    * Return the sizes of all scrollbars assuming that any scrollbars that could
    * be visible due to overflowing content, are. This can be called during reflow
    * of the scrolled contents.
    */
   virtual nsMargin GetDesiredScrollbarSizes(nsPresContext* aPresContext,
-                                            nsIRenderingContext* aRC) = 0;
+                                            nsRenderingContext* aRC) = 0;
 
   /**
    * Get the area of the scrollport relative to the origin of this frame's
    * border-box.
    * This is the area of this frame minus border and scrollbars.
    */
   virtual nsRect GetScrollPortRect() const = 0;
   /**
--- a/layout/generic/nsImageFrame.cpp
+++ b/layout/generic/nsImageFrame.cpp
@@ -40,17 +40,17 @@
 
 #include "nsHTMLParts.h"
 #include "nsCOMPtr.h"
 #include "nsImageFrame.h"
 #include "nsIImageLoadingContent.h"
 #include "nsString.h"
 #include "nsPrintfCString.h"
 #include "nsPresContext.h"
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "nsIPresShell.h"
 #include "nsGkAtoms.h"
 #include "nsIDocument.h"
 #include "nsINodeInfo.h"
 #include "nsContentUtils.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
@@ -732,17 +732,17 @@ nsImageFrame::EnsureIntrinsicSizeAndRati
         mIntrinsicSize.height.SetCoordValue(edgeLengthToUse);
         mIntrinsicRatio.SizeTo(1, 1);
       }
     }
   }
 }
 
 /* virtual */ nsSize
-nsImageFrame::ComputeSize(nsIRenderingContext *aRenderingContext,
+nsImageFrame::ComputeSize(nsRenderingContext *aRenderingContext,
                           nsSize aCBSize, nscoord aAvailableWidth,
                           nsSize aMargin, nsSize aBorder, nsSize aPadding,
                           PRBool aShrinkWrap)
 {
   nsPresContext *presContext = PresContext();
   EnsureIntrinsicSizeAndRatio(presContext);
 
   return nsLayoutUtils::ComputeSizeWithIntrinsicDimensions(
@@ -765,30 +765,30 @@ nsImageFrame::GetContinuationOffset() co
   for (nsIFrame *f = GetPrevInFlow(); f; f = f->GetPrevInFlow()) {
     offset += f->GetContentRect().height;
   }
   NS_ASSERTION(offset >= 0, "bogus GetContentRect");
   return offset;
 }
 
 /* virtual */ nscoord
-nsImageFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
+nsImageFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
 {
   // XXX The caller doesn't account for constraints of the height,
   // min-height, and max-height properties.
   nscoord result;
   DISPLAY_MIN_WIDTH(this, result);
   nsPresContext *presContext = PresContext();
   EnsureIntrinsicSizeAndRatio(presContext);
   return mIntrinsicSize.width.GetUnit() == eStyleUnit_Coord ?
     mIntrinsicSize.width.GetCoordValue() : 0;
 }
 
 /* virtual */ nscoord
-nsImageFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
+nsImageFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
 {
   // XXX The caller doesn't account for constraints of the height,
   // min-height, and max-height properties.
   nscoord result;
   DISPLAY_PREF_WIDTH(this, result);
   nsPresContext *presContext = PresContext();
   EnsureIntrinsicSizeAndRatio(presContext);
   // convert from normal twips to scaled twips (printing...)
@@ -902,17 +902,17 @@ nsImageFrame::Reflow(nsPresContext*     
 // The number of characters that fit within the maximum width are returned in
 // aMaxFit. NOTE: it is assumed that the fontmetrics have already been selected
 // into the rendering context before this is called (for performance). MMP
 nscoord
 nsImageFrame::MeasureString(const PRUnichar*     aString,
                             PRInt32              aLength,
                             nscoord              aMaxWidth,
                             PRUint32&            aMaxFit,
-                            nsIRenderingContext& aContext)
+                            nsRenderingContext& aContext)
 {
   nscoord totalWidth = 0;
   nscoord spaceWidth;
   aContext.SetTextRunRTL(PR_FALSE);
   aContext.GetWidth(' ', spaceWidth);
 
   aMaxFit = 0;
   while (aLength > 0) {
@@ -962,17 +962,17 @@ nsImageFrame::MeasureString(const PRUnic
   }
   return totalWidth;
 }
 
 // Formats the alt-text to fit within the specified rectangle. Breaks lines
 // between words if a word would extend past the edge of the rectangle
 void
 nsImageFrame::DisplayAltText(nsPresContext*      aPresContext,
-                             nsIRenderingContext& aRenderingContext,
+                             nsRenderingContext& aRenderingContext,
                              const nsString&      aAltText,
                              const nsRect&        aRect)
 {
   // Set font and color
   aRenderingContext.SetColor(GetStyleColor()->mColor);
   nsLayoutUtils::SetFontFromStyle(&aRenderingContext, mStyleContext);
 
   // Format the text to display within the formatting rect
@@ -1041,17 +1041,17 @@ struct nsRecessedBorder : public nsStyle
       // Note: use SetBorderStyle here because we want to affect
       // mComputedBorder
       SetBorderStyle(side, NS_STYLE_BORDER_STYLE_INSET);
     }
   }
 };
 
 void
-nsImageFrame::DisplayAltFeedback(nsIRenderingContext& aRenderingContext,
+nsImageFrame::DisplayAltFeedback(nsRenderingContext& aRenderingContext,
                                  const nsRect&        aDirtyRect,
                                  imgIRequest*         aRequest,
                                  nsPoint              aPt)
 {
   // We should definitely have a gIconLoad here.
   NS_ABORT_IF_FALSE(gIconLoad, "How did we succeed in Init then?");
 
   // Calculate the inner area
@@ -1155,46 +1155,46 @@ nsImageFrame::DisplayAltFeedback(nsIRend
                                                  altText);
       DisplayAltText(PresContext(), aRenderingContext, altText, inner);
     }
   }
 
   aRenderingContext.PopState();
 }
 
-static void PaintAltFeedback(nsIFrame* aFrame, nsIRenderingContext* aCtx,
+static void PaintAltFeedback(nsIFrame* aFrame, nsRenderingContext* aCtx,
      const nsRect& aDirtyRect, nsPoint aPt)
 {
   nsImageFrame* f = static_cast<nsImageFrame*>(aFrame);
   f->DisplayAltFeedback(*aCtx,
                         aDirtyRect,
                         IMAGE_OK(f->GetContent()->IntrinsicState(), PR_TRUE)
                            ? nsImageFrame::gIconLoad->mLoadingImage
                            : nsImageFrame::gIconLoad->mBrokenImage,
                         aPt);
 }
 
 #ifdef NS_DEBUG
-static void PaintDebugImageMap(nsIFrame* aFrame, nsIRenderingContext* aCtx,
+static void PaintDebugImageMap(nsIFrame* aFrame, nsRenderingContext* aCtx,
      const nsRect& aDirtyRect, nsPoint aPt) {
   nsImageFrame* f = static_cast<nsImageFrame*>(aFrame);
   nsRect inner = f->GetInnerArea() + aPt;
   nsPresContext* pc = f->PresContext();
 
   aCtx->SetColor(NS_RGB(0, 0, 0));
   aCtx->PushState();
   aCtx->Translate(inner.TopLeft());
   f->GetImageMap(pc)->Draw(aFrame, *aCtx);
   aCtx->PopState();
 }
 #endif
 
 void
 nsDisplayImage::Paint(nsDisplayListBuilder* aBuilder,
-                      nsIRenderingContext* aCtx) {
+                      nsRenderingContext* aCtx) {
   static_cast<nsImageFrame*>(mFrame)->
     PaintImage(*aCtx, ToReferenceFrame(), mVisibleRect, mImage,
                aBuilder->ShouldSyncDecodeImages()
                  ? (PRUint32) imgIContainer::FLAG_SYNC_DECODE
                  : (PRUint32) imgIContainer::FLAG_NONE);
 }
 
 nsCOMPtr<imgIContainer>
@@ -1266,17 +1266,17 @@ nsImageFrame::GetContainer(LayerManager*
   NS_ASSERTION(image->GetFormat() == cairoFormat, "Wrong format");
   static_cast<CairoImage*>(image.get())->SetData(cairoData);
   mImageContainer->SetCurrentImage(image);
 
   return mImageContainer;
 }
 
 void
-nsImageFrame::PaintImage(nsIRenderingContext& aRenderingContext, nsPoint aPt,
+nsImageFrame::PaintImage(nsRenderingContext& aRenderingContext, nsPoint aPt,
                          const nsRect& aDirtyRect, imgIContainer* aImage,
                          PRUint32 aFlags)
 {
   // Render the image into our content area (the area inside
   // the borders and padding)
   NS_ASSERTION(GetInnerArea().width == mComputedSize.width, "bad width");
   nsRect inner = GetInnerArea() + aPt;
   nsRect dest(inner.TopLeft(), mComputedSize);
@@ -2087,17 +2087,17 @@ IsInAutoWidthTableCellForQuirk(nsIFrame 
     nsFrame *grandAncestor = static_cast<nsFrame*>(ancestor->GetParent());
     return grandAncestor &&
       grandAncestor->GetStylePosition()->mWidth.GetUnit() == eStyleUnit_Auto;
   }
   return PR_FALSE;
 }
 
 /* virtual */ void
-nsImageFrame::AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
+nsImageFrame::AddInlineMinWidth(nsRenderingContext *aRenderingContext,
                                 nsIFrame::InlineMinWidthData *aData)
 {
 
   NS_ASSERTION(GetParent(), "Must have a parent if we get here!");
   
   PRBool canBreak =
     !CanContinueTextRun() &&
     GetParent()->GetStyleText()->WhiteSpaceCanWrap() &&
--- a/layout/generic/nsImageFrame.h
+++ b/layout/generic/nsImageFrame.h
@@ -110,18 +110,18 @@ public:
 
   virtual void DestroyFrom(nsIFrame* aDestructRoot);
   NS_IMETHOD Init(nsIContent*      aContent,
                   nsIFrame*        aParent,
                   nsIFrame*        aPrevInFlow);
   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                               const nsRect&           aDirtyRect,
                               const nsDisplayListSet& aLists);
-  virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
-  virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
+  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
+  virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
   virtual IntrinsicSize GetIntrinsicSize();
   virtual nsSize GetIntrinsicRatio();
   NS_IMETHOD Reflow(nsPresContext*          aPresContext,
                     nsHTMLReflowMetrics&     aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus&          aStatus);
   
   NS_IMETHOD  GetContentForEvent(nsPresContext* aPresContext,
@@ -169,37 +169,37 @@ public:
   /**
    * Function to test whether aContent, which has aStyleContext as its style,
    * should get an image frame.  Note that this method is only used by the
    * frame constructor; it's only here because it uses gIconLoad for now.
    */
   static PRBool ShouldCreateImageFrameFor(nsIContent* aContent,
                                           nsStyleContext* aStyleContext);
   
-  void DisplayAltFeedback(nsIRenderingContext& aRenderingContext,
+  void DisplayAltFeedback(nsRenderingContext& aRenderingContext,
                           const nsRect&        aDirtyRect,
                           imgIRequest*         aRequest,
                           nsPoint              aPt);
 
   nsRect GetInnerArea() const;
 
   nsImageMap* GetImageMap(nsPresContext* aPresContext);
 
-  virtual void AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
+  virtual void AddInlineMinWidth(nsRenderingContext *aRenderingContext,
                                  InlineMinWidthData *aData);
 
   nsRefPtr<ImageContainer> GetContainer(LayerManager* aManager,
                                         imgIContainer* aImage);
 
 protected:
   virtual ~nsImageFrame();
 
   void EnsureIntrinsicSizeAndRatio(nsPresContext* aPresContext);
 
-  virtual nsSize ComputeSize(nsIRenderingContext *aRenderingContext,
+  virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
                              nsSize aCBSize, nscoord aAvailableWidth,
                              nsSize aMargin, nsSize aBorder, nsSize aPadding,
                              PRBool aShrinkWrap);
 
   PRBool IsServerImageMap();
 
   void TranslateEventCoords(const nsPoint& aPoint,
                             nsIntPoint& aResult);
@@ -214,24 +214,24 @@ protected:
    * @param out aMaxFit length of the string that fits within aMaxWidth
    *            in PRUnichars
    * @return width of the string that fits within aMaxWidth
    */
   nscoord MeasureString(const PRUnichar*     aString,
                         PRInt32              aLength,
                         nscoord              aMaxWidth,
                         PRUint32&            aMaxFit,
-                        nsIRenderingContext& aContext);
+                        nsRenderingContext& aContext);
 
   void DisplayAltText(nsPresContext*      aPresContext,
-                      nsIRenderingContext& aRenderingContext,
+                      nsRenderingContext& aRenderingContext,
                       const nsString&      aAltText,
                       const nsRect&        aRect);
 
-  void PaintImage(nsIRenderingContext& aRenderingContext, nsPoint aPt,
+  void PaintImage(nsRenderingContext& aRenderingContext, nsPoint aPt,
                   const nsRect& aDirtyRect, imgIContainer* aImage,
                   PRUint32 aFlags);
 
 protected:
   friend class nsImageListener;
   nsresult OnStartContainer(imgIRequest *aRequest, imgIContainer *aImage);
   nsresult OnDataAvailable(imgIRequest *aRequest, PRBool aCurrentFrame,
                            const nsIntRect *rect);
@@ -388,17 +388,17 @@ public:
                  imgIContainer* aImage)
     : nsDisplayItem(aBuilder, aFrame), mImage(aImage) {
     MOZ_COUNT_CTOR(nsDisplayImage);
   }
   virtual ~nsDisplayImage() {
     MOZ_COUNT_DTOR(nsDisplayImage);
   }
   virtual void Paint(nsDisplayListBuilder* aBuilder,
-                     nsIRenderingContext* aCtx);
+                     nsRenderingContext* aCtx);
   nsCOMPtr<imgIContainer> GetImage();
  
   /**
    * Returns an ImageContainer for this image if the image type
    * supports it (TYPE_RASTER only).
    */
   nsRefPtr<ImageContainer> GetContainer(LayerManager* aManager);
   
--- a/layout/generic/nsImageMap.cpp
+++ b/layout/generic/nsImageMap.cpp
@@ -36,17 +36,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 /* code for HTML client-side image maps */
 
 #include "nsImageMap.h"
 #include "nsString.h"
 #include "nsReadableUtils.h"
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "nsPresContext.h"
 #include "nsIURL.h"
 #include "nsIURL.h"
 #include "nsIServiceManager.h"
 #include "nsNetUtil.h"
 #include "nsTextFragment.h"
 #include "mozilla/dom/Element.h"
 #include "nsIDOMHTMLElement.h"
@@ -75,17 +75,17 @@ static NS_DEFINE_CID(kCStringBundleServi
 class Area {
 public:
   Area(nsIContent* aArea);
   virtual ~Area();
 
   virtual void ParseCoords(const nsAString& aSpec);
 
   virtual PRBool IsInside(nscoord x, nscoord y) const = 0;
-  virtual void Draw(nsIFrame* aFrame, nsIRenderingContext& aRC) = 0;
+  virtual void Draw(nsIFrame* aFrame, nsRenderingContext& aRC) = 0;
   virtual void GetRect(nsIFrame* aFrame, nsRect& aRect) = 0;
 
   void HasFocus(PRBool aHasFocus);
 
   nsCOMPtr<nsIContent> mArea;
   nscoord* mCoords;
   PRInt32 mNumCoords;
   PRPackedBool mHasFocus;
@@ -307,31 +307,31 @@ void Area::HasFocus(PRBool aHasFocus)
 
 //----------------------------------------------------------------------
 
 class DefaultArea : public Area {
 public:
   DefaultArea(nsIContent* aArea);
 
   virtual PRBool IsInside(nscoord x, nscoord y) const;
-  virtual void Draw(nsIFrame* aFrame, nsIRenderingContext& aRC);
+  virtual void Draw(nsIFrame* aFrame, nsRenderingContext& aRC);
   virtual void GetRect(nsIFrame* aFrame, nsRect& aRect);
 };
 
 DefaultArea::DefaultArea(nsIContent* aArea)
   : Area(aArea)
 {
 }
 
 PRBool DefaultArea::IsInside(nscoord x, nscoord y) const
 {
   return PR_TRUE;
 }
 
-void DefaultArea::Draw(nsIFrame* aFrame, nsIRenderingContext& aRC)
+void DefaultArea::Draw(nsIFrame* aFrame, nsRenderingContext& aRC)
 {
   if (mHasFocus) {
     nsRect r = aFrame->GetRect();
     r.MoveTo(0, 0);
     nscoord x1 = r.x;
     nscoord y1 = r.y;
     const nscoord kOnePixel = nsPresContext::CSSPixelsToAppUnits(1);
     nscoord x2 = r.XMost() - kOnePixel;
@@ -353,17 +353,17 @@ void DefaultArea::GetRect(nsIFrame* aFra
 //----------------------------------------------------------------------
 
 class RectArea : public Area {
 public:
   RectArea(nsIContent* aArea);
 
   virtual void ParseCoords(const nsAString& aSpec);
   virtual PRBool IsInside(nscoord x, nscoord y) const;
-  virtual void Draw(nsIFrame* aFrame, nsIRenderingContext& aRC);
+  virtual void Draw(nsIFrame* aFrame, nsRenderingContext& aRC);
   virtual void GetRect(nsIFrame* aFrame, nsRect& aRect);
 };
 
 RectArea::RectArea(nsIContent* aArea)
   : Area(aArea)
 {
 }
 
@@ -415,17 +415,17 @@ PRBool RectArea::IsInside(nscoord x, nsc
                  "Someone screwed up RectArea::ParseCoords");
     if ((x >= x1) && (x <= x2) && (y >= y1) && (y <= y2)) {
       return PR_TRUE;
     }
   }
   return PR_FALSE;
 }
 
-void RectArea::Draw(nsIFrame* aFrame, nsIRenderingContext& aRC)
+void RectArea::Draw(nsIFrame* aFrame, nsRenderingContext& aRC)
 {
   if (mHasFocus) {
     if (mNumCoords >= 4) {
       nscoord x1 = nsPresContext::CSSPixelsToAppUnits(mCoords[0]);
       nscoord y1 = nsPresContext::CSSPixelsToAppUnits(mCoords[1]);
       nscoord x2 = nsPresContext::CSSPixelsToAppUnits(mCoords[2]);
       nscoord y2 = nsPresContext::CSSPixelsToAppUnits(mCoords[3]);
       NS_ASSERTION(x1 <= x2 && y1 <= y2,
@@ -455,17 +455,17 @@ void RectArea::GetRect(nsIFrame* aFrame,
 //----------------------------------------------------------------------
 
 class PolyArea : public Area {
 public:
   PolyArea(nsIContent* aArea);
 
   virtual void ParseCoords(const nsAString& aSpec);
   virtual PRBool IsInside(nscoord x, nscoord y) const;
-  virtual void Draw(nsIFrame* aFrame, nsIRenderingContext& aRC);
+  virtual void Draw(nsIFrame* aFrame, nsRenderingContext& aRC);
   virtual void GetRect(nsIFrame* aFrame, nsRect& aRect);
 };
 
 PolyArea::PolyArea(nsIContent* aArea)
   : Area(aArea)
 {
 }
 
@@ -547,17 +547,17 @@ PRBool PolyArea::IsInside(nscoord x, nsc
     }
     if ((intersects & 1) != 0) {
       return PR_TRUE;
     }
   }
   return PR_FALSE;
 }
 
-void PolyArea::Draw(nsIFrame* aFrame, nsIRenderingContext& aRC)
+void PolyArea::Draw(nsIFrame* aFrame, nsRenderingContext& aRC)
 {
   if (mHasFocus) {
     if (mNumCoords >= 6) {
       nscoord x0 = nsPresContext::CSSPixelsToAppUnits(mCoords[0]);
       nscoord y0 = nsPresContext::CSSPixelsToAppUnits(mCoords[1]);
       nscoord x1, y1;
       for (PRInt32 i = 2; i < mNumCoords; i += 2) {
         x1 = nsPresContext::CSSPixelsToAppUnits(mCoords[i]);
@@ -595,17 +595,17 @@ void PolyArea::GetRect(nsIFrame* aFrame,
 //----------------------------------------------------------------------
 
 class CircleArea : public Area {
 public:
   CircleArea(nsIContent* aArea);
 
   virtual void ParseCoords(const nsAString& aSpec);
   virtual PRBool IsInside(nscoord x, nscoord y) const;
-  virtual void Draw(nsIFrame* aFrame, nsIRenderingContext& aRC);
+  virtual void Draw(nsIFrame* aFrame, nsRenderingContext& aRC);
   virtual void GetRect(nsIFrame* aFrame, nsRect& aRect);
 };
 
 CircleArea::CircleArea(nsIContent* aArea)
   : Area(aArea)
 {
 }
 
@@ -654,17 +654,17 @@ PRBool CircleArea::IsInside(nscoord x, n
     nscoord dist = (dx * dx) + (dy * dy);
     if (dist <= (radius * radius)) {
       return PR_TRUE;
     }
   }
   return PR_FALSE;
 }
 
-void CircleArea::Draw(nsIFrame* aFrame, nsIRenderingContext& aRC)
+void CircleArea::Draw(nsIFrame* aFrame, nsRenderingContext& aRC)
 {
   if (mHasFocus) {
     if (mNumCoords >= 3) {
       nscoord x1 = nsPresContext::CSSPixelsToAppUnits(mCoords[0]);
       nscoord y1 = nsPresContext::CSSPixelsToAppUnits(mCoords[1]);
       nscoord radius = nsPresContext::CSSPixelsToAppUnits(mCoords[2]);
       if (radius < 0) {
         return;
@@ -894,17 +894,17 @@ nsImageMap::IsInside(nscoord aX, nscoord
       return PR_TRUE;
     }
   }
 
   return PR_FALSE;
 }
 
 void
-nsImageMap::Draw(nsIFrame* aFrame, nsIRenderingContext& aRC)
+nsImageMap::Draw(nsIFrame* aFrame, nsRenderingContext& aRC)
 {
   PRUint32 i, n = mAreas.Length();
   for (i = 0; i < n; i++) {
     Area* area = mAreas.ElementAt(i);
     area->Draw(aFrame, aRC);
   }
 }
 
--- a/layout/generic/nsImageMap.h
+++ b/layout/generic/nsImageMap.h
@@ -45,17 +45,17 @@
 #include "nsTArray.h"
 #include "nsStubMutationObserver.h"
 #include "nsIDOMFocusListener.h"
 #include "nsIFrame.h"
 #include "nsIImageMap.h"
 
 class nsIDOMHTMLAreaElement;
 class nsIDOMHTMLMapElement;
-class nsIRenderingContext;
+class nsRenderingContext;
 class nsIURI;
 class nsString;
 class nsIDOMEvent;
 class Area;
 
 class nsImageMap : public nsStubMutationObserver, public nsIDOMFocusListener,
                    public nsIImageMap
 {
@@ -68,17 +68,17 @@ public:
    * See if the given aX,aY <b>pixel</b> coordinates are in the image
    * map. If they are then PR_TRUE is returned and aContent points to the
    * found area. If the coordinates are not in the map then PR_FALSE
    * is returned.
    */
   PRBool IsInside(nscoord aX, nscoord aY,
                   nsIContent** aContent) const;
 
-  void Draw(nsIFrame* aFrame, nsIRenderingContext& aRC);
+  void Draw(nsIFrame* aFrame, nsRenderingContext& aRC);
   
   /** 
    * Called just before the nsImageFrame releases us. 
    * Used to break the cycle caused by the DOM listener.
    */
   void Destroy(void);
   
   // nsISupports
--- a/layout/generic/nsInlineFrame.cpp
+++ b/layout/generic/nsInlineFrame.cpp
@@ -41,17 +41,17 @@
 #include "nsInlineFrame.h"
 #include "nsBlockFrame.h"
 #include "nsPlaceholderFrame.h"
 #include "nsGkAtoms.h"
 #include "nsHTMLParts.h"
 #include "nsStyleContext.h"
 #include "nsIPresShell.h"
 #include "nsPresContext.h"
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "nsIFontMetrics.h"
 #include "nsAbsoluteContainingBlock.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsAutoPtr.h"
 #include "nsFrameManager.h"
 #ifdef ACCESSIBILITY
 #include "nsIServiceManager.h"
 #include "nsAccessibilityService.h"
@@ -199,31 +199,31 @@ nsInlineFrame::BuildDisplayList(nsDispla
   }
   return rv;
 }
 
 //////////////////////////////////////////////////////////////////////
 // Reflow methods
 
 /* virtual */ void
-nsInlineFrame::AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
+nsInlineFrame::AddInlineMinWidth(nsRenderingContext *aRenderingContext,
                                  nsIFrame::InlineMinWidthData *aData)
 {
   DoInlineIntrinsicWidth(aRenderingContext, aData, nsLayoutUtils::MIN_WIDTH);
 }
 
 /* virtual */ void
-nsInlineFrame::AddInlinePrefWidth(nsIRenderingContext *aRenderingContext,
+nsInlineFrame::AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
                                   nsIFrame::InlinePrefWidthData *aData)
 {
   DoInlineIntrinsicWidth(aRenderingContext, aData, nsLayoutUtils::PREF_WIDTH);
 }
 
 /* virtual */ nsSize
-nsInlineFrame::ComputeSize(nsIRenderingContext *aRenderingContext,
+nsInlineFrame::ComputeSize(nsRenderingContext *aRenderingContext,
                            nsSize aCBSize, nscoord aAvailableWidth,
                            nsSize aMargin, nsSize aBorder, nsSize aPadding,
                            PRBool aShrinkWrap)
 {
   // Inlines and text don't compute size before reflow.
   return nsSize(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
 }
 
--- a/layout/generic/nsInlineFrame.h
+++ b/layout/generic/nsInlineFrame.h
@@ -96,21 +96,21 @@ public:
 
   virtual PRBool IsEmpty();
   virtual PRBool IsSelfEmpty();
 
   virtual PRBool PeekOffsetCharacter(PRBool aForward, PRInt32* aOffset,
                                      PRBool aRespectClusters = PR_TRUE);
   
   // nsIHTMLReflow overrides
-  virtual void AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
+  virtual void AddInlineMinWidth(nsRenderingContext *aRenderingContext,
                                  InlineMinWidthData *aData);
-  virtual void AddInlinePrefWidth(nsIRenderingContext *aRenderingContext,
+  virtual void AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
                                   InlinePrefWidthData *aData);
-  virtual nsSize ComputeSize(nsIRenderingContext *aRenderingContext,
+  virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
                              nsSize aCBSize, nscoord aAvailableWidth,
                              nsSize aMargin, nsSize aBorder, nsSize aPadding,
                              PRBool aShrinkWrap);
   virtual nsRect ComputeTightBounds(gfxContext* aContext) const;
   NS_IMETHOD Reflow(nsPresContext* aPresContext,
                     nsHTMLReflowMetrics& aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus& aStatus);
--- a/layout/generic/nsLeafFrame.cpp
+++ b/layout/generic/nsLeafFrame.cpp
@@ -45,36 +45,36 @@
 
 nsLeafFrame::~nsLeafFrame()
 {
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsLeafFrame)
 
 /* virtual */ nscoord
-nsLeafFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
+nsLeafFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord result;
   DISPLAY_MIN_WIDTH(this, result);
 
   result = GetIntrinsicWidth();
   return result;
 }
 
 /* virtual */ nscoord
-nsLeafFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
+nsLeafFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord result;
   DISPLAY_PREF_WIDTH(this, result);
   result = GetIntrinsicWidth();
   return result;
 }
 
 /* virtual */ nsSize
-nsLeafFrame::ComputeAutoSize(nsIRenderingContext *aRenderingContext,
+nsLeafFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
                              nsSize aCBSize, nscoord aAvailableWidth,
                              nsSize aMargin, nsSize aBorder,
                              nsSize aPadding, PRBool aShrinkWrap)
 {
   return nsSize(GetIntrinsicWidth(), GetIntrinsicHeight());
 }
 
 NS_IMETHODIMP
--- a/layout/generic/nsLeafFrame.h
+++ b/layout/generic/nsLeafFrame.h
@@ -60,23 +60,23 @@ public:
     DO_GLOBAL_REFLOW_COUNT_DSP("nsLeafFrame");
     return DisplayBorderBackgroundOutline(aBuilder, aLists);
   }
 
   /**
    * Both GetMinWidth and GetPrefWidth will return whatever GetIntrinsicWidth
    * returns.
    */
-  virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
-  virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
+  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
+  virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
 
   /**
    * Our auto size is just intrinsic width and intrinsic height.
    */
-  virtual nsSize ComputeAutoSize(nsIRenderingContext *aRenderingContext,
+  virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext,
                                  nsSize aCBSize, nscoord aAvailableWidth,
                                  nsSize aMargin, nsSize aBorder,
                                  nsSize aPadding, PRBool aShrinkWrap);
 
   /**
    * Reflow our frame.  This will use the computed width plus borderpadding for
    * the desired width, and use the return value of GetIntrinsicHeight plus
    * borderpadding for the desired height.  Ascent will be set to the height,
--- a/layout/generic/nsLineLayout.cpp
+++ b/layout/generic/nsLineLayout.cpp
@@ -52,17 +52,17 @@
 #include "nsInlineFrame.h"
 #include "nsStyleConsts.h"
 #include "nsHTMLContainerFrame.h"
 #include "nsFloatManager.h"
 #include "nsStyleContext.h"
 #include "nsPresContext.h"
 #include "nsIFontMetrics.h"
 #include "nsIThebesFontMetrics.h"
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "nsGkAtoms.h"
 #include "nsPlaceholderFrame.h"
 #include "nsIDocument.h"
 #include "nsIHTMLDocument.h"
 #include "nsIContent.h"
 #include "nsTextFragment.h"
 #include "nsBidiUtils.h"
 #include "nsLayoutUtils.h"
@@ -1556,17 +1556,17 @@ void
 nsLineLayout::VerticalAlignFrames(PerSpanData* psd)
 {
   // Get parent frame info
   PerFrameData* spanFramePFD = psd->mFrame;
   nsIFrame* spanFrame = spanFramePFD->mFrame;
 
   // Get the parent frame's font for all of the frames in this span
   nsStyleContext* styleContext = spanFrame->GetStyleContext();
-  nsIRenderingContext* rc = mBlockReflowState->rendContext;
+  nsRenderingContext* rc = mBlockReflowState->rendContext;
   nsLayoutUtils::SetFontFromStyle(mBlockReflowState->rendContext, styleContext);
   nsCOMPtr<nsIFontMetrics> fm = rc->GetFontMetrics();
 
   PRBool preMode = mStyleText->WhiteSpaceIsSignificant();
 
   // See if the span is an empty continuation. It's an empty continuation iff:
   // - it has a prev-in-flow
   // - it has no next in flow
--- a/layout/generic/nsObjectFrame.cpp
+++ b/layout/generic/nsObjectFrame.cpp
@@ -112,17 +112,17 @@ enum { XKeyPress = KeyPress };
 #include "nsIDOMEventTarget.h"
 #include "nsIDOMNSEvent.h"
 #include "nsIPrivateDOMEvent.h"
 #include "nsIDocumentEncoder.h"
 #include "nsXPIDLString.h"
 #include "nsIDOMRange.h"
 #include "nsIPluginWidget.h"
 #include "nsGUIEvent.h"
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "npapi.h"
 #include "nsTransform2D.h"
 #include "nsIImageLoadingContent.h"
 #include "nsIObjectLoadingContent.h"
 #include "nsPIDOMWindow.h"
 #include "nsIDOMElement.h"
 #include "nsContentUtils.h"
 #include "nsDisplayList.h"
@@ -930,33 +930,33 @@ nsObjectFrame::CreateWidget(nscoord aWid
 
   return (needsWidget && !canCreateWidget) ? NS_ERROR_NOT_AVAILABLE : NS_OK;
 }
 
 #define EMBED_DEF_WIDTH 240
 #define EMBED_DEF_HEIGHT 200
 
 /* virtual */ nscoord
-nsObjectFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
+nsObjectFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord result = 0;
 
   if (!IsHidden(PR_FALSE)) {
     nsIAtom *atom = mContent->Tag();
     if (atom == nsGkAtoms::applet || atom == nsGkAtoms::embed) {
       result = nsPresContext::CSSPixelsToAppUnits(EMBED_DEF_WIDTH);
     }
   }
 
   DISPLAY_MIN_WIDTH(this, result);
   return result;
 }
 
 /* virtual */ nscoord
-nsObjectFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
+nsObjectFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
 {
   return nsObjectFrame::GetMinWidth(aRenderingContext);
 }
 
 void
 nsObjectFrame::GetDesiredSize(nsPresContext* aPresContext,
                               const nsHTMLReflowState& aReflowState,
                               nsHTMLReflowMetrics& aMetrics)
@@ -1314,21 +1314,21 @@ nsObjectFrame::DidReflow(nsPresContext* 
     if (vm)
       vm->SetViewVisibility(view, IsHidden() ? nsViewVisibility_kHide : nsViewVisibility_kShow);
   }
 
   return rv;
 }
 
 /* static */ void
-nsObjectFrame::PaintPrintPlugin(nsIFrame* aFrame, nsIRenderingContext* aCtx,
+nsObjectFrame::PaintPrintPlugin(nsIFrame* aFrame, nsRenderingContext* aCtx,
                                 const nsRect& aDirtyRect, nsPoint aPt)
 {
   nsPoint pt = aPt + aFrame->GetUsedBorderAndPadding().TopLeft();
-  nsIRenderingContext::AutoPushTranslation translate(aCtx, pt);
+  nsRenderingContext::AutoPushTranslation translate(aCtx, pt);
   // FIXME - Bug 385435: Doesn't aDirtyRect need translating too?
   static_cast<nsObjectFrame*>(aFrame)->PrintPlugin(*aCtx, aDirtyRect);
 }
 
 class nsDisplayPluginReadback : public nsDisplayItem {
 public:
   nsDisplayPluginReadback(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
     : nsDisplayItem(aBuilder, aFrame)
@@ -1399,17 +1399,17 @@ nsDisplayPluginReadback::ComputeVisibili
 nsRect
 nsDisplayPlugin::GetBounds(nsDisplayListBuilder* aBuilder)
 {
   return GetDisplayItemBounds(aBuilder, this, mFrame);
 }
 
 void
 nsDisplayPlugin::Paint(nsDisplayListBuilder* aBuilder,
-                       nsIRenderingContext* aCtx)
+                       nsRenderingContext* aCtx)
 {
   nsObjectFrame* f = static_cast<nsObjectFrame*>(mFrame);
   f->PaintPlugin(aBuilder, *aCtx, mVisibleRect, GetBounds(aBuilder));
 }
 
 PRBool
 nsDisplayPlugin::ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                    nsRegion* aVisibleRegion,
@@ -1658,17 +1658,17 @@ nsObjectFrame::BuildDisplayList(nsDispla
   NS_ENSURE_SUCCESS(rv, rv);
 
   WrapReplacedContentForBorderRadius(aBuilder, &replacedContent, aLists);
 
   return NS_OK;
 }
 
 void
-nsObjectFrame::PrintPlugin(nsIRenderingContext& aRenderingContext,
+nsObjectFrame::PrintPlugin(nsRenderingContext& aRenderingContext,
                            const nsRect& aDirtyRect)
 {
   nsCOMPtr<nsIObjectLoadingContent> obj(do_QueryInterface(mContent));
   if (!obj)
     return;
 
   nsIFrame* frame = nsnull;
   obj->GetPrintFrame(&frame);
@@ -1799,17 +1799,17 @@ nsObjectFrame::PrintPlugin(nsIRenderingC
   nativeDraw.EndNativeDrawing();
 #elif defined(XP_UNIX)
 
   /* XXX this just flat-out doesn't work in a thebes world --
    * RenderEPS is a no-op.  So don't bother to do any work here.
    */
 
 #elif defined(XP_OS2)
-  void *hps = aRenderingContext.GetNativeGraphicData(nsIRenderingContext::NATIVE_OS2_PS);
+  void *hps = aRenderingContext.GetNativeGraphicData(nsRenderingContext::NATIVE_OS2_PS);
   if (!hps)
     return;
 
   npprint.print.embedPrint.platformPrint = hps;
   npprint.print.embedPrint.window = window;
   // send off print info to plugin
   pi->Print(&npprint);
 #elif defined(XP_WIN)
@@ -2176,17 +2176,17 @@ nsObjectFrame::BuildLayer(nsDisplayListB
 
   layer->SetTransform(gfx3DMatrix::From2D(transform));
   layer->SetVisibleRegion(nsIntRect(0, 0, size.width, size.height));
   return layer.forget();
 }
 
 void
 nsObjectFrame::PaintPlugin(nsDisplayListBuilder* aBuilder,
-                           nsIRenderingContext& aRenderingContext,
+                           nsRenderingContext& aRenderingContext,
                            const nsRect& aDirtyRect, const nsRect& aPluginRect)
 {
   // Screen painting code
 #if defined(XP_MACOSX)
   // delegate all painting to the plugin instance.
   if (mInstanceOwner) {
     if (mInstanceOwner->GetDrawingModel() == NPDrawingModelCoreGraphics ||
         mInstanceOwner->GetDrawingModel() == NPDrawingModelCoreAnimation ||
@@ -2278,17 +2278,17 @@ nsObjectFrame::PaintPlugin(nsDisplayList
       } else {
         mInstanceOwner->Paint(nativeClipRect - offset, cgContext);
       }
       mInstanceOwner->EndCGPaint();
 
       nativeDrawing.EndNativeDrawing();
     } else {
       // FIXME - Bug 385435: Doesn't aDirtyRect need translating too?
-      nsIRenderingContext::AutoPushTranslation
+      nsRenderingContext::AutoPushTranslation
         translate(&aRenderingContext, aPluginRect.TopLeft());
 
       // this rect is used only in the CoreGraphics drawing model
       gfxRect tmpRect(0, 0, 0, 0);
       mInstanceOwner->Paint(tmpRect, NULL);
     }
   }
 #elif defined(MOZ_X11)
@@ -2418,17 +2418,17 @@ nsObjectFrame::PaintPlugin(nsDisplayList
   GetPluginInstance(*getter_AddRefs(inst));
   if (inst) {
     // Look if it's windowless
     NPWindow *window;
     mInstanceOwner->GetWindow(window);
 
     if (window->type == NPWindowTypeDrawable) {
       // FIXME - Bug 385435: Doesn't aDirtyRect need translating too?
-      nsIRenderingContext::AutoPushTranslation
+      nsRenderingContext::AutoPushTranslation
         translate(&aRenderingContext, aPluginRect.TopLeft());
 
       // check if we need to call SetWindow with updated parameters
       PRBool doupdatewindow = PR_FALSE;
       // the offset of the DC
       nsIntPoint origin;
 
       /*
@@ -2465,17 +2465,17 @@ nsObjectFrame::PaintPlugin(nsDisplayList
       nsRefPtr<gfxASurface> surf = ctx->CurrentSurface(&xoff, &yoff);
 
       if (surf->CairoStatus() != 0) {
         NS_WARNING("Plugin is being asked to render to a surface that's in error!");
         return;
       }
 
       // check if we need to update the PS
-      HPS hps = (HPS)aRenderingContext.GetNativeGraphicData(nsIRenderingContext::NATIVE_OS2_PS);
+      HPS hps = (HPS)aRenderingContext.GetNativeGraphicData(nsRenderingContext::NATIVE_OS2_PS);
       if (reinterpret_cast<HPS>(window->window) != hps) {
         window->window = reinterpret_cast<void*>(hps);
         doupdatewindow = PR_TRUE;
       }
       LONG lPSid = GpiSavePS(hps);
       RECTL rclViewport;
       if (GpiQueryDevice(hps) != NULLHANDLE) { // ensure that we have an associated HDC
         if (GpiQueryPageViewport(hps, &rclViewport)) {
--- a/layout/generic/nsObjectFrame.h
+++ b/layout/generic/nsObjectFrame.h
@@ -80,18 +80,18 @@ public:
 
   friend nsIFrame* NS_NewObjectFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
 
   NS_DECL_QUERYFRAME
 
   NS_IMETHOD Init(nsIContent* aContent,
                   nsIFrame* aParent,
                   nsIFrame* aPrevInFlow);
-  virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
-  virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
+  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
+  virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
   NS_IMETHOD Reflow(nsPresContext* aPresContext,
                     nsHTMLReflowMetrics& aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus& aStatus);
   NS_IMETHOD DidReflow(nsPresContext* aPresContext,
                        const nsHTMLReflowState* aReflowState,
                        nsDidReflowStatus aStatus);
   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
@@ -243,22 +243,22 @@ protected:
   PRBool IsOpaque() const;
   PRBool IsTransparentMode() const;
 
   void NotifyContentObjectWrapper();
 
   nsIntPoint GetWindowOriginInPixels(PRBool aWindowless);
 
   static void PaintPrintPlugin(nsIFrame* aFrame,
-                               nsIRenderingContext* aRenderingContext,
+                               nsRenderingContext* aRenderingContext,
                                const nsRect& aDirtyRect, nsPoint aPt);
-  void PrintPlugin(nsIRenderingContext& aRenderingContext,
+  void PrintPlugin(nsRenderingContext& aRenderingContext,
                    const nsRect& aDirtyRect);
   void PaintPlugin(nsDisplayListBuilder* aBuilder,
-                   nsIRenderingContext& aRenderingContext,
+                   nsRenderingContext& aRenderingContext,
                    const nsRect& aDirtyRect, const nsRect& aPluginRect);
 
   /**
    * Makes sure that mInstanceOwner is valid and without a current plugin
    * instance. Essentially, this prepares the frame to receive a new plugin.
    */
   NS_HIDDEN_(nsresult) PrepareInstanceOwner();
 
@@ -331,17 +331,17 @@ public:
     MOZ_COUNT_DTOR(nsDisplayPlugin);
   }
 #endif
 
   virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
   virtual nsRegion GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
                                    PRBool* aForceTransparentSurface = nsnull);
   virtual void Paint(nsDisplayListBuilder* aBuilder,
-                     nsIRenderingContext* aCtx);
+                     nsRenderingContext* aCtx);
   virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                    nsRegion* aVisibleRegion,
                                    const nsRect& aAllowVisibleRegionExpansion,
                                    PRBool& aContainsRootContentDocBG);
 
   NS_DISPLAY_DECL_NAME("Plugin", TYPE_PLUGIN)
 
   // Compute the desired position and clip region of the plugin's widget.
--- a/layout/generic/nsPageContentFrame.cpp
+++ b/layout/generic/nsPageContentFrame.cpp
@@ -37,34 +37,34 @@
 #include "nsPageContentFrame.h"
 #include "nsPageFrame.h"
 #include "nsPlaceholderFrame.h"
 #include "nsCSSFrameConstructor.h"
 #include "nsHTMLContainerFrame.h"
 #include "nsHTMLParts.h"
 #include "nsIContent.h"
 #include "nsPresContext.h"
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.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);
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsPageContentFrame)
 
 /* virtual */ nsSize
-nsPageContentFrame::ComputeSize(nsIRenderingContext *aRenderingContext,
+nsPageContentFrame::ComputeSize(nsRenderingContext *aRenderingContext,
                                 nsSize aCBSize, nscoord aAvailableWidth,
                                 nsSize aMargin, nsSize aBorder, nsSize aPadding,
                                 PRBool aShrinkWrap)
 {
   NS_ASSERTION(mPD, "Pages are supposed to have page data");
   nscoord height = (!mPD || mPD->mReflowSize.height == NS_UNCONSTRAINEDSIZE)
                    ? NS_UNCONSTRAINEDSIZE
                    : (mPD->mReflowSize.height - mPD->mReflowMargin.TopBottom());
--- a/layout/generic/nsPageContentFrame.h
+++ b/layout/generic/nsPageContentFrame.h
@@ -64,17 +64,17 @@ public:
   }
 
   virtual void SetSharedPageData(nsSharedPageData* aPD) { mPD = aPD; }
 
   /**
    *  Computes page size based on shared page data; SetSharedPageData must be
    *  given valid data first.
    */
-  virtual nsSize ComputeSize(nsIRenderingContext *aRenderingContext,
+  virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
                              nsSize aCBSize, nscoord aAvailableWidth,
                              nsSize aMargin, nsSize aBorder, nsSize aPadding,
                              PRBool aShrinkWrap);
 
   /**
    * Get the "type" of the frame
    *
    * @see nsGkAtoms::pageContentFrame
--- a/layout/generic/nsPageFrame.cpp
+++ b/layout/generic/nsPageFrame.cpp
@@ -33,17 +33,17 @@
  * 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 "nsPageFrame.h"
 #include "nsPresContext.h"
 #include "nsStyleContext.h"
-#include "nsIRenderingContext.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
@@ -240,17 +240,17 @@ nsPageFrame::ProcessSpecialCodes(const n
     PRUnichar * uStr = nsTextFormatter::smprintf(mPD->mPageNumFormat, mTotNumPages);
     aNewStr.ReplaceSubstring(kPageTotal.get(), uStr);
     nsMemory::Free(uStr);
   }
 }
 
 
 //------------------------------------------------------------------------------
-nscoord nsPageFrame::GetXPosition(nsIRenderingContext& aRenderingContext, 
+nscoord nsPageFrame::GetXPosition(nsRenderingContext& aRenderingContext, 
                                   const nsRect&        aRect, 
                                   PRInt32              aJust,
                                   const nsString&      aStr)
 {
   nscoord width = nsLayoutUtils::GetStringWidth(this, &aRenderingContext,
                                                 aStr.get(), aStr.Length());
 
   nscoord x = aRect.x;
@@ -276,17 +276,17 @@ nscoord nsPageFrame::GetXPosition(nsIRen
 // @param aHeaderFooter - indicates whether it is a header or footer
 // @param aStrLeft - string for the left header or footer; can be empty
 // @param aStrCenter - string for the center header or footer; can be empty
 // @param aStrRight - string for the right header or footer; can be empty
 // @param aRect - the rect of the page
 // @param aAscent - the ascent of the font
 // @param aHeight - the height of the font
 void
-nsPageFrame::DrawHeaderFooter(nsIRenderingContext& aRenderingContext,
+nsPageFrame::DrawHeaderFooter(nsRenderingContext& aRenderingContext,
                               nsHeaderFooterEnum   aHeaderFooter,
                               const nsString&      aStrLeft,
                               const nsString&      aStrCenter,
                               const nsString&      aStrRight,
                               const nsRect&        aRect,
                               nscoord              aAscent,
                               nscoord              aHeight)
 {
@@ -320,17 +320,17 @@ nsPageFrame::DrawHeaderFooter(nsIRenderi
 // @param aHeaderFooter - indicates whether it is a header or footer
 // @param aJust - indicates where the string is located within the header/footer
 // @param aStr - the string to be drawn
 // @param aRect - the rect of the page
 // @param aHeight - the height of the font
 // @param aAscent - the ascent of the font
 // @param aWidth - available width for the string
 void
-nsPageFrame::DrawHeaderFooter(nsIRenderingContext& aRenderingContext,
+nsPageFrame::DrawHeaderFooter(nsRenderingContext& aRenderingContext,
                               nsHeaderFooterEnum   aHeaderFooter,
                               PRInt32              aJust,
                               const nsString&      aStr,
                               const nsRect&        aRect,
                               nscoord              aAscent,
                               nscoord              aHeight,
                               nscoord              aWidth)
 {
@@ -390,29 +390,29 @@ nsPageFrame::DrawHeaderFooter(nsIRenderi
     aRenderingContext.PushState();
     aRenderingContext.SetColor(NS_RGB(0,0,0));
     aRenderingContext.SetClipRect(aRect, nsClipCombine_kIntersect);
     nsLayoutUtils::DrawString(this, &aRenderingContext, str.get(), str.Length(), nsPoint(x, y + aAscent));
     aRenderingContext.PopState();
   }
 }
 
-static void PaintPrintPreviewBackground(nsIFrame* aFrame, nsIRenderingContext* aCtx,
+static void PaintPrintPreviewBackground(nsIFrame* aFrame, nsRenderingContext* aCtx,
                                         const nsRect& aDirtyRect, nsPoint aPt)
 {
   static_cast<nsPageFrame*>(aFrame)->PaintPrintPreviewBackground(*aCtx, aPt);
 }
 
-static void PaintPageContent(nsIFrame* aFrame, nsIRenderingContext* aCtx,
+static void PaintPageContent(nsIFrame* aFrame, nsRenderingContext* aCtx,
                              const nsRect& aDirtyRect, nsPoint aPt)
 {
   static_cast<nsPageFrame*>(aFrame)->PaintPageContent(*aCtx, aDirtyRect, aPt);
 }
 
-static void PaintHeaderFooter(nsIFrame* aFrame, nsIRenderingContext* aCtx,
+static void PaintHeaderFooter(nsIFrame* aFrame, nsRenderingContext* aCtx,
                               const nsRect& aDirtyRect, nsPoint aPt)
 {
   static_cast<nsPageFrame*>(aFrame)->PaintHeaderFooter(*aCtx, aPt);
 }
 
 //------------------------------------------------------------------------------
 NS_IMETHODIMP
 nsPageFrame::BuildDisplayList(nsDisplayListBuilder*   aBuilder,
@@ -453,17 +453,17 @@ void
 nsPageFrame::SetPageNumInfo(PRInt32 aPageNumber, PRInt32 aTotalPages) 
 { 
   mPageNum     = aPageNumber; 
   mTotNumPages = aTotalPages;
 }
 
 
 void
-nsPageFrame::PaintPrintPreviewBackground(nsIRenderingContext& aRenderingContext,
+nsPageFrame::PaintPrintPreviewBackground(nsRenderingContext& aRenderingContext,
                                          nsPoint aPt)
 {
   // fill page with White
   aRenderingContext.SetColor(NS_RGB(255,255,255));
   // REVIEW: this used to have rect's width and height be the
   // mClipRect if specialClipIsSet ... but that seems completely bogus
   // and inconsistent with the painting of the shadow below
   nsRect rect(aPt, GetSize());
@@ -488,17 +488,17 @@ nsPageFrame::PaintPrintPreviewBackground
     shadowRect.y = r.y + r.height - mPD->mShadowSize.height;
     shadowRect.width  = r.width - mPD->mShadowSize.width;
     shadowRect.height = mPD->mShadowSize.height;
     aRenderingContext.FillRect(shadowRect);
   }
 }
 
 void
-nsPageFrame::PaintHeaderFooter(nsIRenderingContext& aRenderingContext,
+nsPageFrame::PaintHeaderFooter(nsRenderingContext& aRenderingContext,
                                nsPoint aPt)
 {
   nsPresContext* pc = PresContext();
 
   if (!mPD->mPrintSettings) {
     if (pc->Type() == nsPresContext::eContext_PrintPreview || pc->IsDynamic())
       mPD->mPrintSettings = pc->GetPrintSettings();
     if (!mPD->mPrintSettings)
@@ -540,17 +540,17 @@ nsPageFrame::PaintHeaderFooter(nsIRender
   mPD->mPrintSettings->GetFooterStrRight(getter_Copies(footerRight));
   DrawHeaderFooter(aRenderingContext, eFooter,
                    footerLeft, footerCenter, footerRight,
                    rect, ascent, visibleHeight);
 }
 
 //------------------------------------------------------------------------------
 void
-nsPageFrame::PaintPageContent(nsIRenderingContext& aRenderingContext,
+nsPageFrame::PaintPageContent(nsRenderingContext& aRenderingContext,
                               const nsRect&        aDirtyRect,
                               nsPoint              aPt) {
   nsIFrame* pageContentFrame  = mFrames.FirstChild();
   nsRect rect = aDirtyRect;
   float scale = PresContext()->GetPageScale();
   aRenderingContext.PushState();
   nsPoint framePos = aPt + pageContentFrame->GetOffsetTo(this);
   aRenderingContext.Translate(framePos);
--- a/layout/generic/nsPageFrame.h
+++ b/layout/generic/nsPageFrame.h
@@ -76,48 +76,48 @@ public:
   // For Printing
   //////////////////
 
   // Tell the page which page number it is out of how many
   virtual void  SetPageNumInfo(PRInt32 aPageNumber, PRInt32 aTotalPages);
 
   virtual void SetSharedPageData(nsSharedPageData* aPD);
 
-  void PaintPrintPreviewBackground(nsIRenderingContext& aRenderingContext,
+  void PaintPrintPreviewBackground(nsRenderingContext& aRenderingContext,
                                    nsPoint aPt);
-  void PaintHeaderFooter(nsIRenderingContext& aRenderingContext,
+  void PaintHeaderFooter(nsRenderingContext& aRenderingContext,
                          nsPoint aPt);
-  void PaintPageContent(nsIRenderingContext& aRenderingContext,
+  void PaintPageContent(nsRenderingContext& aRenderingContext,
                         const nsRect&        aDirtyRect,
                         nsPoint              aPt);
 
 protected:
   nsPageFrame(nsStyleContext* aContext);
   virtual ~nsPageFrame();
 
   typedef enum {
     eHeader,
     eFooter
   } nsHeaderFooterEnum;
 
-  nscoord GetXPosition(nsIRenderingContext& aRenderingContext, 
+  nscoord GetXPosition(nsRenderingContext& aRenderingContext, 
                        const nsRect&        aRect, 
                        PRInt32              aJust,
                        const nsString&      aStr);
 
-  void DrawHeaderFooter(nsIRenderingContext& aRenderingContext,
+  void DrawHeaderFooter(nsRenderingContext& aRenderingContext,
                         nsHeaderFooterEnum   aHeaderFooter,
                         PRInt32              aJust,
                         const nsString&      sStr,
                         const nsRect&        aRect,
                         nscoord              aHeight,
                         nscoord              aAscent,
                         nscoord              aWidth);
 
-  void DrawHeaderFooter(nsIRenderingContext& aRenderingContext,
+  void DrawHeaderFooter(nsRenderingContext& aRenderingContext,
                         nsHeaderFooterEnum   aHeaderFooter,
                         const nsString&      aStrLeft,
                         const nsString&      aStrRight,
                         const nsString&      aStrCenter,
                         const nsRect&        aRect,
                         nscoord              aAscent,
                         nscoord              aHeight);
 
--- a/layout/generic/nsPlaceholderFrame.cpp
+++ b/layout/generic/nsPlaceholderFrame.cpp
@@ -41,17 +41,17 @@
  * objects such as floats and absolutely positioned elements
  */
 
 #include "nsLayoutUtils.h"
 #include "nsPlaceholderFrame.h"
 #include "nsLineLayout.h"
 #include "nsIContent.h"
 #include "nsPresContext.h"
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "nsGkAtoms.h"
 #include "nsFrameManager.h"
 #include "nsDisplayList.h"
 
 nsIFrame*
 NS_NewPlaceholderFrame(nsIPresShell* aPresShell, nsStyleContext* aContext,
                        nsFrameState aTypeBit)
 {
@@ -60,25 +60,25 @@ NS_NewPlaceholderFrame(nsIPresShell* aPr
 
 NS_IMPL_FRAMEARENA_HELPERS(nsPlaceholderFrame)
 
 nsPlaceholderFrame::~nsPlaceholderFrame()
 {
 }
 
 /* virtual */ nscoord
-nsPlaceholderFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
+nsPlaceholderFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord result = 0;
   DISPLAY_MIN_WIDTH(this, result);
   return result;
 }
 
 /* virtual */ nscoord
-nsPlaceholderFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
+nsPlaceholderFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord result = 0;
   DISPLAY_PREF_WIDTH(this, result);
   return result;
 }
 
 /* virtual */ nsSize
 nsPlaceholderFrame::GetMinSize(nsBoxLayoutState& aBoxLayoutState)
@@ -100,32 +100,32 @@ nsPlaceholderFrame::GetPrefSize(nsBoxLay
 nsPlaceholderFrame::GetMaxSize(nsBoxLayoutState& aBoxLayoutState)
 {
   nsSize size(NS_INTRINSICSIZE, NS_INTRINSICSIZE);
   DISPLAY_MAX_SIZE(this, size);
   return size;
 }
 
 /* virtual */ void
-nsPlaceholderFrame::AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
+nsPlaceholderFrame::AddInlineMinWidth(nsRenderingContext *aRenderingContext,
                                       nsIFrame::InlineMinWidthData *aData)
 {
   // Override AddInlineMinWith so that *nothing* happens.  In
   // particular, we don't want to zero out |aData->trailingWhitespace|,
   // since nsLineLayout skips placeholders when trimming trailing
   // whitespace, and we don't want to set aData->skipWhitespace to
   // false.
 
   // ...but push floats onto the list
   if (mOutOfFlowFrame->GetStyleDisplay()->mFloats != NS_STYLE_FLOAT_NONE)
     aData->floats.AppendElement(mOutOfFlowFrame);
 }
 
 /* virtual */ void
-nsPlaceholderFrame::AddInlinePrefWidth(nsIRenderingContext *aRenderingContext,
+nsPlaceholderFrame::AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
                                        nsIFrame::InlinePrefWidthData *aData)
 {
   // Override AddInlinePrefWith so that *nothing* happens.  In
   // particular, we don't want to zero out |aData->trailingWhitespace|,
   // since nsLineLayout skips placeholders when trimming trailing
   // whitespace, and we don't want to set aData->skipWhitespace to
   // false.
 
@@ -205,17 +205,17 @@ nsPlaceholderFrame::GetParentStyleContex
   *aProviderFrame =
     CorrectStyleParentFrame(GetParent(), nsGkAtoms::placeholderFrame);
   return NS_OK;
 }
 
 
 #ifdef DEBUG
 static void
-PaintDebugPlaceholder(nsIFrame* aFrame, nsIRenderingContext* aCtx,
+PaintDebugPlaceholder(nsIFrame* aFrame, nsRenderingContext* aCtx,
                       const nsRect& aDirtyRect, nsPoint aPt)
 {
   aCtx->SetColor(NS_RGB(0, 255, 255));
   nscoord x = nsPresContext::CSSPixelsToAppUnits(-5);
   aCtx->FillRect(aPt.x + x, aPt.y,
                  nsPresContext::CSSPixelsToAppUnits(13), nsPresContext::CSSPixelsToAppUnits(3));
   nscoord y = nsPresContext::CSSPixelsToAppUnits(-10);
   aCtx->FillRect(aPt.x, aPt.y + y,
--- a/layout/generic/nsPlaceholderFrame.h
+++ b/layout/generic/nsPlaceholderFrame.h
@@ -117,21 +117,21 @@ public:
                NS_ASSERTION(!aFrame || !aFrame->GetPrevContinuation(),
                             "OOF must be first continuation");
                mOutOfFlowFrame = aFrame;
              }
 
   // nsIHTMLReflow overrides
   // We need to override GetMinWidth and GetPrefWidth because XUL uses
   // placeholders not within lines.
-  virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
-  virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
-  virtual void AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
+  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
+  virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
+  virtual void AddInlineMinWidth(nsRenderingContext *aRenderingContext,
                                  InlineMinWidthData *aData);
-  virtual void AddInlinePrefWidth(nsIRenderingContext *aRenderingContext,
+  virtual void AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
                                   InlinePrefWidthData *aData);
   virtual nsSize GetMinSize(nsBoxLayoutState& aBoxLayoutState);
   virtual nsSize GetPrefSize(nsBoxLayoutState& aBoxLayoutState);
   virtual nsSize GetMaxSize(nsBoxLayoutState& aBoxLayoutState);
   NS_IMETHOD Reflow(nsPresContext* aPresContext,
                     nsHTMLReflowMetrics& aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus& aStatus);
--- a/layout/generic/nsSimplePageSequence.cpp
+++ b/layout/generic/nsSimplePageSequence.cpp
@@ -34,17 +34,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 #include "nsCOMPtr.h" 
 #include "nsReadableUtils.h"
 #include "nsSimplePageSequence.h"
 #include "nsPresContext.h"
 #include "gfxContext.h"
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "nsGkAtoms.h"
 #include "nsIDeviceContext.h"
 #include "nsIPresShell.h"
 #include "nsIFontMetrics.h"
 #include "nsIPrintSettings.h"
 #include "nsPageFrame.h"
 #include "nsStyleConsts.h"
 #include "nsRegion.h"
@@ -599,17 +599,17 @@ nsSimplePageSequenceFrame::PrintNextPage
         PR_PL(("\n"));
         PR_PL(("***************** BeginPage *****************\n"));
         rv = dc->BeginPage();
         NS_ENSURE_SUCCESS(rv, rv);
       }
 
       PR_PL(("SeqFr::PrintNextPage -> %p PageNo: %d", pf, mPageNum));
 
-      nsCOMPtr<nsIRenderingContext> renderingContext;
+      nsRefPtr<nsRenderingContext> renderingContext;
       dc->CreateRenderingContext(*getter_AddRefs(renderingContext));
       NS_ENSURE_TRUE(renderingContext, NS_ERROR_OUT_OF_MEMORY);
 
 #if defined(XP_UNIX) && !defined(XP_MACOSX)
       // On linux, need to rotate landscape-mode output on printed surfaces
       PRInt32 orientation;
       mPageData->mPrintSettings->GetOrientation(&orientation);
       if (nsIPrintSettings::kLandscapeOrientation == orientation) {
@@ -660,25 +660,25 @@ nsSimplePageSequenceFrame::DoPageEnd()
 
   if (mCurrentPageFrame) {
     mCurrentPageFrame = mCurrentPageFrame->GetNextSibling();
   }
   
   return rv;
 }
 
-static void PaintPageSequence(nsIFrame* aFrame, nsIRenderingContext* aCtx,
+static void PaintPageSequence(nsIFrame* aFrame, nsRenderingContext* aCtx,
                              const nsRect& aDirtyRect, nsPoint aPt)
 {
   static_cast<nsSimplePageSequenceFrame*>(aFrame)->PaintPageSequence(*aCtx, aDirtyRect, aPt);
 }
 
 //------------------------------------------------------------------------------
 void
-nsSimplePageSequenceFrame::PaintPageSequence(nsIRenderingContext& aRenderingContext,
+nsSimplePageSequenceFrame::PaintPageSequence(nsRenderingContext& aRenderingContext,
                                              const nsRect&        aDirtyRect,
                                              nsPoint              aPt) {
   nsRect rect = aDirtyRect;
   float scale = PresContext()->GetPrintPreviewScale();
   aRenderingContext.PushState();
   nsPoint framePos = aPt;
   aRenderingContext.Translate(framePos);
   rect -= framePos;
--- a/layout/generic/nsSimplePageSequence.h
+++ b/layout/generic/nsSimplePageSequence.h
@@ -126,17 +126,17 @@ public:
    * @see nsGkAtoms::sequenceFrame
    */
   virtual nsIAtom* GetType() const;
   
 #ifdef NS_DEBUG
   NS_IMETHOD  GetFrameName(nsAString& aResult) const;
 #endif
 
-  void PaintPageSequence(nsIRenderingContext& aRenderingContext,
+  void PaintPageSequence(nsRenderingContext& aRenderingContext,
                          const nsRect&        aDirtyRect,
                          nsPoint              aPt);
 
 protected:
   nsSimplePageSequenceFrame(nsStyleContext* aContext);
   virtual ~nsSimplePageSequenceFrame();
 
   void SetPageNumberFormat(const char* aPropName, const char* aDefPropVal, PRBool aPageNumOnly);
--- a/layout/generic/nsSubDocumentFrame.cpp
+++ b/layout/generic/nsSubDocumentFrame.cpp
@@ -77,17 +77,17 @@ using mozilla::layout::RenderFrameParent
 #include "nsIDOMXULElement.h"
 #include "nsIScriptSecurityManager.h"
 #include "nsXPIDLString.h"
 #include "nsIScrollable.h"
 #include "nsINameSpaceManager.h"
 #include "nsWeakReference.h"
 #include "nsIDOMWindow.h"
 #include "nsIDOMDocument.h"
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "nsIDOMNSHTMLDocument.h"
 #include "nsDisplayList.h"
 #include "nsUnicharUtils.h"
 #include "nsIScrollableFrame.h"
 #include "nsIObjectLoadingContent.h"
 #include "nsLayoutUtils.h"
 #include "FrameLayerBuilder.h"
 #include "nsObjectFrame.h"
@@ -480,33 +480,33 @@ NS_IMETHODIMP nsSubDocumentFrame::GetFra
 
 nsIAtom*
 nsSubDocumentFrame::GetType() const
 {
   return nsGkAtoms::subDocumentFrame;
 }
 
 /* virtual */ nscoord
-nsSubDocumentFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
+nsSubDocumentFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord result;
   DISPLAY_MIN_WIDTH(this, result);
 
   nsIFrame* subDocRoot = ObtainIntrinsicSizeFrame();
   if (subDocRoot) {
     result = subDocRoot->GetMinWidth(aRenderingContext);
   } else {
     result = GetIntrinsicWidth();
   }
 
   return result;
 }
 
 /* virtual */ nscoord
-nsSubDocumentFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
+nsSubDocumentFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord result;
   DISPLAY_PREF_WIDTH(this, result);
 
   nsIFrame* subDocRoot = ObtainIntrinsicSizeFrame();
   if (subDocRoot) {
     result = subDocRoot->GetPrefWidth(aRenderingContext);
   } else {
@@ -532,17 +532,17 @@ nsSubDocumentFrame::GetIntrinsicRatio()
   nsIFrame* subDocRoot = ObtainIntrinsicSizeFrame();
   if (subDocRoot) {
     return subDocRoot->GetIntrinsicRatio();
   }
   return nsLeafFrame::GetIntrinsicRatio();
 }
 
 /* virtual */ nsSize
-nsSubDocumentFrame::ComputeAutoSize(nsIRenderingContext *aRenderingContext,
+nsSubDocumentFrame::ComputeAutoSize(nsRenderingContext *aRenderingContext,
                                     nsSize aCBSize, nscoord aAvailableWidth,
                                     nsSize aMargin, nsSize aBorder,
                                     nsSize aPadding, PRBool aShrinkWrap)
 {
   if (!IsInline()) {
     return nsFrame::ComputeAutoSize(aRenderingContext, aCBSize,
                                     aAvailableWidth, aMargin, aBorder,
                                     aPadding, aShrinkWrap);
@@ -550,17 +550,17 @@ nsSubDocumentFrame::ComputeAutoSize(nsIR
 
   return nsLeafFrame::ComputeAutoSize(aRenderingContext, aCBSize,
                                       aAvailableWidth, aMargin, aBorder,
                                       aPadding, aShrinkWrap);  
 }
 
 
 /* virtual */ nsSize
-nsSubDocumentFrame::ComputeSize(nsIRenderingContext *aRenderingContext,
+nsSubDocumentFrame::ComputeSize(nsRenderingContext *aRenderingContext,
                                 nsSize aCBSize, nscoord aAvailableWidth,
                                 nsSize aMargin, nsSize aBorder, nsSize aPadding,
                                 PRBool aShrinkWrap)
 {
   nsIFrame* subDocRoot = ObtainIntrinsicSizeFrame();
   if (subDocRoot) {
     return nsLayoutUtils::ComputeSizeWithIntrinsicDimensions(
                             aRenderingContext, this,
--- a/layout/generic/nsSubDocumentFrame.h
+++ b/layout/generic/nsSubDocumentFrame.h
@@ -70,28 +70,28 @@ public:
   }
 
   NS_IMETHOD Init(nsIContent*      aContent,
                   nsIFrame*        aParent,
                   nsIFrame*        aPrevInFlow);
 
   virtual void DestroyFrom(nsIFrame* aDestructRoot);
 
-  virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
-  virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
+  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
+  virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
 
   virtual IntrinsicSize GetIntrinsicSize();
   virtual nsSize  GetIntrinsicRatio();
 
-  virtual nsSize ComputeAutoSize(nsIRenderingContext *aRenderingContext,
+  virtual nsSize ComputeAutoSize(nsRenderingContext *aRenderingContext,
                                  nsSize aCBSize, nscoord aAvailableWidth,
                                  nsSize aMargin, nsSize aBorder,
                                  nsSize aPadding, PRBool aShrinkWrap);
 
-  virtual nsSize ComputeSize(nsIRenderingContext *aRenderingContext,
+  virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
                              nsSize aCBSize, nscoord aAvailableWidth,
                              nsSize aMargin, nsSize aBorder, nsSize aPadding,
                              PRBool aShrinkWrap);
 
   NS_IMETHOD Reflow(nsPresContext*          aPresContext,
                     nsHTMLReflowMetrics&     aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus&          aStatus);
--- a/layout/generic/nsTextFrame.h
+++ b/layout/generic/nsTextFrame.h
@@ -221,23 +221,23 @@ public:
     return (GetStateBits() & TEXT_HAS_NONCOLLAPSED_CHARACTERS) != 0;
   }
   
 #ifdef ACCESSIBILITY
   virtual already_AddRefed<nsAccessible> CreateAccessible();
 #endif
   
   virtual void MarkIntrinsicWidthsDirty();
-  virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
-  virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
-  virtual void AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
+  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
+  virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
+  virtual void AddInlineMinWidth(nsRenderingContext *aRenderingContext,
                                  InlineMinWidthData *aData);
-  virtual void AddInlinePrefWidth(nsIRenderingContext *aRenderingContext,
+  virtual void AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
                                   InlinePrefWidthData *aData);
-  virtual nsSize ComputeSize(nsIRenderingContext *aRenderingContext,
+  virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
                              nsSize aCBSize, nscoord aAvailableWidth,
                              nsSize aMargin, nsSize aBorder, nsSize aPadding,
                              PRBool aShrinkWrap);
   virtual nsRect ComputeTightBounds(gfxContext* aContext) const;
   NS_IMETHOD Reflow(nsPresContext* aPresContext,
                     nsHTMLReflowMetrics& aMetrics,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus& aStatus);
@@ -251,35 +251,35 @@ public:
     PRPackedBool mChanged;
     // true if the last character is not justifiable so should be subtracted
     // from the count of justifiable characters in the frame, since the last
     // character in a line is not justifiable.
     PRPackedBool mLastCharIsJustifiable;
     // an amount to *subtract* from the frame's width (zero if !mChanged)
     nscoord      mDeltaWidth;
   };
-  TrimOutput TrimTrailingWhiteSpace(nsIRenderingContext* aRC);
+  TrimOutput TrimTrailingWhiteSpace(nsRenderingContext* aRC);
   virtual nsresult GetRenderedText(nsAString* aString = nsnull,
                                    gfxSkipChars* aSkipChars = nsnull,
                                    gfxSkipCharsIterator* aSkipIter = nsnull,
                                    PRUint32 aSkippedStartOffset = 0,
                                    PRUint32 aSkippedMaxLength = PR_UINT32_MAX);
 
   nsOverflowAreas RecomputeOverflow();
 
-  void AddInlineMinWidthForFlow(nsIRenderingContext *aRenderingContext,
+  void AddInlineMinWidthForFlow(nsRenderingContext *aRenderingContext,
                                 nsIFrame::InlineMinWidthData *aData);
-  void AddInlinePrefWidthForFlow(nsIRenderingContext *aRenderingContext,
+  void AddInlinePrefWidthForFlow(nsRenderingContext *aRenderingContext,
                                  InlinePrefWidthData *aData);
 
   gfxFloat GetSnappedBaselineY(gfxContext* aContext, gfxFloat aY);
 
   // primary frame paint method called from nsDisplayText
   // The private DrawText() is what applies the text to a graphics context
-  void PaintText(nsIRenderingContext* aRenderingContext, nsPoint aPt,
+  void PaintText(nsRenderingContext* aRenderingContext, nsPoint aPt,
                  const nsRect& aDirtyRect);
   // helper: paint quirks-mode CSS text decorations
   void PaintTextDecorations(gfxContext* aCtx, const gfxRect& aDirtyRect,
                             const gfxPoint& aFramePt,
                             const gfxPoint& aTextBaselinePt,
                             nsTextPaintStyle& aTextStyle,
                             PropertyProvider& aProvider,
                             const nscolor* aOverrideColor = nsnull);
@@ -373,17 +373,17 @@ public:
     PRInt32 mLength;
     PRInt32 GetEnd() { return mStart + mLength; }
   };
   TrimmedOffsets GetTrimmedOffsets(const nsTextFragment* aFrag,
                                    PRBool aTrimAfter);
 
   // Similar to Reflow(), but for use from nsLineLayout
   void ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
-                  nsIRenderingContext* aRenderingContext, PRBool aShouldBlink,
+                  nsRenderingContext* aRenderingContext, PRBool aShouldBlink,
                   nsHTMLReflowMetrics& aMetrics, nsReflowStatus& aStatus);
 
 protected:
   virtual ~nsTextFrame();
 
   nsIFrame*   mNextContinuation;
   // The key invariant here is that mContentOffset never decreases along
   // a next-continuation chain. And of course mContentOffset is always <= the
--- a/layout/generic/nsTextFrameThebes.cpp
+++ b/layout/generic/nsTextFrameThebes.cpp
@@ -59,17 +59,17 @@
 #include "nsString.h"
 #include "nsUnicharUtils.h"
 #include "nsPresContext.h"
 #include "nsIContent.h"
 #include "nsStyleConsts.h"
 #include "nsStyleContext.h"
 #include "nsCoord.h"
 #include "nsIFontMetrics.h"
-#include "nsIRenderingContext.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"
@@ -1602,19 +1602,19 @@ GetFontGroupForFrame(nsIFrame* aFrame,
   // XXX this is a bit bogus, we're releasing 'metrics' so the returned font-group
   // might actually be torn down, although because of the way the device context
   // caches font metrics, this seems to not actually happen. But we should fix
   // this.
   return fm->GetThebesFontGroup();
 }
 
 static already_AddRefed<gfxContext>
-GetReferenceRenderingContext(nsTextFrame* aTextFrame, nsIRenderingContext* aRC)
-{
-  nsCOMPtr<nsIRenderingContext> tmp = aRC;
+GetReferenceRenderingContext(nsTextFrame* aTextFrame, nsRenderingContext* aRC)
+{
+  nsRefPtr<nsRenderingContext> tmp = aRC;
   if (!tmp) {
     tmp = aTextFrame->PresContext()->PresShell()->GetReferenceRenderingContext();
     if (!tmp)
       return nsnull;
   }
 
   gfxContext* ctx = tmp->ThebesContext();
   NS_ADDREF(ctx);
@@ -3703,19 +3703,19 @@ public:
                   "creating a loop in continuation chain!");
     mPrevContinuation = aPrevInFlow;
     AddStateBits(NS_FRAME_IS_FLUID_CONTINUATION);
     return NS_OK;
   }
   virtual nsIFrame* GetFirstInFlow() const;
   virtual nsIFrame* GetFirstContinuation() const;
 
-  virtual void AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
+  virtual void AddInlineMinWidth(nsRenderingContext *aRenderingContext,
                                  InlineMinWidthData *aData);
-  virtual void AddInlinePrefWidth(nsIRenderingContext *aRenderingContext,
+  virtual void AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
                                   InlinePrefWidthData *aData);
   
   virtual nsresult GetRenderedText(nsAString* aString = nsnull,
                                    gfxSkipChars* aSkipChars = nsnull,
                                    gfxSkipCharsIterator* aSkipIter = nsnull,
                                    PRUint32 aSkippedStartOffset = 0,
                                    PRUint32 aSkippedMaxLength = PR_UINT32_MAX)
   { return NS_ERROR_NOT_IMPLEMENTED; } // Call on a primary text frame only
@@ -3850,38 +3850,38 @@ nsContinuingTextFrame::GetFirstContinuat
 // but depends on our maintining the frame tree in reasonable ways even
 // for edge cases (block-within-inline splits, nextBidi, etc.)
 
 // XXX We really need to make :first-letter happen during frame
 // construction.
 
 // Needed for text frames in XUL.
 /* virtual */ nscoord
-nsTextFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
+nsTextFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
 {
   return nsLayoutUtils::MinWidthFromInline(this, aRenderingContext);
 }
 
 // Needed for text frames in XUL.
 /* virtual */ nscoord
-nsTextFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
+nsTextFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
 {
   return nsLayoutUtils::PrefWidthFromInline(this, aRenderingContext);
 }
 
 /* virtual */ void
-nsContinuingTextFrame::AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
+nsContinuingTextFrame::AddInlineMinWidth(nsRenderingContext *aRenderingContext,
                                          InlineMinWidthData *aData)
 {
   // Do nothing, since the first-in-flow accounts for everything.
   return;
 }
 
 /* virtual */ void
-nsContinuingTextFrame::AddInlinePrefWidth(nsIRenderingContext *aRenderingContext,
+nsContinuingTextFrame::AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
                                           InlinePrefWidthData *aData)
 {
   // Do nothing, since the first-in-flow accounts for everything.
   return;
 }
 
 static void 
 DestroySelectionDetails(SelectionDetails* aDetails)
@@ -4111,32 +4111,32 @@ public:
   }
   virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
                        HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames) {
     if (nsRect(ToReferenceFrame(), mFrame->GetSize()).Intersects(aRect)) {
       aOutFrames->AppendElement(mFrame);
     }
   }
   virtual void Paint(nsDisplayListBuilder* aBuilder,
-                     nsIRenderingContext* aCtx);
+                     nsRenderingContext* aCtx);
   NS_DISPLAY_DECL_NAME("Text", TYPE_TEXT)
 
   virtual nsRect GetComponentAlphaBounds(nsDisplayListBuilder* aBuilder)
   {
     return GetBounds(aBuilder);
   }
 
   virtual void DisableComponentAlpha() { mDisableSubpixelAA = PR_TRUE; }
 
   PRPackedBool mDisableSubpixelAA;
 };
 
 void
 nsDisplayText::Paint(nsDisplayListBuilder* aBuilder,
-                     nsIRenderingContext* aCtx) {
+                     nsRenderingContext* aCtx) {
   // Add 1 pixel of dirty area around mVisibleRect to allow us to paint
   // antialiased pixels beyond the measured text extents.
   // This is temporary until we do this in the actual calculation of text extents.
   nsRect extraVisible = mVisibleRect;
   nscoord appUnitsPerDevPixel = mFrame->PresContext()->AppUnitsPerDevPixel();
   extraVisible.Inflate(appUnitsPerDevPixel, appUnitsPerDevPixel);
   nsTextFrame* f = static_cast<nsTextFrame*>(mFrame);
 
@@ -5054,17 +5054,17 @@ nsTextFrame::GetSnappedBaselineY(gfxCont
   gfxFloat baseline = aY + mAscent;
   gfxRect putativeRect(0, baseline/appUnitsPerDevUnit, 1, 1);
   if (!aContext->UserToDevicePixelSnapped(putativeRect))
     return baseline;
   return aContext->DeviceToUser(putativeRect.pos).y*appUnitsPerDevUnit;
 }
 
 void
-nsTextFrame::PaintText(nsIRenderingContext* aRenderingContext, nsPoint aPt,
+nsTextFrame::PaintText(nsRenderingContext* aRenderingContext, nsPoint aPt,
                        const nsRect& aDirtyRect)
 {
   // Don't pass in aRenderingContext here, because we need a *reference*
   // context and aRenderingContext might have some transform in it
   // XXX get the block and line passed to us somehow! This is slow!
   gfxSkipCharsIterator iter = EnsureTextRun();
   if (!mTextRun)
     return;
@@ -6020,17 +6020,17 @@ void nsTextFrame::MarkIntrinsicWidthsDir
 {
   ClearTextRun(nsnull);
   nsFrame::MarkIntrinsicWidthsDirty();
 }
 
 // XXX this doesn't handle characters shaped by line endings. We need to
 // temporarily override the "current line ending" settings.
 void
-nsTextFrame::AddInlineMinWidthForFlow(nsIRenderingContext *aRenderingContext,
+nsTextFrame::AddInlineMinWidthForFlow(nsRenderingContext *aRenderingContext,
                                       nsIFrame::InlineMinWidthData *aData)
 {
   PRUint32 flowEndInTextRun;
   gfxContext* ctx = aRenderingContext->ThebesContext();
   gfxSkipCharsIterator iter =
     EnsureTextRun(ctx, aData->lineContainer, aData->line, &flowEndInTextRun);
   if (!mTextRun)
     return;
@@ -6147,17 +6147,17 @@ nsTextFrame::AddInlineMinWidthForFlow(ns
                        iter.ConvertSkippedToOriginal(flowEndInTextRun - 1),
                        textStyle);
   }
 }
 
 // XXX Need to do something here to avoid incremental reflow bugs due to
 // first-line and first-letter changing min-width
 /* virtual */ void
-nsTextFrame::AddInlineMinWidth(nsIRenderingContext *aRenderingContext,
+nsTextFrame::AddInlineMinWidth(nsRenderingContext *aRenderingContext,
                                nsIFrame::InlineMinWidthData *aData)
 {
   nsTextFrame* f;
   gfxTextRun* lastTextRun = nsnull;
   // nsContinuingTextFrame does nothing for AddInlineMinWidth; all text frames
   // in the flow are handled right here.
   for (f = this; f; f = static_cast<nsTextFrame*>(f->GetNextContinuation())) {
     // f->mTextRun could be null if we haven't set up textruns yet for f.
@@ -6178,17 +6178,17 @@ nsTextFrame::AddInlineMinWidth(nsIRender
       lastTextRun = f->mTextRun;
     }
   }
 }
 
 // XXX this doesn't handle characters shaped by line endings. We need to
 // temporarily override the "current line ending" settings.
 void
-nsTextFrame::AddInlinePrefWidthForFlow(nsIRenderingContext *aRenderingContext,
+nsTextFrame::AddInlinePrefWidthForFlow(nsRenderingContext *aRenderingContext,
                                        nsIFrame::InlinePrefWidthData *aData)
 {
   PRUint32 flowEndInTextRun;
   gfxContext* ctx = aRenderingContext->ThebesContext();
   gfxSkipCharsIterator iter =
     EnsureTextRun(ctx, aData->lineContainer, aData->line, &flowEndInTextRun);
   if (!mTextRun)
     return;
@@ -6271,17 +6271,17 @@ nsTextFrame::AddInlinePrefWidthForFlow(n
                        iter.ConvertSkippedToOriginal(flowEndInTextRun - 1),
                        textStyle);
   }
 }
 
 // XXX Need to do something here to avoid incremental reflow bugs due to
 // first-line and first-letter changing pref-width
 /* virtual */ void
-nsTextFrame::AddInlinePrefWidth(nsIRenderingContext *aRenderingContext,
+nsTextFrame::AddInlinePrefWidth(nsRenderingContext *aRenderingContext,
                                 nsIFrame::InlinePrefWidthData *aData)
 {
   nsTextFrame* f;
   gfxTextRun* lastTextRun = nsnull;
   // nsContinuingTextFrame does nothing for AddInlineMinWidth; all text frames
   // in the flow are handled right here.
   for (f = this; f; f = static_cast<nsTextFrame*>(f->GetNextContinuation())) {
     // f->mTextRun could be null if we haven't set up textruns yet for f.
@@ -6300,17 +6300,17 @@ nsTextFrame::AddInlinePrefWidth(nsIRende
       // This will process all the text frames that share the same textrun as f.
       f->AddInlinePrefWidthForFlow(aRenderingContext, aData);
       lastTextRun = f->mTextRun;
     }
   }
 }
 
 /* virtual */ nsSize
-nsTextFrame::ComputeSize(nsIRenderingContext *aRenderingContext,
+nsTextFrame::ComputeSize(nsRenderingContext *aRenderingContext,
                          nsSize aCBSize, nscoord aAvailableWidth,
                          nsSize aMargin, nsSize aBorder, nsSize aPadding,
                          PRBool aShrinkWrap)
 {
   // Inlines and text don't compute size before reflow.
   return nsSize(NS_UNCONSTRAINEDSIZE, NS_UNCONSTRAINEDSIZE);
 }
 
@@ -6527,17 +6527,17 @@ nsTextFrame::Reflow(nsPresContext*      
              aMetrics, aStatus);
 
   NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);
   return NS_OK;
 }
 
 void
 nsTextFrame::ReflowText(nsLineLayout& aLineLayout, nscoord aAvailableWidth,
-                        nsIRenderingContext* aRenderingContext,
+                        nsRenderingContext* aRenderingContext,
                         PRBool aShouldBlink,
                         nsHTMLReflowMetrics& aMetrics,
                         nsReflowStatus& aStatus)
 {
 #ifdef NOISY_REFLOW
   ListTag(stdout);
   printf(": BeginReflow: availableWidth=%d\n", aAvailableWidth);
 #endif
@@ -7052,17 +7052,17 @@ nsTextFrame::ReflowText(nsLineLayout& aL
 /* virtual */ PRBool
 nsTextFrame::CanContinueTextRun() const
 {
   // We can continue a text run through a text frame
   return PR_TRUE;
 }
 
 nsTextFrame::TrimOutput
-nsTextFrame::TrimTrailingWhiteSpace(nsIRenderingContext* aRC)
+nsTextFrame::TrimTrailingWhiteSpace(nsRenderingContext* aRC)
 {
   TrimOutput result;
   result.mChanged = PR_FALSE;
   result.mLastCharIsJustifiable = PR_FALSE;
   result.mDeltaWidth = 0;
 
   AddStateBits(TEXT_END_OF_LINE);
 
--- a/layout/generic/nsVideoFrame.cpp
+++ b/layout/generic/nsVideoFrame.cpp
@@ -42,17 +42,17 @@
 #include "nsCOMPtr.h"
 #include "nsIServiceManager.h"
 #include "nsGkAtoms.h"
 
 #include "nsVideoFrame.h"
 #include "nsHTMLVideoElement.h"
 #include "nsIDOMHTMLVideoElement.h"
 #include "nsDisplayList.h"
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "gfxContext.h"
 #include "gfxImageSurface.h"
 #include "nsPresContext.h"
 #include "nsTransform2D.h"
 #include "nsContentCreatorFunctions.h"
 #include "nsBoxLayoutState.h"
 #include "nsBoxFrame.h"
 #include "nsImageFrame.h"
@@ -486,17 +486,17 @@ nsVideoFrame::CreateAccessible()
 #ifdef DEBUG
 NS_IMETHODIMP
 nsVideoFrame::GetFrameName(nsAString& aResult) const
 {
   return MakeFrameName(NS_LITERAL_STRING("HTMLVideo"), aResult);
 }
 #endif
 
-nsSize nsVideoFrame::ComputeSize(nsIRenderingContext *aRenderingContext,
+nsSize nsVideoFrame::ComputeSize(nsRenderingContext *aRenderingContext,
                                      nsSize aCBSize,
                                      nscoord aAvailableWidth,
                                      nsSize aMargin,
                                      nsSize aBorder,
                                      nsSize aPadding,
                                      PRBool aShrinkWrap)
 {
   nsSize size = GetVideoIntrinsicSize(aRenderingContext);
@@ -512,24 +512,24 @@ nsSize nsVideoFrame::ComputeSize(nsIRend
                                                            intrinsicSize,
                                                            intrinsicRatio,
                                                            aCBSize,
                                                            aMargin,
                                                            aBorder,
                                                            aPadding);
 }
 
-nscoord nsVideoFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
+nscoord nsVideoFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord result = GetVideoIntrinsicSize(aRenderingContext).width;
   DISPLAY_MIN_WIDTH(this, result);
   return result;
 }
 
-nscoord nsVideoFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
+nscoord nsVideoFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord result = GetVideoIntrinsicSize(aRenderingContext).width;
   DISPLAY_PREF_WIDTH(this, result);
   return result;
 }
 
 nsSize nsVideoFrame::GetIntrinsicRatio()
 {
@@ -559,17 +559,17 @@ PRBool nsVideoFrame::ShouldDisplayPoster
   res = request->GetImageStatus(&status);
   if (NS_FAILED(res) || (status & imgIRequest::STATUS_ERROR))
     return PR_FALSE;
 
   return PR_TRUE;
 }
 
 nsSize
-nsVideoFrame::GetVideoIntrinsicSize(nsIRenderingContext *aRenderingContext)
+nsVideoFrame::GetVideoIntrinsicSize(nsRenderingContext *aRenderingContext)
 {
   // Defaulting size to 300x150 if no size given.
   nsIntSize size(300, 150);
 
   if (ShouldDisplayPoster()) {
     // Use the poster image frame's size.
     nsIFrame *child = mFrames.FirstChild();
     if (child && child->GetType() == nsGkAtoms::imageFrame) {
--- a/layout/generic/nsVideoFrame.h
+++ b/layout/generic/nsVideoFrame.h
@@ -71,24 +71,24 @@ public:
                               const nsRect&           aDirtyRect,
                               const nsDisplayListSet& aLists);
 
   NS_IMETHOD AttributeChanged(PRInt32 aNameSpaceID,
                               nsIAtom* aAttribute,
                               PRInt32 aModType);
 
   /* get the size of the video's display */
-  nsSize GetVideoIntrinsicSize(nsIRenderingContext *aRenderingContext);
+  nsSize GetVideoIntrinsicSize(nsRenderingContext *aRenderingContext);
   virtual nsSize GetIntrinsicRatio();
-  virtual nsSize ComputeSize(nsIRenderingContext *aRenderingContext,
+  virtual nsSize ComputeSize(nsRenderingContext *aRenderingContext,
                              nsSize aCBSize, nscoord aAvailableWidth,
                              nsSize aMargin, nsSize aBorder, nsSize aPadding,
                              PRBool aShrinkWrap);
-  virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
-  virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
+  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
+  virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
   virtual void DestroyFrom(nsIFrame* aDestructRoot);
   virtual PRBool IsLeaf() const;
 
   NS_IMETHOD Reflow(nsPresContext*          aPresContext,
                     nsHTMLReflowMetrics&     aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus&          aStatus);
 
--- a/layout/generic/nsViewportFrame.cpp
+++ b/layout/generic/nsViewportFrame.cpp
@@ -187,32 +187,32 @@ ViewportFrame::GetChildList(nsIAtom* aLi
 {
   if (nsGkAtoms::fixedList == aListName)
     return mFixedContainer.GetChildList();
 
   return nsContainerFrame::GetChildList(aListName);
 }
 
 /* virtual */ nscoord
-ViewportFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
+ViewportFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord result;
   DISPLAY_MIN_WIDTH(this, result);
   if (mFrames.IsEmpty())
     result = 0;
   else
     result = mFrames.FirstChild()->GetMinWidth(aRenderingContext);
     
   // XXXldb Deal with mFixedContainer (matters for SizeToContent)!
 
   return result;
 }
 
 /* virtual */ nscoord
-ViewportFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
+ViewportFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord result;
   DISPLAY_PREF_WIDTH(this, result);
   if (mFrames.IsEmpty())
     result = 0;
   else
     result = mFrames.FirstChild()->GetPrefWidth(aRenderingContext);
     
--- a/layout/generic/nsViewportFrame.h
+++ b/layout/generic/nsViewportFrame.h
@@ -89,18 +89,18 @@ public:
   virtual nsIAtom* GetAdditionalChildListName(PRInt32 aIndex) const;
 
   virtual nsFrameList GetChildList(nsIAtom* aListName) const;
 
   NS_IMETHOD BuildDisplayList(nsDisplayListBuilder*   aBuilder,
                               const nsRect&           aDirtyRect,
                               const nsDisplayListSet& aLists);
 
-  virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
-  virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
+  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
+  virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
   NS_IMETHOD Reflow(nsPresContext*          aPresContext,
                     nsHTMLReflowMetrics&     aDesiredSize,
                     const nsHTMLReflowState& aReflowState,
                     nsReflowStatus&          aStatus);
 
   /**
    * Get the "type" of the frame
    *
--- a/layout/inspector/src/inFlasher.cpp
+++ b/layout/inspector/src/inFlasher.cpp
@@ -153,17 +153,17 @@ inFlasher::DrawElementOutline(nsIDOMElem
   nsIFrame* frame = inLayoutUtils::GetFrameFor(aElement);
 
   PRBool isFirstFrame = PR_TRUE;
 
   while (frame) {
     nsPoint offset;
     nsIWidget* widget = frame->GetNearestWidget(offset);
     if (widget) {
-      nsCOMPtr<nsIRenderingContext> rcontext;
+      nsRefPtr<nsRenderingContext> rcontext;
       frame->PresContext()->DeviceContext()->
         CreateRenderingContext(widget, *getter_AddRefs(rcontext));
       if (rcontext) {
         nsRect rect(offset, frame->GetSize());
         if (mInvert) {
           rcontext->InvertRect(rect);
         }
 
@@ -202,17 +202,17 @@ inFlasher::ScrollElementIntoView(nsIDOME
   return NS_OK;
 }
 
 ///////////////////////////////////////////////////////////////////////////////
 // inFlasher
 
 void
 inFlasher::DrawOutline(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
-                       nsIRenderingContext* aRenderContext,
+                       nsRenderingContext* aRenderContext,
                        PRBool aDrawBegin, PRBool aDrawEnd)
 {
   aRenderContext->SetColor(mColor);
 
   DrawLine(aX, aY, aWidth, DIR_HORIZONTAL, BOUND_OUTER, aRenderContext);
   if (aDrawBegin) {
     DrawLine(aX, aY, aHeight, DIR_VERTICAL, BOUND_OUTER, aRenderContext);
   }
@@ -220,17 +220,17 @@ inFlasher::DrawOutline(nscoord aX, nscoo
   if (aDrawEnd) {
     DrawLine(aX+aWidth, aY, aHeight, DIR_VERTICAL, BOUND_INNER, aRenderContext);
   }
 }
 
 void
 inFlasher::DrawLine(nscoord aX, nscoord aY, nscoord aLength,
                     PRBool aDir, PRBool aBounds,
-                    nsIRenderingContext* aRenderContext)
+                    nsRenderingContext* aRenderContext)
 {
   nscoord thickTwips = nsPresContext::CSSPixelsToAppUnits(mThickness);
   if (aDir) { // horizontal
     aRenderContext->FillRect(aX, aY+(aBounds?0:-thickTwips), aLength, thickTwips);
   } else { // vertical
     aRenderContext->FillRect(aX+(aBounds?0:-thickTwips), aY, thickTwips, aLength);
   }
 }
--- a/layout/inspector/src/inFlasher.h
+++ b/layout/inspector/src/inFlasher.h
@@ -36,17 +36,17 @@
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef __inFlasher_h__
 #define __inFlasher_h__
 
 #include "inIFlasher.h"
 
 #include "nsIDOMElement.h"
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 
 #include "nsCOMPtr.h"
 
 #define BOUND_INNER 0
 #define BOUND_OUTER 1
 
 #define DIR_VERTICAL 0
 #define DIR_HORIZONTAL 1 
@@ -57,21 +57,21 @@ public:
   NS_DECL_ISUPPORTS
   NS_DECL_INIFLASHER
 
   inFlasher();
   virtual ~inFlasher();
 
 protected:
   void DrawOutline(nscoord aX, nscoord aY, nscoord aWidth, nscoord aHeight,
-                   nsIRenderingContext* aRenderContext,
+                   nsRenderingContext* aRenderContext,
                    PRBool aDrawBegin, PRBool aDrawEnd);
   void DrawLine(nscoord aX, nscoord aY, nscoord aLength,
                 PRBool aDir, PRBool aBounds,
-                nsIRenderingContext* aRenderContext);
+                nsRenderingContext* aRenderContext);
 
   nscolor mColor;
 
   PRUint16 mThickness;
   PRPackedBool mInvert;
 };
 
 // {9286E71A-621A-4b91-851E-9984C1A2E81A}
--- a/layout/inspector/src/inLayoutUtils.h
+++ b/layout/inspector/src/inLayoutUtils.h
@@ -37,17 +37,17 @@
 
 #ifndef __inLayoutUtils_h__
 #define __inLayoutUtils_h__
 
 #include "nsCOMPtr.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMWindowInternal.h"
 #include "nsIFrame.h"
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "nsIEventStateManager.h"
 #include "nsIDOMDocument.h"
 #include "nsBindingManager.h"
 
 class nsIPresShell;
 
 class inLayoutUtils
 {
--- a/layout/mathml/nsIMathMLFrame.h
+++ b/layout/mathml/nsIMathMLFrame.h
@@ -35,17 +35,17 @@
  * 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 ***** */
 //#define SHOW_BOUNDING_BOX 1
 #ifndef nsIMathMLFrame_h___
 #define nsIMathMLFrame_h___
 
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "nsIFrame.h"
 
 struct nsPresentationData;
 struct nsEmbellishData;
 struct nsHTMLReflowMetrics;
 
 // For MathML, this 'type' will be used to determine the spacing between frames
 // Subclasses can return a 'type' that will give them a particular spacing
@@ -108,17 +108,17 @@ public:
   *        stretch.
   * @param aContainerSize [in] struct that suggests the maximumn size for
   *        the stretched frame. Only member data of the struct that are 
   *        relevant to the direction are used (the rest is ignored). 
   * @param aDesiredStretchSize [in/out] On input the current size
   *        of the frame, on output the size after stretching.
   */
   NS_IMETHOD 
-  Stretch(nsIRenderingContext& aRenderingContext,
+  Stretch(nsRenderingContext& aRenderingContext,
           nsStretchDirection   aStretchDirection,
           nsBoundingMetrics&   aContainerSize,
           nsHTMLReflowMetrics& aDesiredStretchSize) = 0;
 
  /* Get the mEmbellishData member variable. */
  
   NS_IMETHOD
   GetEmbellishData(nsEmbellishData& aEmbellishData) = 0;
--- a/layout/mathml/nsMathMLChar.cpp
+++ b/layout/mathml/nsMathMLChar.cpp
@@ -41,17 +41,17 @@
 
 #include "nsCOMPtr.h"
 #include "nsFrame.h"
 #include "nsPresContext.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsString.h"
 #include "nsUnicharUtils.h"
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "gfxPlatform.h"
 #include "nsIFontMetrics.h"
 
 #include "nsIPrefBranch.h"
 #include "nsIPrefService.h"
 #include "nsISupportsPrimitives.h"
 #include "nsIComponentManager.h"
 #include "nsIPersistentProperties2.h"
@@ -1128,17 +1128,17 @@ insert:
   else { // whitespace or empty
     aFontName = aFallbackFamilies;
   }
 }
 
 // Update the font and rendering context if there is a family change
 static void
 SetFontFamily(nsPresContext*       aPresContext,
-              nsIRenderingContext& aRenderingContext,
+              nsRenderingContext& aRenderingContext,
               nsFont&              aFont,
               const nsGlyphTable*  aGlyphTable,
               const nsGlyphCode&   aGlyphCode,
               const nsAString&     aDefaultFamily)
 {
   const nsAString& family =
     aGlyphCode.font ? aGlyphTable->FontNameFor(aGlyphCode) : aDefaultFamily;
   if (! family.Equals(aFont.name)) {
@@ -1146,17 +1146,17 @@ SetFontFamily(nsPresContext*       aPres
     aRenderingContext.SetFont(aFont, aPresContext->GetUserFontSet());
   }
 }
 
 class nsMathMLChar::StretchEnumContext {
 public:
   StretchEnumContext(nsMathMLChar*        aChar,
                      nsPresContext*       aPresContext,
-                     nsIRenderingContext& aRenderingContext,
+                     nsRenderingContext& aRenderingContext,
                      nsStretchDirection   aStretchDirection,
                      nscoord              aTargetSize,
                      PRUint32             aStretchHint,
                      nsBoundingMetrics&   aStretchedMetrics,
                      const nsAString&     aFamilies,
                      PRBool&              aGlyphFound)
     : mChar(aChar),
       mPresContext(aPresContext),
@@ -1177,17 +1177,17 @@ private:
   static PRBool
   ResolverCallback (const nsAString& aFamily, void *aData);
 
   PRBool TryVariants(nsGlyphTable* aGlyphTable, const nsAString& aFamily);
   PRBool TryParts(nsGlyphTable* aGlyphTable, const nsAString& aFamily);
 
   nsMathMLChar* mChar;
   nsPresContext* mPresContext;
-  nsIRenderingContext& mRenderingContext;
+  nsRenderingContext& mRenderingContext;
   const nsStretchDirection mDirection;
   const nscoord mTargetSize;
   const PRUint32 mStretchHint;
   nsBoundingMetrics& mBoundingMetrics;
   // Font families to search
   const nsAString& mFamilies;
 
 public:
@@ -1520,17 +1520,17 @@ nsMathMLChar::StretchEnumContext::EnumCa
   gfxPlatform *pf = gfxPlatform::GetPlatform();
   nsresult rv =
     pf->ResolveFontName(aFamily, ResolverCallback, aData, aborted);
   return NS_SUCCEEDED(rv) && !aborted; // true means continue
 }
 
 nsresult
 nsMathMLChar::StretchInternal(nsPresContext*           aPresContext,
-                              nsIRenderingContext&     aRenderingContext,
+                              nsRenderingContext&     aRenderingContext,
                               nsStretchDirection&      aStretchDirection,
                               const nsBoundingMetrics& aContainerSize,
                               nsBoundingMetrics&       aDesiredStretchSize,
                               PRUint32                 aStretchHint,
                               // These are currently only used when
                               // aStretchHint & NS_STRETCH_MAXWIDTH:
                               float                    aMaxSize,
                               PRBool                   aMaxSizeIsAbsolute)
@@ -1793,17 +1793,17 @@ nsMathMLChar::StretchInternal(nsPresCont
     }
   }
 
   return NS_OK;
 }
 
 nsresult
 nsMathMLChar::Stretch(nsPresContext*           aPresContext,
-                      nsIRenderingContext&     aRenderingContext,
+                      nsRenderingContext&     aRenderingContext,
                       nsStretchDirection       aStretchDirection,
                       const nsBoundingMetrics& aContainerSize,
                       nsBoundingMetrics&       aDesiredStretchSize,
                       PRUint32                 aStretchHint)
 {
   NS_ASSERTION(!(aStretchHint &
                  ~(NS_STRETCH_VARIABLE_MASK | NS_STRETCH_LARGEOP |
                    NS_STRETCH_INTEGRAL)),
@@ -1831,33 +1831,33 @@ nsMathMLChar::Stretch(nsPresContext*    
 // not be used for any stretch size, StretchInternal sets the initial height
 // to infinity and looks for any characters smaller than this height.  When a
 // character built from parts is considered, (it will be used by Stretch for
 // any characters greater than its minimum size, so) the height is set to its
 // minimum size, so that only widths of smaller subsequent characters are
 // considered.
 nscoord
 nsMathMLChar::GetMaxWidth(nsPresContext* aPresContext,
-                          nsIRenderingContext& aRenderingContext,
+                          nsRenderingContext& aRenderingContext,
                           PRUint32 aStretchHint,
                           float aMaxSize, PRBool aMaxSizeIsAbsolute)
 {
   nsBoundingMetrics bm;
   nsStretchDirection direction = NS_STRETCH_DIRECTION_VERTICAL;
   const nsBoundingMetrics container; // zero target size
 
   StretchInternal(aPresContext, aRenderingContext, direction, container,
                   bm, aStretchHint | NS_STRETCH_MAXWIDTH);
 
   return NS_MAX(bm.width, bm.rightBearing) - NS_MIN(0, bm.leftBearing);
 }
 
 nsresult
 nsMathMLChar::ComposeChildren(nsPresContext*      aPresContext,
-                              nsIRenderingContext& aRenderingContext,
+                              nsRenderingContext& aRenderingContext,
                               nsGlyphTable*        aGlyphTable,
                               nscoord              aTargetSize,
                               nsBoundingMetrics&   aCompositeSize,
                               PRUint32             aStretchHint)
 {
   PRInt32 i = 0;
   nsMathMLChar* child;
   PRInt32 count = aGlyphTable->ChildCountOf(aPresContext, this);
@@ -1941,24 +1941,24 @@ public:
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayMathMLSelectionRect() {
     MOZ_COUNT_DTOR(nsDisplayMathMLSelectionRect);
   }
 #endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
-                     nsIRenderingContext* aCtx);
+                     nsRenderingContext* aCtx);
   NS_DISPLAY_DECL_NAME("MathMLSelectionRect", TYPE_MATHML_SELECTION_RECT)
 private:
   nsRect    mRect;
 };
 
 void nsDisplayMathMLSelectionRect::Paint(nsDisplayListBuilder* aBuilder,
-                                         nsIRenderingContext* aCtx)
+                                         nsRenderingContext* aCtx)
 {
   // get color to use for selection from the look&feel object
   nscolor bgColor = NS_RGB(0, 0, 0);
   mFrame->PresContext()->LookAndFeel()->
       GetColor(nsILookAndFeel::eColor_TextSelectBackground, bgColor);
   aCtx->SetColor(bgColor);
   aCtx->FillRect(mRect + ToReferenceFrame());
 }
@@ -1973,25 +1973,25 @@ public:
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayMathMLCharBackground() {
     MOZ_COUNT_DTOR(nsDisplayMathMLCharBackground);
   }
 #endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
-                     nsIRenderingContext* aCtx);
+                     nsRenderingContext* aCtx);
   NS_DISPLAY_DECL_NAME("MathMLCharBackground", TYPE_MATHML_CHAR_BACKGROUND)
 private:
   nsStyleContext* mStyleContext;
   nsRect          mRect;
 };
 
 void nsDisplayMathMLCharBackground::Paint(nsDisplayListBuilder* aBuilder,
-                                          nsIRenderingContext* aCtx)
+                                          nsRenderingContext* aCtx)
 {
   const nsStyleBorder* border = mStyleContext->GetStyleBorder();
   nsRect rect(mRect + ToReferenceFrame());
   nsCSSRendering::PaintBackgroundWithSC(mFrame->PresContext(), *aCtx, mFrame,
                                         mVisibleRect, rect,
                                         mStyleContext, *border,
                                         aBuilder->GetBackgroundPaintFlags());
 }
@@ -2016,17 +2016,17 @@ public:
     nsPoint offset = ToReferenceFrame() + rect.TopLeft();
     nsBoundingMetrics bm;
     mChar->GetBoundingMetrics(bm);
     return nsRect(offset.x + bm.leftBearing, offset.y,
                   bm.rightBearing - bm.leftBearing, bm.ascent + bm.descent);
   }
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
-                     nsIRenderingContext* aCtx)
+                     nsRenderingContext* aCtx)
   {
     mChar->PaintForeground(mFrame->PresContext(), *aCtx,
                            ToReferenceFrame(), mIsSelected);
   }
 
   NS_DISPLAY_DECL_NAME("MathMLCharForeground", TYPE_MATHML_CHAR_FOREGROUND)
 
   virtual nsRect GetComponentAlphaBounds(nsDisplayListBuilder* aBuilder)
@@ -2049,25 +2049,25 @@ public:
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayMathMLCharDebug() {
     MOZ_COUNT_DTOR(nsDisplayMathMLCharDebug);
   }
 #endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
-                     nsIRenderingContext* aCtx);
+                     nsRenderingContext* aCtx);
   NS_DISPLAY_DECL_NAME("MathMLCharDebug", TYPE_MATHML_CHAR_DEBUG)
 
 private:
   nsRect mRect;
 };
 
 void nsDisplayMathMLCharDebug::Paint(nsDisplayListBuilder* aBuilder,
-                                     nsIRenderingContext* aCtx)
+                                     nsRenderingContext* aCtx)
 {
   // for visual debug
   PRIntn skipSides = 0;
   nsPresContext* presContext = mFrame->PresContext();
   nsStyleContext* styleContext = mFrame->GetStyleContext();
   nsRect rect = mRect + ToReferenceFrame();
   nsCSSRendering::PaintBorder(presContext, *aCtx, mFrame,
                               mVisibleRect, rect, styleContext, skipSides);
@@ -2124,31 +2124,31 @@ nsMathMLChar::Display(nsDisplayListBuild
 #endif
   }
   return aLists.Content()->AppendNewToTop(new (aBuilder)
         nsDisplayMathMLCharForeground(aBuilder, aForFrame, this,
                                       aSelectedRect && !aSelectedRect->IsEmpty()));
 }
 
 void
-nsMathMLChar::ApplyTransforms(nsIRenderingContext& aRenderingContext, nsRect &r)
+nsMathMLChar::ApplyTransforms(nsRenderingContext& aRenderingContext, nsRect &r)
 {
   // apply the transforms
   aRenderingContext.Translate(r.TopLeft());
   aRenderingContext.Scale(mScaleX, mScaleY);
 
   // update the bounding rectangle.
   r.x = r.y = 0;
   r.width /= mScaleX;
   r.height /= mScaleY;
 }
 
 void
 nsMathMLChar::PaintForeground(nsPresContext* aPresContext,
-                              nsIRenderingContext& aRenderingContext,
+                              nsRenderingContext& aRenderingContext,
                               nsPoint aPt,
                               PRBool aIsSelected)
 {
   nsStyleContext* parentContext = mStyleContext->GetParent();
   nsStyleContext* styleContext = mStyleContext;
 
   if (mDrawNormal) {
     // normal drawing if there is nothing special about this char
@@ -2205,19 +2205,19 @@ nsMathMLChar::PaintForeground(nsPresCont
   aRenderingContext.PopState();
 }
 
 /* =================================================================================
   And now the helper routines that actually do the job of painting the char by parts
  */
 
 class AutoPushClipRect {
-  nsIRenderingContext& mCtx;
+  nsRenderingContext& mCtx;
 public:
-  AutoPushClipRect(nsIRenderingContext& aCtx, const nsRect& aRect)
+  AutoPushClipRect(nsRenderingContext& aCtx, const nsRect& aRect)
     : mCtx(aCtx) {
     mCtx.PushState();
     mCtx.SetClipRect(aRect, nsClipCombine_kIntersect);
   }
   ~AutoPushClipRect() {
     mCtx.PopState();
   }
 };
@@ -2233,17 +2233,17 @@ SnapToDevPixels(const gfxContext* aThebe
   pt = aThebesContext->DeviceToUser(pt);
   return nsPoint(NSFloatPixelsToAppUnits(pt.x, aAppUnitsPerGfxUnit),
                  NSFloatPixelsToAppUnits(pt.y, aAppUnitsPerGfxUnit));
 }
 
 // paint a stretchy char by assembling glyphs vertically
 nsresult
 nsMathMLChar::PaintVertically(nsPresContext*      aPresContext,
-                              nsIRenderingContext& aRenderingContext,
+                              nsRenderingContext& aRenderingContext,
                               nsFont&              aFont,
                               nsStyleContext*      aStyleContext,
                               nsGlyphTable*        aGlyphTable,
                               nsRect&              aRect)
 {
   nsresult rv = NS_OK;
   // Get the device pixel size in the vertical direction.
   // (This makes no effort to optimize for non-translation transformations.)
@@ -2466,17 +2466,17 @@ nsMathMLChar::PaintVertically(nsPresCont
   }
 #endif
   return NS_OK;
 }
 
 // paint a stretchy char by assembling glyphs horizontally
 nsresult
 nsMathMLChar::PaintHorizontally(nsPresContext*      aPresContext,
-                                nsIRenderingContext& aRenderingContext,
+                                nsRenderingContext& aRenderingContext,
                                 nsFont&              aFont,
                                 nsStyleContext*      aStyleContext,
                                 nsGlyphTable*        aGlyphTable,
                                 nsRect&              aRect)
 {
   nsresult rv = NS_OK;
   // Get the device pixel size in the horizontal direction.
   // (This makes no effort to optimize for non-translation transformations.)
--- a/layout/mathml/nsMathMLChar.h
+++ b/layout/mathml/nsMathMLChar.h
@@ -126,26 +126,26 @@ public:
 
   nsresult
   Display(nsDisplayListBuilder*   aBuilder,
           nsIFrame*               aForFrame,
           const nsDisplayListSet& aLists,
           const nsRect*           aSelectedRect = nsnull);
           
   void PaintForeground(nsPresContext* aPresContext,
-                       nsIRenderingContext& aRenderingContext,
+                       nsRenderingContext& aRenderingContext,
                        nsPoint aPt,
                        PRBool aIsSelected);
 
   // This is the method called to ask the char to stretch itself.
   // @param aContainerSize - IN - suggested size for the stretched char
   // @param aDesiredStretchSize - OUT - the size that the char wants
   nsresult
   Stretch(nsPresContext*           aPresContext,
-          nsIRenderingContext&     aRenderingContext,
+          nsRenderingContext&     aRenderingContext,
           nsStretchDirection       aStretchDirection,
           const nsBoundingMetrics& aContainerSize,
           nsBoundingMetrics&       aDesiredStretchSize,
           PRUint32                 aStretchHint = NS_STRETCH_NORMAL);
 
   void
   SetData(nsPresContext* aPresContext,
           nsString&       aData);
@@ -196,17 +196,17 @@ public:
   //
   // @param aStretchHint can be the value that will be passed to Stretch().
   // It is used to determine whether the operator is stretchy or a largeop.
   // @param aMaxSize is the value of the "maxsize" attribute.
   // @param aMaxSizeIsAbsolute indicates whether the aMaxSize is an absolute
   // value in app units (PR_TRUE) or a multiplier of the base size (PR_FALSE).
   nscoord
   GetMaxWidth(nsPresContext* aPresContext,
-              nsIRenderingContext& aRenderingContext,
+              nsRenderingContext& aRenderingContext,
               PRUint32 aStretchHint = NS_STRETCH_NORMAL,
               float aMaxSize = NS_MATHML_OPERATOR_SIZE_INFINITY,
               // Perhaps just nsOperatorFlags aFlags.
               // But need DisplayStyle for largeOp,
               // or remove the largeop bit from flags.
               PRBool aMaxSizeIsAbsolute = PR_FALSE);
 
   // Metrics that _exactly_ enclose the char. The char *must* have *already*
@@ -258,45 +258,45 @@ private:
   PRPackedBool       mDrawNormal;
 
   class StretchEnumContext;
   friend class StretchEnumContext;
 
   // helper methods
   nsresult
   StretchInternal(nsPresContext*           aPresContext,
-                  nsIRenderingContext&     aRenderingContext,
+                  nsRenderingContext&     aRenderingContext,
                   nsStretchDirection&      aStretchDirection,
                   const nsBoundingMetrics& aContainerSize,
                   nsBoundingMetrics&       aDesiredStretchSize,
                   PRUint32                 aStretchHint,
                   float           aMaxSize = NS_MATHML_OPERATOR_SIZE_INFINITY,
                   PRBool          aMaxSizeIsAbsolute = PR_FALSE);
 
   nsresult
   ComposeChildren(nsPresContext*       aPresContext,
-                  nsIRenderingContext& aRenderingContext,
+                  nsRenderingContext& aRenderingContext,
                   nsGlyphTable*        aGlyphTable,
                   nscoord              aTargetSize,
                   nsBoundingMetrics&   aCompositeSize,
                   PRUint32             aStretchHint);
 
   nsresult
   PaintVertically(nsPresContext*       aPresContext,
-                  nsIRenderingContext& aRenderingContext,
+                  nsRenderingContext& aRenderingContext,
                   nsFont&              aFont,
                   nsStyleContext*      aStyleContext,
                   nsGlyphTable*        aGlyphTable,
                   nsRect&              aRect);
 
   nsresult
   PaintHorizontally(nsPresContext*       aPresContext,
-                    nsIRenderingContext& aRenderingContext,
+                    nsRenderingContext& aRenderingContext,
                     nsFont&              aFont,
                     nsStyleContext*      aStyleContext,
                     nsGlyphTable*        aGlyphTable,
                     nsRect&              aRect);
 
   void
-  ApplyTransforms(nsIRenderingContext& aRenderingContext, nsRect &r);
+  ApplyTransforms(nsRenderingContext& aRenderingContext, nsRect &r);
 };
 
 #endif /* nsMathMLChar_h___ */
--- a/layout/mathml/nsMathMLContainerFrame.cpp
+++ b/layout/mathml/nsMathMLContainerFrame.cpp
@@ -44,17 +44,17 @@
 #include "nsHTMLParts.h"
 #include "nsFrame.h"
 #include "nsPresContext.h"
 #include "nsIPresShell.h"
 #include "nsCSSAnonBoxes.h"
 #include "nsStyleContext.h"
 #include "nsStyleConsts.h"
 #include "nsINameSpaceManager.h"
-#include "nsIRenderingContext.h"
+#include "nsRenderingContext.h"
 #include "nsIFontMetrics.h"
 
 #include "nsIDOMText.h"
 #include "nsIDOMMutationEvent.h"
 #include "nsFrameManager.h"
 #include "nsStyleChangeList.h"
 
 #include "nsGkAtoms.h"
@@ -78,17 +78,17 @@ NS_QUERYFRAME_HEAD(nsMathMLContainerFram
   NS_QUERYFRAME_ENTRY(nsMathMLFrame)
 NS_QUERYFRAME_TAIL_INHERITING(nsHTMLContainerFrame)
 
 // =============================================================================
 
 // error handlers
 // provide a feedback to the user when a frame with bad markup can not be rendered
 nsresult
-nsMathMLContainerFrame::ReflowError(nsIRenderingContext& aRenderingContext,
+nsMathMLContainerFrame::ReflowError(nsRenderingContext& aRenderingContext,
                                     nsHTMLReflowMetrics& aDesiredSize)
 {
   nsresult rv;
 
   // clear all other flags and record that there is an error with this frame
   mEmbellishData.flags = 0;
   mPresentationData.flags = NS_MATHML_ERROR;
 
@@ -130,22 +130,22 @@ public:
   }
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayMathMLError() {
     MOZ_COUNT_DTOR(nsDisplayMathMLError);
   }
 #endif
 
   virtual void Paint(nsDisplayListBuilder* aBuilder,
-                     nsIRenderingContext* aCtx);
+                     nsRenderingContext* aCtx);
   NS_DISPLAY_DECL_NAME("MathMLError", TYPE_MATHML_ERROR)
 };
 
 void nsDisplayMathMLError::Paint(nsDisplayListBuilder* aBuilder,
-                                 nsIRenderingContext* aCtx)
+                                 nsRenderingContext* aCtx)
 {
   // Set color and font ...
   nsLayoutUtils::SetFontFromStyle(aCtx, mFrame->GetStyleContext());
 
   nsPoint pt = ToReferenceFrame();
   aCtx->SetColor(NS_RGB(255,0,0));
   aCtx->FillRect(nsRect(pt, mFrame->GetSize()));
   aCtx->SetColor(NS_RGB(255,255,255));
@@ -233,17 +233,17 @@ nsMathMLContainerFrame::ClearSavedChildM
     props->Delete(childFrame, HTMLReflowMetricsProperty());
     childFrame = childFrame->GetNextSibling();
   }
 }
 
 // helper to get the preferred size that a container frame should use to fire
 // the stretch on its stretchy child frames.
 void
-nsMathMLContainerFrame::GetPreferredStretchSize(nsIRenderingContext& aRenderingContext,
+nsMathMLContainerFrame::GetPreferredStretchSize(nsRenderingContext& aRenderingContext,
                                                 PRUint32             aOptions,
                                                 nsStretchDirection   aStretchDirection,
                                                 nsBoundingMetrics&   aPreferredStretchSize)
 {
   if (aOptions & STRETCH_CONSIDER_ACTUAL_SIZE) {
     // when our actual size is ok, just use it
     aPreferredStretchSize = mBoundingMetrics;
   }
@@ -328,17 +328,17 @@ nsMathMLContainerFrame::GetPreferredStre
       }
       childFrame = childFrame->GetNextSibling();
     }
     aPreferredStretchSize = bm;
   }
 }
 
 NS_IMETHODIMP
-nsMathMLContainerFrame::Stretch(nsIRenderingContext& aRenderingContext,
+nsMathMLContainerFrame::Stretch(nsRenderingContext& aRenderingContext,
                                 nsStretchDirection   aStretchDirection,
                                 nsBoundingMetrics&   aContainerSize,
                                 nsHTMLReflowMetrics& aDesiredStretchSize)
 {
   if (NS_MATHML_IS_EMBELLISH_OPERATOR(mEmbellishData.flags)) {
 
     if (NS_MATHML_STRETCH_WAS_DONE(mPresentationData.flags)) {
       NS_WARNING("it is wrong to fire stretch more than once on a frame");
@@ -479,17 +479,17 @@ nsMathMLContainerFrame::Stretch(nsIRende
         GatherAndStoreOverflow(&aDesiredStretchSize);
       }
     }
   }
   return NS_OK;
 }
 
 nsresult
-nsMathMLContainerFrame::FinalizeReflow(nsIRenderingContext& aRenderingContext,
+nsMathMLContainerFrame::FinalizeReflow(nsRenderingContext& aRenderingContext,
                                        nsHTMLReflowMetrics& aDesiredSize)
 {
   // During reflow, we use rect.x and rect.y as placeholders for the child's ascent
   // and descent in expectation of a stretch command. Hence we need to ensure that
   // a stretch command will actually be fired later on, after exiting from our
   // reflow. If the stretch is not fired, the rect.x, and rect.y will remain
   // with inappropriate data causing children to be improperly positioned.
   // This helper method checks to see if our parent will fire a stretch command
@@ -1026,35 +1026,35 @@ nsMathMLContainerFrame::Reflow(nsPresCon
   FinalizeReflow(*aReflowState.rendContext, aDesiredSize);
 
   aStatus = NS_FRAME_COMPLETE;
   NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aDesiredSize);
   return NS_OK;
 }
 
 /* virtual */ nscoord
-nsMathMLContainerFrame::GetMinWidth(nsIRenderingContext *aRenderingContext)
+nsMathMLContainerFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord result;
   DISPLAY_MIN_WIDTH(this, result);
   result = GetIntrinsicWidth(aRenderingContext);
   return result;
 }
 
 /* virtual */ nscoord
-nsMathMLContainerFrame::GetPrefWidth(nsIRenderingContext *aRenderingContext)
+nsMathMLContainerFrame::GetPrefWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord result;
   DISPLAY_MIN_WIDTH(this, result);
   result = GetIntrinsicWidth(aRenderingContext);
   return result;
 }
 
 /* virtual */ nscoord
-nsMathMLContainerFrame::GetIntrinsicWidth(nsIRenderingContext* aRenderingContext)
+nsMathMLContainerFrame::GetIntrinsicWidth(nsRenderingContext* aRenderingContext)
 {
   // Get child widths
   nsIFrame* childFrame = mFrames.FirstChild();
   while (childFrame) {
     // XXX This includes margin while Reflow currently doesn't consider
     // margin, so we may end up with too much space, but, with stretchy
     // characters, this is an approximation anyway.
     nscoord width =
@@ -1082,17 +1082,17 @@ nsMathMLContainerFrame::GetIntrinsicWidt
   }
 
   ClearSavedChildMetrics();
 
   return desiredSize.width;
 }
 
 /* virtual */ nsresult
-nsMathMLContainerFrame::MeasureForWidth(nsIRenderingContext& aRenderingContext,
+nsMathMLContainerFrame::MeasureForWidth(nsRenderingContext& aRenderingContext,
                                         nsHTMLReflowMetrics& aDesiredSize)
 {
   return Place(aRenderingContext, PR_FALSE, aDesiredSize);
 }
 
 
 // see spacing table in Chapter 18, TeXBook (p.170)
 // Our table isn't quite identical to TeX because operators have 
@@ -1276,17 +1276,17 @@ private:
                         mItalicCorrection);
     // add left correction -- this fixes the problem of the italic 'f'
     // e.g., <mo>q</mo> <mi>f</mi> <mo>I</mo> 
     mX += leftCorrection;
   }
 };
 
 /* virtual */ nsresult
-nsMathMLContainerFrame::Place(nsIRenderingContext& aRenderingContext,
+nsMathMLContainerFrame::Place(nsRenderingContext& aRenderingContext,
                               PRBool               aPlaceOrigin,
                               nsHTMLReflowMetrics& aDesiredSize)
 {
   // This is needed in case this frame is empty (i.e., no child frames)
   mBoundingMetrics.Clear();
 
   RowChildFrameIterator child(this);
   nscoord ascent = 0, descent = 0;
--- a/layout/mathml/nsMathMLContainerFrame.h
+++ b/layout/mathml/nsMathMLContainerFrame.h
@@ -74,17 +74,17 @@ public:
 
   NS_DECL_QUERYFRAME
   NS_DECL_FRAMEARENA_HELPERS
 
   // --------------------------------------------------------------------------
   // Overloaded nsMathMLFrame methods -- see documentation in nsIMathMLFrame.h
 
   NS_IMETHOD
-  Stretch(nsIRenderingContext& aRenderingContext,
+  Stretch(nsRenderingContext& aRenderingContext,
           nsStretchDirection   aStretchDirection,
           nsBoundingMetrics&   aContainerSize,
           nsHTMLReflowMetrics& aDesiredStretchSize);
 
   NS_IMETHOD
   UpdatePresentationDataFromChildAt(PRInt32         aFirstIndex,
                                     PRInt32         aLastIndex,
                                     PRUint32        aFlagsValues,
@@ -131,23 +131,23 @@ public:
   NS_IMETHOD
   RemoveFrame(nsIAtom*        aListName,
               nsIFrame*       aOldFrame);
 
   /**
    * Both GetMinWidth and GetPrefWidth return whatever
    * GetIntrinsicWidth returns.
    */
-  virtual nscoord GetMinWidth(nsIRenderingContext *aRenderingContext);
-  virtual nscoord GetPrefWidth(nsIRenderingContext *aRenderingContext);
+  virtual nscoord GetMinWidth(nsRenderingContext *aRenderingContext);
+  virtual nscoord GetPrefWidth(nsRenderingContext *aRenderingContext);
 
   /**
    * Return the intrinsic width of the frame's content area.
    */
-  virtual nscoord GetIntrinsicWidth(nsIRenderingContext *aRenderingContext);
+  virtual nscoord GetIntrinsicWidth(nsRenderingContext *aRenderingContext);
 
   NS_IMETHOD
   Reflow(nsPresContext*          aPresContext,
          nsHTMLReflowMetrics&     aDesiredSize,
          const nsHTMLReflowState& aReflowState,
          nsReflowStatus&          aStatus);
 
   NS_IMETHOD
@@ -222,56 +222,56 @@ protected:
    *
    * @param aDesiredSize [out] parameter where you should return your desired
    *        size and your ascent/descent info. Compute your desired size using
    *        the information from GetReflowAndBoundingMetricsFor, and include
    *        any space you want for border/padding in the desired size you
    *        return.
    */
   virtual nsresult
-  Place(nsIRenderingContext& aRenderingContext,
+  Place(nsRenderingContext& aRenderingContext,
         PRBool               aPlaceOrigin,
         nsHTMLReflowMetrics& aDesiredSize);
 
   // MeasureForWidth:
   //
   // A method used by nsMathMLContainerFrame::GetIntrinsicWidth to get the
   // width that a particular Place method desires.  For most frames, this will
   // just call the object's Place method.  However <msqrt> and <menclose> use
   // nsMathMLContainerFrame::GetIntrinsicWidth to measure the child frames as
   // if in an <mrow>, and so their frames implement MeasureForWidth to use
   // nsMathMLContainerFrame::Place.
   virtual nsresult
-  MeasureForWidth(nsIRenderingContext& aRenderingContext,
+  MeasureForWidth(nsRenderingContext& aRenderingContext,
                   nsHTMLReflowMetrics& aDesiredSize);
 
 
   // helper to re-sync the automatic data in our children and notify our parent to
   // reflow us when changes (e.g., append/insert/remove) happen in our child list
   virtual nsresult
   ChildListChanged(PRInt32 aModType);
 
   // helper to get the preferred size that a container frame should use to fire
   // the stretch on its stretchy child frames.
   void
-  GetPreferredStretchSize(nsIRenderingContext& aRenderingContext,
+  GetPreferredStretchSize(nsRenderingContext& aRenderingContext,
                           PRUint32             aOptions,
                           nsStretchDirection   aStretchDirection,
                           nsBoundingMetrics&   aPreferredStretchSize);
 
   // helper used by mstyle, mphantom, mpadded and mrow in their implementation
   // of TransmitAutomaticData() to determine whether they are space-like.
   nsresult
   TransmitAutomaticDataForMrowLikeElement();
 
 public:
   // error handlers to provide a visual feedback to the user when an error
   // (typically invalid markup) was encountered during reflow.
   nsresult
-  ReflowError(nsIRenderingContext& aRenderingContext,
+  ReflowError(nsRenderingContext& aRenderingContext,
               nsHTMLReflowMetrics& aDesiredSize);
 
   // helper method to reflow a child frame. We are inline frames, and we don't
   // know our positions until reflow is finished. That's why we ask the
   // base method not to worry about our position.
   nsresult 
   ReflowChild(nsIFrame*                aKidFrame,
               nsPresContext*          aPresContext,
@@ -288,17 +288,17 @@ protected:
   // emulate the spacing that would have been done by a <mrow> container.
   // e.g., it fixes <math> <mi>f</mi> <mo>q</mo> <mi>f</mi> <mo>I</mo> </math>
   virtual nscoord
   FixInterFrameSpacing(nsHTMLReflowMetrics& aDesiredSize);
 
   // helper method to complete the post-reflow hook and ensure that embellished
   // operators don't terminate their Reflow without receiving a Stretch command.
   virtual nsresult
-  FinalizeReflow(nsIRenderingContext& aRenderingContext,
+  FinalizeReflow(nsRenderingContext& aRenderingContext,
                  nsHTMLReflowMetrics& aDesiredSize);
 
   // Record metrics of a child frame for recovery through the following method
   static void
   SaveReflowAndBoundingMetricsFor(nsIFrame*                  aFrame,
                                   const nsHTMLReflowMetrics& aReflowMetrics,
                                   const nsBoundingMetrics&   aBoundingMetrics);