bug 844133 - eliminate the MOZ_GRAPHITE configure option. r=ted
authorJonathan Kew <jkew@mozilla.com>
Fri, 22 Feb 2013 16:52:20 +0000
changeset 122673 1861d261f88fc6458995a74799f7ad898a640d21
parent 122672 a1c344441241c219c441ded733f478192dc27b5c
child 122674 8679f0f1c2153b06a31122670dcb7d7b2f9f2a42
push id24356
push usergszorc@mozilla.com
push dateSun, 24 Feb 2013 01:00:12 +0000
treeherdermozilla-central@195e706140d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs844133
milestone22.0a1
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
bug 844133 - eliminate the MOZ_GRAPHITE configure option. r=ted
configure.in
gfx/Makefile.in
gfx/thebes/Makefile.in
gfx/thebes/gfxDWriteFonts.cpp
gfx/thebes/gfxFT2Fonts.cpp
gfx/thebes/gfxFont.cpp
gfx/thebes/gfxFont.h
gfx/thebes/gfxGDIFont.cpp
gfx/thebes/gfxMacFont.cpp
gfx/thebes/gfxMacPlatformFontList.mm
gfx/thebes/gfxPangoFonts.cpp
gfx/thebes/gfxPlatform.cpp
gfx/thebes/gfxPlatform.h
gfx/thebes/gfxUserFontSet.cpp
layout/media/Makefile.in
modules/libpref/src/init/all.js
toolkit/toolkit-makefiles.sh
--- a/configure.in
+++ b/configure.in
@@ -4246,17 +4246,16 @@ NSS_DISABLE_DBM=
 NECKO_WIFI=1
 NECKO_COOKIES=1
 NECKO_PROTOCOLS_DEFAULT="about data file ftp http res viewsource websocket wyciwyg device"
 USE_ARM_KUSER=
 BUILD_CTYPES=1
 MOZ_USE_NATIVE_POPUP_WINDOWS=
 MOZ_ANDROID_HISTORY=
 MOZ_WEBSMS_BACKEND=
-MOZ_GRAPHITE=1
 ACCESSIBILITY=1
 MOZ_SYS_MSG=
 MOZ_TIME_MANAGER=
 MOZ_PAY=
 MOZ_AUDIO_CHANNEL_MANAGER=
 
 case "$target_os" in
     mingw*)
@@ -8193,23 +8192,17 @@ dnl ====================================
 dnl HarfBuzz
 dnl ========================================================
 MOZ_HARFBUZZ_LIBS='$(DEPTH)/gfx/harfbuzz/src/$(LIB_PREFIX)mozharfbuzz.$(LIB_SUFFIX)'
 AC_SUBST(MOZ_HARFBUZZ_LIBS)
 
 dnl ========================================================
 dnl SIL Graphite
 dnl ========================================================
-if test "$MOZ_GRAPHITE"; then
-  MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
-  AC_DEFINE(MOZ_GRAPHITE)
-else
-  MOZ_GRAPHITE_LIBS=
-fi
-AC_SUBST(MOZ_GRAPHITE)
+MOZ_GRAPHITE_LIBS='$(DEPTH)/gfx/graphite2/src/$(LIB_PREFIX)mozgraphite2.$(LIB_SUFFIX)'
 AC_SUBST(MOZ_GRAPHITE_LIBS)
 
 dnl ========================================================
 dnl OTS
 dnl ========================================================
 MOZ_OTS_LIBS='$(DEPTH)/gfx/ots/src/$(LIB_PREFIX)mozots.$(LIB_SUFFIX)'
 AC_SUBST(MOZ_OTS_LIBS)
 
--- a/gfx/Makefile.in
+++ b/gfx/Makefile.in
@@ -11,21 +11,17 @@ VPATH		= @srcdir@
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= gfx
 
 ifdef MOZ_TREE_CAIRO
 DIRS		= cairo
 endif
 
-ifdef MOZ_GRAPHITE
-DIRS		+= graphite2/src
-endif
-
-DIRS		+= 2d ycbcr angle src qcms gl layers harfbuzz/src ots/src thebes ipc
+DIRS		+= 2d ycbcr angle src qcms gl layers graphite2/src harfbuzz/src ots/src thebes ipc
 
 ifdef MOZ_ENABLE_SKIA
 DIRS        += skia
 endif
 
 ifdef ENABLE_TESTS
 TOOL_DIRS	+= tests
 endif
--- a/gfx/thebes/Makefile.in
+++ b/gfx/thebes/Makefile.in
@@ -179,34 +179,28 @@ CPPSRCS	= \
 	gfxPlatform.cpp \
 	gfxPlatformFontList.cpp \
 	gfxRect.cpp \
 	gfxSkipChars.cpp \
 	gfxTeeSurface.cpp \
 	gfxUserFontSet.cpp \
 	gfxUtils.cpp \
 	gfxScriptItemizer.cpp \
+	gfxGraphiteShaper.cpp \
 	gfxHarfBuzzShaper.cpp \
 	gfxBaseSharedMemorySurface.cpp \
 	gfxReusableSurfaceWrapper.cpp \
 	nsSurfaceTexture.cpp \
 	gfxSVGGlyphs.cpp \
 	$(NULL)
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),$(findstring $(MOZ_WIDGET_TOOLKIT),android gtk2 gonk qt))
 DEFINES += -DMOZ_ENABLE_FREETYPE
 endif
 
