Backed out 2 changesets (bug 736276) for reftest crashes on a CLOSED TREE.
authorRyan VanderMeulen <ryanvm@gmail.com>
Wed, 15 May 2013 16:14:56 -0400
changeset 143498 1e9dcad2319f442c04317ebc732224b397723345
parent 143497 f232f54d3548f898eb48a73648f5dc34a4e2d739
child 143499 cc139752bed4ee2ac2cf8c05ec93e7ddad9d16d9
child 143523 d4761c35c45ef7b76b6547d496374e5b85b7d651
push id2697
push userbbajaj@mozilla.com
push dateMon, 05 Aug 2013 18:49:53 +0000
treeherdermozilla-beta@dfec938c7b63 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs736276
milestone24.0a1
backs out1bd02a8da04fec998255117b4eb9d86e5c1a2ac8
120285554c44c494a0bcabeae0d6da55a6547302
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
Backed out 2 changesets (bug 736276) for reftest crashes on a CLOSED TREE. Backed out changeset 1bd02a8da04f (bug 736276) Backed out changeset 120285554c44 (bug 736276)
gfx/2d/2D.h
gfx/2d/DrawTargetSkia.cpp
gfx/2d/Factory.cpp
gfx/2d/Makefile.in
gfx/2d/ScaledFontBase.cpp
gfx/2d/ScaledFontBase.h
gfx/2d/ScaledFontCairo.cpp
gfx/2d/ScaledFontCairo.h
gfx/2d/ScaledFontFreetype.cpp
gfx/2d/ScaledFontFreetype.h
gfx/2d/Types.h
gfx/skia/Makefile.in
gfx/skia/include/ports/SkTypeface_cairo.h
gfx/skia/src/ports/SkFontHost_cairo.cpp
gfx/thebes/gfxAndroidPlatform.cpp
gfx/thebes/gfxFT2Fonts.cpp
gfx/thebes/gfxFT2Fonts.h
gfx/thebes/gfxPangoFonts.cpp
gfx/thebes/gfxPlatformGtk.cpp
--- a/gfx/2d/2D.h
+++ b/gfx/2d/2D.h
@@ -919,21 +919,16 @@ public:
 
   static void SetGlobalEventRecorder(DrawEventRecorder *aRecorder);
 
 #ifdef USE_SKIA_GPU
   static TemporaryRef<DrawTarget>
     CreateSkiaDrawTargetForFBO(unsigned int aFBOID, GrContext *aContext, const IntSize &aSize, SurfaceFormat aFormat);
 #endif
 
-#if defined(USE_SKIA) && defined(MOZ_ENABLE_FREETYPE)
-  static TemporaryRef<GlyphRenderingOptions>
-    CreateCairoGlyphRenderingOptions(FontHinting aHinting, bool aAutoHinting);
-#endif
-
 #ifdef WIN32
   static TemporaryRef<DrawTarget> CreateDrawTargetForD3D10Texture(ID3D10Texture2D *aTexture, SurfaceFormat aFormat);
   static TemporaryRef<DrawTarget>
     CreateDualDrawTargetForD3D10Textures(ID3D10Texture2D *aTextureA,
                                          ID3D10Texture2D *aTextureB,
                                          SurfaceFormat aFormat);
 
   static void SetDirect3D10Device(ID3D10Device1 *aDevice);
--- a/gfx/2d/DrawTargetSkia.cpp
+++ b/gfx/2d/DrawTargetSkia.cpp
@@ -1,17 +1,16 @@
 /* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  * 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/. */
 
 #include "DrawTargetSkia.h"
 #include "SourceSurfaceSkia.h"
 #include "ScaledFontBase.h"
-#include "ScaledFontCairo.h"
 #include "skia/SkDevice.h"
 
 #ifdef USE_SKIA_GPU
 #include "skia/SkGpuDevice.h"
 #endif
 
 #include "skia/SkTypeface.h"
 #include "skia/SkGradientShader.h"
