Backout a55eea2c294d (bug 627699) for bustage
authorEd Morley <emorley@mozilla.com>
Wed, 13 Jun 2012 16:07:22 +0100
changeset 101396 2a0ae73dafcfbc48649fd4557616e69732c73107
parent 101395 ffc7f6a20da6d29ba4fb642a25746afef2477b7e
child 101397 112ab5ba3ac43a6a6a0683039169c629bf1ccbc9
push id1316
push userakeybl@mozilla.com
push dateMon, 27 Aug 2012 22:37:00 +0000
treeherdermozilla-beta@db4b09302ee2 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs627699
milestone16.0a1
backs outa55eea2c294d6cada5beee638bb4a3a4797cbc19
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backout a55eea2c294d (bug 627699) for bustage
gfx/gl/GLContextProviderEGL.cpp
gfx/gl/GLContextProviderGLX.cpp
gfx/src/X11Util.h
gfx/src/nsDeviceContext.cpp
gfx/tests/gfxFontSelectionTest.cpp
gfx/tests/gfxTextRunPerfTest.cpp
gfx/tests/gfxWordCacheTest.cpp
gfx/thebes/gfxFT2Fonts.cpp
gfx/thebes/gfxGdkNativeRenderer.cpp
gfx/thebes/gfxGdkNativeRenderer.h
gfx/thebes/gfxPangoFonts.cpp
gfx/thebes/gfxPlatform.cpp
gfx/thebes/gfxPlatformGtk.cpp
gfx/thebes/gfxPlatformGtk.h
gfx/thebes/gfxXlibNativeRenderer.cpp
gfx/thebes/gfxXlibNativeRenderer.h
--- a/gfx/gl/GLContextProviderEGL.cpp
+++ b/gfx/gl/GLContextProviderEGL.cpp
@@ -3,17 +3,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "mozilla/Util.h"
 // please add new includes below Qt, otherwise it break Qt build due malloc wrapper conflicts
 
 #if defined(XP_UNIX)
 
-#if (MOZ_WIDGET_GTK >= 2)
+#ifdef MOZ_WIDGET_GTK2
 #include <gdk/gdkx.h>
 // we're using default display for now
 #define GET_NATIVE_WINDOW(aWidget) (EGLNativeWindowType)GDK_WINDOW_XID((GdkWindow *) aWidget->GetNativeData(NS_NATIVE_WINDOW))
 #elif defined(MOZ_WIDGET_QT)
 #include <QtOpenGL/QGLContext>
 #define GLdouble_defined 1
 // we're using default display for now
 #define GET_NATIVE_WINDOW(aWidget) (EGLNativeWindowType)static_cast<QWidget*>(aWidget->GetNativeData(NS_NATIVE_SHELLWIDGET))->winId()
--- a/gfx/gl/GLContextProviderGLX.cpp
+++ b/gfx/gl/GLContextProviderGLX.cpp
@@ -1,14 +1,14 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#if (MOZ_WIDGET_GTK >= 2)
+#ifdef MOZ_WIDGET_GTK2
 #include <gdk/gdk.h>
 #include <gdk/gdkx.h>
 #define GET_NATIVE_WINDOW(aWidget) GDK_WINDOW_XID((GdkWindow *) aWidget->GetNativeData(NS_NATIVE_WINDOW))
 #elif defined(MOZ_WIDGET_QT)
 #include <QWidget>
 #define GET_NATIVE_WINDOW(aWidget) static_cast<QWidget*>(aWidget->GetNativeData(NS_NATIVE_SHELLWIDGET))->winId()
 #endif
 
@@ -27,17 +27,17 @@
 #include "gfxContext.h"
 #include "gfxImageSurface.h"
 #include "gfxPlatform.h"
 #include "GLContext.h"
 #include "gfxUtils.h"
 
 #include "gfxCrashReporterUtils.h"
 