-ifdef MOZ_GRAPHITE
-DEFINES += -DGRAPHITE2_STATIC
-CPPSRCS	+= \
-	gfxGraphiteShaper.cpp \
-	$(NULL)
-endif
-
 # Are we targeting x86 or x64?  If so, build gfxAlphaRecoverySSE2.cpp.
 ifneq (,$(INTEL_ARCHITECTURE))
 CPPSRCS += gfxAlphaRecoverySSE2.cpp
 endif
 
 SHARED_LIBRARY_LIBS += \
 	../layers/$(LIB_PREFIX)layers.$(LIB_SUFFIX) \
 	$(NULL)
@@ -343,18 +337,22 @@ CPPSRCS +=      nsUnicodeRange.cpp
 CPPSRCS +=      gfxQuartzNativeDrawing.cpp
 
 CMMSRCS = \
 	gfxMacPlatformFontList.mm \
 	$(NULL)
 
 endif
 
-DEFINES += -DIMPL_THEBES -DHB_DONT_DEFINE_STDINT
-DEFINES += -DMOZ_OTS_REPORT_ERRORS
+DEFINES += \
+	-DIMPL_THEBES \
+	-DHB_DONT_DEFINE_STDINT \
+	-DMOZ_OTS_REPORT_ERRORS \
+	-DGRAPHITE2_STATIC \
+	$(NULL)
 
 ifeq (WINNT,$(OS_TARGET))
 DEFINES += -DOTS_DLL
 endif
 
 include $(topsrcdir)/config/rules.mk
 include $(topsrcdir)/ipc/chromium/chromium-config.mk
 
--- a/gfx/thebes/gfxDWriteFonts.cpp
+++ b/gfx/thebes/gfxDWriteFonts.cpp
@@ -2,19 +2,17 @@
  * 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 "gfxDWriteFonts.h"
 #include "gfxDWriteShaper.h"
 #include "gfxHarfBuzzShaper.h"
 #include <algorithm>
-#ifdef MOZ_GRAPHITE
 #include "gfxGraphiteShaper.h"
-#endif
 #include "gfxDWriteFontList.h"
 #include "gfxContext.h"
 #include <dwrite.h>
 
 #include "gfxDWriteTextAnalysis.h"
 
 #include "harfbuzz/hb.h"
 