@@ -441,56 +440,33 @@ DrawTargetSkia::Fill(const Path *aPath,
   mCanvas->drawPath(skiaPath->GetPath(), paint.mPaint);
 }
 
 void
 DrawTargetSkia::FillGlyphs(ScaledFont *aFont,
                            const GlyphBuffer &aBuffer,
                            const Pattern &aPattern,
                            const DrawOptions &aOptions,
-                           const GlyphRenderingOptions *aRenderingOptions)
+                           const GlyphRenderingOptions*)
 {
   if (aFont->GetType() != FONT_MAC &&
       aFont->GetType() != FONT_SKIA &&
       aFont->GetType() != FONT_GDI) {
     return;
   }
 
   MarkChanged();
 
   ScaledFontBase* skiaFont = static_cast<ScaledFontBase*>(aFont);
 
   AutoPaintSetup paint(mCanvas.get(), aOptions, aPattern);
   paint.mPaint.setTypeface(skiaFont->GetSkTypeface());
   paint.mPaint.setTextSize(SkFloatToScalar(skiaFont->mSize));
   paint.mPaint.setTextEncoding(SkPaint::kGlyphID_TextEncoding);
-
-  if (aRenderingOptions && aRenderingOptions->GetType() == FONT_CAIRO) {
-    switch (static_cast<const GlyphRenderingOptionsCairo*>(aRenderingOptions)->GetHinting()) {
-      case FONT_HINTING_NONE:
-        paint.mPaint.setHinting(SkPaint::kNo_Hinting);
-        break;
-      case FONT_HINTING_LIGHT:
-        paint.mPaint.setHinting(SkPaint::kSlight_Hinting);
-        break;
-      case FONT_HINTING_NORMAL:
-        paint.mPaint.setHinting(SkPaint::kNormal_Hinting);
-        break;
-      case FONT_HINTING_FULL:
-        paint.mPaint.setHinting(SkPaint::kFull_Hinting);
-        break;
-    }
-
-    if (static_cast<const GlyphRenderingOptionsCairo*>(aRenderingOptions)->GetAutoHinting()) {
-      paint.mPaint.setAutohinted(true);
-    }
-  } else {
-    paint.mPaint.setHinting(SkPaint::kNormal_Hinting);
-  }
-
+  
   std::vector<uint16_t> indices;
   std::vector<SkPoint> offsets;
   indices.resize(aBuffer.mNumGlyphs);
   offsets.resize(aBuffer.mNumGlyphs);
 
   for (unsigned int i = 0; i < aBuffer.mNumGlyphs; i++) {
     indices[i] = aBuffer.mGlyphs[i].mIndex;
     offsets[i].fX = SkFloatToScalar(aBuffer.mGlyphs[i].mPosition.x);
--- a/gfx/2d/Factory.cpp
+++ b/gfx/2d/Factory.cpp
@@ -2,25 +2,24 @@
  * 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/. */
 
 #include "2D.h"
 
 #ifdef USE_CAIRO
 #include "DrawTargetCairo.h"
-#include "ScaledFontCairo.h"
+#include "ScaledFontBase.h"
 #endif
 
 #ifdef USE_SKIA
 #include "DrawTargetSkia.h"
 #include "ScaledFontBase.h"
 #ifdef MOZ_ENABLE_FREETYPE
-#define USE_SKIA_FREETYPE
-#include "ScaledFontCairo.h"
+#include "ScaledFontFreetype.h"
 #endif
 #endif
 
 #if defined(WIN32) && defined(USE_SKIA)
 #include "ScaledFontWin.h"
 #endif
 
 #ifdef XP_MACOSX
@@ -293,20 +292,30 @@ Factory::CreateScaledFontForNativeFont(c
 #endif
 #endif
 #ifdef XP_MACOSX
   case NATIVE_FONT_MAC_FONT_FACE:
     {
       return new ScaledFontMac(static_cast<CGFontRef>(aNativeFont.mFont), aSize);
     }
 #endif
-#if defined(USE_CAIRO) || defined(USE_SKIA_FREETYPE)
+#ifdef USE_SKIA
+#ifdef MOZ_ENABLE_FREETYPE
+  case NATIVE_FONT_SKIA_FONT_FACE:
+    {
+      return new ScaledFontFreetype(static_cast<FontOptions*>(aNativeFont.mFont), aSize);
+    }
+#endif
+#endif
+#ifdef USE_CAIRO
   case NATIVE_FONT_CAIRO_FONT_FACE:
     {
-      return new ScaledFontCairo(static_cast<cairo_scaled_font_t*>(aNativeFont.mFont), aSize);
+      ScaledFontBase* fontBase = new ScaledFontBase(aSize);
+      fontBase->SetCairoScaledFont(static_cast<cairo_scaled_font_t*>(aNativeFont.mFont));
+      return fontBase;
     }
 #endif
   default:
     gfxWarning() << "Invalid native font type specified.";
     return nullptr;
   }
 }
 
@@ -445,29 +454,16 @@ TemporaryRef<DrawTarget>
 Factory::CreateSkiaDrawTargetForFBO(unsigned int aFBOID, GrContext *aGrContext, const IntSize &aSize, SurfaceFormat aFormat)
 {
   RefPtr<DrawTargetSkia> newTarget = new DrawTargetSkia();
   newTarget->InitWithFBO(aFBOID, aGrContext, aSize, aFormat);
   return newTarget;
 }
 #endif // USE_SKIA_GPU
 
-#ifdef USE_SKIA_FREETYPE
-TemporaryRef<GlyphRenderingOptions>
-Factory::CreateCairoGlyphRenderingOptions(FontHinting aHinting, bool aAutoHinting)
-{
-  RefPtr<GlyphRenderingOptionsCairo> options =
-    new GlyphRenderingOptionsCairo();
-
-  options->SetHinting(aHinting);
-  options->SetAutoHinting(aAutoHinting);
-  return options;
-}
-#endif
-
 TemporaryRef<DrawTarget>
 Factory::CreateDrawTargetForCairoSurface(cairo_surface_t* aSurface, const IntSize& aSize)
 {
   RefPtr<DrawTarget> retVal;
 
 #ifdef USE_CAIRO
   RefPtr<DrawTargetCairo> newTarget = new DrawTargetCairo();
 
--- a/gfx/2d/Makefile.in
+++ b/gfx/2d/Makefile.in
@@ -23,17 +23,16 @@ CPPSRCS	= \
         PathCairo.cpp \
         DrawTargetRecording.cpp \
         PathRecording.cpp \
         RecordedEvent.cpp \
         DrawEventRecorder.cpp \
         Blur.cpp \
         Scale.cpp \
         ScaledFontBase.cpp \
-        ScaledFontCairo.cpp \
         DrawTargetDual.cpp \
         ImageScaling.cpp \
         SourceSurfaceRawData.cpp \
         $(NULL)
 
 GTEST_CPPSRCS = \
         GTestMain.cpp \
         TestBase.cpp \
@@ -69,18 +68,20 @@ endif
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 CPPSRCS += \
         ScaledFontMac.cpp \
         $(NULL)
 
 endif
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),$(findstring $(MOZ_WIDGET_TOOLKIT),android gtk2 gonk qt))
+CPPSRCS	+= \
+        ScaledFontFreetype.cpp \
+        $(NULL)
 DEFINES += -DMOZ_ENABLE_FREETYPE
-OS_CXXFLAGS += $(CAIRO_FT_CFLAGS)
 endif
 
 DEFINES += -DSK_A32_SHIFT=24 -DSK_R32_SHIFT=16 -DSK_G32_SHIFT=8 -DSK_B32_SHIFT=0
 
 ifdef MOZ_DEBUG
 DEFINES += -DGFX_LOG_DEBUG -DGFX_LOG_WARNING
 endif
 