-#if (MOZ_WIDGET_GTK >= 2)
+#ifdef MOZ_WIDGET_GTK2
 #include "gfxPlatformGtk.h"
 #endif
 
 namespace mozilla {
 namespace gl {
 
 static bool gIsATI = false;
 static bool gIsChromium = false;
@@ -219,17 +219,17 @@ GLXLibrary::EnsureInitialized()
         NS_WARNING("Couldn't find required entry point in OpenGL shared library");
         return false;
     }
 
     if (HasExtension(extensionsStr, "GLX_EXT_texture_from_pixmap") &&
         GLLibraryLoader::LoadSymbols(mOGLLibrary, symbols_texturefrompixmap, 
                                          (GLLibraryLoader::PlatformLookupFunction)&xGetProcAddress))
     {
-#if (MOZ_WIDGET_GTK >= 2)
+#ifdef MOZ_WIDGET_GTK2
         mUseTextureFromPixmap = gfxPlatformGtk::UseXRender();
 #else
         mUseTextureFromPixmap = true;
 #endif
     } else {
         mUseTextureFromPixmap = false;
         NS_WARNING("Texture from pixmap disabled");
     }
--- a/gfx/src/X11Util.h
+++ b/gfx/src/X11Util.h
@@ -5,17 +5,17 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef mozilla_X11Util_h
 #define mozilla_X11Util_h
 
 // Utilities common to all X clients, regardless of UI toolkit.
 
-#if (MOZ_WIDGET_GTK >= 2)
+#if defined(MOZ_WIDGET_GTK2)
 #  include <gdk/gdkx.h>
 #elif defined(MOZ_WIDGET_QT)
 #include "gfxQtPlatform.h"
 #undef CursorShape
 #  include <X11/Xlib.h>
 #else
 #  error Unknown toolkit
 #endif 
@@ -28,18 +28,18 @@
 namespace mozilla {
 
 /**
  * Return the default X Display created and used by the UI toolkit.
  */
 inline Display*
 DefaultXDisplay()
 {
-#if (MOZ_WIDGET_GTK >= 2)
-  return GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
+#if defined(MOZ_WIDGET_GTK2)
+  return GDK_DISPLAY();
 #elif defined(MOZ_WIDGET_QT)
   return gfxQtPlatform::GetXDisplay();
 #endif
 }
 
 /**
  * Sets *aVisual to point to aDisplay's Visual struct corresponding to
  * aVisualID, and *aDepth to its depth.  When aVisualID is None, these are set
--- a/gfx/src/nsDeviceContext.cpp
+++ b/gfx/src/nsDeviceContext.cpp
@@ -18,17 +18,17 @@
 #include "nsIObserverService.h"
 
 #include "gfxImageSurface.h"
 
 #if !XP_MACOSX
 #include "gfxPDFSurface.h"
 #endif
 
-#if (MOZ_WIDGET_GTK >= 2)
+#ifdef MOZ_ENABLE_GTK2
 #include "gfxPSSurface.h"
 #elif XP_WIN
 #include "gfxWindowsSurface.h"
 #elif defined(XP_OS2)
 #include "gfxOS2Surface.h"
 #elif XP_MACOSX
 #include "gfxQuartzSurface.h"
 #endif
@@ -635,17 +635,17 @@ nsDeviceContext::CalcPrintingSize()
 
 #if defined(MOZ_PDF_PRINTING)
     case gfxASurface::SurfaceTypePDF:
         inPoints = true;
         size = reinterpret_cast<gfxPDFSurface*>(mPrintingSurface.get())->GetSize();
         break;
 #endif
 
-#if (MOZ_WIDGET_GTK >= 2)
+#ifdef MOZ_ENABLE_GTK2
     case gfxASurface::SurfaceTypePS:
         inPoints = true;
         size = reinterpret_cast<gfxPSSurface*>(mPrintingSurface.get())->GetSize();
         break;
 #endif
 
 #ifdef XP_MACOSX
     case gfxASurface::SurfaceTypeQuartz:
--- a/gfx/tests/gfxFontSelectionTest.cpp
+++ b/gfx/tests/gfxFontSelectionTest.cpp
@@ -15,17 +15,17 @@
 #include "gfxPlatform.h"
 
 #include "gfxFontTest.h"
 
 #if defined(XP_MACOSX)
 #include "gfxTestCocoaHelper.h"
 #endif
 
-#if (MOZ_WIDGET_GTK >= 2)
+#ifdef MOZ_WIDGET_GTK2
 #include "gtk/gtk.h"
 #endif
 
 using namespace mozilla;
 
 enum {
     S_UTF8 = 0,
     S_ASCII = 1
@@ -292,17 +292,17 @@ RunTest (TestEntry *test, gfxContext *ct
     return true;
 }
 
 int
 main (int argc, char **argv) {
     int passed = 0;
     int failed = 0;
 
-#if (MOZ_WIDGET_GTK >= 2)
+#ifdef MOZ_WIDGET_GTK2
     gtk_init(&argc, &argv); 
 #endif
 #ifdef XP_MACOSX
     CocoaPoolInit();
 #endif
 
     // Initialize XPCOM
     nsresult rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);
--- a/gfx/tests/gfxTextRunPerfTest.cpp
+++ b/gfx/tests/gfxTextRunPerfTest.cpp
@@ -17,17 +17,17 @@
 #include "gfxPlatform.h"
 
 #include "gfxFontTest.h"
 
 #if defined(XP_MACOSX)
 #include "gfxTestCocoaHelper.h"
 #endif
 
-#if (MOZ_WIDGET_GTK >= 2)
+#ifdef MOZ_WIDGET_GTK2
 #include "gtk/gtk.h"
 #endif
 
 using namespace mozilla;
 
 struct TestEntry {
   const char* mFamilies;
   const char* mString;
@@ -101,17 +101,17 @@ RunTest (TestEntry *test, gfxContext *ct
     
     textRun->GetAdvanceWidth(0, length, nsnull);
 }
 
 PRUint32 iterations = 20;
 
 int
 main (int argc, char **argv) {
-#if (MOZ_WIDGET_GTK >= 2)
+#ifdef MOZ_WIDGET_GTK2
     gtk_init(&argc, &argv); 
 #endif
 #ifdef XP_MACOSX
     CocoaPoolInit();
 #endif
 
     // Initialize XPCOM
     nsresult rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);
--- a/gfx/tests/gfxWordCacheTest.cpp
+++ b/gfx/tests/gfxWordCacheTest.cpp
@@ -15,17 +15,17 @@
 #include "gfxPlatform.h"
 
 #include "gfxFontTest.h"
 
 #if defined(XP_MACOSX)
 #include "gfxTestCocoaHelper.h"
 #endif
 
-#if (MOZ_WIDGET_GTK >= 2)
+#ifdef MOZ_WIDGET_GTK2
 #include "gtk/gtk.h"
 #endif
 
 class FrameTextRunCache;
 
 static FrameTextRunCache *gTextRuns = nsnull;
 
 /*
@@ -88,17 +88,17 @@ MakeContext ()
                               gfxASurface::ContentFromFormat(gfxASurface::ImageFormatRGB24));
    gfxContext *ctx = new gfxContext(surface);
    NS_IF_ADDREF(ctx);
    return ctx;
 }
 
 int
 main (int argc, char **argv) {
-#if (MOZ_WIDGET_GTK >= 2)
+#ifdef MOZ_WIDGET_GTK2
    gtk_init(&argc, &argv);
 #endif
 #ifdef XP_MACOSX
    CocoaPoolInit();
 #endif
 
    // Initialize XPCOM
    nsresult rv = NS_InitXPCOM2(nsnull, nsnull, nsnull);
--- a/gfx/thebes/gfxFT2Fonts.cpp
+++ b/gfx/thebes/gfxFT2Fonts.cpp
@@ -1,14 +1,14 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 4 -*-
  * This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-#if (MOZ_WIDGET_GTK >= 2)
+#if defined(MOZ_WIDGET_GTK2)
 #include "gfxPlatformGtk.h"
 #define gfxToolkitPlatform gfxPlatformGtk
 #elif defined(MOZ_WIDGET_QT)
 #include <qfontinfo.h>
 #include "gfxQtPlatform.h"
 #define gfxToolkitPlatform gfxQtPlatform
 #elif defined(XP_WIN)
 #include "gfxWindowsPlatform.h"
@@ -92,17 +92,17 @@ gfxFT2FontGroup::gfxFT2FontGroup(const n
     }
     if (familyArray.Length() == 0) {
 #if defined(MOZ_WIDGET_QT) /* FIXME DFB */
         printf("failde to find a font. sadface\n");
         // We want to get rid of this entirely at some point, but first we need real lists of fonts.
         QFont defaultFont;
         QFontInfo fi (defaultFont);
         familyArray.AppendElement(nsDependentString(static_cast<const PRUnichar *>(fi.family().utf16())));
-#elif (MOZ_WIDGET_GTK >= 2)
+#elif defined(MOZ_WIDGET_GTK2)
         FcResult result;
         FcChar8 *family = nsnull;
         FcPattern* pat = FcPatternCreate();
         FcPattern *match = FcFontMatch(nsnull, pat, &result);
         if (match)
             FcPatternGetString(match, FC_FAMILY, 0, &family);
         if (family)
             familyArray.AppendElement(NS_ConvertUTF8toUTF16((char*)family));
--- a/gfx/thebes/gfxGdkNativeRenderer.cpp
+++ b/gfx/thebes/gfxGdkNativeRenderer.cpp
@@ -6,18 +6,16 @@
 #include "gfxGdkNativeRenderer.h"
 #include "gfxContext.h"
 #include "gfxPlatformGtk.h"
 
 #ifdef MOZ_X11
 #include <gdk/gdkx.h>
 #include "cairo-xlib.h"
 #include "gfxXlibSurface.h"
-
-#if defined(MOZ_WIDGET_GTK2)
 nsresult
 gfxGdkNativeRenderer::DrawWithXlib(gfxXlibSurface* surface,
                                    nsIntPoint offset,
                                    nsIntRect* clipRects, PRUint32 numClipRects)
 {
     GdkDrawable *drawable = gfxPlatformGtk::GetGdkDrawable(surface);
     if (!drawable) {
         gfxIntSize size = surface->GetSize();
@@ -56,41 +54,9 @@ gfxGdkNativeRenderer::Draw(gfxContext* c
     Visual* visual =
         gdk_x11_visual_get_xvisual(gdk_colormap_get_visual(colormap));
     Screen* screen =
         gdk_x11_screen_get_xscreen(gdk_colormap_get_screen(colormap));
 
     gfxXlibNativeRenderer::Draw(ctx, size, flags, screen, visual, nsnull);
 }
 
-#else
-nsresult
-gfxGdkNativeRenderer::DrawWithXlib(cairo_t* cr,
-                                   nsIntPoint offset,
-                                   nsIntRect* clipRects, PRUint32 numClipRects)
-{
-    GdkRectangle clipRect;
-    if (numClipRects) {
-        NS_ASSERTION(numClipRects == 1, "Too many clip rects");
-        clipRect.x = clipRects[0].x;
-        clipRect.y = clipRects[0].y;
-        clipRect.width = clipRects[0].width;
-        clipRect.height = clipRects[0].height;
-    }
-
-    nsresult rv = DrawWithGDK(cr, offset.x, offset.y,
-                              numClipRects ? &clipRect : NULL, numClipRects);
-    return rv;
-}
-
-void
-gfxGdkNativeRenderer::Draw(gfxContext* ctx, nsIntSize size,
-                           PRUint32 flags, GdkVisual *visual)
-{
-    mVisual = gdk_visual_get_system();
-    Visual* xvisual = gdk_x11_visual_get_xvisual(mVisual);
-    Screen* xscreen = gdk_x11_screen_get_xscreen(gdk_screen_get_default());
-
-    gfxXlibNativeRenderer::Draw(ctx, size, flags, xscreen, xvisual, nsnull);
-}
 #endif
-
-#endif
--- a/gfx/thebes/gfxGdkNativeRenderer.h
+++ b/gfx/thebes/gfxGdkNativeRenderer.h
@@ -30,25 +30,19 @@ public:
     /**
      * Perform the native drawing.
      * @param offsetX draw at this offset into the given drawable
      * @param offsetY draw at this offset into the given drawable
      * @param clipRects an array of rects; clip to the union
      * @param numClipRects the number of rects in the array, or zero if
      * no clipping is required
      */
-
-#if defined(MOZ_WIDGET_GTK2)
     virtual nsresult DrawWithGDK(GdkDrawable * drawable, gint offsetX, 
             gint offsetY, GdkRectangle * clipRects, PRUint32 numClipRects) = 0;
-#else
-    virtual nsresult DrawWithGDK(cairo_t * cr, gint offsetX, 
-            gint offsetY, GdkRectangle * clipRects, PRUint32 numClipRects) = 0;
-#endif
-
+  
     enum {
         // If set, then Draw() is opaque, i.e., every pixel in the intersection
         // of the clipRect and (offset.x,offset.y,bounds.width,bounds.height)
         // will be set and there is no dependence on what the existing pixels
         // in the drawable are set to.
         DRAW_IS_OPAQUE =
 #ifdef MOZ_X11
             gfxXlibNativeRenderer::DRAW_IS_OPAQUE
@@ -66,35 +60,23 @@ public:
     };
 
     /**
      * @param flags see above
      * @param bounds Draw()'s drawing is guaranteed to be restricted to
      * the rectangle (offset.x,offset.y,bounds.width,bounds.height)
      * @param dpy a display to use for the drawing if ctx doesn't have one
      */
-#if defined(MOZ_WIDGET_GTK2)
     void Draw(gfxContext* ctx, nsIntSize size,
               PRUint32 flags, GdkColormap* colormap);
-#else
-    void Draw(gfxContext* ctx, nsIntSize size,
-              PRUint32 flags, GdkVisual *visual);
-#endif
 
 private:
 #ifdef MOZ_X11
-#if defined(MOZ_WIDGET_GTK2)
     // for gfxXlibNativeRenderer:
     virtual nsresult DrawWithXlib(gfxXlibSurface* surface,
                                   nsIntPoint offset,
                                   nsIntRect* clipRects, PRUint32 numClipRects);
+
     GdkColormap *mColormap;
-#else
-    // for gfxXlibNativeRenderer:
-    virtual nsresult DrawWithXlib(cairo_t *cr,
-                                  nsIntPoint offset,
-                                  nsIntRect* clipRects, PRUint32 numClipRects);
-    GdkVisual *mVisual;
-#endif
 #endif
 };
 
 #endif /*GFXGDKNATIVERENDER_H_*/
--- a/gfx/thebes/gfxPangoFonts.cpp
+++ b/gfx/thebes/gfxPangoFonts.cpp
@@ -10,17 +10,17 @@
 
 #include "prtypes.h"
 #include "prlink.h"
 #include "gfxTypes.h"
 
 #include "nsTArray.h"
 
 #include "gfxContext.h"
-#if (MOZ_WIDGET_GTK >= 2)
+#ifdef MOZ_WIDGET_GTK2
 #include "gfxPlatformGtk.h"
 #endif
 #ifdef MOZ_WIDGET_QT
 #include "gfxQtPlatform.h"
 #endif
 #include "gfxPangoFonts.h"
 #include "gfxFT2FontBase.h"
 #include "gfxFT2Utils.h"
@@ -39,17 +39,17 @@
 #include <cairo-ft.h>
 
 #include <fontconfig/fcfreetype.h>
 #include <pango/pango.h>
 #include <pango/pangocairo.h>
 #include <pango/pango-modules.h>
 #include <pango/pangofc-fontmap.h>
 
-#if (MOZ_WIDGET_GTK >= 2)
+#ifdef MOZ_WIDGET_GTK2
 #include <gdk/gdk.h>
 #endif
 
 #include <math.h>
 
 using namespace mozilla;
 using namespace mozilla::unicode;
 
@@ -945,17 +945,17 @@ gfx_pango_fc_font_get_coverage(PangoFont
     }
 
     return pango_coverage_ref(self->mCoverage);
 }
 
 static PRInt32
 GetDPI()
 {
-#if (MOZ_WIDGET_GTK >= 2)
+#if defined(MOZ_WIDGET_GTK2)
     return gfxPlatformGtk::GetDPI();
 #elif defined(MOZ_WIDGET_QT)
     return gfxQtPlatform::GetDPI();
 #else
     return 96;
 #endif
 }
 
@@ -1726,17 +1726,17 @@ gfx_pango_font_map_class_init(gfxPangoFo
     // The API for create_font changed between Pango 1.22 and 1.24 so new_font
     // is provided instead.
     fcfontmap_class->new_font = gfx_pango_font_map_new_font;
     // get_resolution is not required.
     // context_key_* virtual functions are only necessary if we want to
     // dynamically respond to changes in the screen cairo_font_options_t.
 }
 
-#if (MOZ_WIDGET_GTK >= 2)
+#ifdef MOZ_WIDGET_GTK2
 static void ApplyGdkScreenFontOptions(FcPattern *aPattern);
 #endif
 
 // Apply user settings and defaults to pattern in preparation for matching.
 static void
 PrepareSortPattern(FcPattern *aPattern, double aFallbackSize,
                    double aSizeAdjustFactor, bool aIsPrinterFont)
 {
@@ -1763,17 +1763,17 @@ PrepareSortPattern(FcPattern *aPattern, 
        FcPatternAddBool(aPattern, PRINTING_FC_PROPERTY, FcTrue);
     } else {
 #ifdef MOZ_GFX_OPTIMIZE_MOBILE
        cairo_font_options_t *options = cairo_font_options_create();
        cairo_font_options_set_hint_style(options, CAIRO_HINT_STYLE_NONE);
        cairo_ft_font_options_substitute(options, aPattern);
        cairo_font_options_destroy(options);
 #endif
-#if (MOZ_WIDGET_GTK >= 2)
+#ifdef MOZ_WIDGET_GTK2
        ApplyGdkScreenFontOptions(aPattern);
 #endif
     }
 
     // Protect against any fontconfig settings that may have incorrectly
     // modified the pixelsize, and consider aSizeAdjustFactor.
     double size = aFallbackSize;
     if (FcPatternGetDouble(aPattern, FC_PIXEL_SIZE, 0, &size) != FcResultMatch
@@ -3140,17 +3140,17 @@ GuessPangoLanguage(nsIAtom *aLanguage)
     nsCAutoString lang;
     gfxFontconfigUtils::GetSampleLangForGroup(aLanguage, &lang);
     if (lang.IsEmpty())
         return NULL;
 
     return pango_language_from_string(lang.get());
 }
 
-#if (MOZ_WIDGET_GTK >= 2)
+#ifdef MOZ_WIDGET_GTK2
 /***************************************************************************
  *
  * This function must be last in the file because it uses the system cairo
  * library.  Above this point the cairo library used is the tree cairo if
  * MOZ_TREE_CAIRO.
  */
 
 #if MOZ_TREE_CAIRO
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -10,17 +10,17 @@
 
 #include "gfxPlatform.h"
 
 #if defined(XP_WIN)
 #include "gfxWindowsPlatform.h"
 #include "gfxD2DSurface.h"
 #elif defined(XP_MACOSX)
 #include "gfxPlatformMac.h"
-#elif (MOZ_WIDGET_GTK >= 2)
+#elif defined(MOZ_WIDGET_GTK2)
 #include "gfxPlatformGtk.h"
 #elif defined(MOZ_WIDGET_QT)
 #include "gfxQtPlatform.h"
 #elif defined(XP_OS2)
 #include "gfxOS2Platform.h"
 #elif defined(ANDROID)
 #include "gfxAndroidPlatform.h"
 #endif
@@ -253,17 +253,17 @@ gfxPlatform::Init()
     nsCOMPtr<nsIGfxInfo> gfxInfo;
     /* this currently will only succeed on Windows */
     gfxInfo = do_GetService("@mozilla.org/gfx/info;1");
 
 #if defined(XP_WIN)
     gPlatform = new gfxWindowsPlatform;
 #elif defined(XP_MACOSX)
     gPlatform = new gfxPlatformMac;
-#elif (MOZ_WIDGET_GTK >= 2)
+#elif defined(MOZ_WIDGET_GTK2)
     gPlatform = new gfxPlatformGtk;
 #elif defined(MOZ_WIDGET_QT)
     gPlatform = new gfxQtPlatform;
 #elif defined(XP_OS2)
     gPlatform = new gfxOS2Platform;
 #elif defined(ANDROID)
     gPlatform = new gfxAndroidPlatform;
 #else
--- a/gfx/thebes/gfxPlatformGtk.cpp
+++ b/gfx/thebes/gfxPlatformGtk.cpp
@@ -63,21 +63,17 @@ static FontTable *gPlatformFontAliases =
 static PrefFontTable *gPrefFonts = NULL;
 static gfxSparseBitSet *gCodepointsWithNoFonts = NULL;
 static FT_Library gPlatformFTLibrary = NULL;
 #endif
 
 static cairo_user_data_key_t cairo_gdk_drawable_key;
 static void do_gdk_drawable_unref (void *data)
 {
-#if defined(MOZ_WIDGET_GTK2)
     GdkDrawable *d = (GdkDrawable*) data;
-#else
-    GdkWindow *d = (GdkWindow*) data;
-#endif
     g_object_unref (d);
 }
 
 #ifdef MOZ_X11
     bool gfxPlatformGtk::sUseXRender = true;
 #endif
 
 gfxPlatformGtk::gfxPlatformGtk()
@@ -474,32 +470,32 @@ gfxPlatformGtk::GetDPI()
     return sDPI;
 }
 
 gfxImageFormat
 gfxPlatformGtk::GetOffscreenFormat()
 {
     // Make sure there is a screen
     GdkScreen *screen = gdk_screen_get_default();
-    if (screen && gdk_visual_get_depth(gdk_visual_get_system()) == 16) {
+    if (screen && gdk_visual_get_system()->depth == 16) {
         return gfxASurface::ImageFormatRGB16_565;
     }
 
     return gfxASurface::ImageFormatRGB24;
 }
 
 qcms_profile *
 gfxPlatformGtk::GetPlatformCMSOutputProfile()
 {
 #ifdef MOZ_X11
     const char EDID1_ATOM_NAME[] = "XFree86_DDC_EDID1_RAWDATA";
     const char ICC_PROFILE_ATOM_NAME[] = "_ICC_PROFILE";
 
     Atom edidAtom, iccAtom;
-    Display *dpy = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
+    Display *dpy = GDK_DISPLAY();
     Window root = gdk_x11_get_default_root_xwindow();
 
     Atom retAtom;
     int retFormat;
     unsigned long retLength, retAfter;
     unsigned char *retProperty ;
 
     iccAtom = XInternAtom(dpy, ICC_PROFILE_ATOM_NAME, TRUE);
@@ -689,17 +685,17 @@ gfxPlatformGtk::GetPrefFontEntries(const
 
 void
 gfxPlatformGtk::SetPrefFontEntries(const nsCString& aKey, nsTArray<nsRefPtr<gfxFontEntry> >& aFontEntryList)
 {
     gPrefFonts->Put(aKey, aFontEntryList);
 }
 #endif
 
-#if defined(MOZ_WIDGET_GTK2)
+
 void
 gfxPlatformGtk::SetGdkDrawable(gfxASurface *target,
                                GdkDrawable *drawable)
 {
     if (target->CairoStatus())
         return;
 
     g_object_ref(drawable);
@@ -734,17 +730,16 @@ gfxPlatformGtk::GetGdkDrawable(gfxASurfa
     if (result) {
         SetGdkDrawable(target, result);
         return result;
     }
 #endif
 
     return NULL;
 }
-#endif
 
 RefPtr<ScaledFont>
 gfxPlatformGtk::GetScaledFontForFont(gfxFont *aFont)
 {
     NS_ASSERTION(aFont->GetType() == gfxFont::FONT_TYPE_FT2, "Expecting Freetype font");
     NativeFont nativeFont;
     nativeFont.mType = NATIVE_FONT_SKIA_FONT_FACE;
     nativeFont.mFont = static_cast<gfxFT2FontBase*>(aFont)->GetFontOptions();
@@ -755,8 +750,9 @@ gfxPlatformGtk::GetScaledFontForFont(gfx
 }
 
 bool
 gfxPlatformGtk::SupportsAzure(BackendType& aBackend)
 {
     aBackend = BACKEND_SKIA;
     return true;
 }
+
--- a/gfx/thebes/gfxPlatformGtk.h
+++ b/gfx/thebes/gfxPlatformGtk.h
@@ -5,21 +5,19 @@
 
 #ifndef GFX_PLATFORM_GTK_H
 #define GFX_PLATFORM_GTK_H
 
 #include "gfxPlatform.h"
 #include "nsAutoRef.h"
 #include "nsTArray.h"
 
-#if defined(MOZ_WIDGET_GTK2)
 extern "C" {
     typedef struct _GdkDrawable GdkDrawable;
 }
-#endif
 
 class gfxFontconfigUtils;
 #ifndef MOZ_PANGO
 class FontFamily;
 class FontEntry;
 typedef struct FT_LibraryRec_ *FT_Library;
 #endif
 
@@ -87,21 +85,19 @@ public:
     bool GetPrefFontEntries(const nsCString& aLangGroup, nsTArray<nsRefPtr<gfxFontEntry> > *aFontEntryList);
     void SetPrefFontEntries(const nsCString& aLangGroup, nsTArray<nsRefPtr<gfxFontEntry> >& aFontEntryList);
 #endif
 
 #ifndef MOZ_PANGO
     FT_Library GetFTLibrary();
 #endif
 
-#if defined(MOZ_WIDGET_GTK2)
     static void SetGdkDrawable(gfxASurface *target,
                                GdkDrawable *drawable);
     static GdkDrawable *GetGdkDrawable(gfxASurface *target);
-#endif
 
     static PRInt32 GetDPI();
 
     static bool UseXRender() {
 #if defined(MOZ_X11) && defined(MOZ_PLATFORM_MAEMO)
         // XRender is not accelerated on the Maemo at the moment, and 
         // X server pixman is out of our control; it's likely to be 
         // older than (our) cairo's.   So fall back on software 
--- a/gfx/thebes/gfxXlibNativeRenderer.cpp
+++ b/gfx/thebes/gfxXlibNativeRenderer.cpp
@@ -225,26 +225,20 @@ gfxXlibNativeRenderer::DrawDirect(gfxCon
             NATIVE_DRAWING_NOTE("FALLBACK: unsupported Visual");
             return false;
         }
     }
   
     /* we're good to go! */
     NATIVE_DRAWING_NOTE("TAKING FAST PATH\n");
     cairo_surface_flush (target);
-#if defined(MOZ_WIDGET_GTK2)
     nsRefPtr<gfxASurface> surface = gfxASurface::Wrap(target);
     nsresult rv = DrawWithXlib(static_cast<gfxXlibSurface*>(surface.get()),
                                offset, rectangles,
                                needs_clip ? rect_count : 0);
-#else
-    nsresult rv = DrawWithXlib(cr,
-                               offset, rectangles,
-                               needs_clip ? rect_count : 0);
-#endif
     if (NS_SUCCEEDED(rv)) {
         cairo_surface_mark_dirty (target);
         return true;
     }
     return false;
 }
 
 static bool
@@ -413,46 +407,27 @@ CreateTempXlibSurface (gfxASurface *dest
     } else {
         NATIVE_DRAWING_NOTE(", SLOW ALPHA EXTRACTION\n");
         *method = eAlphaExtraction;
     }
 
     return surface.forget();
 }
 
-#if defined(MOZ_WIDGET_GTK2)
 bool
 gfxXlibNativeRenderer::DrawOntoTempSurface(gfxXlibSurface *tempXlibSurface,
                                            nsIntPoint offset)
 {
     tempXlibSurface->Flush();
     /* no clipping is needed because the callback can't draw outside the native
        surface anyway */
     nsresult rv = DrawWithXlib(tempXlibSurface, offset, NULL, 0);
     tempXlibSurface->MarkDirty();
     return NS_SUCCEEDED(rv);
 }
-#else
-PRBool
-gfxXlibNativeRenderer::DrawOntoTempSurface(cairo_t *cr,
-                                           nsIntPoint offset)
-{
-    cairo_surface_t *target = cairo_get_group_target (cr);
-
-    cairo_surface_flush (target);
-    /* no clipping is needed because the callback can't draw outside the native
-       surface anyway */
-    nsresult rv = DrawWithXlib(cr, offset, NULL, 0);
-    if (NS_SUCCEEDED(rv)) {
-        cairo_surface_mark_dirty (target);
-    }
-
-    return NS_SUCCEEDED(rv);
-}
-#endif
 
 static already_AddRefed<gfxImageSurface>
 CopyXlibSurfaceToImage(gfxXlibSurface *tempXlibSurface,
                        gfxASurface::gfxImageFormat format)
 {
     nsRefPtr<gfxImageSurface> result =
         new gfxImageSurface(tempXlibSurface->GetSize(), format);
 
@@ -543,43 +518,38 @@ gfxXlibNativeRenderer::Draw(gfxContext* 
         return;
   
     if (drawingRect.Size() != size || method == eCopyBackground) {
         // Only drawing a portion, or copying background,
         // so won't return a result.
         result = NULL;
     }
 
-    nsRefPtr<gfxContext> tmpCtx = new gfxContext(tempXlibSurface);
+    nsRefPtr<gfxContext> tmpCtx;
     if (!drawIsOpaque) {
+        tmpCtx = new gfxContext(tempXlibSurface);
         if (method == eCopyBackground) {
             tmpCtx->SetOperator(gfxContext::OPERATOR_SOURCE);
             tmpCtx->SetSource(target, -(offset + matrix.GetTranslation()));
             // The copy from the tempXlibSurface to the target context should
             // use operator SOURCE, but that would need a mask to bound the
             // operation.  Here we only copy opaque backgrounds so operator
             // OVER will behave like SOURCE masked by the surface.
             NS_ASSERTION(tempXlibSurface->GetContentType()
                          == gfxASurface::CONTENT_COLOR,
                          "Don't copy background with a transparent surface");
         } else {
             tmpCtx->SetOperator(gfxContext::OPERATOR_CLEAR);
         }
         tmpCtx->Paint();
     }
 
-#if defined(MOZ_WIDGET_GTK2)
     if (!DrawOntoTempSurface(tempXlibSurface, -drawingRect.TopLeft())) {
         return;
     }
-#else
-    if (!DrawOntoTempSurface(tmpCtx->GetCairo(), -drawingRect.TopLeft())) {
-        return;
-    }
-#endif
   
     if (method != eAlphaExtraction) {
         ctx->SetSource(tempXlibSurface, offset);
         ctx->Paint();
         if (result) {
             result->mSurface = tempXlibSurface;
             /* fill in the result with what we know, which is really just what our
                assumption was */
@@ -590,21 +560,17 @@ gfxXlibNativeRenderer::Draw(gfxContext* 
     }
     
     nsRefPtr<gfxImageSurface> blackImage =
         CopyXlibSurfaceToImage(tempXlibSurface, gfxASurface::ImageFormatARGB32);
     
     tmpCtx->SetDeviceColor(gfxRGBA(1.0, 1.0, 1.0));
     tmpCtx->SetOperator(gfxContext::OPERATOR_SOURCE);
     tmpCtx->Paint();
-#if defined(MOZ_WIDGET_GTK2)
     DrawOntoTempSurface(tempXlibSurface, -drawingRect.TopLeft());
-#else
-    DrawOntoTempSurface(tmpCtx->GetCairo(), -drawingRect.TopLeft());
-#endif
     nsRefPtr<gfxImageSurface> whiteImage =
         CopyXlibSurfaceToImage(tempXlibSurface, gfxASurface::ImageFormatRGB24);
   
     if (blackImage->CairoStatus() == CAIRO_STATUS_SUCCESS &&
         whiteImage->CairoStatus() == CAIRO_STATUS_SUCCESS) {
         gfxAlphaRecovery::Analysis analysis;
         if (!gfxAlphaRecovery::RecoverAlpha(blackImage, whiteImage,
                                             result ? &analysis : nsnull))
--- a/gfx/thebes/gfxXlibNativeRenderer.h
+++ b/gfx/thebes/gfxXlibNativeRenderer.h
@@ -5,20 +5,16 @@
 
 #ifndef GFXXLIBNATIVERENDER_H_
 #define GFXXLIBNATIVERENDER_H_
 
 #include "gfxColor.h"
 #include "nsAutoPtr.h"
 #include "nsRect.h"
 #include <X11/Xlib.h>
-#if MOZ_WIDGET_GTK == 3
-#include "cairo-xlib.h"
-#include "cairo-xlib-xrender.h"
-#endif
 
 class gfxASurface;
 class gfxXlibSurface;
 class gfxContext;
 
 /**
  * This class lets us take code that draws into an X drawable and lets us
  * use it to draw into any Thebes context. The user should subclass this class,
@@ -36,29 +32,20 @@ public:
      * @param offsetY draw at this offset into the given drawable
      * @param clipRects an array of rectangles; clip to the union.
      *                  Any rectangles provided will be contained by the
      *                  rectangle with size provided to Draw and by the
      *                  surface extents.
      * @param numClipRects the number of rects in the array, or zero if
      *                     no clipping is required.
      */
-
-#if defined(MOZ_WIDGET_GTK2)
     virtual nsresult DrawWithXlib(gfxXlibSurface* surface,
                                   nsIntPoint offset,
                                   nsIntRect* clipRects, PRUint32 numClipRects) = 0;
-#else
-    virtual nsresult DrawWithXlib(cairo_t *cr,
-                                  nsIntPoint offset,
-                                  nsIntRect* clipRects, PRUint32 numClipRects) = 0;
-#endif  
- 
-
- 
+  
     enum {
         // If set, then Draw() is opaque, i.e., every pixel in the intersection
         // of the clipRect and (offset.x,offset.y,bounds.width,bounds.height)
         // will be set and there is no dependence on what the existing pixels
         // in the drawable are set to.
         DRAW_IS_OPAQUE = 0x01,
         // If set, then numClipRects can be zero or one
         DRAW_SUPPORTS_CLIP_RECT = 0x04,
@@ -97,18 +84,14 @@ public:
     void Draw(gfxContext* ctx, nsIntSize size,
               PRUint32 flags, Screen *screen, Visual *visual,
               DrawOutput* result);
 
 private:
     bool DrawDirect(gfxContext *ctx, nsIntSize bounds,
                       PRUint32 flags, Screen *screen, Visual *visual);
 
-#if defined(MOZ_WIDGET_GTK2)
     bool DrawOntoTempSurface(gfxXlibSurface *tempXlibSurface,
                                nsIntPoint offset);
-#else
-    PRBool DrawOntoTempSurface(cairo_t *cr,
-                               nsIntPoint offset);
-#endif
+
 };
 
 #endif /*GFXXLIBNATIVERENDER_H_*/