@@ -103,21 +101,19 @@ gfxDWriteFont::gfxDWriteFont(gfxFontEntr
 
     if (NS_FAILED(rv)) {
         mIsValid = false;
         return;
     }
 
     ComputeMetrics(anAAOption);
 
-#ifdef MOZ_GRAPHITE
     if (FontCanSupportGraphite()) {
         mGraphiteShaper = new gfxGraphiteShaper(this);
     }
-#endif
 
     if (FontCanSupportHarfBuzz()) {
         mHarfBuzzShaper = new gfxHarfBuzzShaper(this);
     }
 }
 
 gfxDWriteFont::~gfxDWriteFont()
 {
--- a/gfx/thebes/gfxFT2Fonts.cpp
+++ b/gfx/thebes/gfxFT2Fonts.cpp
@@ -20,19 +20,17 @@
 
 #include "gfxTypes.h"
 #include "gfxFT2Fonts.h"
 #include "gfxFT2FontBase.h"
 #include "gfxFT2Utils.h"
 #include "gfxFT2FontList.h"
 #include <locale.h>
 #include "gfxHarfBuzzShaper.h"
-#ifdef MOZ_GRAPHITE
 #include "gfxGraphiteShaper.h"
-#endif
 #include "nsGkAtoms.h"
 #include "nsTArray.h"
 #include "nsUnicodeRange.h"
 #include "nsCRT.h"
 #include "nsXULAppAPI.h"
 
 #include "prlog.h"
 #include "prinit.h"
@@ -408,28 +406,26 @@ gfxFT2Font::ShapeText(gfxContext      *a
                       uint32_t         aOffset,
                       uint32_t         aLength,
                       int32_t          aScript,
                       gfxShapedText   *aShapedText,
                       bool             aPreferPlatformShaping)
 {
     bool ok = false;
 
-#ifdef MOZ_GRAPHITE
     if (FontCanSupportGraphite()) {
         if (gfxPlatform::GetPlatform()->UseGraphiteShaping()) {
             if (!mGraphiteShaper) {
                 mGraphiteShaper = new gfxGraphiteShaper(this);
             }
             ok = mGraphiteShaper->ShapeText(aContext, aText,
                                             aOffset, aLength,
                                             aScript, aShapedText);
         }
     }
-#endif
 
     if (!ok && gfxPlatform::GetPlatform()->UseHarfBuzzForScript(aScript)) {
         if (!mHarfBuzzShaper) {
             gfxFT2LockedFace face(this);
             mFUnitsConvFactor = face.XScale();
 
             mHarfBuzzShaper = new gfxHarfBuzzShaper(this);
         }
--- a/gfx/thebes/gfxFont.cpp
+++ b/gfx/thebes/gfxFont.cpp
@@ -426,25 +426,23 @@ gfxFontEntry::ShareFontTableAndGetBlob(u
         // ensure the entry is null
         entry->Clear();
         return nullptr;
     }
 
     return entry->ShareTableAndGetBlob(*aBuffer, &mFontTableCache);
 }
 
-#ifdef MOZ_GRAPHITE
 void
 gfxFontEntry::CheckForGraphiteTables()
 {
     AutoFallibleTArray<uint8_t,16384> buffer;
     mHasGraphiteTables =
         NS_SUCCEEDED(GetFontTable(TRUETYPE_TAG('S','i','l','f'), buffer));
 }
-#endif
 
 /* static */ size_t
 gfxFontEntry::FontTableHashEntry::SizeOfEntryExcludingThis
     (FontTableHashEntry *aEntry,
      nsMallocSizeOfFun   aMallocSizeOf,
      void*               aUserArg)
 {
     FontListSizes *sizes = static_cast<FontListSizes*>(aUserArg);
@@ -2537,22 +2535,20 @@ gfxFont::ShapeText(gfxContext      *aCon
                    uint32_t         aOffset,
                    uint32_t         aLength,
                    int32_t          aScript,
                    gfxShapedText   *aShapedText,
                    bool             aPreferPlatformShaping)
 {
     bool ok = false;
 
-#ifdef MOZ_GRAPHITE
     if (mGraphiteShaper && gfxPlatform::GetPlatform()->UseGraphiteShaping()) {
         ok = mGraphiteShaper->ShapeText(aContext, aText, aOffset, aLength,
                                         aScript, aShapedText);
     }
-#endif
 
     if (!ok && mHarfBuzzShaper && !aPreferPlatformShaping) {
         if (gfxPlatform::GetPlatform()->UseHarfBuzzForScript(aScript)) {
             ok = mHarfBuzzShaper->ShapeText(aContext, aText, aOffset, aLength,
                                             aScript, aShapedText);
         }
     }
 
--- a/gfx/thebes/gfxFont.h
+++ b/gfx/thebes/gfxFont.h
@@ -211,19 +211,17 @@ public:
         mIsProxy(false), mIsValid(true), 
         mIsBadUnderlineFont(false), mIsUserFont(false),
         mIsLocalUserFont(false), mStandardFace(aIsStandardFace),
         mSymbolFont(false),
         mIgnoreGDEF(false),
         mIgnoreGSUB(false),
         mSVGInitialized(false),
         mWeight(500), mStretch(NS_FONT_STRETCH_NORMAL),
-#ifdef MOZ_GRAPHITE
         mCheckedForGraphiteTables(false),
-#endif
         mHasCmapTable(false),
         mUVSOffset(0), mUVSData(nullptr),
         mUserFontData(nullptr),
         mSVGGlyphs(nullptr),
         mLanguageOverride(NO_FONT_LANGUAGE_OVERRIDE)
     { }
 
     virtual ~gfxFontEntry();
@@ -252,25 +250,23 @@ public:
     bool IsFixedPitch() const { return mFixedPitch; }
     bool IsItalic() const { return mItalic; }
     bool IsBold() const { return mWeight >= 600; } // bold == weights 600 and above
     bool IgnoreGDEF() const { return mIgnoreGDEF; }
     bool IgnoreGSUB() const { return mIgnoreGSUB; }
 
     virtual bool IsSymbolFont();
 
-#ifdef MOZ_GRAPHITE
     inline bool HasGraphiteTables() {
         if (!mCheckedForGraphiteTables) {
             CheckForGraphiteTables();
             mCheckedForGraphiteTables = true;
         }
         return mHasGraphiteTables;
     }
-#endif
 
     inline bool HasCmapTable() {
         if (!mCharacterMap) {
             ReadCMAP();
             NS_ASSERTION(mCharacterMap, "failed to initialize character map");
         }
         return mHasCmapTable;
     }
@@ -347,20 +343,18 @@ public:
     bool             mSymbolFont  : 1;
     bool             mIgnoreGDEF  : 1;
     bool             mIgnoreGSUB  : 1;
     bool             mSVGInitialized : 1;
 
     uint16_t         mWeight;
     int16_t          mStretch;
 
-#ifdef MOZ_GRAPHITE
     bool             mHasGraphiteTables;
     bool             mCheckedForGraphiteTables;
-#endif
     bool             mHasCmapTable;
     nsRefPtr<gfxCharacterMap> mCharacterMap;
     uint32_t         mUVSOffset;
     nsAutoArrayPtr<uint8_t> mUVSData;
     gfxUserFontData* mUserFontData;
     gfxSVGGlyphs    *mSVGGlyphs;
 
     nsTArray<gfxFontFeature> mFeatureSettings;
@@ -380,34 +374,30 @@ protected:
         mIsUserFont(false),
         mIsLocalUserFont(false),
         mStandardFace(false),
         mSymbolFont(false),
         mIgnoreGDEF(false),
         mIgnoreGSUB(false),
         mSVGInitialized(false),
         mWeight(500), mStretch(NS_FONT_STRETCH_NORMAL),
-#ifdef MOZ_GRAPHITE
         mCheckedForGraphiteTables(false),
-#endif
         mHasCmapTable(false),
         mUVSOffset(0), mUVSData(nullptr),
         mUserFontData(nullptr),
         mSVGGlyphs(nullptr),
         mLanguageOverride(NO_FONT_LANGUAGE_OVERRIDE)
     { }
 
     virtual gfxFont *CreateFontInstance(const gfxFontStyle *aFontStyle, bool aNeedsBold) {
         NS_NOTREACHED("oops, somebody didn't override CreateFontInstance");
         return nullptr;
     }
 
-#ifdef MOZ_GRAPHITE
     virtual void CheckForGraphiteTables();
-#endif
 
 private:
 
     /**
      * Font table hashtable, to support GetFontTable for harfbuzz.
      *
      * The harfbuzz shaper (and potentially other clients) needs access to raw
      * font table data. This needs to be cached so that it can be used
@@ -1269,22 +1259,20 @@ public:
         return mFUnitsConvFactor;
     }
 
     // check whether this is an sfnt we can potentially use with harfbuzz
     bool FontCanSupportHarfBuzz() {
         return mFontEntry->HasCmapTable();
     }
 
-#ifdef MOZ_GRAPHITE
     // check whether this is an sfnt we can potentially use with Graphite
     bool FontCanSupportGraphite() {
         return mFontEntry->HasGraphiteTables();
     }
-#endif
 
     // Access to raw font table data (needed for Harfbuzz):
     // returns a pointer to data owned by the fontEntry or the OS,
     // which will remain valid until released.
     //
     // Default implementations forward to the font entry,
     // and maintain a shared table.
     //
@@ -1728,19 +1716,18 @@ protected:
     // a copy of the font without antialiasing, if needed for separate
     // measurement by mathml code
     nsAutoPtr<gfxFont>         mNonAAFont;
 
     // we may switch between these shapers on the fly, based on the script
     // of the text run being shaped
     nsAutoPtr<gfxFontShaper>   mPlatformShaper;
     nsAutoPtr<gfxFontShaper>   mHarfBuzzShaper;
-#ifdef MOZ_GRAPHITE
     nsAutoPtr<gfxFontShaper>   mGraphiteShaper;
-#endif
+
     mozilla::RefPtr<mozilla::gfx::ScaledFont> mAzureScaledFont;
 
     // Create a default platform text shaper for this font.
     // (TODO: This should become pure virtual once all font backends have
     // been updated.)
     virtual void CreatePlatformShaper() { }
 
     // Helper for subclasses that want to initialize standard metrics from the
--- a/gfx/thebes/gfxGDIFont.cpp
+++ b/gfx/thebes/gfxGDIFont.cpp
@@ -3,19 +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 "gfxGDIFont.h"
 #include "gfxGDIShaper.h"
 #include "gfxUniscribeShaper.h"
 #include "gfxHarfBuzzShaper.h"
 #include <algorithm>
-#ifdef MOZ_GRAPHITE
 #include "gfxGraphiteShaper.h"
-#endif
 #include "gfxWindowsPlatform.h"
 #include "gfxContext.h"
 
 #include "cairo-win32.h"
 
 #define ROUND(x) floor((x) + 0.5)
 
 static inline cairo_antialias_t
@@ -40,21 +38,19 @@ gfxGDIFont::gfxGDIFont(GDIFontEntry *aFo
                        AntialiasOption anAAOption)
     : gfxFont(aFontEntry, aFontStyle, anAAOption),
       mFont(NULL),
       mFontFace(nullptr),
       mMetrics(nullptr),
       mSpaceGlyph(0),
       mNeedsBold(aNeedsBold)
 {
-#ifdef MOZ_GRAPHITE
     if (FontCanSupportGraphite()) {
         mGraphiteShaper = new gfxGraphiteShaper(this);
     }
-#endif
     if (FontCanSupportHarfBuzz()) {
         mHarfBuzzShaper = new gfxHarfBuzzShaper(this);
     }
 }
 
 gfxGDIFont::~gfxGDIFont()
 {
     if (mScaledFont) {
@@ -128,23 +124,21 @@ gfxGDIFont::ShapeText(gfxContext      *a
     // Ensure the cairo font is set up, so there's no risk it'll fall back to
     // creating a "toy" font internally (see bug 544617).
     // We must check that this succeeded, otherwise we risk cairo creating the
     // wrong kind of font internally as a fallback (bug 744480).
     if (!SetupCairoFont(aContext)) {
         return false;
     }
 
-#ifdef MOZ_GRAPHITE
     if (mGraphiteShaper && gfxPlatform::GetPlatform()->UseGraphiteShaping()) {
         ok = mGraphiteShaper->ShapeText(aContext, aText,
                                         aOffset, aLength,
                                         aScript, aShapedText);
     }
-#endif
 
     if (!ok && mHarfBuzzShaper) {
         if (gfxPlatform::GetPlatform()->UseHarfBuzzForScript(aScript)) {
             ok = mHarfBuzzShaper->ShapeText(aContext, aText, aOffset, aLength,
                                             aScript, aShapedText);
         }
     }
 
--- a/gfx/thebes/gfxMacFont.cpp
+++ b/gfx/thebes/gfxMacFont.cpp
@@ -2,19 +2,17 @@
  * 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 "gfxMacFont.h"
 #include "gfxCoreTextShaper.h"
 #include "gfxHarfBuzzShaper.h"
 #include <algorithm>
-#ifdef MOZ_GRAPHITE
 #include "gfxGraphiteShaper.h"
-#endif
 #include "gfxPlatformMac.h"
 #include "gfxContext.h"
 #include "gfxFontUtils.h"
 
 #include "cairo-quartz.h"
 
 using namespace mozilla;
 using namespace mozilla::gfx;
@@ -95,21 +93,19 @@ gfxMacFont::gfxMacFont(MacOSFontEntry *a
 #ifdef DEBUG
         char warnBuf[1024];
         sprintf(warnBuf, "Failed to create scaled font: %s status: %d",
                 NS_ConvertUTF16toUTF8(GetName()).get(), cairoerr);
         NS_WARNING(warnBuf);
 #endif
     }
 
-#ifdef MOZ_GRAPHITE
     if (FontCanSupportGraphite()) {
         mGraphiteShaper = new gfxGraphiteShaper(this);
     }
-#endif
     if (FontCanSupportHarfBuzz()) {
         mHarfBuzzShaper = new gfxHarfBuzzShaper(this);
     }
 }
 
 gfxMacFont::~gfxMacFont()
 {
     if (mScaledFont) {
--- a/gfx/thebes/gfxMacPlatformFontList.mm
+++ b/gfx/thebes/gfxMacPlatformFontList.mm
@@ -258,30 +258,22 @@ MacOSFontEntry::ReadCMAP()
     bool unicodeFont = false, symbolFont = false; // currently ignored
 
     if (NS_SUCCEEDED(rv)) {
         rv = gfxFontUtils::ReadCMAP(cmap.Elements(), cmap.Length(),
                                     *charmap, mUVSOffset,
                                     unicodeFont, symbolFont);
     }
   
-    if (NS_SUCCEEDED(rv)) {
-#ifdef MOZ_GRAPHITE
-        // TODO: when we remove the MOZ_GRAPHITE conditional,
-        // we can merge this into the preceding if().
-        // Hence not (temporarily) indenting the code below
-        // by an extra level, only to undo that next time we
-        // touch it.
-        //
+    if (NS_SUCCEEDED(rv) && !HasGraphiteTables()) {
         // We assume a Graphite font knows what it's doing,
         // and provides whatever shaping is needed for the
         // characters it supports, so only check/clear the
         // complex-script ranges for non-Graphite fonts
-        if (!HasGraphiteTables()) {
-#endif
+
         // for layout support, check for the presence of mort/morx and/or
         // opentype layout tables
         bool hasAATLayout = HasFontTable(TRUETYPE_TAG('m','o','r','x')) ||
                             HasFontTable(TRUETYPE_TAG('m','o','r','t'));
         bool hasGSUB = HasFontTable(TRUETYPE_TAG('G','S','U','B'));
         bool hasGPOS = HasFontTable(TRUETYPE_TAG('G','P','O','S'));
         if (hasAATLayout && !(hasGSUB || hasGPOS)) {
             mRequiresAAT = true; // prefer CoreText if font has no OTL tables
@@ -306,19 +298,16 @@ MacOSFontEntry::ReadCMAP()
                 // We check for GSUB here, as GPOS alone would not be ok.
                 if (hasGSUB && SupportsScriptInGSUB(this, sr.tags)) {
                     continue;
                 }
 
                 charmap->ClearRange(sr.rangeStart, sr.rangeEnd);
             }
         }
-#ifdef MOZ_GRAPHITE
-        }
-#endif
     }
 
     mHasCmapTable = NS_SUCCEEDED(rv);
     if (mHasCmapTable) {
         gfxPlatformFontList *pfl = gfxPlatformFontList::PlatformFontList();
         mCharacterMap = pfl->FindCharMap(charmap);
     } else {
         // if error occurred, initialize to null cmap
--- a/gfx/thebes/gfxPangoFonts.cpp
+++ b/gfx/thebes/gfxPangoFonts.cpp
@@ -22,19 +22,17 @@
 #include "gfxQtPlatform.h"
 #endif
 #include "gfxPangoFonts.h"
 #include "gfxFT2FontBase.h"
 #include "gfxFT2Utils.h"
 #include "harfbuzz/hb.h"
 #include "harfbuzz/hb-ot.h"
 #include "gfxHarfBuzzShaper.h"
-#ifdef MOZ_GRAPHITE
 #include "gfxGraphiteShaper.h"
-#endif
 #include "nsUnicodeProperties.h"
 #include "nsUnicodeScriptCodes.h"
 #include "gfxFontconfigUtils.h"
 #include "gfxUserFontSet.h"
 
 #include <cairo.h>
 #include <cairo-ft.h>
 
@@ -188,19 +186,17 @@ public:
 
 protected:
     gfxFcFontEntry(const nsAString& aName)
         : gfxFontEntry(aName),
           mSkipHarfBuzz(false), mSkipGraphiteCheck(false)
     {
     }
 
-#ifdef MOZ_GRAPHITE
     virtual void CheckForGraphiteTables();
-#endif
 
     // One pattern is the common case and some subclasses rely on successful
     // addition of the first element to the array.
     nsAutoTArray<nsCountedRef<FcPattern>,1> mPatterns;
     bool mSkipHarfBuzz;
     bool mSkipGraphiteCheck;
 
     static cairo_user_data_key_t sFontEntryKey;
@@ -227,28 +223,26 @@ gfxFcFontEntry::RealFaceName()
             }
             return result;
         }
     }
     // fall back to gfxFontEntry implementation (only works for sfnt fonts)
     return gfxFontEntry::RealFaceName();
 }
 
-#ifdef MOZ_GRAPHITE
 void
 gfxFcFontEntry::CheckForGraphiteTables()
 {
     FcChar8 *capability;
     mHasGraphiteTables =
         !mPatterns.IsEmpty() &&
         FcPatternGetString(mPatterns[0],
                            FC_CAPABILITY, 0, &capability) == FcResultMatch &&
         FcStrStr(capability, gfxFontconfigUtils::ToFcChar8("ttable:Silf"));
 }
-#endif
 
 bool
 gfxFcFontEntry::ShouldUseHarfBuzz(int32_t aRunScript) {
     if (mSkipHarfBuzz ||
         !gfxPlatform::GetPlatform()->UseHarfBuzzForScript(aRunScript))
     {
         return false;
     }
@@ -2228,27 +2222,25 @@ gfxFcFont::ShapeText(gfxContext      *aC
                      int32_t          aScript,
                      gfxShapedText   *aShapedText,
                      bool             aPreferPlatformShaping)
 {
     gfxFcFontEntry *fontEntry = static_cast<gfxFcFontEntry*>(GetFontEntry());
 
     bool ok = false;
 
-#ifdef MOZ_GRAPHITE
     if (FontCanSupportGraphite()) {
         if (gfxPlatform::GetPlatform()->UseGraphiteShaping()) {
             if (!mGraphiteShaper) {
                 mGraphiteShaper = new gfxGraphiteShaper(this);
             }
             ok = mGraphiteShaper->ShapeText(aContext, aText, aOffset, aLength,
                                             aScript, aShapedText);
         }
     }
-#endif
 
     if (!ok && fontEntry->ShouldUseHarfBuzz(aScript)) {
         if (!mHarfBuzzShaper) {
             gfxFT2LockedFace face(this);
             mHarfBuzzShaper = new gfxHarfBuzzShaper(this);
             // Used by gfxHarfBuzzShaper, currently only for kerning
             mFUnitsConvFactor = face.XScale();
         }
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -35,19 +35,17 @@
 
 #include "nsGkAtoms.h"
 #include "gfxPlatformFontList.h"
 #include "gfxContext.h"
 #include "gfxImageSurface.h"
 #include "gfxUserFontSet.h"
 #include "nsUnicodeProperties.h"
 #include "harfbuzz/hb.h"
-#ifdef MOZ_GRAPHITE
 #include "gfxGraphiteShaper.h"
-#endif
 
 #include "nsUnicodeRange.h"
 #include "nsServiceManagerUtils.h"
 #include "nsTArray.h"
 #include "nsUnicharUtilCIID.h"
 #include "nsILocaleService.h"
 #include "nsReadableUtils.h"
 
@@ -131,19 +129,17 @@ SRGBOverrideObserver::Observe(nsISupport
 #define GFX_DOWNLOADABLE_FONTS_ENABLED "gfx.downloadable_fonts.enabled"
 
 #define GFX_PREF_HARFBUZZ_SCRIPTS "gfx.font_rendering.harfbuzz.scripts"
 #define HARFBUZZ_SCRIPTS_DEFAULT  mozilla::unicode::SHAPING_DEFAULT
 #define GFX_PREF_FALLBACK_USE_CMAPS  "gfx.font_rendering.fallback.always_use_cmaps"
 
 #define GFX_PREF_OPENTYPE_SVG "gfx.font_rendering.opentype_svg.enabled"
 
-#ifdef MOZ_GRAPHITE
 #define GFX_PREF_GRAPHITE_SHAPING "gfx.font_rendering.graphite.enabled"
-#endif
 
 #define BIDI_NUMERAL_PREF "bidi.numeral"
 
 static const char* kObservedPrefs[] = {
     "gfx.downloadable_fonts.",
     "gfx.font_rendering.",
     "bidi.numeral",
     nullptr
@@ -236,19 +232,17 @@ static const char *gPrefLangNames[] = {
 
 gfxPlatform::gfxPlatform()
   : mAzureCanvasBackendCollector(this, &gfxPlatform::GetAzureBackendInfo)
 {
     mUseHarfBuzzScripts = UNINITIALIZED_VALUE;
     mAllowDownloadableFonts = UNINITIALIZED_VALUE;
     mFallbackUsesCmaps = UNINITIALIZED_VALUE;
 
-#ifdef MOZ_GRAPHITE
     mGraphiteShapingEnabled = UNINITIALIZED_VALUE;
-#endif
     mBidiNumeralOption = UNINITIALIZED_VALUE;
 
     uint32_t canvasMask = (1 << BACKEND_CAIRO) | (1 << BACKEND_SKIA);
     uint32_t contentMask = 0;
     InitBackendPrefs(canvasMask, contentMask);
 }
 
 gfxPlatform*
@@ -388,19 +382,17 @@ gfxPlatform::Init()
 
 void
 gfxPlatform::Shutdown()
 {
     // These may be called before the corresponding subsystems have actually
     // started up. That's OK, they can handle it.
     gfxFontCache::Shutdown();
     gfxFontGroup::Shutdown();
-#ifdef MOZ_GRAPHITE
     gfxGraphiteShaper::Shutdown();
-#endif
 #if defined(XP_MACOSX) || defined(XP_WIN) // temporary, until this is implemented on others
     gfxPlatformFontList::Shutdown();
 #endif
 
     // Free the various non-null transforms and loaded profiles
     ShutdownCMS();
 
     // In some cases, gPlatform may not be created but Shutdown() called,
@@ -823,28 +815,26 @@ gfxPlatform::UseCmapsDuringSystemFallbac
     if (mFallbackUsesCmaps == UNINITIALIZED_VALUE) {
         mFallbackUsesCmaps =
             Preferences::GetBool(GFX_PREF_FALLBACK_USE_CMAPS, false);
     }
 
     return mFallbackUsesCmaps;
 }
 
-#ifdef MOZ_GRAPHITE
 bool
 gfxPlatform::UseGraphiteShaping()
 {
     if (mGraphiteShapingEnabled == UNINITIALIZED_VALUE) {
         mGraphiteShapingEnabled =
             Preferences::GetBool(GFX_PREF_GRAPHITE_SHAPING, false);
     }
 
     return mGraphiteShapingEnabled;
 }
-#endif
 
 bool
 gfxPlatform::UseHarfBuzzForScript(int32_t aScriptCode)
 {
     if (mUseHarfBuzzScripts == UNINITIALIZED_VALUE) {
         mUseHarfBuzzScripts = Preferences::GetInt(GFX_PREF_HARFBUZZ_SCRIPTS, HARFBUZZ_SCRIPTS_DEFAULT);
     }
 
@@ -1603,25 +1593,23 @@ gfxPlatform::GetBidiNumeralOption()
 void
 gfxPlatform::FontsPrefsChanged(const char *aPref)
 {
     NS_ASSERTION(aPref != nullptr, "null preference");
     if (!strcmp(GFX_DOWNLOADABLE_FONTS_ENABLED, aPref)) {
         mAllowDownloadableFonts = UNINITIALIZED_VALUE;
     } else if (!strcmp(GFX_PREF_FALLBACK_USE_CMAPS, aPref)) {
         mFallbackUsesCmaps = UNINITIALIZED_VALUE;
-#ifdef MOZ_GRAPHITE
     } else if (!strcmp(GFX_PREF_GRAPHITE_SHAPING, aPref)) {
         mGraphiteShapingEnabled = UNINITIALIZED_VALUE;
         gfxFontCache *fontCache = gfxFontCache::GetCache();
         if (fontCache) {
             fontCache->AgeAllGenerations();
             fontCache->FlushShapedWordCaches();
         }
-#endif
     } else if (!strcmp(GFX_PREF_HARFBUZZ_SCRIPTS, aPref)) {
         mUseHarfBuzzScripts = UNINITIALIZED_VALUE;
         gfxFontCache *fontCache = gfxFontCache::GetCache();
         if (fontCache) {
             fontCache->AgeAllGenerations();
             fontCache->FlushShapedWordCaches();
         }
     } else if (!strcmp(BIDI_NUMERAL_PREF, aPref)) {
--- a/gfx/thebes/gfxPlatform.h
+++ b/gfx/thebes/gfxPlatform.h
@@ -347,23 +347,21 @@ public:
 	return true;
     }
 
     /**
      * Whether to check all font cmaps during system font fallback
      */
     bool UseCmapsDuringSystemFallback();
 
-#ifdef MOZ_GRAPHITE
     /**
      * Whether to use the SIL Graphite rendering engine
      * (for fonts that include Graphite tables)
      */
     bool UseGraphiteShaping();
-#endif
 
     /**
      * Whether to use the harfbuzz shaper (depending on script complexity).
      *
      * This allows harfbuzz to be enabled selectively via the preferences.
      */
     bool UseHarfBuzzForScript(int32_t aScriptCode);
 
@@ -560,19 +558,17 @@ protected:
      */
     static mozilla::gfx::BackendType BackendTypeForName(const nsCString& aName);
 
     mozilla::gfx::BackendType GetContentBackend() {
       return mContentBackend;
     }
 
     int8_t  mAllowDownloadableFonts;
-#ifdef MOZ_GRAPHITE
     int8_t  mGraphiteShapingEnabled;
-#endif
 
     int8_t  mBidiNumeralOption;
 
     // whether to always search font cmaps globally 
     // when doing system font fallback
     int8_t  mFallbackUsesCmaps;
 
     // which scripts should be shaped with harfbuzz
--- a/gfx/thebes/gfxUserFontSet.cpp
+++ b/gfx/thebes/gfxUserFontSet.cpp
@@ -301,35 +301,30 @@ const uint8_t*
 gfxUserFontSet::SanitizeOpenTypeData(gfxMixedFontFamily *aFamily,
                                      gfxProxyFontEntry *aProxy,
                                      const uint8_t* aData, uint32_t aLength,
                                      uint32_t& aSaneLength, bool aIsCompressed)
 {
     // limit output/expansion to 256MB
     ExpandingMemoryStream output(aIsCompressed ? aLength * 2 : aLength,
                                  1024 * 1024 * 256);
-#ifdef MOZ_GRAPHITE
-#define PRESERVE_GRAPHITE true
-#else
-#define PRESERVE_GRAPHITE false
-#endif
 
 #ifdef MOZ_OTS_REPORT_ERRORS
     OTSCallbackUserData userData;
     userData.mFontSet = this;
     userData.mFamily = aFamily;
     userData.mProxy = aProxy;
 #define ERROR_REPORTING_ARGS &gfxUserFontSet::OTSMessage, &userData,
 #else
 #define ERROR_REPORTING_ARGS
 #endif
 
     if (ots::Process(&output, aData, aLength,
                      ERROR_REPORTING_ARGS
-                     PRESERVE_GRAPHITE)) {
+                     true)) {
         aSaneLength = output.Tell();
         return static_cast<uint8_t*>(output.forget());
     } else {
         aSaneLength = 0;
         return nullptr;
     }
 }
 
--- a/layout/media/Makefile.in
+++ b/layout/media/Makefile.in
@@ -15,31 +15,28 @@ LIBRARY_NAME	= gkmedias
 EXPORT_LIBRARY	= $(DIST)/lib
 ifeq (WINNT,$(OS_TARGET))
 FORCE_SHARED_LIB = 1
 endif
 
 SHARED_LIBRARY_LIBS = \
     $(MOZ_OTS_LIBS) \
     $(QCMS_LIBS) \
+    $(MOZ_GRAPHITE_LIBS) \
     $(MOZ_HARFBUZZ_LIBS) \
     $(NULL)
 
 ifdef MOZ_TREE_CAIRO
 SHARED_LIBRARY_LIBS += $(MOZ_CAIRO_LIBS)
 endif
 
 ifdef MOZ_TREE_PIXMAN
 SHARED_LIBRARY_LIBS += $(MOZ_PIXMAN_LIBS)
 endif
 
-ifdef MOZ_GRAPHITE
-SHARED_LIBRARY_LIBS += $(MOZ_GRAPHITE_LIBS)
-endif
-
 ifdef MOZ_VORBIS
 SHARED_LIBRARY_LIBS 	+= \
 	$(DEPTH)/media/libvorbis/lib/$(LIB_PREFIX)vorbis.$(LIB_SUFFIX) \
 	$(DEPTH)/media/libogg/src/$(LIB_PREFIX)ogg.$(LIB_SUFFIX) \
 	$(NULL)
 endif
 
 ifdef MOZ_TREMOR
--- a/modules/libpref/src/init/all.js
+++ b/modules/libpref/src/init/all.js
@@ -227,19 +227,17 @@ pref("gfx.color_management.enablev4", fa
 pref("gfx.downloadable_fonts.enabled", true);
 pref("gfx.downloadable_fonts.fallback_delay", 3000);
 
 pref("gfx.filter.nearest.force-enabled", false);
 
 // whether to always search all font cmaps during system font fallback
 pref("gfx.font_rendering.fallback.always_use_cmaps", false);
 
-#ifdef MOZ_GRAPHITE
 pref("gfx.font_rendering.graphite.enabled", false);
-#endif
 
 // Check intl/unicharutil/util/nsUnicodeProperties.h for definitions of script bits
 // in the ShapingType enumeration
 // Currently-defined bits:
 //  SHAPING_DEFAULT   = 0x0001,
 //  SHAPING_ARABIC    = 0x0002,
 //  SHAPING_HEBREW    = 0x0004,
 //  SHAPING_HANGUL    = 0x0008,
--- a/toolkit/toolkit-makefiles.sh
+++ b/toolkit/toolkit-makefiles.sh
@@ -119,16 +119,17 @@ MAKEFILES_parser="
   parser/xml/src/Makefile
 "
 
 MAKEFILES_gfx="
   gfx/Makefile
   gfx/2d/Makefile
   gfx/angle/Makefile
   gfx/gl/Makefile
+  gfx/graphite2/src/Makefile
   gfx/harfbuzz/src/Makefile
   gfx/ipc/Makefile
   gfx/layers/Makefile
   gfx/ots/src/Makefile
   gfx/src/Makefile
   gfx/thebes/Makefile
   gfx/qcms/Makefile
   gfx/ycbcr/Makefile
@@ -1331,22 +1332,16 @@ if [ "$MOZ_ENABLE_XREMOTE" ]; then
 fi
 
 if [ "$MOZ_FEEDS" ]; then
   add_makefiles "
     toolkit/components/feeds/Makefile
   "
 fi
 
-if [ "$MOZ_GRAPHITE" ]; then
-  add_makefiles "
-    gfx/graphite2/src/Makefile
-  "
-fi
-
 if [ "$MOZ_HELP_VIEWER" ]; then
   add_makefiles "
     toolkit/components/help/Makefile
   "
   if [ "$MOZ_WIDGET_TOOLKIT" = "cocoa" ]; then
     add_makefiles "
       toolkit/themes/pinstripe/help/Makefile
     "