--- a/gfx/2d/ScaledFontBase.cpp
+++ b/gfx/2d/ScaledFontBase.cpp
@@ -23,28 +23,28 @@ using namespace std;
 namespace mozilla {
 namespace gfx {
 
 ScaledFontBase::~ScaledFontBase()
 {
 #ifdef USE_SKIA
   SkSafeUnref(mTypeface);
 #endif
-#ifdef USE_CAIRO_SCALED_FONT
+#ifdef USE_CAIRO
   cairo_scaled_font_destroy(mScaledFont);
 #endif
 }
 
 ScaledFontBase::ScaledFontBase(Float aSize)
   : mSize(aSize)
 {
 #ifdef USE_SKIA
   mTypeface = nullptr;
 #endif
-#ifdef USE_CAIRO_SCALED_FONT
+#ifdef USE_CAIRO
   mScaledFont = nullptr;
 #endif
 }
 
 TemporaryRef<Path>
 ScaledFontBase::GetPathForGlyphs(const GlyphBuffer &aBuffer, const DrawTarget *aTarget)
 {
 #ifdef USE_SKIA
@@ -101,17 +101,17 @@ ScaledFontBase::GetPathForGlyphs(const G
 void
 ScaledFontBase::CopyGlyphsToBuilder(const GlyphBuffer &aBuffer, PathBuilder *aBuilder)
 {
   // XXX - implement me
   MOZ_ASSERT(false);
   return;
 }
 
-#ifdef USE_CAIRO_SCALED_FONT
+#ifdef USE_CAIRO
 void
 ScaledFontBase::SetCairoScaledFont(cairo_scaled_font_t* font)
 {
   MOZ_ASSERT(!mScaledFont);
 
   mScaledFont = font;
   cairo_scaled_font_reference(mScaledFont);
 }
--- a/gfx/2d/ScaledFontBase.h
+++ b/gfx/2d/ScaledFontBase.h
@@ -3,25 +3,20 @@
  * 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_GFX_SCALEDFONTBASE_H_
 #define MOZILLA_GFX_SCALEDFONTBASE_H_
 
 #include "2D.h"
 
-// Skia uses cairo_scaled_font_t as the internal font type in ScaledFont
-#if defined(USE_SKIA) || defined(USE_CAIRO)
-#define USE_CAIRO_SCALED_FONT
-#endif
-
 #ifdef USE_SKIA
 #include "skia/SkTypeface.h"
 #endif
-#ifdef USE_CAIRO_SCALED_FONT
+#ifdef USE_CAIRO
 #include "cairo.h"
 #endif
 
 class gfxFont;
 
 namespace mozilla {
 namespace gfx {
 
@@ -39,27 +34,27 @@ public:
 
 #ifdef USE_SKIA
   virtual SkTypeface* GetSkTypeface() { return mTypeface; }
 #endif
 
   // Not true, but required to instantiate a ScaledFontBase.
   virtual FontType GetType() const { return FONT_SKIA; }
 
-#ifdef USE_CAIRO_SCALED_FONT
+#ifdef USE_CAIRO
   cairo_scaled_font_t* GetCairoScaledFont() { return mScaledFont; }
   void SetCairoScaledFont(cairo_scaled_font_t* font);
 #endif
 
 protected:
   friend class DrawTargetSkia;
 #ifdef USE_SKIA
   SkTypeface* mTypeface;
 #endif
-#ifdef USE_CAIRO_SCALED_FONT
+#ifdef USE_CAIRO
   cairo_scaled_font_t* mScaledFont;
 #endif
   Float mSize;
 };
 
 }
 }
 
deleted file mode 100644
--- a/gfx/2d/ScaledFontCairo.cpp
+++ /dev/null
@@ -1,59 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * 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/. */
-
-#include "ScaledFontCairo.h"
-#include "Logging.h"
-
-#include "gfxFont.h"
-
-#ifdef MOZ_ENABLE_FREETYPE
-#include <ft2build.h>
-#include FT_FREETYPE_H
-#include "cairo-ft.h"
-#endif
-
-#if defined(USE_SKIA) && defined(MOZ_ENABLE_FREETYPE)
-#include "skia/SkTypeface.h"
-#include "skia/SkTypeface_cairo.h"
-#endif
-
-#include <string>
-
-typedef struct FT_FaceRec_* FT_Face;
-
-using namespace std;
-
-namespace mozilla {
-namespace gfx {
-
-// On Linux and Android our "platform" font is a cairo_scaled_font_t and we use
-// an SkFontHost implementation that allows Skia to render using this.
-// This is mainly because FT_Face is not good for sharing between libraries, which
-// is a requirement when we consider runtime switchable backends and so on
-ScaledFontCairo::ScaledFontCairo(cairo_scaled_font_t* aScaledFont, Float aSize)
-  : ScaledFontBase(aSize)
-{
-  mScaledFont = aScaledFont;
-#if defined(USE_SKIA) && defined(MOZ_ENABLE_FREETYPE)
-  cairo_font_face_t* fontFace = cairo_scaled_font_get_font_face(aScaledFont);
-  FT_Face face = cairo_ft_scaled_font_lock_face(aScaledFont);
-
-  int style = SkTypeface::kNormal;
-
-  if (face->style_flags & FT_STYLE_FLAG_ITALIC)
-    style |= SkTypeface::kItalic;
-
-  if (face->style_flags & FT_STYLE_FLAG_BOLD)
-    style |= SkTypeface::kBold;
-
-  bool isFixedWidth = face->face_flags & FT_FACE_FLAG_FIXED_WIDTH;
-  cairo_ft_scaled_font_unlock_face(aScaledFont);
-
-  mTypeface = SkCreateTypefaceFromCairoFont(fontFace, (SkTypeface::Style)style, isFixedWidth);
-#endif
-}
-
-}
-}
deleted file mode 100644
--- a/gfx/2d/ScaledFontCairo.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
- * 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/. */
-
-#ifndef MOZILLA_GFX_SCALEDFONTCAIRO_H_
-#define MOZILLA_GFX_SCALEDFONTCAIRO_H_
-
-#include "ScaledFontBase.h"
-
-#include "cairo.h"
-
-namespace mozilla {
-namespace gfx {
-
-class ScaledFontCairo : public ScaledFontBase
-{
-public:
-
-  ScaledFontCairo(cairo_scaled_font_t* aScaledFont, Float aSize);
-};
-
-// We need to be able to tell Skia whether or not to use
-// hinting when rendering text, so that the glyphs it renders
-// are the same as what layout is expecting. At the moment, only
-// Skia uses this class when rendering with FreeType, as gfxFT2Font
-// is the only gfxFont that honours gfxPlatform::FontHintingEnabled().
-class GlyphRenderingOptionsCairo : public GlyphRenderingOptions
-{
-public:
-  GlyphRenderingOptionsCairo()
-    : mHinting(FONT_HINTING_NORMAL)
-    , mAutoHinting(false)
-  {
-  }
-
-  void SetHinting(FontHinting aHinting) { mHinting = aHinting; }
-  void SetAutoHinting(bool aAutoHinting) { mAutoHinting = aAutoHinting; }
-  FontHinting GetHinting() const { return mHinting; }
-  bool GetAutoHinting() const { return mAutoHinting; }
-  virtual FontType GetType() const { return FONT_CAIRO; }
-private:
-  FontHinting mHinting;
-  bool mAutoHinting;
-};
-
-}
-}
-
-#endif /* MOZILLA_GFX_SCALEDFONTCAIRO_H_ */
new file mode 100644
--- /dev/null
+++ b/gfx/2d/ScaledFontFreetype.cpp
@@ -0,0 +1,53 @@
+/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ * 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/. */
+
+#include "ScaledFontFreetype.h"
+#include "Logging.h"
+
+#include "gfxFont.h"
+
+#ifdef USE_SKIA
+#include "skia/SkTypeface.h"
+#endif
+
+#include <string>
+
+using namespace std;
+
+namespace mozilla {
+namespace gfx {
+
+#ifdef USE_SKIA
+static SkTypeface::Style
+fontStyleToSkia(FontStyle aStyle)
+{
+  switch (aStyle) {
+  case FONT_STYLE_NORMAL:
+    return SkTypeface::kNormal;
+  case FONT_STYLE_ITALIC:
+    return SkTypeface::kItalic;
+  case FONT_STYLE_BOLD:
+    return SkTypeface::kBold;
+  case FONT_STYLE_BOLD_ITALIC:
+    return SkTypeface::kBoldItalic;
+   }
+
+  gfxWarning() << "Unknown font style";
+  return SkTypeface::kNormal;
+}
+#endif
+
+// Ideally we want to use FT_Face here but as there is currently no way to get
+// an SkTypeface from an FT_Face we do this.
+ScaledFontFreetype::ScaledFontFreetype(FontOptions* aFont, Float aSize)
+  : ScaledFontBase(aSize)
+{
+#ifdef USE_SKIA
+  mTypeface = SkTypeface::CreateFromName(aFont->mName.c_str(), fontStyleToSkia(aFont->mStyle));
+#endif
+}
+
+}
+}
new file mode 100644
--- /dev/null
+++ b/gfx/2d/ScaledFontFreetype.h
@@ -0,0 +1,24 @@
+/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
+ * 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/. */
+
+#ifndef MOZILLA_GFX_SCALEDFONTFREETYPE_H_
+#define MOZILLA_GFX_SCALEDFONTFREETYPE_H_
+
+#include "ScaledFontBase.h"
+
+namespace mozilla {
+namespace gfx {
+
+class ScaledFontFreetype : public ScaledFontBase
+{
+public:
+
+  ScaledFontFreetype(FontOptions* aFont, Float aSize);
+};
+
+}
+}
+
+#endif /* MOZILLA_GFX_SCALEDFONTFREETYPE_H_ */
--- a/gfx/2d/Types.h
+++ b/gfx/2d/Types.h
@@ -83,24 +83,16 @@ enum NativeFontType
 enum FontStyle
 {
   FONT_STYLE_NORMAL,
   FONT_STYLE_ITALIC,
   FONT_STYLE_BOLD,
   FONT_STYLE_BOLD_ITALIC
 };
 
-enum FontHinting
-{
-  FONT_HINTING_NONE,
-  FONT_HINTING_LIGHT,
-  FONT_HINTING_NORMAL,
-  FONT_HINTING_FULL
-};
-
 enum CompositionOp { OP_OVER, OP_ADD, OP_ATOP, OP_OUT, OP_IN, OP_SOURCE, OP_DEST_IN, OP_DEST_OUT, OP_DEST_OVER, OP_DEST_ATOP, OP_XOR, 
   OP_MULTIPLY, OP_SCREEN, OP_OVERLAY, OP_DARKEN, OP_LIGHTEN, OP_COLOR_DODGE, OP_COLOR_BURN, OP_HARD_LIGHT, OP_SOFT_LIGHT,  OP_DIFFERENCE, OP_EXCLUSION, OP_HUE, OP_SATURATION, OP_COLOR, OP_LUMINOSITY, OP_COUNT };
 enum ExtendMode { EXTEND_CLAMP, EXTEND_REPEAT, EXTEND_REFLECT };
 enum FillRule { FILL_WINDING, FILL_EVEN_ODD };
 enum AntialiasMode { AA_NONE, AA_GRAY, AA_SUBPIXEL, AA_DEFAULT };
 enum Snapping { SNAP_NONE, SNAP_ALIGNED };
 enum Filter { FILTER_LINEAR, FILTER_POINT };
 enum PatternType { PATTERN_COLOR, PATTERN_SURFACE, PATTERN_LINEAR_GRADIENT, PATTERN_RADIAL_GRADIENT };
--- a/gfx/skia/Makefile.in
+++ b/gfx/skia/Makefile.in
@@ -294,59 +294,52 @@ CPPSRCS += \
 	$(NULL)
 endif
 
 ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
 CPPSRCS += \
 	SkFontHost_mac_coretext.cpp \
 	SkStream_mac.cpp \
 	SkTime_Unix.cpp \
-	SkThread_pthread.cpp \
 	$(NULL)
-DEFINES += -DSK_USE_POSIX_THREADS=1
 endif
 
 ifeq (android,$(MOZ_WIDGET_TOOLKIT))
 CPPSRCS += \
 	SkDebug_android.cpp \
-	SkFontHost_cairo.cpp \
+	SkFontHost_android_old.cpp \
+	SkFontHost_FreeType.cpp \
 	SkFontHost_FreeType_common.cpp \
 	SkFontHost_tables.cpp \
 	SkMMapStream.cpp \
 	SkTime_Unix.cpp \
 	SkThread_pthread.cpp \
 	$(NULL)
 
+OS_CXXFLAGS += $(CAIRO_FT_CFLAGS)
 DEFINES += -DSK_USE_POSIX_THREADS=1
-EXPORTS_skia += \
-	include/ports/SkTypeface_cairo.h \
-	$(NULL)
-
-OS_CXXFLAGS += $(MOZ_CAIRO_CFLAGS) $(CAIRO_FT_CFLAGS)
 else
 CPPSRCS += \
 	SkDebug_stdio.cpp \
+	SkThread_none.cpp \
 	$(NULL)
 endif
 
 ifeq (gtk2,$(MOZ_WIDGET_TOOLKIT))
 CPPSRCS += \
-	SkFontHost_cairo.cpp \
+	SkFontHost_FreeType.cpp \
 	SkFontHost_FreeType_common.cpp \
+	SkFontHost_linux.cpp \
 	SkFontHost_tables.cpp \
 	SkTime_Unix.cpp \
 	SkMMapStream.cpp \
 	SkOSFile.cpp \
 	$(NULL)
 
-EXPORTS_skia += \
-	include/ports/SkTypeface_cairo.h \
-	$(NULL)
-
-OS_CXXFLAGS += $(MOZ_CAIRO_CFLAGS) $(CAIRO_FT_CFLAGS)
+OS_CXXFLAGS += $(MOZ_PANGO_CFLAGS)
 endif
 
 ifeq (qt,$(MOZ_WIDGET_TOOLKIT))
 CPPSRCS += \
 	SkFontHost_FreeType.cpp \
 	SkFontHost_FreeType_common.cpp \
 	SkFontHost_tables.cpp \
 	SkMMapStream.cpp \
@@ -359,28 +352,24 @@ CPPSRCS += \
 	SkTime_Unix.cpp \
 	$(NULL)
 endif
 OS_CXXFLAGS += $(MOZ_PANGO_CFLAGS)
 endif
 
 ifeq (Linux,$(OS_TARGET))
 DEFINES += -DSK_USE_POSIX_THREADS=1
-CPPSRCS += \
-	SkThread_pthread.cpp \
-	$(NULL)
 endif
 
 ifeq (windows,$(MOZ_WIDGET_TOOLKIT))
 CPPSRCS += \
 	SkFontHost_win.cpp \
 	SkFontHost_tables.cpp \
 	SkFontHost_sandbox_none.cpp \
 	SkTime_win.cpp \
-	SkThread_win.cpp \
 	$(NULL)
 DEFINES += -DSKIA_IMPLEMENTATION=1 -DGR_IMPLEMENTATION=1
 endif
 
 ifneq (,$(INTEL_ARCHITECTURE))
 CPPSRCS += \
 	SkBitmapProcState_opts_SSE2.cpp \
 	SkBlitRect_opts_SSE2.cpp \
deleted file mode 100644
--- a/gfx/skia/include/ports/SkTypeface_cairo.h
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef SkTypeface_cairo_DEFINED
-#define SkTypeface_cairo_DEFINED
-
-#include <cairo.h>
-
-#include "SkTypeface.h"
-
-SK_API extern SkTypeface* SkCreateTypefaceFromCairoFont(cairo_font_face_t* fontFace, SkTypeface::Style style, bool isFixedWidth);
-
-#endif
-
deleted file mode 100644
--- a/gfx/skia/src/ports/SkFontHost_cairo.cpp
+++ /dev/null
@@ -1,382 +0,0 @@
-
-/*
- * Copyright 2012 Mozilla Foundation
- *
- * Use of this source code is governed by a BSD-style license that can be
- * found in the LICENSE file.
- */
-
-#include "cairo.h"
-#include "cairo-ft.h"
-
-#include "SkFontHost_FreeType_common.h"
-
-#include "SkAdvancedTypefaceMetrics.h"
-#include "SkFontHost.h"
-#include "SkPath.h"
-#include "SkScalerContext.h"
-#include "SkTypefaceCache.h"
-
-#include <ft2build.h>
-#include FT_FREETYPE_H
-
-static cairo_user_data_key_t kSkTypefaceKey;
-
-class SkScalerContext_CairoFT : public SkScalerContext_FreeType_Base {
-public:
-    SkScalerContext_CairoFT(const SkDescriptor* desc);
-    virtual ~SkScalerContext_CairoFT();
-
-protected:
-    virtual unsigned generateGlyphCount() SK_OVERRIDE;
-    virtual uint16_t generateCharToGlyph(SkUnichar uniChar) SK_OVERRIDE;
-    virtual void generateAdvance(SkGlyph* glyph) SK_OVERRIDE;
-    virtual void generateMetrics(SkGlyph* glyph) SK_OVERRIDE;
-    virtual void generateImage(const SkGlyph& glyph, SkMaskGamma::PreBlend* maskPreBlend) SK_OVERRIDE;
-    virtual void generatePath(const SkGlyph& glyph, SkPath* path) SK_OVERRIDE;
-    virtual void generateFontMetrics(SkPaint::FontMetrics* mx,
-                                     SkPaint::FontMetrics* my) SK_OVERRIDE;
-    virtual SkUnichar generateGlyphToChar(uint16_t glyph) SK_OVERRIDE;
-private:
-    cairo_scaled_font_t* fScaledFont;
-    uint32_t fLoadGlyphFlags;
-};
-
-class CairoLockedFTFace {
-public:
-    CairoLockedFTFace(cairo_scaled_font_t* scaledFont)
-        : fScaledFont(scaledFont)
-        , fFace(cairo_ft_scaled_font_lock_face(scaledFont))
-    {}
-
-    ~CairoLockedFTFace()
-    {
-        cairo_ft_scaled_font_unlock_face(fScaledFont);
-    }
-
-    FT_Face getFace()
-    {
-        return fFace;
-    }
-
-private:
-    cairo_scaled_font_t* fScaledFont;
-    FT_Face fFace;
-};
-
-class SkCairoFTTypeface : public SkTypeface {
-public:
-    static SkTypeface* CreateTypeface(cairo_font_face_t* fontFace, SkTypeface::Style style, bool isFixedWidth) {
-        SkASSERT(fontFace != NULL);
-        SkASSERT(cairo_font_face_get_type(fontFace) == CAIRO_FONT_TYPE_FT);
-
-        SkFontID newId = SkTypefaceCache::NewFontID();
-
-        return SkNEW_ARGS(SkCairoFTTypeface, (fontFace, style, newId, isFixedWidth));
-    }
-
-    cairo_font_face_t* getFontFace() {
-        return fFontFace;
-    }
-
-private:
-
-    SkCairoFTTypeface(cairo_font_face_t* fontFace, SkTypeface::Style style, SkFontID id, bool isFixedWidth)
-        : SkTypeface(style, id, isFixedWidth)
-        , fFontFace(fontFace)
-    {
-        cairo_font_face_set_user_data(fFontFace, &kSkTypefaceKey, this, NULL);
-        cairo_font_face_reference(fFontFace);
-    }
-
-    ~SkCairoFTTypeface()
-    {
-        cairo_font_face_set_user_data(fFontFace, &kSkTypefaceKey, NULL, NULL);
-        cairo_font_face_destroy(fFontFace);
-    }
-
-    cairo_font_face_t* fFontFace;
-};
-
-SkTypeface* SkCreateTypefaceFromCairoFont(cairo_font_face_t* fontFace, SkTypeface::Style style, bool isFixedWidth)
-{
-    SkTypeface* typeface = reinterpret_cast<SkTypeface*>(cairo_font_face_get_user_data(fontFace, &kSkTypefaceKey));
-
-    if (typeface) {
-        typeface->ref();
-    } else {
-        typeface = SkCairoFTTypeface::CreateTypeface(fontFace, style, isFixedWidth);
-        SkTypefaceCache::Add(typeface, style);
-    }
-
-    return typeface;
-}
-
-SkTypeface* SkFontHost::CreateTypeface(const SkTypeface* familyFace,
-                                     const char famillyName[],
-                                     SkTypeface::Style style)
-{
-    SkDEBUGFAIL("SkFontHost::FindTypeface unimplemented");
-    return NULL;
-}
-
-SkTypeface* SkFontHost::CreateTypefaceFromStream(SkStream*)
-{
-    SkDEBUGFAIL("SkFontHost::CreateTypeface unimplemented");
-    return NULL;
-}
-
-SkTypeface* SkFontHost::CreateTypefaceFromFile(char const*)
-{
-    SkDEBUGFAIL("SkFontHost::CreateTypefaceFromFile unimplemented");
-    return NULL;
-}
-
-// static
-SkAdvancedTypefaceMetrics* SkFontHost::GetAdvancedTypefaceMetrics(
-        uint32_t fontID,
-        SkAdvancedTypefaceMetrics::PerGlyphInfo perGlyphInfo,
-        const uint32_t* glyphIDs,
-        uint32_t glyphIDsCount)
-{
-    return NULL;
-}
-
-void SkFontHost::FilterRec(SkScalerContext::Rec* rec) {
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-SkStream* SkFontHost::OpenStream(uint32_t uniqueID)
-{
-    SkDEBUGFAIL("SkFontHost::OpenStream unimplemented");
-    return NULL;
-}
-
-size_t SkFontHost::GetFileName(SkFontID fontID, char path[], size_t length,
-                               int32_t* index) {
-    SkDebugf("SkFontHost::GetFileName unimplemented\n");
-    return 0;
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
-void SkFontHost::Serialize(const SkTypeface* face, SkWStream* stream)
-{
-    SkDEBUGFAIL("SkFontHost::Serialize unimplemented");
-}
-
-SkTypeface* SkFontHost::Deserialize(SkStream* stream) {
-    SkDEBUGFAIL("SkFontHost::Deserialize unimplemented");
-    return NULL;
-}
-
-static bool isLCD(const SkScalerContext::Rec& rec) {
-    switch (rec.fMaskFormat) {
-        case SkMask::kLCD16_Format:
-        case SkMask::kLCD32_Format:
-            return true;
-        default:
-            return false;
-    }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-SkScalerContext_CairoFT::SkScalerContext_CairoFT(const SkDescriptor* desc)
-    : SkScalerContext_FreeType_Base(desc)
-{
-    SkCairoFTTypeface* typeface = static_cast<SkCairoFTTypeface*>(SkTypefaceCache::FindByID(fRec.fFontID));
-
-    SkMatrix matrix;
-    fRec.getSingleMatrix(&matrix);
-
-    cairo_font_face_t* fontFace = typeface->getFontFace();
-
-    cairo_matrix_t fontMatrix, ctMatrix;
-    cairo_matrix_init(&fontMatrix, matrix.getScaleX(), matrix.getSkewY(), matrix.getSkewX(), matrix.getScaleY(), 0.0, 0.0);
-    cairo_matrix_init_scale(&ctMatrix, 1.0, 1.0);
-
-    // We need to ensure that the font options match for hinting, as generateMetrics()
-    // uses the fScaledFont which uses these font options
-    cairo_font_options_t *fontOptions = cairo_font_options_create();
-
-    FT_Int32 loadFlags = FT_LOAD_DEFAULT;
-
-    if (SkMask::kBW_Format == fRec.fMaskFormat) {
-        // See http://code.google.com/p/chromium/issues/detail?id=43252#c24
-        loadFlags = FT_LOAD_TARGET_MONO;
-        if (fRec.getHinting() == SkPaint::kNo_Hinting) {
-            cairo_font_options_set_hint_style(fontOptions, CAIRO_HINT_STYLE_NONE);
-            loadFlags = FT_LOAD_NO_HINTING;
-        }
-    } else {
-        switch (fRec.getHinting()) {
-        case SkPaint::kNo_Hinting:
-            loadFlags = FT_LOAD_NO_HINTING;
-            cairo_font_options_set_hint_style(fontOptions, CAIRO_HINT_STYLE_NONE);
-            break;
-        case SkPaint::kSlight_Hinting:
-            loadFlags = FT_LOAD_TARGET_LIGHT;  // This implies FORCE_AUTOHINT
-            cairo_font_options_set_hint_style(fontOptions, CAIRO_HINT_STYLE_SLIGHT);
-            break;
-        case SkPaint::kNormal_Hinting:
-            cairo_font_options_set_hint_style(fontOptions, CAIRO_HINT_STYLE_MEDIUM);
-            if (fRec.fFlags & SkScalerContext::kAutohinting_Flag) {
-                loadFlags = FT_LOAD_FORCE_AUTOHINT;
-            }
-            break;
-        case SkPaint::kFull_Hinting:
-            cairo_font_options_set_hint_style(fontOptions, CAIRO_HINT_STYLE_FULL);
-            if (fRec.fFlags & SkScalerContext::kAutohinting_Flag) {
-                loadFlags = FT_LOAD_FORCE_AUTOHINT;
-            }
-            if (isLCD(fRec)) {
-                if (SkToBool(fRec.fFlags & SkScalerContext::kLCD_Vertical_Flag)) {
-                    loadFlags = FT_LOAD_TARGET_LCD_V;
-                } else {
-                    loadFlags = FT_LOAD_TARGET_LCD;
-                }
-            }
-            break;
-        default:
-            SkDebugf("---------- UNKNOWN hinting %d\n", fRec.getHinting());
-            break;
-        }
-    }
-
-    fScaledFont = cairo_scaled_font_create(fontFace, &fontMatrix, &ctMatrix, fontOptions);
-
-    if ((fRec.fFlags & SkScalerContext::kEmbeddedBitmapText_Flag) == 0) {
-        loadFlags |= FT_LOAD_NO_BITMAP;
-    }
-
-    // Always using FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH to get correct
-    // advances, as fontconfig and cairo do.
-    // See http://code.google.com/p/skia/issues/detail?id=222.
-    loadFlags |= FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH;
-
-    fLoadGlyphFlags = loadFlags;
-}
-
-SkScalerContext_CairoFT::~SkScalerContext_CairoFT()
-{
-    cairo_scaled_font_destroy(fScaledFont);
-}
-
-SkScalerContext* SkFontHost::CreateScalerContext(const SkDescriptor* desc)
-{
-    return SkNEW_ARGS(SkScalerContext_CairoFT, (desc));
-}
-
-SkFontID SkFontHost::NextLogicalFont(SkFontID currFontID, SkFontID origFontID)
-{
-    return 0;
-}
-
-#ifdef SK_BUILD_FOR_ANDROID
-uint32_t SkFontHost::GetUnitsPerEm(SkFontID fontID) {
-    return 0;
-}
-#endif
-
-unsigned SkScalerContext_CairoFT::generateGlyphCount()
-{
-    CairoLockedFTFace faceLock(fScaledFont);
-    return faceLock.getFace()->num_glyphs;
-}
-
-uint16_t SkScalerContext_CairoFT::generateCharToGlyph(SkUnichar uniChar)
-{
-    CairoLockedFTFace faceLock(fScaledFont);
-    return SkToU16(FT_Get_Char_Index(faceLock.getFace(), uniChar));
-}
-
-void SkScalerContext_CairoFT::generateAdvance(SkGlyph* glyph)
-{
-    generateMetrics(glyph);
-}
-
-void SkScalerContext_CairoFT::generateMetrics(SkGlyph* glyph)
-{
-    SkASSERT(fScaledFont != NULL);
-    cairo_text_extents_t extents;
-    cairo_glyph_t cairoGlyph = { glyph->getGlyphID(fBaseGlyphCount), 0.0, 0.0 };
-    cairo_scaled_font_glyph_extents(fScaledFont, &cairoGlyph, 1, &extents);
-
-    glyph->fAdvanceX = SkDoubleToFixed(extents.x_advance);
-    glyph->fAdvanceY = SkDoubleToFixed(extents.y_advance);
-    glyph->fWidth = SkToU16(SkScalarCeil(extents.width));
-    glyph->fHeight = SkToU16(SkScalarCeil(extents.height));
-    glyph->fLeft = SkToS16(SkScalarCeil(extents.x_bearing));
-    glyph->fTop = SkToS16(SkScalarCeil(extents.y_bearing));
-    glyph->fLsbDelta = 0;
-    glyph->fRsbDelta = 0;
-}
-
-void SkScalerContext_CairoFT::generateImage(const SkGlyph& glyph, SkMaskGamma::PreBlend* maskPreBlend)
-{
-    SkASSERT(fScaledFont != NULL);
-    CairoLockedFTFace faceLock(fScaledFont);
-    FT_Face face = faceLock.getFace();
-
-    FT_Error err = FT_Load_Glyph(face, glyph.getGlyphID(fBaseGlyphCount), fLoadGlyphFlags);
-
-    if (err != 0) {
-        memset(glyph.fImage, 0, glyph.rowBytes() * glyph.fHeight);
-        return;
-    }
-
-    generateGlyphImage(face, glyph, maskPreBlend);
-}
-
-void SkScalerContext_CairoFT::generatePath(const SkGlyph& glyph, SkPath* path)
-{
-    SkASSERT(fScaledFont != NULL);
-    CairoLockedFTFace faceLock(fScaledFont);
-    FT_Face face = faceLock.getFace();
-
-    SkASSERT(&glyph && path);
-
-    uint32_t flags = fLoadGlyphFlags;
-    flags |= FT_LOAD_NO_BITMAP; // ignore embedded bitmaps so we're sure to get the outline
-    flags &= ~FT_LOAD_RENDER;   // don't scan convert (we just want the outline)
-
-    FT_Error err = FT_Load_Glyph(face, glyph.getGlyphID(fBaseGlyphCount), flags);
-
-    if (err != 0) {
-        path->reset();
-        return;
-    }
-
-    generateGlyphPath(face, glyph, path);
-}
-
-void SkScalerContext_CairoFT::generateFontMetrics(SkPaint::FontMetrics* mx,
-                                                  SkPaint::FontMetrics* my)
-{
-}
-
-SkUnichar SkScalerContext_CairoFT::generateGlyphToChar(uint16_t glyph)
-{
-    SkASSERT(fScaledFont != NULL);
-    CairoLockedFTFace faceLock(fScaledFont);
-    FT_Face face = faceLock.getFace();
-
-    FT_UInt glyphIndex;
-    SkUnichar charCode = FT_Get_First_Char(face, &glyphIndex);
-    while (glyphIndex != 0) {
-        if (glyphIndex == glyph) {
-            return charCode;
-        }
-        charCode = FT_Get_Next_Char(face, charCode, &glyphIndex);
-    }
-
-    return 0;
-}
-
-#ifdef SK_BUILD_FOR_ANDROID
-SkTypeface* SkAndroidNextLogicalTypeface(SkFontID currFontID,
-                                         SkFontID origFontID) {
-    return NULL;
-}
-#endif
--- a/gfx/thebes/gfxAndroidPlatform.cpp
+++ b/gfx/thebes/gfxAndroidPlatform.cpp
@@ -317,23 +317,26 @@ gfxAndroidPlatform::MakePlatformFont(con
                                                                      aFontData,
                                                                      aLength);
 }
 
 TemporaryRef<ScaledFont>
 gfxAndroidPlatform::GetScaledFontForFont(DrawTarget* aTarget, gfxFont *aFont)
 {
     NativeFont nativeFont;
-    if (aTarget->GetType() == BACKEND_CAIRO || aTarget->GetType() == BACKEND_SKIA) {
+    if (aTarget->GetType() == BACKEND_CAIRO) {
         nativeFont.mType = NATIVE_FONT_CAIRO_FONT_FACE;
-        nativeFont.mFont = aFont->GetCairoScaledFont();
-        return Factory::CreateScaledFontForNativeFont(nativeFont, aFont->GetAdjustedSize());
+        nativeFont.mFont = NULL;
+        return Factory::CreateScaledFontWithCairo(nativeFont, aFont->GetAdjustedSize(), aFont->GetCairoScaledFont());
     }
-
-    return nullptr;
+ 
+    NS_ASSERTION(aFont->GetType() == gfxFont::FONT_TYPE_FT2, "Expecting Freetype font");
+    nativeFont.mType = NATIVE_FONT_SKIA_FONT_FACE;
+    nativeFont.mFont = static_cast<gfxFT2FontBase*>(aFont)->GetFontOptions();
+    return Factory::CreateScaledFontForNativeFont(nativeFont, aFont->GetAdjustedSize());
 }
 
 bool
 gfxAndroidPlatform::FontHintingEnabled()
 {
     // In "mobile" builds, we sometimes use non-reflow-zoom, so we
     // might not want hinting.  Let's see.
 
--- a/gfx/thebes/gfxFT2Fonts.cpp
+++ b/gfx/thebes/gfxFT2Fonts.cpp
@@ -31,17 +31,16 @@
 #include "nsUnicodeRange.h"
 #include "nsCRT.h"
 #include "nsXULAppAPI.h"
 
 #include "prlog.h"
 #include "prinit.h"
 
 #include "mozilla/Preferences.h"
-#include "mozilla/gfx/2D.h"
 
 // rounding and truncation functions for a Freetype floating point number
 // (FT26Dot6) stored in a 32bit integer with high 26 bits for the integer
 // part and low 6 bits for the fractional part.
 #define MOZ_FT_ROUND(x) (((x) + 32) & ~63) // 63 = 2^6 - 1
 #define MOZ_FT_TRUNC(x) ((x) >> 6)
 #define CONVERT_DESIGN_UNITS_TO_PIXELS(v, s) \
         MOZ_FT_TRUNC(MOZ_FT_ROUND(FT_MulFix((v) , (s))))
@@ -655,26 +654,8 @@ gfxFT2Font::SizeOfExcludingThis(nsMalloc
 
 void
 gfxFT2Font::SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf,
                                 FontCacheSizes*   aSizes) const
 {
     aSizes->mFontInstances += aMallocSizeOf(this);
     SizeOfExcludingThis(aMallocSizeOf, aSizes);
 }
-
-#ifdef USE_SKIA
-mozilla::TemporaryRef<mozilla::gfx::GlyphRenderingOptions>
-gfxFT2Font::GetGlyphRenderingOptions()
-{
-  mozilla::gfx::FontHinting hinting;
-
-  if (gfxPlatform::GetPlatform()->FontHintingEnabled()) {
-    hinting = mozilla::gfx::FONT_HINTING_NORMAL;
-  } else {
-    hinting = mozilla::gfx::FONT_HINTING_NONE;
-  }
-
-  // We don't want to force the use of the autohinter over the font's built in hints
-  return mozilla::gfx::Factory::CreateCairoGlyphRenderingOptions(hinting, false);
-}
-#endif
-
--- a/gfx/thebes/gfxFT2Fonts.h
+++ b/gfx/thebes/gfxFT2Fonts.h
@@ -63,20 +63,16 @@ public: // new functions
         return &entry->mData;
     }
 
     virtual void SizeOfExcludingThis(nsMallocSizeOfFun aMallocSizeOf,
                                      FontCacheSizes*   aSizes) const;
     virtual void SizeOfIncludingThis(nsMallocSizeOfFun aMallocSizeOf,
                                      FontCacheSizes*   aSizes) const;
 
-#ifdef USE_SKIA
-    virtual mozilla::TemporaryRef<mozilla::gfx::GlyphRenderingOptions> GetGlyphRenderingOptions();
-#endif
-
 protected:
     virtual bool ShapeText(gfxContext      *aContext,
                            const PRUnichar *aText,
                            uint32_t         aOffset,
                            uint32_t         aLength,
                            int32_t          aScript,
                            gfxShapedText   *aShapedText,
                            bool             aPreferPlatformShaping);
--- a/gfx/thebes/gfxPangoFonts.cpp
+++ b/gfx/thebes/gfxPangoFonts.cpp
@@ -772,20 +772,16 @@ public:
     // The PangoFont returned is owned by the gfxFcFont
     PangoFont *GetPangoFont() {
         if (!mPangoFont) {
             MakePangoFont();
         }
         return mPangoFont;
     }
 
-#ifdef USE_SKIA
-    virtual mozilla::TemporaryRef<mozilla::gfx::GlyphRenderingOptions> GetGlyphRenderingOptions();
-#endif
-
 protected:
     virtual bool ShapeText(gfxContext      *aContext,
                            const PRUnichar *aText,
                            uint32_t         aOffset,
                            uint32_t         aLength,
                            int32_t          aScript,
                            gfxShapedText   *aShapedText,
                            bool             aPreferPlatformShaping);
@@ -3230,41 +3226,8 @@ ApplyGdkScreenFontOptions(FcPattern *aPa
 {
     const cairo_font_options_t *options =
         gdk_screen_get_font_options(gdk_screen_get_default());
 
     cairo_ft_font_options_substitute(options, aPattern);
 }
 
 #endif // MOZ_WIDGET_GTK2
-
-#ifdef USE_SKIA
-mozilla::TemporaryRef<mozilla::gfx::GlyphRenderingOptions>
-gfxFcFont::GetGlyphRenderingOptions()
-{
-  cairo_scaled_font_t *scaled_font = CairoScaledFont();
-  cairo_font_options_t *options = cairo_font_options_create();
-  cairo_scaled_font_get_font_options(scaled_font, options);
-  cairo_hint_style_t hint_style = cairo_font_options_get_hint_style(options);     
-  cairo_font_options_destroy(options);
-
-  mozilla::gfx::FontHinting hinting;
-
-  switch (hint_style) {
-    case CAIRO_HINT_STYLE_NONE:
-      hinting = mozilla::gfx::FONT_HINTING_NONE;
-      break;
-    case CAIRO_HINT_STYLE_SLIGHT:
-      hinting = mozilla::gfx::FONT_HINTING_LIGHT;
-      break;
-    case CAIRO_HINT_STYLE_FULL:
-      hinting = mozilla::gfx::FONT_HINTING_FULL;
-      break;
-    default:
-      hinting = mozilla::gfx::FONT_HINTING_NORMAL;
-      break;
-  }
-
-  // We don't want to force the use of the autohinter over the font's built in hints
-  return mozilla::gfx::Factory::CreateCairoGlyphRenderingOptions(hinting, false);
-}
-#endif
-
--- a/gfx/thebes/gfxPlatformGtk.cpp
+++ b/gfx/thebes/gfxPlatformGtk.cpp
@@ -753,18 +753,18 @@ gfxPlatformGtk::GetGdkDrawable(gfxASurfa
     return NULL;
 }
 #endif
 
 TemporaryRef<ScaledFont>
 gfxPlatformGtk::GetScaledFontForFont(DrawTarget* aTarget, gfxFont *aFont)
 {
     NativeFont nativeFont;
-
-    if (aTarget->GetType() == BACKEND_CAIRO || aTarget->GetType() == BACKEND_SKIA) {
+    if (aTarget->GetType() == BACKEND_CAIRO) {
         nativeFont.mType = NATIVE_FONT_CAIRO_FONT_FACE;
-        nativeFont.mFont = aFont->GetCairoScaledFont();
-        return Factory::CreateScaledFontForNativeFont(nativeFont, aFont->GetAdjustedSize());
+        nativeFont.mFont = NULL;
+        return Factory::CreateScaledFontWithCairo(nativeFont, aFont->GetAdjustedSize(), aFont->GetCairoScaledFont());
     }
-
-    return NULL;
-
+    NS_ASSERTION(aFont->GetType() == gfxFont::FONT_TYPE_FT2, "Expecting Freetype font");
+    nativeFont.mType = NATIVE_FONT_SKIA_FONT_FACE;
+    nativeFont.mFont = static_cast<gfxFT2FontBase*>(aFont)->GetFontOptions();
+    return Factory::CreateScaledFontForNativeFont(nativeFont, aFont->GetAdjustedSize());
 }