Merge m-c to inbound.
authorRyan VanderMeulen <ryanvm@gmail.com>
Sun, 27 Apr 2014 15:09:36 -0400
changeset 180880 ea25086073c8faa8df41a0e1aeb9cb7f8f4e32b6
parent 180871 e248f673c2f222e9a3aeafc5673e8bd7000e6db1 (current diff)
parent 180879 63bbdca27a534b203f02aaf30b268fee2a062eaa (diff)
child 180881 c9ef39ad6e7089faae1cbffb22b8b4885ac7e626
child 180897 3627a8411cecee5b39f616aab9f6ddd2f1d20d53
child 180900 17fd295f094de41039fae65a9a1b2ea25fab39ef
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
milestone31.0a1
Merge m-c to inbound.
mfbt/TypedEnumBits.h
mfbt/TypedEnumInternal.h
--- a/b2g/app/ua-update.json.in
+++ b/b2g/app/ua-update.json.in
@@ -1,17 +1,15 @@
 // Comments must be on their own lines and must start with "//"
 
 // Send these sites a custom user-agent. Bugs to remove each override after
 // evangelism are included.
 {
   // bug 826335, globo.com
   "globo.com": "\\(Mobile#(Android; Mobile",
-  // bug 826344, abril.com.br
-  "abril.com.br": "\\(Mobile#(Android; Mobile",
   // bug 826347, msn.com
   "msn.com": "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19",
   // bug 826348, linkedin.com
   "linkedin.com": "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19",
   // bug 826353, itau.com.br
   "itau.com.br": "\\(Mobile#(Android; Mobile",
   // bug 826504, orkut.com.br
   "orkut.com.br": "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19",
@@ -38,30 +36,20 @@
   // bug 827573, webmotors.com.br
   "webmotors.com.br": "\\(Mobile#(Android; Mobile",
   // bug 827670, elpais.com.co
   "elpais.com.co": "Mozilla/5.0 (Linux; Android 4.0.4; Galaxy Nexus Build/IMM76B) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.133 Mobile Safari/535.19",
   // bug 827674, avianca.com
   "avianca.com": "\\(Mobile#(Android; Mobile",
   // bug 827678, marca.com
   "marca.com": "\\(Mobile#(Android; Mobile",
-  // bug 828354, gazeta.pl
-  "gazeta.pl": "\\(Mobile#(Android; Mobile",
-  // bug 828360, sport.pl
-  "sport.pl": "\\(Mobile#(Android; Mobile",
   // bug 828371, ingbank.pl
   "ingbank.pl": "\\(Mobile#(Android; Mobile",
-  // bug 828378, wyborcza.pl
-  "wyborcza.pl": "\\(Mobile#(Android; Mobile",
-  // bug 828380, deser.pl
-  "deser.pl": "\\(Mobile#(Android; Mobile",
   // bug 828386, ebay.es
   "ebay.es": "\\(Mobile#(Android; Mobile",
-  // bug 828392, infojobs.net
-  "infojobs.net": "\\(Mobile#(Android; Mobile",
   // bug 828399, antena3.com
   "antena3.com": "\\(Mobile#(Android; Mobile",
   // bug 828416, loteriasyapuestas.es
   "loteriasyapuestas.es": "\\(Mobile#(Android; Mobile",
   // bug 828418, bbva.es
   "bbva.es": "\\(Mobile#(Android; Mobile",
   // bug 828422, publico.es
   "publico.es": "\\(Mobile#(Android; Mobile",
@@ -74,50 +62,44 @@
   // bug 843132, comunio.es
   "comunio.es": "\\(Mobile#(Android; Mobile",
   // bug 843151, citibank.com
   "citibank.com": "\\(Mobile#(Android; Mobile",
   // bug 843153, games.com
   "games.com": "\\(Mobile#(Android; Mobile",
   // bug 843160, ehow.com
   "ehow.com": "\\(Mobile#(Android; Mobile",
-  // bug 866577, 3g.qq.com
-  "3g.qq.com": "\\(Mobile#(Android; Mobile",
   // bug 878228, blikk.hu
   "blikk.hu": "\\(Mobile#(Android; Mobile",
   // bug 878232, hazipatika.com
   "hazipatika.com": "\\(Mobile#(Android; Mobile",
   // bug 878238, koponyeg.hu
   "koponyeg.hu": "\\(Mobile#(Android; Mobile",
   // bug 878240, kuruc.info
   "kuruc.info": "\\(Mobile#(Android; Mobile",
   // bug 878242, nemzetisport.hu
   "nemzetisport.hu": "\\(Mobile#(Android; Mobile",
   // bug 878246, port.hu
   "port.hu": "\\(Mobile#(Android; Mobile",
   // bug 878249, portfolio.hu
   "portfolio.hu": "\\(Mobile#(Android; Mobile",
   // bug 878253, vatera.hu
   "vatera.hu": "\\(Mobile#(Android; Mobile",
-  // bug 878255, 24sata.hr
-  "24sata.hr": "\\(Mobile#(Android; Mobile",
   // bug 878260, cdm.me
   "cdm.me": "\\(Mobile#(Android; Mobile",
   // bug 878262, download.com
   "download.com": "\\(Mobile#(Android; Mobile",
   // bug 878264, haber.ba
   "haber.ba": "\\(Mobile#(Android; Mobile",
   // bug 878271, kurir-info.rs
   "kurir-info.rs": "\\(Mobile#(Android; Mobile",
   // bug 878273, livescore.com
   "livescore.com": "\\(Mobile#(Android; Mobile",
   // bug 878277, naslovi.net
   "naslovi.net": "\\(Mobile#(Android; Mobile",
-  // bug 878630, ask.com
-  "ask.com": "\\(Mobile#(Android; Mobile",
   // bug 878632, banorte.com
   "banorte.com": "\\(Mobile#(Android; Mobile",
   // bug 878649, univision.com
   "univision.com": "\\(Mobile#(Android; Mobile",
   // bug 878653, redstarbelgrade.info
   "redstarbelgrade.info": "\\(Mobile#(Android; Mobile",
   // bug 878655, vesti-online.com
   "vesti-online.com": "\\(Mobile#(Android; Mobile"
--- a/browser/devtools/debugger/test/browser.ini
+++ b/browser/devtools/debugger/test/browser.ini
@@ -241,16 +241,17 @@ support-files =
 [browser_dbg_variables-view-02.js]
 [browser_dbg_variables-view-03.js]
 [browser_dbg_variables-view-04.js]
 [browser_dbg_variables-view-05.js]
 [browser_dbg_variables-view-accessibility.js]
 [browser_dbg_variables-view-data.js]
 [browser_dbg_variables-view-edit-cancel.js]
 [browser_dbg_variables-view-edit-click.js]
+skip-if = (os == 'mac' || os == 'win') && (debug == false) # Bug 986166
 [browser_dbg_variables-view-edit-getset-01.js]
 [browser_dbg_variables-view-edit-getset-02.js]
 [browser_dbg_variables-view-edit-value.js]
 [browser_dbg_variables-view-edit-watch.js]
 [browser_dbg_variables-view-filter-01.js]
 [browser_dbg_variables-view-filter-02.js]
 [browser_dbg_variables-view-filter-03.js]
 [browser_dbg_variables-view-filter-04.js]
--- a/dom/audiochannel/AudioChannelAgent.cpp
+++ b/dom/audiochannel/AudioChannelAgent.cpp
@@ -80,23 +80,30 @@ AudioChannelAgent::InitInternal(nsIDOMWi
                                 nsIAudioChannelAgentCallback *aCallback,
                                 bool aUseWeakRef, bool aWithVideo)
 {
   // We need the window only for IPC.
   MOZ_ASSERT(aWindow || XRE_GetProcessType() == GeckoProcessType_Default);
 
   // We syncd the enum of channel type between nsIAudioChannelAgent.idl and
   // AudioChannelBinding.h the same.
-  MOZ_ASSERT(int(AUDIO_AGENT_CHANNEL_NORMAL) == int(AudioChannel::Normal) &&
-             int(AUDIO_AGENT_CHANNEL_CONTENT) == int(AudioChannel::Content) &&
-             int(AUDIO_AGENT_CHANNEL_NOTIFICATION) == int(AudioChannel::Notification) &&
-             int(AUDIO_AGENT_CHANNEL_ALARM) == int(AudioChannel::Alarm) &&
-             int(AUDIO_AGENT_CHANNEL_TELEPHONY) == int(AudioChannel::Telephony) &&
-             int(AUDIO_AGENT_CHANNEL_RINGER) == int(AudioChannel::Ringer) &&
-             int(AUDIO_AGENT_CHANNEL_PUBLICNOTIFICATION) == int(AudioChannel::Publicnotification),
+  MOZ_ASSERT(static_cast<AudioChannel>(AUDIO_AGENT_CHANNEL_NORMAL) ==
+             AudioChannel::Normal &&
+             static_cast<AudioChannel>(AUDIO_AGENT_CHANNEL_CONTENT) ==
+             AudioChannel::Content &&
+             static_cast<AudioChannel>(AUDIO_AGENT_CHANNEL_NOTIFICATION) ==
+             AudioChannel::Notification &&
+             static_cast<AudioChannel>(AUDIO_AGENT_CHANNEL_ALARM) ==
+             AudioChannel::Alarm &&
+             static_cast<AudioChannel>(AUDIO_AGENT_CHANNEL_TELEPHONY) ==
+             AudioChannel::Telephony &&
+             static_cast<AudioChannel>(AUDIO_AGENT_CHANNEL_RINGER) ==
+             AudioChannel::Ringer &&
+             static_cast<AudioChannel>(AUDIO_AGENT_CHANNEL_PUBLICNOTIFICATION) ==
+             AudioChannel::Publicnotification,
              "Enum of channel on nsIAudioChannelAgent.idl should be the same with AudioChannelBinding.h");
 
   if (mAudioChannelType != AUDIO_AGENT_CHANNEL_ERROR ||
       aChannelType > AUDIO_AGENT_CHANNEL_PUBLICNOTIFICATION ||
       aChannelType < AUDIO_AGENT_CHANNEL_NORMAL) {
     return NS_ERROR_FAILURE;
   }
 
--- a/gfx/gl/SharedSurfaceGralloc.cpp
+++ b/gfx/gl/SharedSurfaceGralloc.cpp
@@ -70,17 +70,17 @@ SharedSurface_Gralloc::Create(GLContext*
     gfxImageFormat format
       = gfxPlatform::GetPlatform()->OptimalFormatForContent(type);
 
     RefPtr<GrallocTextureClientOGL> grallocTC =
       new GrallocTextureClientOGL(
           allocator,
           gfx::ImageFormatToSurfaceFormat(format),
           gfx::BackendType::NONE, // we don't need to use it with a DrawTarget
-          layers::TextureFlags::DEFAULT);
+          TEXTURE_FLAGS_DEFAULT);
 
     if (!grallocTC->AllocateForGLRendering(size)) {
       return nullptr;
     }
 
     sp<GraphicBuffer> buffer = grallocTC->GetGraphicBuffer();
 
     EGLDisplay display = egl->Display();
--- a/gfx/ipc/GfxMessageUtils.h
+++ b/gfx/ipc/GfxMessageUtils.h
@@ -318,45 +318,16 @@ struct ParamTraits<mozilla::gfx::Primiti
 template <>
 struct ParamTraits<mozilla::gfx::ColorSpace>
   : public ContiguousTypedEnumSerializer<
              mozilla::gfx::ColorSpace,
              mozilla::gfx::ColorSpace::SRGB,
              mozilla::gfx::ColorSpace::Max>
 {};
 
-template <>
-struct ParamTraits<mozilla::layers::TextureFlags>
-  : public BitFlagsTypedEnumSerializer<
-            mozilla::layers::TextureFlags,
-            mozilla::layers::TextureFlags::ALL_BITS>
-{};
-
-template <>
-struct ParamTraits<mozilla::layers::TextureIdentifier>
-  : public ContiguousTypedEnumSerializer<
-             mozilla::layers::TextureIdentifier,
-             mozilla::layers::TextureIdentifier::Front,
-             mozilla::layers::TextureIdentifier::HighBound>
-{};
-
-template <>
-struct ParamTraits<mozilla::layers::DeprecatedTextureHostFlags>
-  : public BitFlagsTypedEnumSerializer<
-             mozilla::layers::DeprecatedTextureHostFlags,
-             mozilla::layers::DeprecatedTextureHostFlags::ALL_BITS>
-{};
-
-template <>
-struct ParamTraits<mozilla::layers::DiagnosticTypes>
-  : public BitFlagsTypedEnumSerializer<
-             mozilla::layers::DiagnosticTypes,
-             mozilla::layers::DiagnosticTypes::ALL_BITS>
-{};
-
 /*
 template <>
 struct ParamTraits<mozilla::PixelFormat>
   : public EnumSerializer<mozilla::PixelFormat,
                           gfxImageFormat::ARGB32,
                           gfxImageFormat::Unknown>
 {};
 */
@@ -833,20 +804,20 @@ struct ParamTraits<mozilla::layers::Text
     return ReadParam(aMsg, aIter, &aResult->mCompositableType) &&
            ReadParam(aMsg, aIter, &aResult->mDeprecatedTextureHostFlags) &&
            ReadParam(aMsg, aIter, &aResult->mTextureFlags);
   }
 };
 
 template <>
 struct ParamTraits<mozilla::layers::CompositableType>
-  : public ContiguousTypedEnumSerializer<
+  : public ContiguousEnumSerializer<
              mozilla::layers::CompositableType,
-             mozilla::layers::CompositableType::BUFFER_UNKNOWN,
-             mozilla::layers::CompositableType::BUFFER_COUNT>
+             mozilla::layers::BUFFER_UNKNOWN,
+             mozilla::layers::BUFFER_COUNT>
 {};
 
 template <>
 struct ParamTraits<mozilla::gfx::SurfaceFormat>
   : public ContiguousTypedEnumSerializer<
              mozilla::gfx::SurfaceFormat,
              mozilla::gfx::SurfaceFormat::B8G8R8A8,
              mozilla::gfx::SurfaceFormat::UNKNOWN>
--- a/gfx/layers/Compositor.cpp
+++ b/gfx/layers/Compositor.cpp
@@ -46,24 +46,24 @@ Compositor::AssertOnCompositorThread()
   MOZ_ASSERT(CompositorParent::CompositorLoop() ==
              MessageLoop::current(),
              "Can only call this from the compositor thread!");
 }
 
 bool
 Compositor::ShouldDrawDiagnostics(DiagnosticFlags aFlags)
 {
-  if ((aFlags & DiagnosticFlags::TILE) && !(mDiagnosticTypes & DiagnosticTypes::TILE_BORDERS)) {
+  if ((aFlags & DIAGNOSTIC_TILE) && !(mDiagnosticTypes & DIAGNOSTIC_TILE_BORDERS)) {
     return false;
   }
-  if ((aFlags & DiagnosticFlags::BIGIMAGE) &&
-      !(mDiagnosticTypes & DiagnosticTypes::BIGIMAGE_BORDERS)) {
+  if ((aFlags & DIAGNOSTIC_BIGIMAGE) &&
+      !(mDiagnosticTypes & DIAGNOSTIC_BIGIMAGE_BORDERS)) {
     return false;
   }
-  if (mDiagnosticTypes == DiagnosticTypes::NO_DIAGNOSTIC) {
+  if (!mDiagnosticTypes) {
     return false;
   }
   return true;
 }
 
 void
 Compositor::DrawDiagnostics(DiagnosticFlags aFlags,
                             const nsIntRegion& aVisibleRegion,
@@ -75,17 +75,17 @@ Compositor::DrawDiagnostics(DiagnosticFl
     return;
   }
 
   if (aVisibleRegion.GetNumRects() > 1) {
     nsIntRegionRectIterator screenIter(aVisibleRegion);
 
     while (const nsIntRect* rect = screenIter.Next())
     {
-      DrawDiagnostics(aFlags | DiagnosticFlags::REGION_RECT,
+      DrawDiagnostics(aFlags | DIAGNOSTIC_REGION_RECT,
                       ToRect(*rect), aClipRect, aTransform, aFlashCounter);
     }
   }
 
   DrawDiagnostics(aFlags, ToRect(aVisibleRegion.GetBounds()),
                   aClipRect, aTransform, aFlashCounter);
 }
 
@@ -148,41 +148,41 @@ Compositor::DrawDiagnosticsInternal(Diag
 #elif defined(ANDROID)
   int lWidth = 10;
 #else
   int lWidth = 2;
 #endif
   float opacity = 0.7f;
 
   gfx::Color color;
-  if (aFlags & DiagnosticFlags::CONTENT) {
+  if (aFlags & DIAGNOSTIC_CONTENT) {
     color = gfx::Color(0.0f, 1.0f, 0.0f, 1.0f); // green
-    if (aFlags & DiagnosticFlags::COMPONENT_ALPHA) {
+    if (aFlags & DIAGNOSTIC_COMPONENT_ALPHA) {
       color = gfx::Color(0.0f, 1.0f, 1.0f, 1.0f); // greenish blue
     }
-  } else if (aFlags & DiagnosticFlags::IMAGE) {
+  } else if (aFlags & DIAGNOSTIC_IMAGE) {
     color = gfx::Color(1.0f, 0.0f, 0.0f, 1.0f); // red
-  } else if (aFlags & DiagnosticFlags::COLOR) {
+  } else if (aFlags & DIAGNOSTIC_COLOR) {
     color = gfx::Color(0.0f, 0.0f, 1.0f, 1.0f); // blue
-  } else if (aFlags & DiagnosticFlags::CONTAINER) {
+  } else if (aFlags & DIAGNOSTIC_CONTAINER) {
     color = gfx::Color(0.8f, 0.0f, 0.8f, 1.0f); // purple
   }
 
   // make tile borders a bit more transparent to keep layer borders readable.
-  if (aFlags & DiagnosticFlags::TILE ||
-      aFlags & DiagnosticFlags::BIGIMAGE ||
-      aFlags & DiagnosticFlags::REGION_RECT) {
+  if (aFlags & DIAGNOSTIC_TILE ||
+      aFlags & DIAGNOSTIC_BIGIMAGE ||
+      aFlags & DIAGNOSTIC_REGION_RECT) {
     lWidth = 1;
     opacity = 0.5f;
     color.r *= 0.7f;
     color.g *= 0.7f;
     color.b *= 0.7f;
   }
 
-  if (mDiagnosticTypes & DiagnosticTypes::FLASH_BORDERS) {
+  if (mDiagnosticTypes & DIAGNOSTIC_FLASH_BORDERS) {
     float flash = (float)aFlashCounter / (float)DIAGNOSTIC_FLASH_COUNTER_MAX;
     color.r *= flash;
     color.g *= flash;
     color.b *= flash;
   }
 
   EffectChain effects;
 
--- a/gfx/layers/Compositor.h
+++ b/gfx/layers/Compositor.h
@@ -194,23 +194,23 @@ class Compositor
 protected:
   virtual ~Compositor() {}
 
 public:
   NS_INLINE_DECL_REFCOUNTING(Compositor)
 
   Compositor(PCompositorParent* aParent = nullptr)
     : mCompositorID(0)
-    , mDiagnosticTypes(DiagnosticTypes::NO_DIAGNOSTIC)
+    , mDiagnosticTypes(DIAGNOSTIC_NONE)
     , mParent(aParent)
     , mScreenRotation(ROTATION_0)
   {
   }
 
-  virtual TemporaryRef<DataTextureSource> CreateDataTextureSource(TextureFlags aFlags = TextureFlags::NO_FLAGS) = 0;
+  virtual TemporaryRef<DataTextureSource> CreateDataTextureSource(TextureFlags aFlags = 0) = 0;
   virtual bool Initialize() = 0;
   virtual void Destroy() = 0;
 
   /**
    * Return true if the effect type is supported.
    *
    * By default Compositor implementations should support all effects but in
    * some rare cases it is not possible to support an effect efficiently.
--- a/gfx/layers/CompositorTypes.h
+++ b/gfx/layers/CompositorTypes.h
@@ -6,186 +6,175 @@
 #ifndef MOZILLA_LAYERS_COMPOSITORTYPES_H
 #define MOZILLA_LAYERS_COMPOSITORTYPES_H
 
 #include <stdint.h>                     // for uint32_t
 #include <sys/types.h>                  // for int32_t
 #include "LayersTypes.h"                // for LayersBackend, etc
 #include "nsXULAppAPI.h"                // for GeckoProcessType, etc
 
-#include "mozilla/TypedEnum.h"
-#include "mozilla/TypedEnumBits.h"
-
 namespace mozilla {
 namespace layers {
 
 typedef int32_t SurfaceDescriptorType;
 const SurfaceDescriptorType SURFACEDESCRIPTOR_UNKNOWN = 0;
 
 /**
  * Flags used by texture clients and texture hosts. These are passed from client
  * side to host side when textures and compositables are created. Usually set
  * by the compositableCient, they may be modified by either the compositable or
  * texture clients.
  *
  * XXX - switch to all caps constant names which seems to be the standard in gecko
  */
-MOZ_BEGIN_ENUM_CLASS(TextureFlags, uint32_t)
-  NO_FLAGS           = 0,
-  // Use nearest-neighbour texture filtering (as opposed to linear filtering).
-  USE_NEAREST_FILTER = 1 << 0,
-  // The texture should be flipped around the y-axis when composited.
-  NEEDS_Y_FLIP       = 1 << 1,
-  // Force the texture to be represented using a single tile (note that this means
-  // tiled textures, not tiled layers).
-  DISALLOW_BIGIMAGE  = 1 << 2,
-  // Allow using 'repeat' mode for wrapping.
-  ALLOW_REPEAT       = 1 << 3,
-  // The texture represents a tile which is newly created.
-  NEW_TILE           = 1 << 4,
-  // The texture is part of a component-alpha pair
-  COMPONENT_ALPHA    = 1 << 5,
-  // The buffer will be treated as if the RB bytes are swapped.
-  // This is useful for rendering using Cairo/Thebes, because there is no
-  // BGRX Android pixel format, and so we have to do byte swapping.
-  //
-  // For example, if the GraphicBuffer has an Android pixel format of
-  // PIXEL_FORMAT_RGBA_8888 and isRBSwapped is true, when it is sampled
-  // (for example, with GL), a BGRA shader should be used.
-  RB_SWAPPED         = 1 << 6,
+typedef uint32_t TextureFlags;
+// Use nearest-neighbour texture filtering (as opposed to linear filtering).
+const TextureFlags TEXTURE_USE_NEAREST_FILTER = 1 << 0;
+// The texture should be flipped around the y-axis when composited.
+const TextureFlags TEXTURE_NEEDS_Y_FLIP       = 1 << 1;
+// Force the texture to be represented using a single tile (note that this means
+// tiled textures, not tiled layers).
+const TextureFlags TEXTURE_DISALLOW_BIGIMAGE  = 1 << 2;
+// Allow using 'repeat' mode for wrapping.
+const TextureFlags TEXTURE_ALLOW_REPEAT       = 1 << 3;
+// The texture represents a tile which is newly created.
+const TextureFlags TEXTURE_NEW_TILE           = 1 << 4;
+// The texture is part of a component-alpha pair
+const TextureFlags TEXTURE_COMPONENT_ALPHA    = 1 << 5;
+// The buffer will be treated as if the RB bytes are swapped.
+// This is useful for rendering using Cairo/Thebes, because there is no
+// BGRX Android pixel format, and so we have to do byte swapping.
+//
+// For example, if the GraphicBuffer has an Android pixel format of
+// PIXEL_FORMAT_RGBA_8888 and isRBSwapped is true, when it is sampled
+// (for example, with GL), a BGRA shader should be used.
+const TextureFlags TEXTURE_RB_SWAPPED         = 1 << 6;
 
-  FRONT              = 1 << 7,
-  // A texture host on white for component alpha
-  ON_WHITE           = 1 << 8,
-  // A texture host on black for component alpha
-  ON_BLACK           = 1 << 9,
-  // A texture host that supports tiling
-  TILE               = 1 << 10,
-  // A texture should be recycled when no longer in used
-  RECYCLE            = 1 << 11,
-  // Texture contents should be initialized
-  // from the previous texture.
-  COPY_PREVIOUS      = 1 << 12,
-  // Who is responsible for deallocating the shared data.
-  // if DEALLOCATE_CLIENT is set, the shared data is deallocated on the
-  // client side and requires some extra synchronizaion to ensure race-free
-  // deallocation.
-  // The default behaviour is to deallocate on the host side.
-  DEALLOCATE_CLIENT  = 1 << 13,
-  // After being shared ith the compositor side, an immutable texture is never
-  // modified, it can only be read. It is safe to not Lock/Unlock immutable
-  // textures.
-  IMMUTABLE          = 1 << 14,
-  // The contents of the texture must be uploaded or copied immediately
-  // during the transaction, because the producer may want to write
-  // to it again.
-  IMMEDIATE_UPLOAD   = 1 << 15,
-  // The texture is going to be used as part of a double
-  // buffered pair, and so we can guarantee that the producer/consumer
-  // won't be racing to access its contents.
-  DOUBLE_BUFFERED    = 1 << 16,
-  // We've previously tried a texture and it didn't work for some reason. If there
-  // is a fallback available, try that.
-  ALLOC_FALLBACK     = 1 << 17,
-  // OR union of all valid bits
-  ALL_BITS           = (1 << 18) - 1,
-  // the default flags
-  DEFAULT = FRONT
-MOZ_END_ENUM_CLASS(TextureFlags)
-MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(TextureFlags)
+const TextureFlags TEXTURE_FRONT              = 1 << 12;
+// A texture host on white for component alpha
+const TextureFlags TEXTURE_ON_WHITE           = 1 << 13;
+ // A texture host on black for component alpha
+const TextureFlags TEXTURE_ON_BLACK           = 1 << 14;
+// A texture host that supports tiling
+const TextureFlags TEXTURE_TILE               = 1 << 15;
+// A texture should be recycled when no longer in used
+const TextureFlags TEXTURE_RECYCLE            = 1 << 16;
+// Texture contents should be initialized
+// from the previous texture.
+const TextureFlags TEXTURE_COPY_PREVIOUS      = 1 << 24;
+// Who is responsible for deallocating the shared data.
+// if TEXTURE_DEALLOCATE_CLIENT is set, the shared data is deallocated on the
+// client side and requires some extra synchronizaion to ensure race-free
+// deallocation.
+// The default behaviour is to deallocate on the host side.
+const TextureFlags TEXTURE_DEALLOCATE_CLIENT  = 1 << 25;
+// After being shared ith the compositor side, an immutable texture is never
+// modified, it can only be read. It is safe to not Lock/Unlock immutable
+// textures.
+const TextureFlags TEXTURE_IMMUTABLE          = 1 << 27;
+// The contents of the texture must be uploaded or copied immediately
+// during the transaction, because the producer may want to write
+// to it again.
+const TextureFlags TEXTURE_IMMEDIATE_UPLOAD   = 1 << 28;
+// The texture is going to be used as part of a double
+// buffered pair, and so we can guarantee that the producer/consumer
+// won't be racing to access its contents.
+const TextureFlags TEXTURE_DOUBLE_BUFFERED    = 1 << 29;
+// We've previously tried a texture and it didn't work for some reason. If there
+// is a fallback available, try that.
+const TextureFlags TEXTURE_ALLOC_FALLBACK     = 1 << 31;
+
+// the default flags
+const TextureFlags TEXTURE_FLAGS_DEFAULT = TEXTURE_FRONT;
 
 static inline bool
 TextureRequiresLocking(TextureFlags aFlags)
 {
   // If we're not double buffered, or uploading
   // within a transaction, then we need to support
   // locking correctly.
-  return !(aFlags & (TextureFlags::IMMEDIATE_UPLOAD |
-                     TextureFlags::DOUBLE_BUFFERED |
-                     TextureFlags::IMMUTABLE));
+  return !(aFlags & (TEXTURE_IMMEDIATE_UPLOAD |
+                     TEXTURE_DOUBLE_BUFFERED |
+                     TEXTURE_IMMUTABLE));
 }
 
 /**
  * The type of debug diagnostic to enable.
  */
-MOZ_BEGIN_ENUM_CLASS(DiagnosticTypes, uint8_t)
-  NO_DIAGNOSTIC    = 0,
-  TILE_BORDERS     = 1 << 0,
-  LAYER_BORDERS    = 1 << 1,
-  BIGIMAGE_BORDERS = 1 << 2,
-  FLASH_BORDERS    = 1 << 3,
-  ALL_BITS         = (1 << 4) - 1
-MOZ_END_ENUM_CLASS(DiagnosticTypes)
-MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(DiagnosticTypes)
+typedef uint32_t DiagnosticTypes;
+const DiagnosticTypes DIAGNOSTIC_NONE             = 0;
+const DiagnosticTypes DIAGNOSTIC_TILE_BORDERS     = 1 << 0;
+const DiagnosticTypes DIAGNOSTIC_LAYER_BORDERS    = 1 << 1;
+const DiagnosticTypes DIAGNOSTIC_BIGIMAGE_BORDERS = 1 << 2;
+const DiagnosticTypes DIAGNOSTIC_FLASH_BORDERS    = 1 << 3;
 
 #define DIAGNOSTIC_FLASH_COUNTER_MAX 100
 
 /**
  * Information about the object that is being diagnosed.
  */
-MOZ_BEGIN_ENUM_CLASS(DiagnosticFlags, uint16_t)
-  NO_DIAGNOSTIC   = 0,
-  IMAGE           = 1 << 0,
-  CONTENT         = 1 << 1,
-  CANVAS          = 1 << 2,
-  COLOR           = 1 << 3,
-  CONTAINER       = 1 << 4,
-  TILE            = 1 << 5,
-  BIGIMAGE        = 1 << 6,
-  COMPONENT_ALPHA = 1 << 7,
-  REGION_RECT     = 1 << 8
-MOZ_END_ENUM_CLASS(DiagnosticFlags)
-MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(DiagnosticFlags)
+typedef uint32_t DiagnosticFlags;
+const DiagnosticFlags DIAGNOSTIC_IMAGE      = 1 << 0;
+const DiagnosticFlags DIAGNOSTIC_CONTENT    = 1 << 1;
+const DiagnosticFlags DIAGNOSTIC_CANVAS     = 1 << 2;
+const DiagnosticFlags DIAGNOSTIC_COLOR      = 1 << 3;
+const DiagnosticFlags DIAGNOSTIC_CONTAINER  = 1 << 4;
+const DiagnosticFlags DIAGNOSTIC_TILE       = 1 << 5;
+const DiagnosticFlags DIAGNOSTIC_BIGIMAGE   = 1 << 6;
+const DiagnosticFlags DIAGNOSTIC_COMPONENT_ALPHA = 1 << 7;
+const DiagnosticFlags DIAGNOSTIC_REGION_RECT = 1 << 8;
 
 /**
  * See gfx/layers/Effects.h
  */
-MOZ_BEGIN_ENUM_CLASS(EffectTypes, uint8_t)
-  MASK,
-  MAX_SECONDARY, // sentinel for the count of secondary effect types
-  RGB,
-  YCBCR,
-  COMPONENT_ALPHA,
-  SOLID_COLOR,
-  RENDER_TARGET,
-  MAX  //sentinel for the count of all effect types
-MOZ_END_ENUM_CLASS(EffectTypes)
+enum EffectTypes
+{
+  EFFECT_MASK,
+  EFFECT_MAX_SECONDARY, // sentinel for the count of secondary effect types
+  EFFECT_RGB,
+  EFFECT_YCBCR,
+  EFFECT_COMPONENT_ALPHA,
+  EFFECT_SOLID_COLOR,
+  EFFECT_RENDER_TARGET,
+  EFFECT_MAX  //sentinel for the count of all effect types
+};
 
 /**
  * How the Compositable should manage textures.
  */
-MOZ_BEGIN_ENUM_CLASS(CompositableType, uint8_t)
+enum CompositableType
+{
   BUFFER_UNKNOWN,
   // the deprecated compositable types
   BUFFER_IMAGE_SINGLE,    // image/canvas with a single texture, single buffered
   BUFFER_IMAGE_BUFFERED,  // canvas, double buffered
   BUFFER_BRIDGE,          // image bridge protocol
   BUFFER_CONTENT_INC,     // thebes layer interface, only sends incremental
                           // updates to a texture on the compositor side.
   // somewhere in the middle
   BUFFER_TILED,           // tiled thebes layer
   BUFFER_SIMPLE_TILED,
   // the new compositable types
-  IMAGE,     // image with single buffering
-  CONTENT_SINGLE,  // thebes layer interface, single buffering
-  CONTENT_DOUBLE,  // thebes layer interface, double buffering
+  COMPOSITABLE_IMAGE,     // image with single buffering
+  COMPOSITABLE_CONTENT_SINGLE,  // thebes layer interface, single buffering
+  COMPOSITABLE_CONTENT_DOUBLE,  // thebes layer interface, double buffering
   BUFFER_COUNT
-MOZ_END_ENUM_CLASS(CompositableType)
+};
 
 /**
  * How the texture host is used for composition,
  */
-MOZ_BEGIN_ENUM_CLASS(DeprecatedTextureHostFlags, uint8_t)
-  DEFAULT = 0,       // The default texture host for the given SurfaceDescriptor
-  TILED = 1 << 0,    // A texture host that supports tiling
-  COPY_PREVIOUS = 1 << 1, // Texture contents should be initialized
+enum DeprecatedTextureHostFlags
+{
+  TEXTURE_HOST_DEFAULT = 0,       // The default texture host for the given
+                                  // SurfaceDescriptor
+  TEXTURE_HOST_TILED = 1 << 0,    // A texture host that supports tiling
+  TEXTURE_HOST_COPY_PREVIOUS = 1 << 1 // Texture contents should be initialized
                                       // from the previous texture.
-  ALL_BITS = (1 << 2) - 1
-MOZ_END_ENUM_CLASS(DeprecatedTextureHostFlags)
-MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(DeprecatedTextureHostFlags)
+};
 
 /**
  * Sent from the compositor to the content-side LayerManager, includes properties
  * of the compositor and should (in the future) include information about what
  * kinds of buffer and texture clients to create.
  */
 struct TextureFactoryIdentifier
 {
@@ -209,77 +198,72 @@ struct TextureFactoryIdentifier
 };
 
 /**
  * Identify a texture to a compositable. Many textures can have the same id, but
  * the id is unique for any texture owned by a particular compositable.
  * XXX - This is now redundant with TextureFlags. it ill be removed along with
  * deprecated texture classes.
  */
-MOZ_BEGIN_ENUM_CLASS(TextureIdentifier, uint8_t)
-  Front = 1,
-  Back = 2,
-  OnWhiteFront = 3,
-  OnWhiteBack = 4,
-  HighBound
-MOZ_END_ENUM_CLASS(TextureIdentifier)
+typedef uint32_t TextureIdentifier;
+const TextureIdentifier TextureFront = 1;
+const TextureIdentifier TextureBack = 2;
+const TextureIdentifier TextureOnWhiteFront = 3;
+const TextureIdentifier TextureOnWhiteBack = 4;
 
 /**
  * Information required by the compositor from the content-side for creating or
  * using compositables and textures.
  * XXX - TextureInfo is a bad name: this information is useful for the compositable,
  * not the Texture. And ith new Textures, only the compositable type is really
  * useful. This may (should) be removed in the near future.
  */
 struct TextureInfo
 {
   CompositableType mCompositableType;
-  DeprecatedTextureHostFlags mDeprecatedTextureHostFlags;
-  TextureFlags mTextureFlags;
+  uint32_t mDeprecatedTextureHostFlags;
+  uint32_t mTextureFlags;
 
   TextureInfo()
-    : mCompositableType(CompositableType::BUFFER_UNKNOWN)
-    , mDeprecatedTextureHostFlags(DeprecatedTextureHostFlags::DEFAULT)
-    , mTextureFlags(TextureFlags::NO_FLAGS)
+    : mCompositableType(BUFFER_UNKNOWN)
+    , mDeprecatedTextureHostFlags(0)
+    , mTextureFlags(0)
   {}
 
   TextureInfo(CompositableType aType)
     : mCompositableType(aType)
-    , mDeprecatedTextureHostFlags(DeprecatedTextureHostFlags::DEFAULT)
-    , mTextureFlags(TextureFlags::NO_FLAGS)
+    , mDeprecatedTextureHostFlags(0)
+    , mTextureFlags(0)
   {}
 
   bool operator==(const TextureInfo& aOther) const
   {
     return mCompositableType == aOther.mCompositableType &&
            mDeprecatedTextureHostFlags == aOther.mDeprecatedTextureHostFlags &&
            mTextureFlags == aOther.mTextureFlags;
   }
 };
 
 /**
  * How a SurfaceDescriptor will be opened.
  *
  * See ShadowLayerForwarder::OpenDescriptor for example.
  */
-MOZ_BEGIN_ENUM_CLASS(OpenMode, uint8_t)
-  OPEN_NONE        = 0,
-  OPEN_READ        = 0x1,
-  OPEN_WRITE       = 0x2,
-  OPEN_READ_WRITE  = OPEN_READ|OPEN_WRITE,
-  OPEN_READ_ONLY   = OPEN_READ,
-  OPEN_WRITE_ONLY  = OPEN_WRITE
-MOZ_END_ENUM_CLASS(OpenMode)
-MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(OpenMode)
+typedef uint32_t OpenMode;
+const OpenMode OPEN_READ        = 0x1;
+const OpenMode OPEN_WRITE       = 0x2;
+const OpenMode OPEN_READ_WRITE  = OPEN_READ|OPEN_WRITE;
+const OpenMode OPEN_READ_ONLY   = OPEN_READ;
+const OpenMode OPEN_WRITE_ONLY  = OPEN_WRITE;
 
 // The kinds of mask texture a shader can support
 // We rely on the items in this enum being sequential
-MOZ_BEGIN_ENUM_CLASS(MaskType, uint8_t)
+enum MaskType {
   MaskNone = 0,   // no mask layer
   Mask2d,         // mask layer for layers with 2D transforms
   Mask3d,         // mask layer for layers with 3D transforms
   NumMaskTypes
-MOZ_END_ENUM_CLASS(MaskType)
+};
 
 } // namespace layers
 } // namespace mozilla
 
 #endif
--- a/gfx/layers/D3D9SurfaceImage.cpp
+++ b/gfx/layers/D3D9SurfaceImage.cpp
@@ -126,17 +126,17 @@ D3D9SurfaceImage::GetSize()
 }
 
 TextureClient*
 D3D9SurfaceImage::GetTextureClient(CompositableClient* aClient)
 {
   EnsureSynchronized();
   if (!mTextureClient) {
     RefPtr<SharedTextureClientD3D9> textureClient =
-      new SharedTextureClientD3D9(gfx::SurfaceFormat::B8G8R8X8, TextureFlags::DEFAULT);
+      new SharedTextureClientD3D9(gfx::SurfaceFormat::B8G8R8X8, TEXTURE_FLAGS_DEFAULT);
     textureClient->InitWith(mTexture, mShareHandle, mDesc);
     mTextureClient = textureClient;
   }
   return mTextureClient;
 }
 
 TemporaryRef<gfx::SourceSurface>
 D3D9SurfaceImage::GetAsSourceSurface()
--- a/gfx/layers/Effects.h
+++ b/gfx/layers/Effects.h
@@ -12,17 +12,16 @@
 #include "mozilla/gfx/Point.h"          // for IntSize
 #include "mozilla/gfx/Rect.h"           // for Rect
 #include "mozilla/gfx/Types.h"          // for Filter, etc
 #include "mozilla/layers/CompositorTypes.h"  // for EffectTypes, etc
 #include "mozilla/layers/LayersTypes.h"
 #include "mozilla/layers/TextureHost.h"  // for CompositingRenderTarget, etc
 #include "mozilla/mozalloc.h"           // for operator delete, etc
 #include "nscore.h"                     // for nsACString
-#include "mozilla/EnumeratedArray.h"
 
 namespace mozilla {
 namespace layers {
 
 /**
  * Effects and effect chains are used by the compositor API (see Compositor.h).
  * An effect chain represents a rendering method, for example some shader and
  * the data required for that shader to run. An effect is some component of the
@@ -76,17 +75,17 @@ struct TexturedEffect : public Effect
 };
 
 // Support an alpha mask.
 struct EffectMask : public Effect
 {
   EffectMask(TextureSource *aMaskTexture,
              gfx::IntSize aSize,
              const gfx::Matrix4x4 &aMaskTransform)
-    : Effect(EffectTypes::MASK)
+    : Effect(EFFECT_MASK)
     , mMaskTexture(aMaskTexture)
     , mIs3D(false)
     , mSize(aSize)
     , mMaskTransform(aMaskTransform)
   {}
 
   virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
 
@@ -95,83 +94,82 @@ struct EffectMask : public Effect
   gfx::IntSize mSize;
   gfx::Matrix4x4 mMaskTransform;
 };
 
 // Render to a render target rather than the screen.
 struct EffectRenderTarget : public TexturedEffect
 {
   EffectRenderTarget(CompositingRenderTarget *aRenderTarget)
-    : TexturedEffect(EffectTypes::RENDER_TARGET, aRenderTarget, true, gfx::Filter::LINEAR)
+    : TexturedEffect(EFFECT_RENDER_TARGET, aRenderTarget, true, gfx::Filter::LINEAR)
     , mRenderTarget(aRenderTarget)
   {}
 
   virtual const char* Name() { return "EffectRenderTarget"; }
   virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
 
   RefPtr<CompositingRenderTarget> mRenderTarget;
 };
 
 struct EffectRGB : public TexturedEffect
 {
   EffectRGB(TextureSource *aTexture,
             bool aPremultiplied,
             gfx::Filter aFilter,
             bool aFlipped = false)
-    : TexturedEffect(EffectTypes::RGB, aTexture, aPremultiplied, aFilter)
+    : TexturedEffect(EFFECT_RGB, aTexture, aPremultiplied, aFilter)
   {}
 
   virtual const char* Name() { return "EffectRGB"; }
 };
 
 struct EffectYCbCr : public TexturedEffect
 {
   EffectYCbCr(TextureSource *aSource, gfx::Filter aFilter)
-    : TexturedEffect(EffectTypes::YCBCR, aSource, false, aFilter)
+    : TexturedEffect(EFFECT_YCBCR, aSource, false, aFilter)
   {}
 
   virtual const char* Name() { return "EffectYCbCr"; }
 };
 
 struct EffectComponentAlpha : public TexturedEffect
 {
   EffectComponentAlpha(TextureSource *aOnBlack,
                        TextureSource *aOnWhite,
                        gfx::Filter aFilter)
-    : TexturedEffect(EffectTypes::COMPONENT_ALPHA, nullptr, false, aFilter)
+    : TexturedEffect(EFFECT_COMPONENT_ALPHA, nullptr, false, aFilter)
     , mOnBlack(aOnBlack)
     , mOnWhite(aOnWhite)
   {}
 
   virtual const char* Name() { return "EffectComponentAlpha"; }
 
   TextureSource* mOnBlack;
   TextureSource* mOnWhite;
 };
 
 struct EffectSolidColor : public Effect
 {
   EffectSolidColor(const gfx::Color &aColor)
-    : Effect(EffectTypes::SOLID_COLOR)
+    : Effect(EFFECT_SOLID_COLOR)
     , mColor(aColor)
   {}
 
   virtual void PrintInfo(nsACString& aTo, const char* aPrefix);
 
   gfx::Color mColor;
 };
 
 struct EffectChain
 {
   EffectChain() : mLayerRef(nullptr) {}
   explicit EffectChain(void* aLayerRef) : mLayerRef(aLayerRef) {}
 
   RefPtr<Effect> mPrimaryEffect;
-  EnumeratedArray<EffectTypes, EffectTypes::MAX_SECONDARY, RefPtr<Effect>>
-    mSecondaryEffects;
+  RefPtr<Effect> mSecondaryEffects[EFFECT_MAX_SECONDARY];
   void* mLayerRef; //!< For LayerScope logging
 };
 
 /**
  * Create a Textured effect corresponding to aFormat and using
  * aSource as the (first) texture source.
  *
  * Note that aFormat can be different form aSource->GetFormat if, we are
--- a/gfx/layers/ImageContainer.cpp
+++ b/gfx/layers/ImageContainer.cpp
@@ -126,17 +126,17 @@ ImageContainer::ImageContainer(int flag)
   mRemoteData(nullptr),
   mRemoteDataMutex(nullptr),
   mCompositionNotifySink(nullptr),
   mImageClient(nullptr)
 {
   if (flag == ENABLE_ASYNC && ImageBridgeChild::IsCreated()) {
     // the refcount of this ImageClient is 1. we don't use a RefPtr here because the refcount
     // of this class must be done on the ImageBridge thread.
-    mImageClient = ImageBridgeChild::GetSingleton()->CreateImageClient(CompositableType::BUFFER_IMAGE_SINGLE).drop();
+    mImageClient = ImageBridgeChild::GetSingleton()->CreateImageClient(BUFFER_IMAGE_SINGLE).drop();
     MOZ_ASSERT(mImageClient);
   }
 }
 
 ImageContainer::~ImageContainer()
 {
   if (IsAsync()) {
     ImageBridgeChild::DispatchReleaseImageClient(mImageClient);
@@ -619,22 +619,22 @@ CairoImage::GetTextureClient(Compositabl
     return textureClient;
   }
 
   RefPtr<SourceSurface> surface = GetAsSourceSurface();
   MOZ_ASSERT(surface);
 
   // gfx::BackendType::NONE means default to content backend
   textureClient = aClient->CreateTextureClientForDrawing(surface->GetFormat(),
-                                                         TextureFlags::DEFAULT,
+                                                         TEXTURE_FLAGS_DEFAULT,
                                                          gfx::BackendType::NONE,
                                                          surface->GetSize());
   MOZ_ASSERT(textureClient->CanExposeDrawTarget());
   if (!textureClient->AllocateForSurface(surface->GetSize()) ||
-      !textureClient->Lock(OpenMode::OPEN_WRITE_ONLY)) {
+      !textureClient->Lock(OPEN_WRITE_ONLY)) {
     return nullptr;
   }
 
   {
     // We must not keep a reference to the DrawTarget after it has been unlocked.
     RefPtr<DrawTarget> dt = textureClient->GetAsDrawTarget();
     dt->CopySurface(surface, IntRect(IntPoint(), surface->GetSize()), IntPoint());
   }
--- a/gfx/layers/LayerScope.cpp
+++ b/gfx/layers/LayerScope.cpp
@@ -773,47 +773,47 @@ LayerScope::SendEffectChain(GLContext* a
                             const EffectChain& aEffectChain,
                             int aWidth, int aHeight)
 {
     if (!CheckSender())
         return;
 
     const Effect* primaryEffect = aEffectChain.mPrimaryEffect;
     switch (primaryEffect->mType) {
-    case EffectTypes::RGB:
+    case EFFECT_RGB:
     {
         const TexturedEffect* texturedEffect =
             static_cast<const TexturedEffect*>(primaryEffect);
         SendTexturedEffect(aGLContext, aEffectChain.mLayerRef, texturedEffect);
     }
     break;
-    case EffectTypes::YCBCR:
+    case EFFECT_YCBCR:
     {
         const EffectYCbCr* yCbCrEffect =
             static_cast<const EffectYCbCr*>(primaryEffect);
         SendYCbCrEffect(aGLContext, aEffectChain.mLayerRef, yCbCrEffect);
     }
-    case EffectTypes::SOLID_COLOR:
+    case EFFECT_SOLID_COLOR:
     {
         const EffectSolidColor* solidColorEffect =
             static_cast<const EffectSolidColor*>(primaryEffect);
         gfxRGBA color(solidColorEffect->mColor.r,
                       solidColorEffect->mColor.g,
                       solidColorEffect->mColor.b,
                       solidColorEffect->mColor.a);
         SendColor(aEffectChain.mLayerRef, color, aWidth, aHeight);
     }
     break;
-    case EffectTypes::COMPONENT_ALPHA:
-    case EffectTypes::RENDER_TARGET:
+    case EFFECT_COMPONENT_ALPHA:
+    case EFFECT_RENDER_TARGET:
     default:
         break;
     }
 
-    //const Effect* secondaryEffect = aEffectChain.mSecondaryEffects[EffectTypes::MASK];
+    //const Effect* secondaryEffect = aEffectChain.mSecondaryEffects[EFFECT_MASK];
     // TODO:
 }
 
 LayerScopeWebSocketManager::LayerScopeWebSocketManager()
 {
     NS_NewThread(getter_AddRefs(mDebugSenderThread));
 
     mServerSocket = do_CreateInstance(NS_SERVERSOCKET_CONTRACTID);
--- a/gfx/layers/LayersLogging.cpp
+++ b/gfx/layers/LayersLogging.cpp
@@ -175,36 +175,36 @@ AppendToString(nsACString& s, const Filt
   return s += sfx;
 }
 
 nsACString&
 AppendToString(nsACString& s, TextureFlags flags,
                const char* pfx, const char* sfx)
 {
   s += pfx;
-  if (flags == TextureFlags::NO_FLAGS) {
+  if (!flags) {
     s += "NoFlags";
   } else {
 
 #define AppendFlag(test) \
 { \
-  if (!!(flags & test)) { \
+  if (flags & test) { \
     if (previous) { \
       s += "|"; \
     } \
     s += #test; \
     previous = true; \
   } \
 }
     bool previous = false;
-    AppendFlag(TextureFlags::USE_NEAREST_FILTER);
-    AppendFlag(TextureFlags::NEEDS_Y_FLIP);
-    AppendFlag(TextureFlags::DISALLOW_BIGIMAGE);
-    AppendFlag(TextureFlags::ALLOW_REPEAT);
-    AppendFlag(TextureFlags::NEW_TILE);
+    AppendFlag(TEXTURE_USE_NEAREST_FILTER);
+    AppendFlag(TEXTURE_NEEDS_Y_FLIP);
+    AppendFlag(TEXTURE_DISALLOW_BIGIMAGE);
+    AppendFlag(TEXTURE_ALLOW_REPEAT);
+    AppendFlag(TEXTURE_NEW_TILE);
 
 #undef AppendFlag
   }
   return s += sfx;
 }
 
 nsACString&
 AppendToString(nsACString& s, mozilla::gfx::SurfaceFormat format,
--- a/gfx/layers/LayersTypes.h
+++ b/gfx/layers/LayersTypes.h
@@ -6,17 +6,16 @@
 #ifndef GFX_LAYERSTYPES_H
 #define GFX_LAYERSTYPES_H
 
 #include <stdint.h>                     // for uint32_t
 #include "nsPoint.h"                    // for nsIntPoint
 #include "nsRegion.h"
 
 #include "mozilla/TypedEnum.h"
-#include "mozilla/TypedEnumBits.h"
 
 #ifdef MOZ_WIDGET_GONK
 #include <ui/GraphicBuffer.h>
 #endif
 #if defined(DEBUG) || defined(PR_LOGGING)
 #  include <stdio.h>            // FILE
 #  include "prlog.h"            // for PR_LOG
 #  ifndef MOZ_LAYERS_HAVE_LOG
@@ -36,16 +35,18 @@ namespace android {
 class GraphicBuffer;
 }
 
 namespace mozilla {
 namespace layers {
 
 class TextureHost;
 
+typedef uint32_t TextureFlags;
+
 #undef NONE
 #undef OPAQUE
 
 MOZ_BEGIN_ENUM_CLASS(LayersBackend, int8_t)
   LAYERS_NONE = 0,
   LAYERS_BASIC,
   LAYERS_OPENGL,
   LAYERS_D3D9,
@@ -71,78 +72,73 @@ MOZ_BEGIN_ENUM_CLASS(SurfaceMode, int8_t
   SURFACE_OPAQUE,
   SURFACE_SINGLE_CHANNEL_ALPHA,
   SURFACE_COMPONENT_ALPHA
 MOZ_END_ENUM_CLASS(SurfaceMode)
 
 // LayerRenderState for Composer2D
 // We currently only support Composer2D using gralloc. If we want to be backed
 // by other surfaces we will need a more generic LayerRenderState.
-MOZ_BEGIN_ENUM_CLASS(LayerRenderStateFlags, int8_t)
-  LAYER_RENDER_STATE_DEFAULT = 0,
-  Y_FLIPPED = 1 << 0,
-  BUFFER_ROTATION = 1 << 1,
+enum LayerRenderStateFlags {
+  LAYER_RENDER_STATE_Y_FLIPPED = 1 << 0,
+  LAYER_RENDER_STATE_BUFFER_ROTATION = 1 << 1,
   // Notify Composer2D to swap the RB pixels of gralloc buffer
-  FORMAT_RB_SWAP = 1 << 2
-MOZ_END_ENUM_CLASS(LayerRenderStateFlags)
-MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(LayerRenderStateFlags)
+  LAYER_RENDER_STATE_FORMAT_RB_SWAP = 1 << 2
+};
 
 // The 'ifdef MOZ_WIDGET_GONK' sadness here is because we don't want to include
 // android::sp unless we have to.
 struct LayerRenderState {
   LayerRenderState()
 #ifdef MOZ_WIDGET_GONK
-    : mFlags(LayerRenderStateFlags::LAYER_RENDER_STATE_DEFAULT)
-    , mHasOwnOffset(false)
-    , mSurface(nullptr)
-    , mTexture(nullptr)
+    : mSurface(nullptr), mTexture(nullptr), mFlags(0), mHasOwnOffset(false)
 #endif
   {}
 
 #ifdef MOZ_WIDGET_GONK
   LayerRenderState(android::GraphicBuffer* aSurface,
                    const nsIntSize& aSize,
-                   LayerRenderStateFlags aFlags,
+                   uint32_t aFlags,
                    TextureHost* aTexture)
-    : mFlags(aFlags)
-    , mHasOwnOffset(false)
-    , mSurface(aSurface)
+    : mSurface(aSurface)
     , mSize(aSize)
     , mTexture(aTexture)
+    , mFlags(aFlags)
+    , mHasOwnOffset(false)
   {}
 
   bool YFlipped() const
-  { return bool(mFlags & LayerRenderStateFlags::Y_FLIPPED); }
+  { return mFlags & LAYER_RENDER_STATE_Y_FLIPPED; }
 
   bool BufferRotated() const
-  { return bool(mFlags & LayerRenderStateFlags::BUFFER_ROTATION); }
+  { return mFlags & LAYER_RENDER_STATE_BUFFER_ROTATION; }
 
   bool FormatRBSwapped() const
-  { return bool(mFlags & LayerRenderStateFlags::FORMAT_RB_SWAP); }
+  { return mFlags & LAYER_RENDER_STATE_FORMAT_RB_SWAP; }
 #endif
 
   void SetOffset(const nsIntPoint& aOffset)
   {
     mOffset = aOffset;
     mHasOwnOffset = true;
   }
 
-  // see LayerRenderStateFlags
-  LayerRenderStateFlags mFlags;
-  // true if mOffset is applicable
-  bool mHasOwnOffset;
-  // the location of the layer's origin on mSurface
-  nsIntPoint mOffset;
 #ifdef MOZ_WIDGET_GONK
   // surface to render
   android::sp<android::GraphicBuffer> mSurface;
   // size of mSurface 
   nsIntSize mSize;
   TextureHost* mTexture;
 #endif
+  // see LayerRenderStateFlags
+  uint32_t mFlags;
+  // the location of the layer's origin on mSurface
+  nsIntPoint mOffset;
+  // true if mOffset is applicable
+  bool mHasOwnOffset;
 };
 
 MOZ_BEGIN_ENUM_CLASS(ScaleMode, int8_t)
   SCALE_NONE,
   STRETCH,
   SENTINEL
 // Unimplemented - PRESERVE_ASPECT_RATIO_CONTAIN
 MOZ_END_ENUM_CLASS(ScaleMode)
--- a/gfx/layers/MacIOSurfaceImage.cpp
+++ b/gfx/layers/MacIOSurfaceImage.cpp
@@ -9,17 +9,17 @@
 using namespace mozilla;
 using namespace mozilla::layers;
 
 TextureClient*
 MacIOSurfaceImage::GetTextureClient(CompositableClient* aClient)
 {
   if (!mTextureClient) {
     RefPtr<MacIOSurfaceTextureClientOGL> buffer =
-      new MacIOSurfaceTextureClientOGL(TextureFlags::DEFAULT);
+      new MacIOSurfaceTextureClientOGL(TEXTURE_FLAGS_DEFAULT);
     buffer->InitWith(mSurface);
     mTextureClient = buffer;
   }
   return mTextureClient;
 }
 
 TemporaryRef<gfx::SourceSurface>
 MacIOSurfaceImage::GetAsSourceSurface()
--- a/gfx/layers/basic/BasicCompositor.cpp
+++ b/gfx/layers/basic/BasicCompositor.cpp
@@ -121,17 +121,17 @@ BasicCompositor::CreateDataTextureSource
 {
   RefPtr<DataTextureSource> result = new DataTextureSourceBasic();
   return result.forget();
 }
 
 bool
 BasicCompositor::SupportsEffect(EffectTypes aEffect)
 {
-  return static_cast<EffectTypes>(aEffect) != EffectTypes::YCBCR;
+  return static_cast<EffectTypes>(aEffect) != EFFECT_YCBCR;
 }
 
 static void
 DrawSurfaceWithTextureCoords(DrawTarget *aDest,
                              const gfx::Rect& aDestRect,
                              SourceSurface *aSource,
                              const gfx::Rect& aTextureCoords,
                              gfx::Filter aFilter,
@@ -286,65 +286,65 @@ BasicCompositor::DrawQuad(const gfx::Rec
     transformBounds.MoveTo(0, 0);
   }
 
   newTransform.Translate(-offset.x, -offset.y);
   buffer->SetTransform(newTransform);
 
   RefPtr<SourceSurface> sourceMask;
   Matrix maskTransform;
-  if (aEffectChain.mSecondaryEffects[EffectTypes::MASK]) {
-    EffectMask *effectMask = static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EffectTypes::MASK].get());
+  if (aEffectChain.mSecondaryEffects[EFFECT_MASK]) {
+    EffectMask *effectMask = static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EFFECT_MASK].get());
     sourceMask = effectMask->mMaskTexture->AsSourceBasic()->GetSurface();
     MOZ_ASSERT(effectMask->mMaskTransform.Is2D(), "How did we end up with a 3D transform here?!");
     MOZ_ASSERT(!effectMask->mIs3D);
     maskTransform = effectMask->mMaskTransform.As2D();
     maskTransform.Translate(-offset.x, -offset.y);
   }
 
   switch (aEffectChain.mPrimaryEffect->mType) {
-    case EffectTypes::SOLID_COLOR: {
+    case EFFECT_SOLID_COLOR: {
       EffectSolidColor* effectSolidColor =
         static_cast<EffectSolidColor*>(aEffectChain.mPrimaryEffect.get());
 
       FillRectWithMask(dest, aRect, effectSolidColor->mColor,
                        DrawOptions(aOpacity), sourceMask, &maskTransform);
       break;
     }
-    case EffectTypes::RGB: {
+    case EFFECT_RGB: {
       TexturedEffect* texturedEffect =
           static_cast<TexturedEffect*>(aEffectChain.mPrimaryEffect.get());
       TextureSourceBasic* source = texturedEffect->mTexture->AsSourceBasic();
 
       DrawSurfaceWithTextureCoords(dest, aRect,
                                    source->GetSurface(),
                                    texturedEffect->mTextureCoords,
                                    texturedEffect->mFilter,
                                    aOpacity, sourceMask, &maskTransform);
       break;
     }
-    case EffectTypes::YCBCR: {
+    case EFFECT_YCBCR: {
       NS_RUNTIMEABORT("Can't (easily) support component alpha with BasicCompositor!");
       break;
     }
-    case EffectTypes::RENDER_TARGET: {
+    case EFFECT_RENDER_TARGET: {
       EffectRenderTarget* effectRenderTarget =
         static_cast<EffectRenderTarget*>(aEffectChain.mPrimaryEffect.get());
       RefPtr<BasicCompositingRenderTarget> surface
         = static_cast<BasicCompositingRenderTarget*>(effectRenderTarget->mRenderTarget.get());
       RefPtr<SourceSurface> sourceSurf = surface->mDrawTarget->Snapshot();
 
       DrawSurfaceWithTextureCoords(dest, aRect,
                                    sourceSurf,
                                    effectRenderTarget->mTextureCoords,
                                    effectRenderTarget->mFilter,
                                    aOpacity, sourceMask, &maskTransform);
       break;
     }
-    case EffectTypes::COMPONENT_ALPHA: {
+    case EFFECT_COMPONENT_ALPHA: {
       NS_RUNTIMEABORT("Can't (easily) support component alpha with BasicCompositor!");
       break;
     }
     default: {
       NS_RUNTIMEABORT("Invalid effect type!");
       break;
     }
   }
--- a/gfx/layers/basic/BasicCompositor.h
+++ b/gfx/layers/basic/BasicCompositor.h
@@ -60,17 +60,17 @@ public:
   CreateRenderTarget(const gfx::IntRect &aRect, SurfaceInitMode aInit) MOZ_OVERRIDE;
 
   virtual TemporaryRef<CompositingRenderTarget>
   CreateRenderTargetFromSource(const gfx::IntRect &aRect,
                                const CompositingRenderTarget *aSource,
                                const gfx::IntPoint &aSourcePoint) MOZ_OVERRIDE;
 
   virtual TemporaryRef<DataTextureSource>
-  CreateDataTextureSource(TextureFlags aFlags = TextureFlags::NO_FLAGS) MOZ_OVERRIDE;
+  CreateDataTextureSource(TextureFlags aFlags = 0) MOZ_OVERRIDE;
 
   virtual bool SupportsEffect(EffectTypes aEffect) MOZ_OVERRIDE;
 
   virtual void SetRenderTarget(CompositingRenderTarget *aSource) MOZ_OVERRIDE
   {
     mRenderTarget = static_cast<BasicCompositingRenderTarget*>(aSource);
   }
   virtual CompositingRenderTarget* GetCurrentRenderTarget() const MOZ_OVERRIDE
--- a/gfx/layers/basic/TextureClientX11.cpp
+++ b/gfx/layers/basic/TextureClientX11.cpp
@@ -66,17 +66,17 @@ TextureClientX11::ToSurfaceDescriptor(Su
 
   aOutDescriptor = SurfaceDescriptorX11(mSurface);
   return true;
 }
 
 TextureClientData*
 TextureClientX11::DropTextureData()
 {
-  MOZ_ASSERT(!(mFlags & TextureFlags::DEALLOCATE_CLIENT));
+  MOZ_ASSERT(!(mFlags & TEXTURE_DEALLOCATE_CLIENT));
   return nullptr;
 }
 
 bool
 TextureClientX11::AllocateForSurface(IntSize aSize, TextureAllocationFlags aTextureFlags)
 {
   MOZ_ASSERT(IsValid());
   //MOZ_ASSERT(mFormat != gfx::FORMAT_YUV, "This TextureClient cannot use YCbCr data");
--- a/gfx/layers/basic/TextureClientX11.h
+++ b/gfx/layers/basic/TextureClientX11.h
@@ -14,17 +14,17 @@ namespace mozilla {
 namespace layers {
 
 /**
  * A TextureClient implementation based on Xlib.
  */
 class TextureClientX11 : public TextureClient
 {
  public:
-  TextureClientX11(gfx::SurfaceFormat format, TextureFlags aFlags = TextureFlags::DEFAULT);
+  TextureClientX11(gfx::SurfaceFormat format, TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
 
   ~TextureClientX11();
 
   // TextureClient
 
   virtual bool IsAllocated() const MOZ_OVERRIDE;
 
   virtual bool ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor) MOZ_OVERRIDE;
--- a/gfx/layers/client/CanvasClient.cpp
+++ b/gfx/layers/client/CanvasClient.cpp
@@ -38,17 +38,17 @@ CanvasClient::CreateCanvasClient(CanvasC
 #ifndef MOZ_WIDGET_GONK
   if (XRE_GetProcessType() != GeckoProcessType_Default) {
     NS_WARNING("Most platforms still need an optimized way to share GL cross process.");
     return new CanvasClient2D(aForwarder, aFlags);
   }
 #endif
   if (aType == CanvasClientGLContext &&
       aForwarder->GetCompositorBackendType() == LayersBackend::LAYERS_OPENGL) {
-    aFlags |= TextureFlags::DEALLOCATE_CLIENT;
+    aFlags |= TEXTURE_DEALLOCATE_CLIENT;
     return new CanvasClientSurfaceStream(aForwarder, aFlags);
   }
   return new CanvasClient2D(aForwarder, aFlags);
 }
 
 void
 CanvasClient2D::Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer)
 {
@@ -61,30 +61,30 @@ CanvasClient2D::Update(gfx::IntSize aSiz
   bool bufferCreated = false;
   if (!mBuffer) {
     bool isOpaque = (aLayer->GetContentFlags() & Layer::CONTENT_OPAQUE);
     gfxContentType contentType = isOpaque
                                                 ? gfxContentType::COLOR
                                                 : gfxContentType::COLOR_ALPHA;
     gfxImageFormat format
       = gfxPlatform::GetPlatform()->OptimalFormatForContent(contentType);
-    TextureFlags flags = TextureFlags::DEFAULT;
-    if (mTextureFlags & TextureFlags::NEEDS_Y_FLIP) {
-      flags |= TextureFlags::NEEDS_Y_FLIP;
+    uint32_t flags = TEXTURE_FLAGS_DEFAULT;
+    if (mTextureFlags & TEXTURE_NEEDS_Y_FLIP) {
+      flags |= TEXTURE_NEEDS_Y_FLIP;
     }
     mBuffer = CreateBufferTextureClient(gfx::ImageFormatToSurfaceFormat(format),
                                         flags,
                                         gfxPlatform::GetPlatform()->GetPreferredCanvasBackend());
     MOZ_ASSERT(mBuffer->CanExposeDrawTarget());
     mBuffer->AllocateForSurface(aSize);
 
     bufferCreated = true;
   }
 
-  if (!mBuffer->Lock(OpenMode::OPEN_WRITE_ONLY)) {
+  if (!mBuffer->Lock(OPEN_WRITE_ONLY)) {
     mBuffer = nullptr;
     return;
   }
 
   bool updated = false;
   {
     // Restrict drawTarget to a scope so that terminates before Unlock.
     RefPtr<DrawTarget> target =
--- a/gfx/layers/client/CanvasClient.h
+++ b/gfx/layers/client/CanvasClient.h
@@ -74,17 +74,17 @@ public:
   CanvasClient2D(CompositableForwarder* aLayerForwarder,
                  TextureFlags aFlags)
     : CanvasClient(aLayerForwarder, aFlags)
   {
   }
 
   TextureInfo GetTextureInfo() const
   {
-    return TextureInfo(CompositableType::IMAGE);
+    return TextureInfo(COMPOSITABLE_IMAGE);
   }
 
   virtual void Clear() MOZ_OVERRIDE
   {
     mBuffer = nullptr;
   }
 
   virtual void Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer) MOZ_OVERRIDE;
@@ -108,17 +108,17 @@ private:
 // GL backend.
 class CanvasClientSurfaceStream : public CanvasClient
 {
 public:
   CanvasClientSurfaceStream(CompositableForwarder* aLayerForwarder, TextureFlags aFlags);
 
   TextureInfo GetTextureInfo() const
   {
-    return TextureInfo(CompositableType::IMAGE);
+    return TextureInfo(COMPOSITABLE_IMAGE);
   }
 
   virtual void Clear() MOZ_OVERRIDE
   {
     mBuffer = nullptr;
   }
 
   virtual void Update(gfx::IntSize aSize, ClientCanvasLayer* aLayer) MOZ_OVERRIDE;
--- a/gfx/layers/client/ClientCanvasLayer.cpp
+++ b/gfx/layers/client/ClientCanvasLayer.cpp
@@ -128,28 +128,28 @@ ClientCanvasLayer::RenderLayer()
     return;
   }
 
   if (GetMaskLayer()) {
     ToClientLayer(GetMaskLayer())->RenderLayer();
   }
   
   if (!mCanvasClient) {
-    TextureFlags flags = TextureFlags::IMMEDIATE_UPLOAD;
+    TextureFlags flags = TEXTURE_IMMEDIATE_UPLOAD;
     if (mNeedsYFlip) {
-      flags |= TextureFlags::NEEDS_Y_FLIP;
+      flags |= TEXTURE_NEEDS_Y_FLIP;
     }
 
     if (!mGLContext) {
       // We don't support locking for buffer surfaces currently
-      flags |= TextureFlags::IMMEDIATE_UPLOAD;
+      flags |= TEXTURE_IMMEDIATE_UPLOAD;
     } else {
       // GLContext's SurfaceStream handles ownership itself,
       // and doesn't require layers to do any deallocation.
-      flags |= TextureFlags::DEALLOCATE_CLIENT;
+      flags |= TEXTURE_DEALLOCATE_CLIENT;
     }
     mCanvasClient = CanvasClient::CreateCanvasClient(GetCanvasClientType(),
                                                      ClientManager()->AsShadowForwarder(), flags);
     if (!mCanvasClient) {
       return;
     }
     if (HasShadow()) {
       mCanvasClient->Connect();
--- a/gfx/layers/client/ClientImageLayer.cpp
+++ b/gfx/layers/client/ClientImageLayer.cpp
@@ -24,30 +24,30 @@ namespace mozilla {
 namespace layers {
 
 class ClientImageLayer : public ImageLayer, 
                          public ClientLayer {
 public:
   ClientImageLayer(ClientLayerManager* aLayerManager)
     : ImageLayer(aLayerManager,
                  static_cast<ClientLayer*>(MOZ_THIS_IN_INITIALIZER_LIST()))
-    , mImageClientTypeContainer(CompositableType::BUFFER_UNKNOWN)
+    , mImageClientTypeContainer(BUFFER_UNKNOWN)
   {
     MOZ_COUNT_CTOR(ClientImageLayer);
   }
   virtual ~ClientImageLayer()
   {
     DestroyBackBuffer();
     MOZ_COUNT_DTOR(ClientImageLayer);
   }
   
   virtual void SetContainer(ImageContainer* aContainer) MOZ_OVERRIDE
   {
     ImageLayer::SetContainer(aContainer);
-    mImageClientTypeContainer = CompositableType::BUFFER_UNKNOWN;
+    mImageClientTypeContainer = BUFFER_UNKNOWN;
   }
 
   virtual void SetVisibleRegion(const nsIntRegion& aRegion)
   {
     NS_ASSERTION(ClientManager()->InConstruction(),
                  "Can only set properties in construction phase");
     ImageLayer::SetVisibleRegion(aRegion);
   }
@@ -89,36 +89,36 @@ public:
 protected:
   ClientLayerManager* ClientManager()
   {
     return static_cast<ClientLayerManager*>(mManager);
   }
 
   CompositableType GetImageClientType()
   {
-    if (mImageClientTypeContainer != CompositableType::BUFFER_UNKNOWN) {
+    if (mImageClientTypeContainer != BUFFER_UNKNOWN) {
       return mImageClientTypeContainer;
     }
 
     if (mContainer->IsAsync()) {
-      mImageClientTypeContainer = CompositableType::BUFFER_BRIDGE;
+      mImageClientTypeContainer = BUFFER_BRIDGE;
       return mImageClientTypeContainer;
     }
 
     RefPtr<gfx::SourceSurface> surface;
     AutoLockImage autoLock(mContainer, &surface);
 
 #ifdef MOZ_WIDGET_GONK
-    // gralloc buffer needs CompositableType::BUFFER_IMAGE_BUFFERED to prevent
+    // gralloc buffer needs BUFFER_IMAGE_BUFFERED to prevent
     // the buffer's usage conflict.
     mImageClientTypeContainer = autoLock.GetImage() ?
-                                  CompositableType::BUFFER_IMAGE_BUFFERED : CompositableType::BUFFER_UNKNOWN;
+                                  BUFFER_IMAGE_BUFFERED : BUFFER_UNKNOWN;
 #else
     mImageClientTypeContainer = autoLock.GetImage() ?
-                                  CompositableType::BUFFER_IMAGE_SINGLE : CompositableType::BUFFER_UNKNOWN;
+                                  BUFFER_IMAGE_SINGLE : BUFFER_UNKNOWN;
 #endif
     return mImageClientTypeContainer;
   }
 
   RefPtr<ImageClient> mImageClient;
   CompositableType mImageClientTypeContainer;
 };
 
@@ -135,27 +135,27 @@ ClientImageLayer::RenderLayer()
 
   if (mImageClient) {
     mImageClient->OnTransaction();
   }
 
   if (!mImageClient ||
       !mImageClient->UpdateImage(mContainer, GetContentFlags())) {
     CompositableType type = GetImageClientType();
-    if (type == CompositableType::BUFFER_UNKNOWN) {
+    if (type == BUFFER_UNKNOWN) {
       return;
     }
-    TextureFlags flags = TextureFlags::FRONT;
+    TextureFlags flags = TEXTURE_FRONT;
     if (mDisallowBigImage) {
-      flags |= TextureFlags::DISALLOW_BIGIMAGE;
+      flags |= TEXTURE_DISALLOW_BIGIMAGE;
     }
     mImageClient = ImageClient::CreateImageClient(type,
                                                   ClientManager()->AsShadowForwarder(),
                                                   flags);
-    if (type == CompositableType::BUFFER_BRIDGE) {
+    if (type == BUFFER_BRIDGE) {
       static_cast<ImageClientBridge*>(mImageClient.get())->SetLayer(this);
     }
 
     if (!mImageClient) {
       return;
     }
     if (HasShadow() && !mContainer->IsAsync()) {
       mImageClient->Connect();
--- a/gfx/layers/client/CompositableClient.h
+++ b/gfx/layers/client/CompositableClient.h
@@ -70,25 +70,25 @@ class TextureClientData;
 class CompositableClient
 {
 protected:
   virtual ~CompositableClient();
 
 public:
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(CompositableClient)
 
-  CompositableClient(CompositableForwarder* aForwarder, TextureFlags aFlags = TextureFlags::NO_FLAGS);
+  CompositableClient(CompositableForwarder* aForwarder, TextureFlags aFlags = 0);
 
   virtual TextureInfo GetTextureInfo() const = 0;
 
   LayersBackend GetCompositorBackendType() const;
 
   TemporaryRef<BufferTextureClient>
   CreateBufferTextureClient(gfx::SurfaceFormat aFormat,
-                            TextureFlags aFlags = TextureFlags::DEFAULT,
+                            TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT,
                             gfx::BackendType aMoz2dBackend = gfx::BackendType::NONE);
 
   TemporaryRef<TextureClient>
   CreateTextureClientForDrawing(gfx::SurfaceFormat aFormat,
                                 TextureFlags aTextureFlags,
                                 gfx::BackendType aMoz2dBackend,
                                 const gfx::IntSize& aSizeHint);
 
--- a/gfx/layers/client/ContentClient.cpp
+++ b/gfx/layers/client/ContentClient.cpp
@@ -35,29 +35,30 @@
 namespace mozilla {
 
 using namespace gfx;
 
 namespace layers {
 
 static TextureFlags TextureFlagsForRotatedContentBufferFlags(uint32_t aBufferFlags)
 {
-  TextureFlags result = TextureFlags::NO_FLAGS;
+  TextureFlags result = 0;
 
   if (aBufferFlags & RotatedContentBuffer::BUFFER_COMPONENT_ALPHA) {
-    result |= TextureFlags::COMPONENT_ALPHA;
+    result |= TEXTURE_COMPONENT_ALPHA;
   }
 
   if (aBufferFlags & RotatedContentBuffer::ALLOW_REPEAT) {
-    result |= TextureFlags::ALLOW_REPEAT;
+    result |= TEXTURE_ALLOW_REPEAT;
   }
 
   return result;
 }
 
+
 /* static */ TemporaryRef<ContentClient>
 ContentClient::CreateContentClient(CompositableForwarder* aForwarder)
 {
   LayersBackend backend = aForwarder->GetCompositorBackendType();
   if (backend != LayersBackend::LAYERS_OPENGL &&
       backend != LayersBackend::LAYERS_D3D9 &&
       backend != LayersBackend::LAYERS_D3D11 &&
       backend != LayersBackend::LAYERS_BASIC) {
@@ -191,17 +192,17 @@ ContentClientRemoteBuffer::CreateAndAllo
                                           gfx::BackendType::NONE,
                                           mSize);
   if (!aClient) {
     return false;
   }
 
   if (!aClient->AllocateForSurface(mSize, ALLOC_CLEAR_BUFFER)) {
     aClient = CreateTextureClientForDrawing(mSurfaceFormat,
-                mTextureInfo.mTextureFlags | TextureFlags::ALLOC_FALLBACK | aFlags,
+                mTextureInfo.mTextureFlags | TEXTURE_ALLOC_FALLBACK | aFlags,
                 gfx::BackendType::NONE,
                 mSize);
     if (!aClient) {
       return false;
     }
     if (!aClient->AllocateForSurface(mSize, ALLOC_CLEAR_BUFFER)) {
       NS_WARNING("Could not allocate texture client");
       aClient = nullptr;
@@ -230,29 +231,29 @@ ContentClientRemoteBuffer::BuildTextureC
   mIsNewBuffer = true;
 
   DestroyBuffers();
 
   mSurfaceFormat = aFormat;
   mSize = gfx::IntSize(aRect.width, aRect.height);
   mTextureInfo.mTextureFlags = TextureFlagsForRotatedContentBufferFlags(aFlags);
 
-  if (!CreateAndAllocateTextureClient(mTextureClient, TextureFlags::ON_BLACK) ||
+  if (!CreateAndAllocateTextureClient(mTextureClient, TEXTURE_ON_BLACK) ||
       !AddTextureClient(mTextureClient)) {
     AbortTextureClientCreation();
     return;
   }
 
   if (aFlags & BUFFER_COMPONENT_ALPHA) {
-    if (!CreateAndAllocateTextureClient(mTextureClientOnWhite, TextureFlags::ON_WHITE) ||
+    if (!CreateAndAllocateTextureClient(mTextureClientOnWhite, TEXTURE_ON_WHITE) ||
         !AddTextureClient(mTextureClientOnWhite)) {
       AbortTextureClientCreation();
       return;
     }
-    mTextureInfo.mTextureFlags |= TextureFlags::COMPONENT_ALPHA;
+    mTextureInfo.mTextureFlags |= TEXTURE_COMPONENT_ALPHA;
   }
 
   CreateFrontBuffer(aRect);
 }
 
 void
 ContentClientRemoteBuffer::CreateBuffer(ContentType aType,
                                         const nsIntRect& aRect,
@@ -262,22 +263,22 @@ ContentClientRemoteBuffer::CreateBuffer(
 {
   BuildTextureClients(gfxPlatform::GetPlatform()->Optimal2DFormatForContent(aType), aRect, aFlags);
   if (!mTextureClient) {
     return;
   }
 
   // We just created the textures and we are about to get their draw targets
   // so we have to lock them here.
-  DebugOnly<bool> locked = mTextureClient->Lock(OpenMode::OPEN_READ_WRITE);
+  DebugOnly<bool> locked = mTextureClient->Lock(OPEN_READ_WRITE);
   MOZ_ASSERT(locked, "Could not lock the TextureClient");
 
   *aBlackDT = mTextureClient->GetAsDrawTarget();
   if (aFlags & BUFFER_COMPONENT_ALPHA) {
-    locked = mTextureClientOnWhite->Lock(OpenMode::OPEN_READ_WRITE);
+    locked = mTextureClientOnWhite->Lock(OPEN_READ_WRITE);
     MOZ_ASSERT(locked, "Could not lock the second TextureClient for component alpha");
 
     *aWhiteDT = mTextureClientOnWhite->GetAsDrawTarget();
   }
 }
 
 nsIntRegion
 ContentClientRemoteBuffer::GetUpdatedRegion(const nsIntRegion& aRegionToDraw,
@@ -333,23 +334,23 @@ ContentClientRemoteBuffer::SwapBuffers(c
 {
   MOZ_ASSERT(mTextureClient);
   mFrontAndBackBufferDiffer = true;
 }
 
 void
 ContentClientDoubleBuffered::CreateFrontBuffer(const nsIntRect& aBufferRect)
 {
-  if (!CreateAndAllocateTextureClient(mFrontClient, TextureFlags::ON_BLACK) ||
+  if (!CreateAndAllocateTextureClient(mFrontClient, TEXTURE_ON_BLACK) ||
       !AddTextureClient(mFrontClient)) {
     AbortTextureClientCreation();
     return;
   }
-  if (mTextureInfo.mTextureFlags & TextureFlags::COMPONENT_ALPHA) {
-    if (!CreateAndAllocateTextureClient(mFrontClientOnWhite, TextureFlags::ON_WHITE) ||
+  if (mTextureInfo.mTextureFlags & TEXTURE_COMPONENT_ALPHA) {
+    if (!CreateAndAllocateTextureClient(mFrontClientOnWhite, TEXTURE_ON_WHITE) ||
         !AddTextureClient(mFrontClientOnWhite)) {
       AbortTextureClientCreation();
       return;
     }
   }
 
   mFrontBufferRect = aBufferRect;
   mFrontBufferRotation = nsIntPoint();
@@ -421,21 +422,21 @@ ContentClientDoubleBuffered::BeginPaint(
 // Sync front/back buffers content
 // After executing, the new back buffer has the same (interesting) pixels as
 // the new front buffer, and mValidRegion et al. are correct wrt the new
 // back buffer (i.e. as they were for the old back buffer)
 void
 ContentClientDoubleBuffered::FinalizeFrame(const nsIntRegion& aRegionToDraw)
 {
   if (mTextureClient) {
-    DebugOnly<bool> locked = mTextureClient->Lock(OpenMode::OPEN_READ_WRITE);
+    DebugOnly<bool> locked = mTextureClient->Lock(OPEN_READ_WRITE);
     MOZ_ASSERT(locked);
   }
   if (mTextureClientOnWhite) {
-    DebugOnly<bool> locked = mTextureClientOnWhite->Lock(OpenMode::OPEN_READ_WRITE);
+    DebugOnly<bool> locked = mTextureClientOnWhite->Lock(OPEN_READ_WRITE);
     MOZ_ASSERT(locked);
   }
 
   if (!mFrontAndBackBufferDiffer) {
     MOZ_ASSERT(!mDidSelfCopy, "If we have to copy the world, then our buffers are different, right?");
     return;
   }
   MOZ_ASSERT(mFrontClient);
@@ -459,21 +460,21 @@ ContentClientDoubleBuffered::FinalizeFra
   // nothing to sync at all, there is nothing to do and we can go home early.
   updateRegion.Sub(updateRegion, aRegionToDraw);
   if (updateRegion.IsEmpty()) {
     return;
   }
 
   // We need to ensure that we lock these two buffers in the same
   // order as the compositor to prevent deadlocks.
-  if (!mFrontClient->Lock(OpenMode::OPEN_READ_ONLY)) {
+  if (!mFrontClient->Lock(OPEN_READ_ONLY)) {
     return;
   }
   if (mFrontClientOnWhite &&
-      !mFrontClientOnWhite->Lock(OpenMode::OPEN_READ_ONLY)) {
+      !mFrontClientOnWhite->Lock(OPEN_READ_ONLY)) {
     mFrontClient->Unlock();
     return;
   }
   {
     // Restrict the DrawTargets and frontBuffer to a scope to make
     // sure there is no more external references to the DrawTargets
     // when we Unlock the TextureClients.
     RefPtr<DrawTarget> dt = mFrontClient->GetAsDrawTarget();
@@ -534,21 +535,21 @@ ContentClientDoubleBuffered::UpdateDesti
     }
   }
 }
 
 void
 ContentClientSingleBuffered::FinalizeFrame(const nsIntRegion& aRegionToDraw)
 {
   if (mTextureClient) {
-    DebugOnly<bool> locked = mTextureClient->Lock(OpenMode::OPEN_READ_WRITE);
+    DebugOnly<bool> locked = mTextureClient->Lock(OPEN_READ_WRITE);
     MOZ_ASSERT(locked);
   }
   if (mTextureClientOnWhite) {
-    DebugOnly<bool> locked = mTextureClientOnWhite->Lock(OpenMode::OPEN_READ_WRITE);
+    DebugOnly<bool> locked = mTextureClientOnWhite->Lock(OPEN_READ_WRITE);
     MOZ_ASSERT(locked);
   }
 }
 
 static void
 WrapRotationAxis(int32_t* aRotationPoint, int32_t aSize)
 {
   if (*aRotationPoint < 0) {
@@ -566,33 +567,21 @@ FillSurface(DrawTarget* aDT, const nsInt
   const nsIntRect* r;
   while ((r = iter.Next()) != nullptr) {
     aDT->FillRect(Rect(r->x - aOffset.x, r->y - aOffset.y,
                        r->width, r->height),
                   ColorPattern(ToColor(aColor)));
   }
 }
 
-void
-ContentClientIncremental::NotifyBufferCreated(ContentType aType, TextureFlags aFlags)
-{
-  mTextureInfo.mTextureFlags = aFlags;
-  mContentType = aType;
-
-  mForwarder->CreatedIncrementalBuffer(this,
-                                        mTextureInfo,
-                                        mBufferRect);
-
-}
-
 RotatedContentBuffer::PaintState
 ContentClientIncremental::BeginPaintBuffer(ThebesLayer* aLayer,
                                            uint32_t aFlags)
 {
-  mTextureInfo.mDeprecatedTextureHostFlags = DeprecatedTextureHostFlags::DEFAULT;
+  mTextureInfo.mDeprecatedTextureHostFlags = 0;
   PaintState result;
   // We need to disable rotation if we're going to be resampled when
   // drawing, because we might sample across the rotation boundary.
   bool canHaveRotation =  !(aFlags & RotatedContentBuffer::PAINT_WILL_RESAMPLE);
 
   nsIntRegion validRegion = aLayer->GetValidRegion();
 
   bool canUseOpaqueSurface = aLayer->CanUseOpaqueSurface();
@@ -607,17 +596,17 @@ ContentClientIncremental::BeginPaintBuff
 
   while (true) {
     mode = aLayer->GetSurfaceMode();
     neededRegion = aLayer->GetVisibleRegion();
     // If we're going to resample, we need a buffer that's in clamp mode.
     canReuseBuffer = neededRegion.GetBounds().Size() <= mBufferRect.Size() &&
       mHasBuffer &&
       (!(aFlags & RotatedContentBuffer::PAINT_WILL_RESAMPLE) ||
-       !(mTextureInfo.mTextureFlags & TextureFlags::ALLOW_REPEAT));
+       !(mTextureInfo.mTextureFlags & TEXTURE_ALLOW_REPEAT));
 
     if (canReuseBuffer) {
       if (mBufferRect.Contains(neededRegion.GetBounds())) {
         // We don't need to adjust mBufferRect.
         destBufferRect = mBufferRect;
       } else {
         // The buffer's big enough but doesn't contain everything that's
         // going to be visible. We'll move it.
@@ -691,22 +680,19 @@ ContentClientIncremental::BeginPaintBuff
     mBufferRect.SetRect(0, 0, 0, 0);
     mBufferRotation.MoveTo(0, 0);
     canReuseBuffer = false;
   }
 
   nsIntRect drawBounds = result.mRegionToDraw.GetBounds();
   bool createdBuffer = false;
 
-  TextureFlags bufferFlags = TextureFlags::NO_FLAGS;
-  if (canHaveRotation) {
-    bufferFlags |= TextureFlags::ALLOW_REPEAT;
-  }
+  uint32_t bufferFlags = canHaveRotation ? TEXTURE_ALLOW_REPEAT : 0;
   if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
-    bufferFlags |= TextureFlags::COMPONENT_ALPHA;
+    bufferFlags |= TEXTURE_COMPONENT_ALPHA;
   }
   if (canReuseBuffer) {
     nsIntRect keepArea;
     if (keepArea.IntersectRect(destBufferRect, mBufferRect)) {
       // Set mBufferRotation so that the pixels currently in mBuffer
       // will still be rendered in the right place when mBufferRect
       // changes to destBufferRect.
       nsIntPoint newRotation = mBufferRotation +
@@ -749,17 +735,17 @@ ContentClientIncremental::BeginPaintBuff
 
   if (!createdBuffer && !mHasBuffer) {
     return result;
   }
 
   if (createdBuffer) {
     if (mHasBuffer &&
         (mode != SurfaceMode::SURFACE_COMPONENT_ALPHA || mHasBufferOnWhite)) {
-      mTextureInfo.mDeprecatedTextureHostFlags = DeprecatedTextureHostFlags::COPY_PREVIOUS;
+      mTextureInfo.mDeprecatedTextureHostFlags = TEXTURE_HOST_COPY_PREVIOUS;
     }
 
     mHasBuffer = true;
     if (mode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
       mHasBufferOnWhite = true;
     }
     mBufferRect = destBufferRect;
     mBufferRotation = nsIntPoint(0,0);
@@ -846,26 +832,26 @@ ContentClientIncremental::BorrowDrawTarg
 
 void
 ContentClientIncremental::Updated(const nsIntRegion& aRegionToDraw,
                                   const nsIntRegion& aVisibleRegion,
                                   bool aDidSelfCopy)
 {
   if (IsSurfaceDescriptorValid(mUpdateDescriptor)) {
     mForwarder->UpdateTextureIncremental(this,
-                                         TextureIdentifier::Front,
+                                         TextureFront,
                                          mUpdateDescriptor,
                                          aRegionToDraw,
                                          mBufferRect,
                                          mBufferRotation);
     mUpdateDescriptor = SurfaceDescriptor();
   }
   if (IsSurfaceDescriptorValid(mUpdateDescriptorOnWhite)) {
     mForwarder->UpdateTextureIncremental(this,
-                                         TextureIdentifier::OnWhiteFront,
+                                         TextureOnWhiteFront,
                                          mUpdateDescriptorOnWhite,
                                          aRegionToDraw,
                                          mBufferRect,
                                          mBufferRotation);
     mUpdateDescriptorOnWhite = SurfaceDescriptor();
   }
 
 }
--- a/gfx/layers/client/ContentClient.h
+++ b/gfx/layers/client/ContentClient.h
@@ -269,17 +269,17 @@ protected:
                            uint32_t aFlags);
 
   // Create the front buffer for the ContentClient/Host pair if necessary
   // and notify the compositor that we have created the buffer(s).
   virtual void CreateFrontBuffer(const nsIntRect& aBufferRect) = 0;
   virtual void DestroyFrontBuffer() {}
 
   bool CreateAndAllocateTextureClient(RefPtr<TextureClient>& aClient,
-                                      TextureFlags aFlags = TextureFlags::NO_FLAGS);
+                                      TextureFlags aFlags = 0);
 
   virtual void AbortTextureClientCreation()
   {
     mTextureClient = nullptr;
     mTextureClientOnWhite = nullptr;
     mIsNewBuffer = false;
   }
 
@@ -309,17 +309,17 @@ protected:
  * (in SwapBuffers).
  */
 class ContentClientDoubleBuffered : public ContentClientRemoteBuffer
 {
 public:
   ContentClientDoubleBuffered(CompositableForwarder* aFwd)
     : ContentClientRemoteBuffer(aFwd)
   {
-    mTextureInfo.mCompositableType = CompositableType::CONTENT_DOUBLE;
+    mTextureInfo.mCompositableType = COMPOSITABLE_CONTENT_DOUBLE;
   }
   virtual ~ContentClientDoubleBuffered() {}
 
   virtual void Clear() MOZ_OVERRIDE
   {
     ContentClientRemoteBuffer::Clear();
     mFrontClient = nullptr;
     mFrontClientOnWhite = nullptr;
@@ -363,17 +363,17 @@ private:
  * the compositor.
  */
 class ContentClientSingleBuffered : public ContentClientRemoteBuffer
 {
 public:
   ContentClientSingleBuffered(CompositableForwarder* aFwd)
     : ContentClientRemoteBuffer(aFwd)
   {
-    mTextureInfo.mCompositableType = CompositableType::CONTENT_SINGLE;
+    mTextureInfo.mCompositableType = COMPOSITABLE_CONTENT_SINGLE;
   }
   virtual ~ContentClientSingleBuffered() {}
 
   virtual void FinalizeFrame(const nsIntRegion& aRegionToDraw) MOZ_OVERRIDE;
 
 protected:
   virtual void CreateFrontBuffer(const nsIntRect& aBufferRect) MOZ_OVERRIDE {}
 };
@@ -389,17 +389,17 @@ class ContentClientIncremental : public 
 {
 public:
   ContentClientIncremental(CompositableForwarder* aFwd)
     : ContentClientRemote(aFwd)
     , mContentType(gfxContentType::COLOR_ALPHA)
     , mHasBuffer(false)
     , mHasBufferOnWhite(false)
   {
-    mTextureInfo.mCompositableType = CompositableType::BUFFER_CONTENT_INC;
+    mTextureInfo.mCompositableType = BUFFER_CONTENT_INC;
   }
 
   typedef RotatedContentBuffer::PaintState PaintState;
   typedef RotatedContentBuffer::ContentType ContentType;
 
   virtual TextureInfo GetTextureInfo() const
   {
     return mTextureInfo;
@@ -438,17 +438,26 @@ public:
 
 private:
 
   enum BufferType{
     BUFFER_BLACK,
     BUFFER_WHITE
   };
 
-  void NotifyBufferCreated(ContentType aType, TextureFlags aFlags);
+  void NotifyBufferCreated(ContentType aType, uint32_t aFlags)
+  {
+    mTextureInfo.mTextureFlags = aFlags & ~TEXTURE_DEALLOCATE_CLIENT;
+    mContentType = aType;
+
+    mForwarder->CreatedIncrementalBuffer(this,
+                                         mTextureInfo,
+                                         mBufferRect);
+
+  }
 
   TemporaryRef<gfx::DrawTarget> GetUpdateSurface(BufferType aType,
                                                  const nsIntRegion& aUpdateRegion);
 
   TextureInfo mTextureInfo;
   nsIntRect mBufferRect;
   nsIntPoint mBufferRotation;
 
--- a/gfx/layers/client/ImageClient.cpp
+++ b/gfx/layers/client/ImageClient.cpp
@@ -43,27 +43,27 @@ namespace layers {
 
 /* static */ TemporaryRef<ImageClient>
 ImageClient::CreateImageClient(CompositableType aCompositableHostType,
                                CompositableForwarder* aForwarder,
                                TextureFlags aFlags)
 {
   RefPtr<ImageClient> result = nullptr;
   switch (aCompositableHostType) {
-  case CompositableType::IMAGE:
-  case CompositableType::BUFFER_IMAGE_SINGLE:
-    result = new ImageClientSingle(aForwarder, aFlags, CompositableType::IMAGE);
+  case COMPOSITABLE_IMAGE:
+  case BUFFER_IMAGE_SINGLE:
+    result = new ImageClientSingle(aForwarder, aFlags, COMPOSITABLE_IMAGE);
     break;
-  case CompositableType::BUFFER_IMAGE_BUFFERED:
-    result = new ImageClientBuffered(aForwarder, aFlags, CompositableType::IMAGE);
+  case BUFFER_IMAGE_BUFFERED:
+    result = new ImageClientBuffered(aForwarder, aFlags, COMPOSITABLE_IMAGE);
     break;
-  case CompositableType::BUFFER_BRIDGE:
+  case BUFFER_BRIDGE:
     result = new ImageClientBridge(aForwarder, aFlags);
     break;
-  case CompositableType::BUFFER_UNKNOWN:
+  case BUFFER_UNKNOWN:
     result = nullptr;
     break;
   default:
     MOZ_CRASH("unhandled program type");
   }
 
   NS_ASSERTION(result, "Failed to create ImageClient");
 
@@ -81,17 +81,17 @@ ImageClientBuffered::ImageClientBuffered
                                          TextureFlags aFlags,
                                          CompositableType aType)
   : ImageClientSingle(aFwd, aFlags, aType)
 {
 }
 
 TextureInfo ImageClientSingle::GetTextureInfo() const
 {
-  return TextureInfo(CompositableType::IMAGE);
+  return TextureInfo(COMPOSITABLE_IMAGE);
 }
 
 void
 ImageClientSingle::FlushAllImages(bool aExceptFront)
 {
   if (!aExceptFront && mFrontBuffer) {
     GetForwarder()->RemoveTextureFromCompositable(this, mFrontBuffer);
     mFrontBuffer = nullptr;
@@ -159,27 +159,27 @@ ImageClientSingle::UpdateImageInternal(I
 
     if (mFrontBuffer && mFrontBuffer->IsImmutable()) {
       GetForwarder()->RemoveTextureFromCompositable(this, mFrontBuffer);
       mFrontBuffer = nullptr;
     }
 
     bool bufferCreated = false;
     if (!mFrontBuffer) {
-      mFrontBuffer = CreateBufferTextureClient(gfx::SurfaceFormat::YUV, TextureFlags::DEFAULT);
+      mFrontBuffer = CreateBufferTextureClient(gfx::SurfaceFormat::YUV, TEXTURE_FLAGS_DEFAULT);
       gfx::IntSize ySize(data->mYSize.width, data->mYSize.height);
       gfx::IntSize cbCrSize(data->mCbCrSize.width, data->mCbCrSize.height);
       if (!mFrontBuffer->AsTextureClientYCbCr()->AllocateForYCbCr(ySize, cbCrSize, data->mStereoMode)) {
         mFrontBuffer = nullptr;
         return false;
       }
       bufferCreated = true;
     }
 
-    if (!mFrontBuffer->Lock(OpenMode::OPEN_WRITE_ONLY)) {
+    if (!mFrontBuffer->Lock(OPEN_WRITE_ONLY)) {
       mFrontBuffer = nullptr;
       return false;
     }
     bool status = mFrontBuffer->AsTextureClientYCbCr()->UpdateYCbCr(*data);
     mFrontBuffer->Unlock();
 
     if (bufferCreated) {
       if (!AddTextureClient(mFrontBuffer)) {
@@ -237,17 +237,17 @@ ImageClientSingle::UpdateImageInternal(I
       if (!mFrontBuffer->AllocateForSurface(size)) {
         mFrontBuffer = nullptr;
         return false;
       }
 
       bufferCreated = true;
     }
 
-    if (!mFrontBuffer->Lock(OpenMode::OPEN_WRITE_ONLY)) {
+    if (!mFrontBuffer->Lock(OPEN_WRITE_ONLY)) {
       mFrontBuffer = nullptr;
       return false;
     }
 
     {
       // We must not keep a reference to the DrawTarget after it has been unlocked.
       RefPtr<DrawTarget> dt = mFrontBuffer->GetAsDrawTarget();
       MOZ_ASSERT(surface.get());
@@ -330,17 +330,17 @@ ImageClient::UpdatePictureRect(nsIntRect
   }
   mPictureRect = aRect;
   MOZ_ASSERT(mForwarder);
   GetForwarder()->UpdatePictureRect(this, aRect);
 }
 
 ImageClientBridge::ImageClientBridge(CompositableForwarder* aFwd,
                                      TextureFlags aFlags)
-: ImageClient(aFwd, aFlags, CompositableType::BUFFER_BRIDGE)
+: ImageClient(aFwd, aFlags, BUFFER_BRIDGE)
 , mAsyncContainerID(0)
 , mLayer(nullptr)
 {
 }
 
 bool
 ImageClientBridge::UpdateImage(ImageContainer* aContainer, uint32_t aContentFlags)
 {
--- a/gfx/layers/client/SimpleTextureClientPool.cpp
+++ b/gfx/layers/client/SimpleTextureClientPool.cpp
@@ -67,20 +67,20 @@ SimpleTextureClientPool::GetTextureClien
     textureClient->WaitReleaseFence();
     mAvailableTextureClients.pop();
     RECYCLE_LOG("%s Skip allocate (%i left), returning %p\n", (mFormat == SurfaceFormat::B8G8R8A8?"poolA":"poolX"), mAvailableTextureClients.size(), textureClient.get());
 
   } else {
     // No unused clients in the pool, create one
     if (gfxPrefs::ForceShmemTiles()) {
       textureClient = TextureClient::CreateBufferTextureClient(mSurfaceAllocator,
-        mFormat, TextureFlags::IMMEDIATE_UPLOAD | TextureFlags::RECYCLE, gfx::BackendType::NONE);
+        mFormat, TEXTURE_IMMEDIATE_UPLOAD | TEXTURE_RECYCLE, gfx::BackendType::NONE);
     } else {
       textureClient = TextureClient::CreateTextureClientForDrawing(mSurfaceAllocator,
-        mFormat, TextureFlags::DEFAULT | TextureFlags::RECYCLE, gfx::BackendType::NONE, mSize);
+        mFormat, TEXTURE_FLAGS_DEFAULT | TEXTURE_RECYCLE, gfx::BackendType::NONE, mSize);
     }
     if (!textureClient->AllocateForSurface(mSize, ALLOC_DEFAULT)) {
       NS_WARNING("TextureClient::AllocateForSurface failed!");
     }
     RECYCLE_LOG("%s Must allocate (0 left), returning %p\n", (mFormat == SurfaceFormat::B8G8R8A8?"poolA":"poolX"), textureClient.get());
   }
 
   if (aAutoRecycle) {
--- a/gfx/layers/client/SimpleTiledContentClient.cpp
+++ b/gfx/layers/client/SimpleTiledContentClient.cpp
@@ -85,17 +85,17 @@ SimpleTiledLayerBuffer::ValidateTile(Sim
 
   RefPtr<TextureClient> textureClient = mManager->GetSimpleTileTexturePool(tileFormat)->GetTextureClientWithAutoRecycle();
 
   if (!textureClient) {
     NS_WARNING("TextureClient allocation failed");
     return SimpleTiledLayerTile();
   }
 
-  if (!textureClient->Lock(OpenMode::OPEN_READ_WRITE)) {
+  if (!textureClient->Lock(OPEN_READ_WRITE)) {
     NS_WARNING("TextureClient lock failed");
     return SimpleTiledLayerTile();
   }
 
   if (!textureClient->CanExposeDrawTarget()) {
     doBufferedDrawing = false;
   }
 
--- a/gfx/layers/client/SimpleTiledContentClient.h
+++ b/gfx/layers/client/SimpleTiledContentClient.h
@@ -139,17 +139,17 @@ class SimpleTiledContentClient : public 
 public:
   SimpleTiledContentClient(SimpleClientTiledThebesLayer* aThebesLayer,
                            ClientLayerManager* aManager);
 
   ~SimpleTiledContentClient();
 
   virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
   {
-    return TextureInfo(CompositableType::BUFFER_SIMPLE_TILED);
+    return TextureInfo(BUFFER_SIMPLE_TILED);
   }
 
   void UseTiledLayerBuffer();
 
 private:
   SimpleTiledLayerBuffer mTiledBuffer;
 };
 
--- a/gfx/layers/client/TextureClient.cpp
+++ b/gfx/layers/client/TextureClient.cpp
@@ -284,51 +284,51 @@ TextureClient::CreateTextureClientForDra
 #ifdef XP_WIN
   LayersBackend parentBackend = aAllocator->GetCompositorBackendType();
   if (parentBackend == LayersBackend::LAYERS_D3D11 &&
       (aMoz2DBackend == gfx::BackendType::DIRECT2D ||
         aMoz2DBackend == gfx::BackendType::DIRECT2D1_1) &&
       gfxWindowsPlatform::GetPlatform()->GetD2DDevice() &&
       aSizeHint.width <= maxTextureSize &&
       aSizeHint.height <= maxTextureSize &&
-      !(aTextureFlags & TextureFlags::ALLOC_FALLBACK)) {
+      !(aTextureFlags & TEXTURE_ALLOC_FALLBACK)) {
     result = new TextureClientD3D11(aFormat, aTextureFlags);
   }
   if (parentBackend == LayersBackend::LAYERS_D3D9 &&
       aMoz2DBackend == gfx::BackendType::CAIRO &&
       aAllocator->IsSameProcess() &&
       aSizeHint.width <= maxTextureSize &&
       aSizeHint.height <= maxTextureSize &&
-      !(aTextureFlags & TextureFlags::ALLOC_FALLBACK)) {
+      !(aTextureFlags & TEXTURE_ALLOC_FALLBACK)) {
     if (!gfxWindowsPlatform::GetPlatform()->GetD3D9Device()) {
       result = new DIBTextureClientD3D9(aFormat, aTextureFlags);
     } else {
       result = new CairoTextureClientD3D9(aFormat, aTextureFlags);
     }
   }
 #endif
 
 #ifdef MOZ_X11
   LayersBackend parentBackend = aAllocator->GetCompositorBackendType();
   gfxSurfaceType type =
     gfxPlatform::GetPlatform()->ScreenReferenceSurface()->GetType();
 
   if (parentBackend == LayersBackend::LAYERS_BASIC &&
       aMoz2DBackend == gfx::BackendType::CAIRO &&
       type == gfxSurfaceType::Xlib &&
-      !(aTextureFlags & TextureFlags::ALLOC_FALLBACK))
+      !(aTextureFlags & TEXTURE_ALLOC_FALLBACK))
   {
     result = new TextureClientX11(aFormat, aTextureFlags);
   }
 #ifdef GL_PROVIDER_GLX
 #if 0
   // Bug 977963: Disabled for black layers
   if (parentBackend == LayersBackend::LAYERS_OPENGL &&
       type == gfxSurfaceType::Xlib &&
-      !(aTextureFlags & TextureFlags::ALLOC_FALLBACK) &&
+      !(aTextureFlags & TEXTURE_ALLOC_FALLBACK) &&
       aFormat != SurfaceFormat::A8 &&
       gl::sGLXLibrary.UseTextureFromPixmap())
   {
     result = new TextureClientX11(aFormat, aTextureFlags);
   }
 #endif
 #endif
 #endif
@@ -456,17 +456,17 @@ TextureClient::~TextureClient()
 {
   // All the destruction code that may lead to virtual method calls must
   // be in Finalize() which is called just before the destructor.
 }
 
 void TextureClient::ForceRemove()
 {
   if (mValid && mActor) {
-    if (GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
+    if (GetFlags() & TEXTURE_DEALLOCATE_CLIENT) {
       mActor->SetTextureData(DropTextureData());
       if (mActor->IPCOpen()) {
         mActor->SendRemoveTextureSync();
       }
       mActor->DeleteTextureData();
     } else {
       if (mActor->IPCOpen()) {
         mActor->SendRemoveTexture();
@@ -644,17 +644,17 @@ MemoryTextureClient::~MemoryTextureClien
 BufferTextureClient::BufferTextureClient(ISurfaceAllocator* aAllocator,
                                          gfx::SurfaceFormat aFormat,
                                          gfx::BackendType aMoz2DBackend,
                                          TextureFlags aFlags)
   : TextureClient(aFlags)
   , mAllocator(aAllocator)
   , mFormat(aFormat)
   , mBackend(aMoz2DBackend)
-  , mOpenMode(OpenMode::OPEN_NONE)
+  , mOpenMode(0)
   , mUsingFallbackDrawTarget(false)
   , mLocked(false)
 {}
 
 BufferTextureClient::~BufferTextureClient()
 {}
 
 ISurfaceAllocator*
@@ -711,17 +711,17 @@ BufferTextureClient::GetAsDrawTarget()
   // DrawTarget around raw memory. This is going to be slow :(
   mDrawTarget = gfx::Factory::CreateDrawTarget(mBackend, serializer.GetSize(),
                                                serializer.GetFormat());
   if (!mDrawTarget) {
     return nullptr;
   }
 
   mUsingFallbackDrawTarget = true;
-  if (mOpenMode & OpenMode::OPEN_READ) {
+  if (mOpenMode & OPEN_READ) {
     RefPtr<DataSourceSurface> surface = serializer.GetAsSurface();
     IntRect rect(0, 0, surface->GetSize().width, surface->GetSize().height);
     mDrawTarget->CopySurface(surface, rect, IntPoint(0,0));
   }
   return mDrawTarget;
 }
 
 bool
@@ -745,17 +745,17 @@ BufferTextureClient::Unlock()
 
   // see the comment on TextureClient::GetAsDrawTarget.
   // This DrawTarget is internal to the TextureClient and is only exposed to the
   // outside world between Lock() and Unlock(). This assertion checks that no outside
   // reference remains by the time Unlock() is called.
   MOZ_ASSERT(mDrawTarget->refCount() == 1);
 
   mDrawTarget->Flush();
-  if (mUsingFallbackDrawTarget && (mOpenMode & OpenMode::OPEN_WRITE)) {
+  if (mUsingFallbackDrawTarget && (mOpenMode & OPEN_WRITE)) {
     // When we are using a fallback DrawTarget, it means we could not create
     // a DrawTarget wrapping the TextureClient's shared memory. In this scenario
     // we need to put the content of the fallback draw target back into our shared
     // memory.
     RefPtr<SourceSurface> snapshot = mDrawTarget->Snapshot();
     RefPtr<DataSourceSurface> surface = snapshot->GetDataSurface();
     ImageDataSerializer serializer(GetBuffer(), GetBufferSize());
     if (!serializer.IsValid() || serializer.GetSize() != surface->GetSize()) {
--- a/gfx/layers/client/TextureClient.h
+++ b/gfx/layers/client/TextureClient.h
@@ -125,17 +125,17 @@ public:
  * responsibility of the compositable (which would use two Texture pairs).
  * In order to send several different buffers to the compositor side, use
  * several TextureClients.
  */
 class TextureClient
   : public AtomicRefCountedWithFinalize<TextureClient>
 {
 public:
-  TextureClient(TextureFlags aFlags = TextureFlags::DEFAULT);
+  TextureClient(TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
   virtual ~TextureClient();
 
   static TemporaryRef<BufferTextureClient>
   CreateBufferTextureClient(ISurfaceAllocator* aAllocator,
                             gfx::SurfaceFormat aFormat,
                             TextureFlags aTextureFlags,
                             gfx::BackendType aMoz2dBackend);
 
@@ -170,17 +170,17 @@ public:
    * return the same DrawTarget.
    * The DrawTarget is automatically flushed by the TextureClient when the latter
    * is unlocked, and the DrawTarget that will be returned within the next
    * lock/unlock pair may or may not be the same object.
    * Do not keep references to the DrawTarget outside of the lock/unlock pair.
    *
    * This is typically used as follows:
    *
-   * if (!texture->Lock(OpenMode::OPEN_READ_WRITE)) {
+   * if (!texture->Lock(OPEN_READ_WRITE)) {
    *   return false;
    * }
    * {
    *   // Restrict this code's scope to ensure all references to dt are gone
    *   // when Unlock is called.
    *   RefPtr<DrawTarget> dt = texture->GetAsDrawTarget();
    *   // use the draw target ...
    * }
@@ -257,32 +257,32 @@ public:
    * TextureFlags contain important information about various aspects
    * of the texture, like how its liferime is managed, and how it
    * should be displayed.
    * See TextureFlags in CompositorTypes.h.
    */
   TextureFlags GetFlags() const { return mFlags; }
 
   /**
-   * valid only for TextureFlags::RECYCLE TextureClient.
+   * valid only for TEXTURE_RECYCLE TextureClient.
    * When called this texture client will grab a strong reference and release
    * it once the compositor notifies that it is done with the texture.
    * NOTE: In this stage the texture client can no longer be used by the
    * client in a transaction.
    */
   void WaitForCompositorRecycle();
 
   /**
    * After being shared with the compositor side, an immutable texture is never
    * modified, it can only be read. It is safe to not Lock/Unlock immutable
    * textures.
    */
-  bool IsImmutable() const { return !!(mFlags & TextureFlags::IMMUTABLE); }
+  bool IsImmutable() const { return mFlags & TEXTURE_IMMUTABLE; }
 
-  void MarkImmutable() { AddFlags(TextureFlags::IMMUTABLE); }
+  void MarkImmutable() { AddFlags(TEXTURE_IMMUTABLE); }
 
   bool IsSharedWithCompositor() const { return mShared; }
 
   bool ShouldDeallocateInDestructor() const;
 
   /**
    * If this method returns false users of TextureClient are not allowed
    * to access the shared data.
@@ -302,17 +302,17 @@ public:
    * This is to be used with IPDL messages only. Do not store the returned
    * pointer.
    */
   PTextureChild* GetIPDLActor();
 
   /**
    * Triggers the destruction of the shared data and the corresponding TextureHost.
    *
-   * If the texture flags contain TextureFlags::DEALLOCATE_CLIENT, the destruction
+   * If the texture flags contain TEXTURE_DEALLOCATE_CLIENT, the destruction
    * will be synchronously coordinated with the compositor side, otherwise it
    * will be done asynchronously.
    */
   void ForceRemove();
 
   virtual void SetReleaseFenceHandle(FenceHandle aReleaseFenceHandle) {}
 
   const FenceHandle& GetReleaseFenceHandle() const
--- a/gfx/layers/client/TextureClientPool.cpp
+++ b/gfx/layers/client/TextureClientPool.cpp
@@ -52,20 +52,20 @@ TextureClientPool::GetTextureClient()
   // We're increasing the number of outstanding TextureClients without reusing a
   // client, we may need to free a deferred-return TextureClient.
   ShrinkToMaximumSize();
 
   // No unused clients in the pool, create one
   if (gfxPrefs::ForceShmemTiles()) {
     // gfx::BackendType::NONE means use the content backend
     textureClient = TextureClient::CreateBufferTextureClient(mSurfaceAllocator,
-      mFormat, TextureFlags::IMMEDIATE_UPLOAD, gfx::BackendType::NONE);
+      mFormat, TEXTURE_IMMEDIATE_UPLOAD, gfx::BackendType::NONE);
   } else {
     textureClient = TextureClient::CreateTextureClientForDrawing(mSurfaceAllocator,
-      mFormat, TextureFlags::IMMEDIATE_UPLOAD, gfx::BackendType::NONE, mSize);
+      mFormat, TEXTURE_IMMEDIATE_UPLOAD, gfx::BackendType::NONE, mSize);
   }
   textureClient->AllocateForSurface(mSize, ALLOC_DEFAULT);
 
   return textureClient;
 }
 
 void
 TextureClientPool::ReturnTextureClient(TextureClient *aClient)
--- a/gfx/layers/client/TiledContentClient.cpp
+++ b/gfx/layers/client/TiledContentClient.cpp
@@ -438,23 +438,23 @@ TileClient::ValidateBackBufferFromFront(
 
       if (regionToCopy.IsEmpty() ||
           (aCanRerasterizeValidRegion &&
            regionToCopy.Area() < tileSize.width * tileSize.height * MINIMUM_TILE_COPY_AREA)) {
         // Just redraw it all.
         return;
       }
 
-      if (!mFrontBuffer->Lock(OpenMode::OPEN_READ)) {
+      if (!mFrontBuffer->Lock(OPEN_READ)) {
         NS_WARNING("Failed to lock the tile's front buffer");
         return;
       }
       TextureClientAutoUnlock autoFront(mFrontBuffer);
 
-      if (!mBackBuffer->Lock(OpenMode::OPEN_WRITE)) {
+      if (!mBackBuffer->Lock(OPEN_WRITE)) {
         NS_WARNING("Failed to lock the tile's back buffer");
         return;
       }
       TextureClientAutoUnlock autoBack(mBackBuffer);
 
       // Copy the bounding rect of regionToCopy. As tiles are quite small, it
       // is unlikely that we'd save much by copying each individual rect of the
       // region, but we can reevaluate this if it becomes an issue.
@@ -744,17 +744,17 @@ ClientTiledLayerBuffer::ValidateTile(Til
   offsetScaledDirtyRegion.ScaleRoundOut(mResolution, mResolution);
 
   bool usingSinglePaintBuffer = !!mSinglePaintDrawTarget;
   RefPtr<TextureClient> backBuffer =
     aTile.GetBackBuffer(offsetScaledDirtyRegion,
                         mManager->GetTexturePool(gfxPlatform::GetPlatform()->Optimal2DFormatForContent(GetContentType())),
                         &createdTextureClient, !usingSinglePaintBuffer);
 
-  if (!backBuffer->Lock(OpenMode::OPEN_READ_WRITE)) {
+  if (!backBuffer->Lock(OPEN_READ_WRITE)) {
     NS_WARNING("Failed to lock tile TextureClient for updating.");
     aTile.DiscardFrontBuffer();
     return aTile;
   }
 
   // We must not keep a reference to the DrawTarget after it has been unlocked,
   // make sure these are null'd before unlocking as destruction of the context
   // may cause the target to be flushed.
--- a/gfx/layers/client/TiledContentClient.h
+++ b/gfx/layers/client/TiledContentClient.h
@@ -478,17 +478,17 @@ public:
     MOZ_COUNT_DTOR(TiledContentClient);
 
     mTiledBuffer.Release();
     mLowPrecisionTiledBuffer.Release();
   }
 
   virtual TextureInfo GetTextureInfo() const MOZ_OVERRIDE
   {
-    return TextureInfo(CompositableType::BUFFER_TILED);
+    return TextureInfo(BUFFER_TILED);
   }
 
   virtual void ClearCachedResources() MOZ_OVERRIDE;
 
   enum TiledBufferType {
     TILED_BUFFER,
     LOW_PRECISION_TILED_BUFFER
   };
--- a/gfx/layers/composite/CanvasLayerComposite.cpp
+++ b/gfx/layers/composite/CanvasLayerComposite.cpp
@@ -39,19 +39,19 @@ CanvasLayerComposite::~CanvasLayerCompos
 
   CleanupResources();
 }
 
 bool
 CanvasLayerComposite::SetCompositableHost(CompositableHost* aHost)
 {
   switch (aHost->GetType()) {
-    case CompositableType::BUFFER_IMAGE_SINGLE:
-    case CompositableType::BUFFER_IMAGE_BUFFERED:
-    case CompositableType::IMAGE:
+    case BUFFER_IMAGE_SINGLE:
+    case BUFFER_IMAGE_BUFFERED:
+    case COMPOSITABLE_IMAGE:
       mImageHost = aHost;
       return true;
     default:
       return false;
   }
 
 }
 
--- a/gfx/layers/composite/ColorLayerComposite.cpp
+++ b/gfx/layers/composite/ColorLayerComposite.cpp
@@ -6,17 +6,17 @@
 #include "ColorLayerComposite.h"
 #include "gfxColor.h"                   // for gfxRGBA
 #include "mozilla/RefPtr.h"             // for RefPtr
 #include "mozilla/gfx/Matrix.h"         // for Matrix4x4
 #include "mozilla/gfx/Point.h"          // for Point
 #include "mozilla/gfx/Rect.h"           // for Rect
 #include "mozilla/gfx/Types.h"          // for Color
 #include "mozilla/layers/Compositor.h"  // for Compositor
-#include "mozilla/layers/CompositorTypes.h"  // for DiagnosticFlags::COLOR
+#include "mozilla/layers/CompositorTypes.h"  // for DIAGNOSTIC_COLOR
 #include "mozilla/layers/Effects.h"     // for Effect, EffectChain, etc
 #include "mozilla/mozalloc.h"           // for operator delete, etc
 #include "nsPoint.h"                    // for nsIntPoint
 #include "nsRect.h"                     // for nsIntRect
 
 namespace mozilla {
 namespace layers {
 
@@ -38,15 +38,15 @@ ColorLayerComposite::RenderLayer(const n
                  boundRect.width, boundRect.height);
   gfx::Rect clipRect(aClipRect.x, aClipRect.y,
                      aClipRect.width, aClipRect.height);
 
   float opacity = GetEffectiveOpacity();
 
   const gfx::Matrix4x4& transform = GetEffectiveTransform();
   mCompositor->DrawQuad(rect, clipRect, effects, opacity, transform);
-  mCompositor->DrawDiagnostics(DiagnosticFlags::COLOR,
+  mCompositor->DrawDiagnostics(DIAGNOSTIC_COLOR,
                                rect, clipRect,
                                transform);
 }
 
 } /* layers */
 } /* mozilla */
--- a/gfx/layers/composite/CompositableHost.cpp
+++ b/gfx/layers/composite/CompositableHost.cpp
@@ -153,17 +153,17 @@ CompositableHost::AddMaskEffect(EffectCh
     NS_WARNING("Using compositable with no texture host as mask layer");
     return false;
   }
 
   RefPtr<EffectMask> effect = new EffectMask(source,
                                              source->GetSize(),
                                              aTransform);
   effect->mIs3D = aIs3D;
-  aEffects.mSecondaryEffects[EffectTypes::MASK] = effect;
+  aEffects.mSecondaryEffects[EFFECT_MASK] = effect;
   return true;
 }
 
 void
 CompositableHost::RemoveMaskEffect()
 {
   RefPtr<TextureHost> host = GetAsTextureHost();
   if (host) {
@@ -174,41 +174,41 @@ CompositableHost::RemoveMaskEffect()
 // implemented in TextureHostOGL.cpp
 TemporaryRef<CompositableBackendSpecificData> CreateCompositableBackendSpecificDataOGL();
 
 /* static */ TemporaryRef<CompositableHost>
 CompositableHost::Create(const TextureInfo& aTextureInfo)
 {
   RefPtr<CompositableHost> result;
   switch (aTextureInfo.mCompositableType) {
-  case CompositableType::BUFFER_BRIDGE:
+  case BUFFER_BRIDGE:
     NS_ERROR("Cannot create an image bridge compositable this way");
     break;
-  case CompositableType::BUFFER_CONTENT_INC:
+  case BUFFER_CONTENT_INC:
     result = new ContentHostIncremental(aTextureInfo);
     break;
-  case CompositableType::BUFFER_TILED:
-  case CompositableType::BUFFER_SIMPLE_TILED:
+  case BUFFER_TILED:
+  case BUFFER_SIMPLE_TILED:
     result = new TiledContentHost(aTextureInfo);
     break;
-  case CompositableType::IMAGE:
+  case COMPOSITABLE_IMAGE:
     result = new ImageHost(aTextureInfo);
     break;
-  case CompositableType::CONTENT_SINGLE:
+  case COMPOSITABLE_CONTENT_SINGLE:
     result = new ContentHostSingleBuffered(aTextureInfo);
     break;
-  case CompositableType::CONTENT_DOUBLE:
+  case COMPOSITABLE_CONTENT_DOUBLE:
     result = new ContentHostDoubleBuffered(aTextureInfo);
     break;
   default:
     NS_ERROR("Unknown CompositableType");
   }
   // We know that Tiled buffers don't use the compositable backend-specific
   // data, so don't bother creating it.
-  if (result && aTextureInfo.mCompositableType != CompositableType::BUFFER_TILED) {
+  if (result && aTextureInfo.mCompositableType != BUFFER_TILED) {
     RefPtr<CompositableBackendSpecificData> data = CreateCompositableBackendSpecificDataOGL();
     result->SetCompositableBackendSpecificData(data);
   }
   return result;
 }
 
 #ifdef MOZ_DUMP_PAINTING
 void
--- a/gfx/layers/composite/ContainerLayerComposite.cpp
+++ b/gfx/layers/composite/ContainerLayerComposite.cpp
@@ -13,17 +13,17 @@
 #include "gfxUtils.h"                   // for gfxUtils, etc
 #include "mozilla/Assertions.h"         // for MOZ_ASSERT, etc
 #include "mozilla/RefPtr.h"             // for RefPtr
 #include "mozilla/gfx/BaseRect.h"       // for BaseRect
 #include "mozilla/gfx/Matrix.h"         // for Matrix4x4
 #include "mozilla/gfx/Point.h"          // for Point, IntPoint
 #include "mozilla/gfx/Rect.h"           // for IntRect, Rect
 #include "mozilla/layers/Compositor.h"  // for Compositor, etc
-#include "mozilla/layers/CompositorTypes.h"  // for DiagnosticFlags::CONTAINER
+#include "mozilla/layers/CompositorTypes.h"  // for DIAGNOSTIC_CONTAINER
 #include "mozilla/layers/Effects.h"     // for Effect, EffectChain, etc
 #include "mozilla/layers/TextureHost.h"  // for CompositingRenderTarget
 #include "mozilla/mozalloc.h"           // for operator delete, etc
 #include "nsAutoPtr.h"                  // for nsRefPtr
 #include "nsDebug.h"                    // for NS_ASSERTION
 #include "nsISupportsImpl.h"            // for MOZ_COUNT_CTOR, etc
 #include "nsISupportsUtils.h"           // for NS_ADDREF, NS_RELEASE
 #include "nsPoint.h"                    // for nsIntPoint
@@ -408,17 +408,17 @@ ContainerRender(ContainerT* aContainer,
                                         aContainer->GetEffectiveTransform());
   }
 
   if (aContainer->GetFrameMetrics().IsScrollable()) {
     const FrameMetrics& frame = aContainer->GetFrameMetrics();
     LayerRect layerBounds = ParentLayerRect(frame.mCompositionBounds) * ParentLayerToLayerScale(1.0);
     gfx::Rect rect(layerBounds.x, layerBounds.y, layerBounds.width, layerBounds.height);
     gfx::Rect clipRect(aClipRect.x, aClipRect.y, aClipRect.width, aClipRect.height);
-    aManager->GetCompositor()->DrawDiagnostics(DiagnosticFlags::CONTAINER,
+    aManager->GetCompositor()->DrawDiagnostics(DIAGNOSTIC_CONTAINER,
                                                rect, clipRect,
                                                aContainer->GetEffectiveTransform());
   }
 }
 
 ContainerLayerComposite::ContainerLayerComposite(LayerManagerComposite *aManager)
   : ContainerLayer(aManager, nullptr)
   , LayerComposite(aManager)
--- a/gfx/layers/composite/ContentHost.cpp
+++ b/gfx/layers/composite/ContentHost.cpp
@@ -193,20 +193,18 @@ ContentHostBase::Composite(EffectChain& 
                          tileScreenRect.width, tileScreenRect.height);
 
           effect->mTextureCoords = Rect(Float(tileRegionRect.x) / texRect.width,
                                         Float(tileRegionRect.y) / texRect.height,
                                         Float(tileRegionRect.width) / texRect.width,
                                         Float(tileRegionRect.height) / texRect.height);
           GetCompositor()->DrawQuad(rect, aClipRect, aEffectChain, aOpacity, aTransform);
           if (usingTiles) {
-            DiagnosticFlags diagnostics = DiagnosticFlags::CONTENT | DiagnosticFlags::BIGIMAGE;
-            if (iterOnWhite) {
-              diagnostics |= DiagnosticFlags::COMPONENT_ALPHA;
-            }
+            DiagnosticTypes diagnostics = DIAGNOSTIC_CONTENT | DIAGNOSTIC_BIGIMAGE;
+            diagnostics |= iterOnWhite ? DIAGNOSTIC_COMPONENT_ALPHA : 0;
             GetCompositor()->DrawDiagnostics(diagnostics, rect, aClipRect,
                                              aTransform, mFlashCounter);
           }
         }
       }
     }
 
     if (iterOnWhite) {
@@ -216,20 +214,18 @@ ContentHostBase::Composite(EffectChain& 
 
   if (tileIter) {
     tileIter->EndTileIteration();
   }
   if (iterOnWhite) {
     iterOnWhite->EndTileIteration();
   }
 
-  DiagnosticFlags diagnostics = DiagnosticFlags::CONTENT;
-  if (iterOnWhite) {
-    diagnostics |= DiagnosticFlags::COMPONENT_ALPHA;
-  }
+  DiagnosticTypes diagnostics = DIAGNOSTIC_CONTENT;
+  diagnostics |= iterOnWhite ? DIAGNOSTIC_COMPONENT_ALPHA : 0;
   GetCompositor()->DrawDiagnostics(diagnostics, *aVisibleRegion, aClipRect,
                                    aTransform, mFlashCounter);
 }
 
 
 void
 ContentHostTexture::UseTextureHost(TextureHost* aTexture)
 {
@@ -487,25 +483,25 @@ ContentHostIncremental::TextureCreationR
   RefPtr<DataTextureSource> temp =
     compositor->CreateDataTextureSource(mTextureInfo.mTextureFlags);
   MOZ_ASSERT(temp->AsSourceOGL() &&
              temp->AsSourceOGL()->AsTextureImageTextureSource());
   RefPtr<TextureImageTextureSourceOGL> newSource =
     temp->AsSourceOGL()->AsTextureImageTextureSource();
 
   RefPtr<TextureImageTextureSourceOGL> newSourceOnWhite;
-  if (mTextureInfo.mTextureFlags & TextureFlags::COMPONENT_ALPHA) {
+  if (mTextureInfo.mTextureFlags & TEXTURE_COMPONENT_ALPHA) {
     temp =
       compositor->CreateDataTextureSource(mTextureInfo.mTextureFlags);
     MOZ_ASSERT(temp->AsSourceOGL() &&
                temp->AsSourceOGL()->AsTextureImageTextureSource());
     newSourceOnWhite = temp->AsSourceOGL()->AsTextureImageTextureSource();
   }
 
-  if (mTextureInfo.mDeprecatedTextureHostFlags & DeprecatedTextureHostFlags::COPY_PREVIOUS) {
+  if (mTextureInfo.mDeprecatedTextureHostFlags & TEXTURE_HOST_COPY_PREVIOUS) {
     nsIntRect bufferRect = aHost->mBufferRect;
     nsIntPoint bufferRotation = aHost->mBufferRotation;
     nsIntRect overlap;
 
     // The buffer looks like:
     //  ______
     // |1  |2 |  Where the center point is offset by mBufferRotation from the top-left corner.
     // |___|__|
@@ -645,17 +641,17 @@ ContentHostIncremental::TextureUpdateReq
   NS_ASSERTION(quadrantRect.Contains(drawBounds), "Messed up quadrants");
 
   mUpdated.MoveBy(-nsIntPoint(quadrantRect.x, quadrantRect.y));
 
   IntPoint offset = ToIntPoint(-mUpdated.GetBounds().TopLeft());
 
   RefPtr<DataSourceSurface> surf = GetSurfaceForDescriptor(mDescriptor);
 
-  if (mTextureId == TextureIdentifier::Front) {
+  if (mTextureId == TextureFront) {
     aHost->mSource->Update(surf, &mUpdated, &offset);
   } else {
     aHost->mSourceOnWhite->Update(surf, &mUpdated, &offset);
   }
 }
 
 void
 ContentHostTexture::PrintInfo(nsACString& aTo, const char* aPrefix)
@@ -684,17 +680,17 @@ ContentHostTexture::GetRenderState()
 {
   if (!mTextureHost) {
     return LayerRenderState();
   }
 
   LayerRenderState result = mTextureHost->GetRenderState();
 
   if (mBufferRotation != nsIntPoint()) {
-    result.mFlags |= LayerRenderStateFlags::BUFFER_ROTATION;
+    result.mFlags |= LAYER_RENDER_STATE_BUFFER_ROTATION;
   }
   result.SetOffset(GetOriginOffset());
   return result;
 }
 
 #ifdef MOZ_DUMP_PAINTING
 TemporaryRef<gfx::DataSourceSurface>
 ContentHostTexture::GetAsSurface()
--- a/gfx/layers/composite/ContentHost.h
+++ b/gfx/layers/composite/ContentHost.h
@@ -204,17 +204,17 @@ class ContentHostDoubleBuffered : public
 {
 public:
   ContentHostDoubleBuffered(const TextureInfo& aTextureInfo)
     : ContentHostTexture(aTextureInfo)
   {}
 
   virtual ~ContentHostDoubleBuffered() {}
 
-  virtual CompositableType GetType() { return CompositableType::CONTENT_DOUBLE; }
+  virtual CompositableType GetType() { return COMPOSITABLE_CONTENT_DOUBLE; }
 
   virtual bool UpdateThebes(const ThebesBufferData& aData,
                             const nsIntRegion& aUpdated,
                             const nsIntRegion& aOldValidRegionBack,
                             nsIntRegion* aUpdatedRegionBack);
 
 protected:
   nsIntRegion mValidRegionForNextBackBuffer;
@@ -227,17 +227,17 @@ protected:
 class ContentHostSingleBuffered : public ContentHostTexture
 {
 public:
   ContentHostSingleBuffered(const TextureInfo& aTextureInfo)
     : ContentHostTexture(aTextureInfo)
   {}
   virtual ~ContentHostSingleBuffered() {}
 
-  virtual CompositableType GetType() { return CompositableType::CONTENT_SINGLE; }
+  virtual CompositableType GetType() { return COMPOSITABLE_CONTENT_SINGLE; }
 
   virtual bool UpdateThebes(const ThebesBufferData& aData,
                             const nsIntRegion& aUpdated,
                             const nsIntRegion& aOldValidRegionBack,
                             nsIntRegion* aUpdatedRegionBack);
 };
 
 /**
@@ -251,17 +251,17 @@ public:
  * avoid blocking the main thread.
  */
 class ContentHostIncremental : public ContentHostBase
 {
 public:
   ContentHostIncremental(const TextureInfo& aTextureInfo);
   ~ContentHostIncremental();
 
-  virtual CompositableType GetType() { return CompositableType::BUFFER_CONTENT_INC; }
+  virtual CompositableType GetType() { return BUFFER_CONTENT_INC; }
 
   virtual LayerRenderState GetRenderState() MOZ_OVERRIDE { return LayerRenderState(); }
 
   virtual bool CreatedIncrementalTexture(ISurfaceAllocator* aAllocator,
                                          const TextureInfo& aTextureInfo,
                                          const nsIntRect& aBufferRect) MOZ_OVERRIDE;
 
   virtual void UpdateIncremental(TextureIdentifier aTextureId,
--- a/gfx/layers/composite/ImageHost.cpp
+++ b/gfx/layers/composite/ImageHost.cpp
@@ -121,46 +121,46 @@ ImageHost::Composite(EffectChain& aEffec
                                       Float(rect.y - tileRect.y) / tileRect.height,
                                       Float(rect.width) / tileRect.width,
                                       Float(rect.height) / tileRect.height);
       } else {
         effect->mTextureCoords = Rect(0, 0, 1, 1);
       }
       GetCompositor()->DrawQuad(rect, aClipRect, aEffectChain,
                                 aOpacity, aTransform);
-      GetCompositor()->DrawDiagnostics(DiagnosticFlags::IMAGE | DiagnosticFlags::BIGIMAGE,
+      GetCompositor()->DrawDiagnostics(DIAGNOSTIC_IMAGE|DIAGNOSTIC_BIGIMAGE,
                                        rect, aClipRect, aTransform, mFlashCounter);
     } while (it->NextTile());
     it->EndTileIteration();
     // layer border
-    GetCompositor()->DrawDiagnostics(DiagnosticFlags::IMAGE,
+    GetCompositor()->DrawDiagnostics(DIAGNOSTIC_IMAGE,
                                      gfxPictureRect, aClipRect,
                                      aTransform, mFlashCounter);
   } else {
     IntSize textureSize = source->GetSize();
     gfx::Rect rect;
     if (mHasPictureRect) {
       effect->mTextureCoords = Rect(Float(mPictureRect.x) / textureSize.width,
                                     Float(mPictureRect.y) / textureSize.height,
                                     Float(mPictureRect.width) / textureSize.width,
                                     Float(mPictureRect.height) / textureSize.height);
       rect = pictureRect;
     } else {
       effect->mTextureCoords = Rect(0, 0, 1, 1);
       rect = gfx::Rect(0, 0, textureSize.width, textureSize.height);
     }
 
-    if (mFrontBuffer->GetFlags() & TextureFlags::NEEDS_Y_FLIP) {
+    if (mFrontBuffer->GetFlags() & TEXTURE_NEEDS_Y_FLIP) {
       effect->mTextureCoords.y = effect->mTextureCoords.YMost();
       effect->mTextureCoords.height = -effect->mTextureCoords.height;
     }
 
     GetCompositor()->DrawQuad(rect, aClipRect, aEffectChain,
                               aOpacity, aTransform);
-    GetCompositor()->DrawDiagnostics(DiagnosticFlags::IMAGE,
+    GetCompositor()->DrawDiagnostics(DIAGNOSTIC_IMAGE,
                                      rect, aClipRect,
                                      aTransform, mFlashCounter);
   }
 }
 
 void
 ImageHost::SetCompositor(Compositor* aCompositor)
 {
--- a/gfx/layers/composite/ImageLayerComposite.cpp
+++ b/gfx/layers/composite/ImageLayerComposite.cpp
@@ -46,19 +46,19 @@ ImageLayerComposite::~ImageLayerComposit
 
   CleanupResources();
 }
 
 bool
 ImageLayerComposite::SetCompositableHost(CompositableHost* aHost)
 {
   switch (aHost->GetType()) {
-    case CompositableType::BUFFER_IMAGE_SINGLE:
-    case CompositableType::BUFFER_IMAGE_BUFFERED:
-    case CompositableType::IMAGE:
+    case BUFFER_IMAGE_SINGLE:
+    case BUFFER_IMAGE_BUFFERED:
+    case COMPOSITABLE_IMAGE:
       mImageHost = aHost;
       return true;
     default:
       return false;
   }
 }
 
 void
--- a/gfx/layers/composite/TextureHost.cpp
+++ b/gfx/layers/composite/TextureHost.cpp
@@ -228,17 +228,17 @@ TextureHost::TextureHost(TextureFlags aF
 {}
 
 TextureHost::~TextureHost()
 {
 }
 
 void TextureHost::Finalize()
 {
-  if (!(GetFlags() & TextureFlags::DEALLOCATE_CLIENT)) {
+  if (!(GetFlags() & TEXTURE_DEALLOCATE_CLIENT)) {
     DeallocateSharedData();
     DeallocateDeviceData();
   }
 }
 
 void
 TextureHost::PrintInfo(nsACString& aTo, const char* aPrefix)
 {
@@ -287,17 +287,17 @@ BufferTextureHost::Updated(const nsIntRe
 {
   ++mUpdateSerial;
   if (aRegion) {
     mPartialUpdate = true;
     mMaybeUpdatedRegion = *aRegion;
   } else {
     mPartialUpdate = false;
   }
-  if (GetFlags() & TextureFlags::IMMEDIATE_UPLOAD) {
+  if (GetFlags() & TEXTURE_IMMEDIATE_UPLOAD) {
     DebugOnly<bool> result = MaybeUpload(mPartialUpdate ? &mMaybeUpdatedRegion : nullptr);
     NS_WARN_IF_FALSE(result, "Failed to upload a texture");
   }
 }
 
 void
 BufferTextureHost::SetCompositor(Compositor* aCompositor)
 {
@@ -350,17 +350,17 @@ BufferTextureHost::GetFormat() const
 {
   // mFormat is the format of the data that we share with the content process.
   // GetFormat, on the other hand, expects the format that we present to the
   // Compositor (it is used to choose the effect type).
   // if the compositor does not support YCbCr effects, we give it a RGBX texture
   // instead (see BufferTextureHost::Upload)
   if (mFormat == gfx::SurfaceFormat::YUV &&
     mCompositor &&
-    !mCompositor->SupportsEffect(EffectTypes::YCBCR)) {
+    !mCompositor->SupportsEffect(EFFECT_YCBCR)) {
     return gfx::SurfaceFormat::R8G8B8X8;
   }
   return mFormat;
 }
 
 bool
 BufferTextureHost::MaybeUpload(nsIntRegion *aRegion)
 {
@@ -392,33 +392,33 @@ BufferTextureHost::Upload(nsIntRegion *a
   }
   if (mFormat == gfx::SurfaceFormat::UNKNOWN) {
     NS_WARNING("BufferTextureHost: unsupported format!");
     return false;
   } else if (mFormat == gfx::SurfaceFormat::YUV) {
     YCbCrImageDataDeserializer yuvDeserializer(GetBuffer(), GetBufferSize());
     MOZ_ASSERT(yuvDeserializer.IsValid());
 
-    if (!mCompositor->SupportsEffect(EffectTypes::YCBCR)) {
+    if (!mCompositor->SupportsEffect(EFFECT_YCBCR)) {
       RefPtr<gfx::DataSourceSurface> surf = yuvDeserializer.ToDataSourceSurface();
       if (!mFirstSource) {
         mFirstSource = mCompositor->CreateDataTextureSource(mFlags);
       }
       mFirstSource->Update(surf, aRegion);
       return true;
     }
 
     RefPtr<DataTextureSource> srcY;
     RefPtr<DataTextureSource> srcU;
     RefPtr<DataTextureSource> srcV;
     if (!mFirstSource) {
       // We don't support BigImages for YCbCr compositing.
-      srcY = mCompositor->CreateDataTextureSource(mFlags|TextureFlags::DISALLOW_BIGIMAGE);
-      srcU = mCompositor->CreateDataTextureSource(mFlags|TextureFlags::DISALLOW_BIGIMAGE);
-      srcV = mCompositor->CreateDataTextureSource(mFlags|TextureFlags::DISALLOW_BIGIMAGE);
+      srcY = mCompositor->CreateDataTextureSource(mFlags|TEXTURE_DISALLOW_BIGIMAGE);
+      srcU = mCompositor->CreateDataTextureSource(mFlags|TEXTURE_DISALLOW_BIGIMAGE);
+      srcV = mCompositor->CreateDataTextureSource(mFlags|TEXTURE_DISALLOW_BIGIMAGE);
       mFirstSource = srcY;
       srcY->SetNextSibling(srcU);
       srcU->SetNextSibling(srcV);
     } else {
       // mFormat never changes so if this was created as a YCbCr host and already
       // contains a source it should already have 3 sources.
       // BufferTextureHost only uses DataTextureSources so it is safe to assume
       // all 3 sources are DataTextureSource.
@@ -564,17 +564,17 @@ MemoryTextureHost::MemoryTextureHost(uin
 , mBuffer(aBuffer)
 {
   MOZ_COUNT_CTOR(MemoryTextureHost);
 }
 
 MemoryTextureHost::~MemoryTextureHost()
 {
   DeallocateDeviceData();
-  NS_ASSERTION(!mBuffer || (mFlags & TextureFlags::DEALLOCATE_CLIENT),
+  NS_ASSERTION(!mBuffer || (mFlags & TEXTURE_DEALLOCATE_CLIENT),
                "Leaking our buffer");
   MOZ_COUNT_DTOR(MemoryTextureHost);
 }
 
 void
 MemoryTextureHost::DeallocateSharedData()
 {
   if (mBuffer) {
@@ -639,17 +639,17 @@ TextureParent::CompositorRecycle()
       // In this case, HWC implicitly handles buffer's fence.
     }
   }
 #endif
   mozilla::unused << SendCompositorRecycle(handle);
 
   // Don't forget to prepare for the next reycle
   // if TextureClient request it.
-  if (mTextureHost->GetFlags() & TextureFlags::RECYCLE) {
+  if (mTextureHost->GetFlags() & TEXTURE_RECYCLE) {
     mWaitForClientRecycle = mTextureHost;
   }
 }
 
 bool
 TextureParent::RecvClientRecycle()
 {
   // This will allow the RecycleCallback to be called once the compositor
@@ -666,17 +666,17 @@ bool
 TextureParent::Init(const SurfaceDescriptor& aSharedData,
                     const TextureFlags& aFlags)
 {
   mTextureHost = TextureHost::Create(aSharedData,
                                      mAllocator,
                                      aFlags);
   if (mTextureHost) {
     mTextureHost->mActor = this;
-    if (aFlags & TextureFlags::RECYCLE) {
+    if (aFlags & TEXTURE_RECYCLE) {
       mWaitForClientRecycle = mTextureHost;
       RECYCLE_LOG("Setup recycling for tile %p\n", this);
     }
   }
 
   return !!mTextureHost;
 }
 
@@ -706,21 +706,21 @@ TextureParent::ActorDestroy(ActorDestroy
   case Deletion:
   case NormalShutdown:
   case AbnormalShutdown:
     break;
   case FailedConstructor:
     NS_RUNTIMEABORT("FailedConstructor isn't possible in PTexture");
   }
 
-  if (mTextureHost->GetFlags() & TextureFlags::RECYCLE) {
+  if (mTextureHost->GetFlags() & TEXTURE_RECYCLE) {
     RECYCLE_LOG("clear recycling for tile %p\n", this);
     mTextureHost->ClearRecycleCallback();
   }
-  if (mTextureHost->GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
+  if (mTextureHost->GetFlags() & TEXTURE_DEALLOCATE_CLIENT) {
     mTextureHost->ForgetSharedData();
   }
 
   // Clear recycle callback.
   mTextureHost->ClearRecycleCallback();
   mWaitForClientRecycle = nullptr;
 
   mTextureHost->mActor = nullptr;
--- a/gfx/layers/composite/ThebesLayerComposite.cpp
+++ b/gfx/layers/composite/ThebesLayerComposite.cpp
@@ -49,20 +49,20 @@ ThebesLayerComposite::~ThebesLayerCompos
   MOZ_COUNT_DTOR(ThebesLayerComposite);
   CleanupResources();
 }
 
 bool
 ThebesLayerComposite::SetCompositableHost(CompositableHost* aHost)
 {
   switch (aHost->GetType()) {
-    case CompositableType::BUFFER_CONTENT_INC:
-    case CompositableType::BUFFER_TILED:
-    case CompositableType::CONTENT_SINGLE:
-    case CompositableType::CONTENT_DOUBLE:
+    case BUFFER_CONTENT_INC:
+    case BUFFER_TILED:
+    case COMPOSITABLE_CONTENT_SINGLE:
+    case COMPOSITABLE_CONTENT_DOUBLE:
       mBuffer = static_cast<ContentHost*>(aHost);
       return true;
     default:
       return false;
   }
 }
 
 void
--- a/gfx/layers/composite/TiledContentHost.cpp
+++ b/gfx/layers/composite/TiledContentHost.cpp
@@ -119,17 +119,17 @@ TiledLayerBufferComposite::ReleaseTextur
 }
 
 void
 TiledLayerBufferComposite::Upload()
 {
   if(!IsValid()) {
     return;
   }
-  // The TextureClients were created with the TextureFlags::IMMEDIATE_UPLOAD flag,
+  // The TextureClients were created with the TEXTURE_IMMEDIATE_UPLOAD flag,
   // so calling Update on all the texture hosts will perform the texture upload.
   Update(mValidRegion, mPaintedRegion);
   ClearPaintedRegion();
 }
 
 TileHost
 TiledLayerBufferComposite::ValidateTile(TileHost aTile,
                                         const nsIntPoint& aTileOrigin,
@@ -140,17 +140,17 @@ TiledLayerBufferComposite::ValidateTile(
     return aTile;
   }
 
 #ifdef GFX_TILEDLAYER_PREF_WARNINGS
   printf_stderr("Upload tile %i, %i\n", aTileOrigin.x, aTileOrigin.y);
   long start = PR_IntervalNow();
 #endif
 
-  MOZ_ASSERT(aTile.mTextureHost->GetFlags() & TextureFlags::IMMEDIATE_UPLOAD);
+  MOZ_ASSERT(aTile.mTextureHost->GetFlags() & TEXTURE_IMMEDIATE_UPLOAD);
   // We possibly upload the entire texture contents here. This is a purposeful
   // decision, as sub-image upload can often be slow and/or unreliable, but
   // we may want to reevaluate this in the future.
   // For !HasInternalBuffer() textures, this is likely a no-op.
   aTile.mTextureHost->Updated(nullptr);
 
 #ifdef GFX_TILEDLAYER_PREF_WARNINGS
   if (PR_IntervalNow() - start > 1) {
@@ -375,17 +375,17 @@ TiledContentHost::RenderTile(const TileH
                      rect->width, rect->height);
 
     effect->mTextureCoords = Rect(textureRect.x / aTextureBounds.width,
                                   textureRect.y / aTextureBounds.height,
                                   textureRect.width / aTextureBounds.width,
                                   textureRect.height / aTextureBounds.height);
     mCompositor->DrawQuad(graphicsRect, aClipRect, aEffectChain, aOpacity, aTransform);
   }
-  mCompositor->DrawDiagnostics(DiagnosticFlags::CONTENT | DiagnosticFlags::TILE,
+  mCompositor->DrawDiagnostics(DIAGNOSTIC_CONTENT|DIAGNOSTIC_TILE,
                                aScreenRegion, aClipRect, aTransform, mFlashCounter);
 }
 
 void
 TiledContentHost::RenderLayerBuffer(TiledLayerBufferComposite& aLayerBuffer,
                                     EffectChain& aEffectChain,
                                     float aOpacity,
                                     const gfx::Filter& aFilter,
@@ -466,17 +466,17 @@ TiledContentHost::RenderLayerBuffer(Tile
       tileY++;
       y += h;
     }
     tileX++;
     x += w;
   }
   gfx::Rect rect(visibleRect.x, visibleRect.y,
                  visibleRect.width, visibleRect.height);
-  GetCompositor()->DrawDiagnostics(DiagnosticFlags::CONTENT,
+  GetCompositor()->DrawDiagnostics(DIAGNOSTIC_CONTENT,
                                    rect, aClipRect, aTransform, mFlashCounter);
 }
 
 void
 TiledContentHost::PrintInfo(nsACString& aTo, const char* aPrefix)
 {
   aTo += aPrefix;
   aTo += nsPrintfCString("TiledContentHost (0x%p)", this);
--- a/gfx/layers/composite/TiledContentHost.h
+++ b/gfx/layers/composite/TiledContentHost.h
@@ -214,17 +214,17 @@ public:
   void Composite(EffectChain& aEffectChain,
                  float aOpacity,
                  const gfx::Matrix4x4& aTransform,
                  const gfx::Filter& aFilter,
                  const gfx::Rect& aClipRect,
                  const nsIntRegion* aVisibleRegion = nullptr,
                  TiledLayerProperties* aLayerProperties = nullptr);
 
-  virtual CompositableType GetType() { return CompositableType::BUFFER_TILED; }
+  virtual CompositableType GetType() { return BUFFER_TILED; }
 
   virtual TiledLayerComposer* AsTiledLayerComposer() MOZ_OVERRIDE { return this; }
 
   virtual void Attach(Layer* aLayer,
                       Compositor* aCompositor,
                       AttachFlags aFlags = NO_FLAGS) MOZ_OVERRIDE;
 
 #ifdef MOZ_DUMP_PAINTING
--- a/gfx/layers/composite/X11TextureHost.cpp
+++ b/gfx/layers/composite/X11TextureHost.cpp
@@ -20,17 +20,17 @@ using namespace mozilla::gfx;
 X11TextureHost::X11TextureHost(TextureFlags aFlags,
                                const SurfaceDescriptorX11& aDescriptor)
  : TextureHost(aFlags)
 {
   nsRefPtr<gfxXlibSurface> surface = aDescriptor.OpenForeign();
   mSurface = surface.get();
 
   // The host always frees the pixmap.
-  MOZ_ASSERT(!(aFlags & TextureFlags::DEALLOCATE_CLIENT));
+  MOZ_ASSERT(!(aFlags & TEXTURE_DEALLOCATE_CLIENT));
   mSurface->TakePixmap();
 }
 
 bool
 X11TextureHost::Lock()
 {
   if (!mCompositor) {
     return false;
--- a/gfx/layers/d3d11/CompositorD3D11.cpp
+++ b/gfx/layers/d3d11/CompositorD3D11.cpp
@@ -473,31 +473,31 @@ CompositorD3D11::SetRenderTarget(Composi
   mContext->OMSetRenderTargets(1, &view, nullptr);
   PrepareViewport(newRT->GetSize(), gfx::Matrix());
 }
 
 void
 CompositorD3D11::SetPSForEffect(Effect* aEffect, MaskType aMaskType, gfx::SurfaceFormat aFormat)
 {
   switch (aEffect->mType) {
-  case EffectTypes::SOLID_COLOR:
+  case EFFECT_SOLID_COLOR:
     mContext->PSSetShader(mAttachments->mSolidColorShader[aMaskType], nullptr, 0);
     return;
-  case EffectTypes::RENDER_TARGET:
+  case EFFECT_RENDER_TARGET:
     mContext->PSSetShader(mAttachments->mRGBAShader[aMaskType], nullptr, 0);
     return;
-  case EffectTypes::RGB:
+  case EFFECT_RGB:
     mContext->PSSetShader((aFormat == SurfaceFormat::B8G8R8A8 || aFormat == SurfaceFormat::R8G8B8A8)
                           ? mAttachments->mRGBAShader[aMaskType]
                           : mAttachments->mRGBShader[aMaskType], nullptr, 0);
     return;
-  case EffectTypes::YCBCR:
+  case EFFECT_YCBCR:
     mContext->PSSetShader(mAttachments->mYCbCrShader[aMaskType], nullptr, 0);
     return;
-  case EffectTypes::COMPONENT_ALPHA:
+  case EFFECT_COMPONENT_ALPHA:
     mContext->PSSetShader(mAttachments->mComponentAlphaShader[aMaskType], nullptr, 0);
     return;
   default:
     NS_WARNING("No shader to load");
     return;
   }
 }
 
@@ -516,19 +516,19 @@ CompositorD3D11::ClearRect(const gfx::Re
 
   D3D11_RECT scissor;
   scissor.left = aRect.x;
   scissor.right = aRect.XMost();
   scissor.top = aRect.y;
   scissor.bottom = aRect.YMost();
   mContext->RSSetScissorRects(1, &scissor);
   mContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
-  mContext->VSSetShader(mAttachments->mVSQuadShader[MaskType::MaskNone], nullptr, 0);
+  mContext->VSSetShader(mAttachments->mVSQuadShader[MaskNone], nullptr, 0);
 
-  mContext->PSSetShader(mAttachments->mSolidColorShader[MaskType::MaskNone], nullptr, 0);
+  mContext->PSSetShader(mAttachments->mSolidColorShader[MaskNone], nullptr, 0);
   mPSConstants.layerColor[0] = 0;
   mPSConstants.layerColor[1] = 0;
   mPSConstants.layerColor[2] = 0;
   mPSConstants.layerColor[3] = 0;
 
   UpdateConstantBuffers();
 
   mContext->Draw(4, 0);
@@ -549,28 +549,28 @@ CompositorD3D11::DrawQuad(const gfx::Rec
   mVSConstants.renderTargetOffset[0] = origin.x;
   mVSConstants.renderTargetOffset[1] = origin.y;
   mVSConstants.layerQuad = aRect;
 
   mPSConstants.layerOpacity[0] = aOpacity;
 
   bool restoreBlendMode = false;
 
-  MaskType maskType = MaskType::MaskNone;
+  MaskType maskType = MaskNone;
 
-  if (aEffectChain.mSecondaryEffects[EffectTypes::MASK]) {
+  if (aEffectChain.mSecondaryEffects[EFFECT_MASK]) {
     if (aTransform.Is2D()) {
-      maskType = MaskType::Mask2d;
+      maskType = Mask2d;
     } else {
-      MOZ_ASSERT(aEffectChain.mPrimaryEffect->mType == EffectTypes::RGB);
-      maskType = MaskType::Mask3d;
+      MOZ_ASSERT(aEffectChain.mPrimaryEffect->mType == EFFECT_RGB);
+      maskType = Mask3d;
     }
 
     EffectMask* maskEffect =
-      static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EffectTypes::MASK].get());
+      static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EFFECT_MASK].get());
     TextureSourceD3D11* source = maskEffect->mMaskTexture->AsSourceD3D11();
 
     if (!source) {
       NS_WARNING("Missing texture source!");
       return;
     }
 
     RefPtr<ID3D11ShaderResourceView> view;
@@ -593,29 +593,29 @@ CompositorD3D11::DrawQuad(const gfx::Rec
   scissor.top = aClipRect.y;
   scissor.bottom = aClipRect.YMost();
   mContext->RSSetScissorRects(1, &scissor);
   mContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLESTRIP);
   mContext->VSSetShader(mAttachments->mVSQuadShader[maskType], nullptr, 0);
 
 
   switch (aEffectChain.mPrimaryEffect->mType) {
-  case EffectTypes::SOLID_COLOR: {
+  case EFFECT_SOLID_COLOR: {
       SetPSForEffect(aEffectChain.mPrimaryEffect, maskType, SurfaceFormat::UNKNOWN);
 
       Color color =
         static_cast<EffectSolidColor*>(aEffectChain.mPrimaryEffect.get())->mColor;
       mPSConstants.layerColor[0] = color.r * color.a * aOpacity;
       mPSConstants.layerColor[1] = color.g * color.a * aOpacity;
       mPSConstants.layerColor[2] = color.b * color.a * aOpacity;
       mPSConstants.layerColor[3] = color.a * aOpacity;
     }
     break;
-  case EffectTypes::RGB:
-  case EffectTypes::RENDER_TARGET:
+  case EFFECT_RGB:
+  case EFFECT_RENDER_TARGET:
     {
       TexturedEffect* texturedEffect =
         static_cast<TexturedEffect*>(aEffectChain.mPrimaryEffect.get());
 
       mVSConstants.textureCoords = texturedEffect->mTextureCoords;
 
       TextureSourceD3D11* source = texturedEffect->mTexture->AsSourceD3D11();
 
@@ -635,17 +635,17 @@ CompositorD3D11::DrawQuad(const gfx::Rec
       if (!texturedEffect->mPremultiplied) {
         mContext->OMSetBlendState(mAttachments->mNonPremulBlendState, sBlendFactor, 0xFFFFFFFF);
         restoreBlendMode = true;
       }
 
       SetSamplerForFilter(texturedEffect->mFilter);
     }
     break;
-  case EffectTypes::YCBCR: {
+  case EFFECT_YCBCR: {
       EffectYCbCr* ycbcrEffect =
         static_cast<EffectYCbCr*>(aEffectChain.mPrimaryEffect.get());
 
       SetSamplerForFilter(Filter::LINEAR);
 
       mVSConstants.textureCoords = ycbcrEffect->mTextureCoords;
 
       const int Y = 0, Cb = 1, Cr = 2;
@@ -675,17 +675,17 @@ CompositorD3D11::DrawQuad(const gfx::Rec
                                         nullptr, byRef(views[1]));
       mDevice->CreateShaderResourceView(sourceCr->GetD3D11Texture(),
                                         nullptr, byRef(views[2]));
 
       ID3D11ShaderResourceView* srViews[3] = { views[0], views[1], views[2] };
       mContext->PSSetShaderResources(0, 3, srViews);
     }
     break;
-  case EffectTypes::COMPONENT_ALPHA:
+  case EFFECT_COMPONENT_ALPHA:
     {
       MOZ_ASSERT(gfxPrefs::ComponentAlphaEnabled());
       MOZ_ASSERT(mAttachments->mComponentBlendState);
       EffectComponentAlpha* effectComponentAlpha =
         static_cast<EffectComponentAlpha*>(aEffectChain.mPrimaryEffect.get());
 
       TextureSourceD3D11* sourceOnWhite = effectComponentAlpha->mOnWhite->AsSourceD3D11();
       TextureSourceD3D11* sourceOnBlack = effectComponentAlpha->mOnBlack->AsSourceD3D11();
@@ -895,42 +895,42 @@ CompositorD3D11::UpdateRenderTarget()
 bool
 CompositorD3D11::CreateShaders()
 {
   HRESULT hr;
 
   hr = mDevice->CreateVertexShader(LayerQuadVS,
                                    sizeof(LayerQuadVS),
                                    nullptr,
-                                   byRef(mAttachments->mVSQuadShader[MaskType::MaskNone]));
+                                   byRef(mAttachments->mVSQuadShader[MaskNone]));
   if (FAILED(hr)) {
     return false;
   }
 
   hr = mDevice->CreateVertexShader(LayerQuadMaskVS,
                                    sizeof(LayerQuadMaskVS),
                                    nullptr,
-                                   byRef(mAttachments->mVSQuadShader[MaskType::Mask2d]));
+                                   byRef(mAttachments->mVSQuadShader[Mask2d]));
   if (FAILED(hr)) {
     return false;
   }
 
   hr = mDevice->CreateVertexShader(LayerQuadMask3DVS,
                                    sizeof(LayerQuadMask3DVS),
                                    nullptr,
-                                   byRef(mAttachments->mVSQuadShader[MaskType::Mask3d]));
+                                   byRef(mAttachments->mVSQuadShader[Mask3d]));
   if (FAILED(hr)) {
     return false;
   }
 
-#define LOAD_PIXEL_SHADER(x) hr = mDevice->CreatePixelShader(x, sizeof(x), nullptr, byRef(mAttachments->m##x[MaskType::MaskNone])); \
+#define LOAD_PIXEL_SHADER(x) hr = mDevice->CreatePixelShader(x, sizeof(x), nullptr, byRef(mAttachments->m##x[MaskNone])); \
   if (FAILED(hr)) { \
     return false; \
   } \
-  hr = mDevice->CreatePixelShader(x##Mask, sizeof(x##Mask), nullptr, byRef(mAttachments->m##x[MaskType::Mask2d])); \
+  hr = mDevice->CreatePixelShader(x##Mask, sizeof(x##Mask), nullptr, byRef(mAttachments->m##x[Mask2d])); \
   if (FAILED(hr)) { \
     return false; \
   }
 
   LOAD_PIXEL_SHADER(SolidColorShader);
   LOAD_PIXEL_SHADER(RGBShader);
   LOAD_PIXEL_SHADER(RGBAShader);
   LOAD_PIXEL_SHADER(YCbCrShader);
@@ -938,17 +938,17 @@ CompositorD3D11::CreateShaders()
     LOAD_PIXEL_SHADER(ComponentAlphaShader);
   }
 
 #undef LOAD_PIXEL_SHADER
 
   hr = mDevice->CreatePixelShader(RGBAShaderMask3D,
                                   sizeof(RGBAShaderMask3D),
                                   nullptr,
-                                  byRef(mAttachments->mRGBAShader[MaskType::Mask3d]));
+                                  byRef(mAttachments->mRGBAShader[Mask3d]));
   if (FAILED(hr)) {
     return false;
   }
 
   return true;
 }
 
 void
--- a/gfx/layers/d3d11/CompositorD3D11.h
+++ b/gfx/layers/d3d11/CompositorD3D11.h
@@ -45,17 +45,17 @@ public:
 
   virtual bool Initialize() MOZ_OVERRIDE;
   virtual void Destroy() MOZ_OVERRIDE {}
 
   virtual TextureFactoryIdentifier
     GetTextureFactoryIdentifier() MOZ_OVERRIDE;
 
   virtual TemporaryRef<DataTextureSource>
-    CreateDataTextureSource(TextureFlags aFlags = TextureFlags::NO_FLAGS) MOZ_OVERRIDE;
+    CreateDataTextureSource(TextureFlags aFlags = 0) MOZ_OVERRIDE;
 
   virtual bool CanUseCanvasLayerForSize(const gfx::IntSize& aSize) MOZ_OVERRIDE;
   virtual int32_t GetMaxTextureSize() const MOZ_FINAL;
 
   virtual void SetTargetContext(gfx::DrawTarget* aTarget)  MOZ_OVERRIDE
   {
     mTarget = aTarget;
   }
--- a/gfx/layers/d3d11/TextureD3D11.cpp
+++ b/gfx/layers/d3d11/TextureD3D11.cpp
@@ -72,17 +72,17 @@ DataTextureSourceD3D11::DataTextureSourc
   MOZ_COUNT_CTOR(DataTextureSourceD3D11);
 }
 
 DataTextureSourceD3D11::DataTextureSourceD3D11(SurfaceFormat aFormat,
                                                CompositorD3D11* aCompositor,
                                                ID3D11Texture2D* aTexture)
 : mCompositor(aCompositor)
 , mFormat(aFormat)
-, mFlags(TextureFlags::NO_FLAGS)
+, mFlags(0)
 , mCurrentTile(0)
 , mIsTiled(false)
 , mIterating(false)
 {
   MOZ_COUNT_CTOR(DataTextureSourceD3D11);
 
   mTexture = aTexture;
   D3D11_TEXTURE2D_DESC desc;
@@ -356,17 +356,17 @@ DataTextureSourceD3D11::Update(DataSourc
   mFormat = aSurface->GetFormat();
 
   CD3D11_TEXTURE2D_DESC desc(dxgiFormat, mSize.width, mSize.height,
                              1, 1, D3D11_BIND_SHADER_RESOURCE,
                              D3D11_USAGE_IMMUTABLE);
 
   int32_t maxSize = mCompositor->GetMaxTextureSize();
   if ((mSize.width <= maxSize && mSize.height <= maxSize) ||
-      (mFlags & TextureFlags::DISALLOW_BIGIMAGE)) {
+      (mFlags & TEXTURE_DISALLOW_BIGIMAGE)) {
     D3D11_SUBRESOURCE_DATA initData;
     initData.pSysMem = aSurface->GetData();
     initData.SysMemPitch = aSurface->Stride();
 
     mCompositor->GetDevice()->CreateTexture2D(&desc, &initData, byRef(mTexture));
     mIsTiled = false;
     if (!mTexture) {
       Reset();
--- a/gfx/layers/d3d9/CompositorD3D9.cpp
+++ b/gfx/layers/d3d9/CompositorD3D9.cpp
@@ -190,25 +190,25 @@ CompositorD3D9::SetRenderTarget(Composit
   mCurrentRT->BindRenderTarget(device());
   PrepareViewport(mCurrentRT->GetSize(), Matrix());
 }
 
 static DeviceManagerD3D9::ShaderMode
 ShaderModeForEffectType(EffectTypes aEffectType, gfx::SurfaceFormat aFormat)
 {
   switch (aEffectType) {
-  case EffectTypes::SOLID_COLOR:
+  case EFFECT_SOLID_COLOR:
     return DeviceManagerD3D9::SOLIDCOLORLAYER;
-  case EffectTypes::RENDER_TARGET:
+  case EFFECT_RENDER_TARGET:
     return DeviceManagerD3D9::RGBALAYER;
-  case EffectTypes::RGB:
+  case EFFECT_RGB:
     if (aFormat == SurfaceFormat::B8G8R8A8 || aFormat == SurfaceFormat::R8G8B8A8)
       return DeviceManagerD3D9::RGBALAYER;
     return DeviceManagerD3D9::RGBLAYER;
-  case EffectTypes::YCBCR:
+  case EFFECT_YCBCR:
     return DeviceManagerD3D9::YCBCRLAYER;
   }
 
   MOZ_CRASH("Bad effect type");
 }
 
 void
 CompositorD3D9::ClearRect(const gfx::Rect& aRect)
@@ -248,66 +248,66 @@ CompositorD3D9::DrawQuad(const gfx::Rect
   d3d9Device->SetVertexShaderConstantF(CBvLayerQuad,
                                        ShaderConstantRect(aRect.x,
                                                           aRect.y,
                                                           aRect.width,
                                                           aRect.height),
                                        1);
   bool target = false;
 
-  if (aEffectChain.mPrimaryEffect->mType != EffectTypes::SOLID_COLOR) {
+  if (aEffectChain.mPrimaryEffect->mType != EFFECT_SOLID_COLOR) {
     float opacity[4];
     /*
      * We always upload a 4 component float, but the shader will use only the
      * first component since it's declared as a 'float'.
      */
     opacity[0] = aOpacity;
     d3d9Device->SetPixelShaderConstantF(CBfLayerOpacity, opacity, 1);
   }
 
   bool isPremultiplied = true;
 
-  MaskType maskType = MaskType::MaskNone;
+  MaskType maskType = MaskNone;
 
-  if (aEffectChain.mSecondaryEffects[EffectTypes::MASK]) {
+  if (aEffectChain.mSecondaryEffects[EFFECT_MASK]) {
     if (aTransform.Is2D()) {
-      maskType = MaskType::Mask2d;
+      maskType = Mask2d;
     } else {
-      maskType = MaskType::Mask3d;
+      maskType = Mask3d;
     }
   }
 
   RECT scissor;
   scissor.left = aClipRect.x;
   scissor.right = aClipRect.XMost();
   scissor.top = aClipRect.y;
   scissor.bottom = aClipRect.YMost();
   d3d9Device->SetScissorRect(&scissor);
 
   uint32_t maskTexture = 0;
   switch (aEffectChain.mPrimaryEffect->mType) {
-  case EffectTypes::SOLID_COLOR:
+  case EFFECT_SOLID_COLOR:
     {
       // output color is premultiplied, so we need to adjust all channels.
       Color layerColor =
         static_cast<EffectSolidColor*>(aEffectChain.mPrimaryEffect.get())->mColor;
       float color[4];
       color[0] = layerColor.r * layerColor.a * aOpacity;
       color[1] = layerColor.g * layerColor.a * aOpacity;
       color[2] = layerColor.b * layerColor.a * aOpacity;
       color[3] = layerColor.a * aOpacity;
 
       d3d9Device->SetPixelShaderConstantF(CBvColor, color, 1);
 
       maskTexture = mDeviceManager
         ->SetShaderMode(DeviceManagerD3D9::SOLIDCOLORLAYER, maskType);
     }
     break;
-  case EffectTypes::RENDER_TARGET:
-  case EffectTypes::RGB:
+  case EFFECT_RENDER_TARGET:
+  case EFFECT_RGB:
     {
       TexturedEffect* texturedEffect =
         static_cast<TexturedEffect*>(aEffectChain.mPrimaryEffect.get());
 
       Rect textureCoords = texturedEffect->mTextureCoords;
       d3d9Device->SetVertexShaderConstantF(CBvTextureCoords,
                                            ShaderConstantRect(
                                              textureCoords.x,
@@ -324,17 +324,17 @@ CompositorD3D9::DrawQuad(const gfx::Rect
       maskTexture = mDeviceManager
         ->SetShaderMode(ShaderModeForEffectType(aEffectChain.mPrimaryEffect->mType,
                                                 texturedEffect->mTexture->GetFormat()),
                         maskType);
 
       isPremultiplied = texturedEffect->mPremultiplied;
     }
     break;
-  case EffectTypes::YCBCR:
+  case EFFECT_YCBCR:
     {
       EffectYCbCr* ycbcrEffect =
         static_cast<EffectYCbCr*>(aEffectChain.mPrimaryEffect.get());
 
       SetSamplerForFilter(Filter::LINEAR);
 
       Rect textureCoords = ycbcrEffect->mTextureCoords;
       d3d9Device->SetVertexShaderConstantF(CBvTextureCoords,
@@ -410,17 +410,17 @@ CompositorD3D9::DrawQuad(const gfx::Rect
       // presumably even with point filtering we'll still want chroma upsampling
       // to be linear. In the current approach we can't.
       device()->SetTexture(Y, sourceY->GetD3D9Texture());
       device()->SetTexture(Cb, sourceCb->GetD3D9Texture());
       device()->SetTexture(Cr, sourceCr->GetD3D9Texture());
       maskTexture = mDeviceManager->SetShaderMode(DeviceManagerD3D9::YCBCRLAYER, maskType);
     }
     break;
-  case EffectTypes::COMPONENT_ALPHA:
+  case EFFECT_COMPONENT_ALPHA:
     {
       MOZ_ASSERT(gfxPrefs::ComponentAlphaEnabled());
       EffectComponentAlpha* effectComponentAlpha =
         static_cast<EffectComponentAlpha*>(aEffectChain.mPrimaryEffect.get());
       TextureSourceD3D9* sourceOnWhite = effectComponentAlpha->mOnWhite->AsSourceD3D9();
       TextureSourceD3D9* sourceOnBlack = effectComponentAlpha->mOnBlack->AsSourceD3D9();
 
       Rect textureCoords = effectComponentAlpha->mTextureCoords;
@@ -471,17 +471,17 @@ CompositorD3D9::DrawQuad(const gfx::Rect
     d3d9Device->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_ONE);
   }
 }
 
 void
 CompositorD3D9::SetMask(const EffectChain &aEffectChain, uint32_t aMaskTexture)
 {
   EffectMask *maskEffect =
-    static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EffectTypes::MASK].get());
+    static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EFFECT_MASK].get());
   if (!maskEffect) {
     return;
   }
 
   TextureSourceD3D9 *source = maskEffect->mMaskTexture->AsSourceD3D9();
 
   MOZ_ASSERT(aMaskTexture >= 0);
   device()->SetTexture(aMaskTexture, source->GetD3D9Texture());
--- a/gfx/layers/d3d9/CompositorD3D9.h
+++ b/gfx/layers/d3d9/CompositorD3D9.h
@@ -118,17 +118,17 @@ public:
   {
     if (aOffset.x || aOffset.y) {
       NS_RUNTIMEABORT("SetScreenRenderOffset not supported by CompositorD3D9.");
     }
     // If the offset is 0, 0 that's okay.
   }
 
   virtual TemporaryRef<DataTextureSource>
-    CreateDataTextureSource(TextureFlags aFlags = TextureFlags::NO_FLAGS) MOZ_OVERRIDE;
+    CreateDataTextureSource(TextureFlags aFlags = 0) MOZ_OVERRIDE;
 private:
   // ensure mSize is up to date with respect to mWidget
   void EnsureSize();
   void SetSamplerForFilter(gfx::Filter aFilter);
   void PaintToTarget();
   void SetMask(const EffectChain &aEffectChain, uint32_t aMaskTexture);
   /**
    * Ensure we have a swap chain and it is ready for rendering.
--- a/gfx/layers/d3d9/DeviceManagerD3D9.cpp
+++ b/gfx/layers/d3d9/DeviceManagerD3D9.cpp
@@ -564,17 +564,17 @@ LoadMaskTexture(Layer* aMask, IDirect3DD
 
   aDevice->SetTexture(aMaskTexRegister, texture);
   return true;
 }
 
 uint32_t
 DeviceManagerD3D9::SetShaderMode(ShaderMode aMode, MaskType aMaskType)
 {
-  if (aMaskType == MaskType::MaskNone) {
+  if (aMaskType == MaskNone) {
     switch (aMode) {
       case RGBLAYER:
         mDevice->SetVertexShader(mLayerVS);
         mDevice->SetPixelShader(mRGBPS);
         break;
       case RGBALAYER:
         mDevice->SetVertexShader(mLayerVS);
         mDevice->SetPixelShader(mRGBAPS);
@@ -602,17 +602,17 @@ DeviceManagerD3D9::SetShaderMode(ShaderM
   uint32_t maskTexRegister;
   switch (aMode) {
     case RGBLAYER:
       mDevice->SetVertexShader(mLayerVSMask);
       mDevice->SetPixelShader(mRGBPSMask);
       maskTexRegister = 1;
       break;
     case RGBALAYER:
-      if (aMaskType == MaskType::Mask2d) {
+      if (aMaskType == Mask2d) {
         mDevice->SetVertexShader(mLayerVSMask);
         mDevice->SetPixelShader(mRGBAPSMask);
       } else {
         mDevice->SetVertexShader(mLayerVSMask3D);
         mDevice->SetPixelShader(mRGBAPSMask3D);
       }
       maskTexRegister = 1;
       break;
@@ -638,28 +638,28 @@ DeviceManagerD3D9::SetShaderMode(ShaderM
       break;
   }
   return maskTexRegister;
 }
 
 void
 DeviceManagerD3D9::SetShaderMode(ShaderMode aMode, Layer* aMask, bool aIs2D)
 {
-  MaskType maskType = MaskType::MaskNone;
+  MaskType maskType = MaskNone;
   if (aMask) {
-    maskType = aIs2D ? MaskType::Mask2d : MaskType::Mask3d;
+    maskType = aIs2D ? Mask2d : Mask3d;
   }
   uint32_t maskTexRegister = SetShaderMode(aMode, maskType);
   if (aMask) {
     // register allocations are taken from LayerManagerD3D9Shaders.h after
     // the shaders are compiled (genshaders.sh)
     if (!LoadMaskTexture(aMask, mDevice, maskTexRegister)) {
       // if we can't load the mask, fall back to unmasked rendering
       NS_WARNING("Could not load texture for mask layer.");
-      SetShaderMode(aMode, MaskType::MaskNone);
+      SetShaderMode(aMode, MaskNone);
     }
   }
 }
 
 void
 DeviceManagerD3D9::DestroyDevice()
 {
   ++mDeviceResetCount;
--- a/gfx/layers/d3d9/TextureD3D9.cpp
+++ b/gfx/layers/d3d9/TextureD3D9.cpp
@@ -407,17 +407,17 @@ DataTextureSourceD3D9::Update(gfx::DataS
   default:
     NS_WARNING("Bad image format");
     return false;
   }
 
   int32_t maxSize = mCompositor->GetMaxTextureSize();
   DeviceManagerD3D9* deviceManager = gfxWindowsPlatform::GetPlatform()->GetD3D9DeviceManager();
   if ((mSize.width <= maxSize && mSize.height <= maxSize) ||
-      (mFlags & TextureFlags::DISALLOW_BIGIMAGE)) {
+      (mFlags & TEXTURE_DISALLOW_BIGIMAGE)) {
     mTexture = DataToTexture(deviceManager,
                              aSurface->GetData(), aSurface->Stride(),
                              IntSize(mSize), format, bpp);
     if (!mTexture) {
       NS_WARNING("Could not upload texture");
       Reset();
       return false;
     }
@@ -482,17 +482,17 @@ DataTextureSourceD3D9::Update(gfxWindows
   default:
     NS_WARNING("Bad image format");
     return false;
   }
 
   int32_t maxSize = mCompositor->GetMaxTextureSize();
   DeviceManagerD3D9* deviceManager = gfxWindowsPlatform::GetPlatform()->GetD3D9DeviceManager();
   if ((mSize.width <= maxSize && mSize.height <= maxSize) ||
-      (mFlags & TextureFlags::DISALLOW_BIGIMAGE)) {
+      (mFlags & TEXTURE_DISALLOW_BIGIMAGE)) {
     mTexture = SurfaceToTexture(deviceManager, aSurface, mSize, format);
 
     if (!mTexture) {
       NS_WARNING("Could not upload texture");
       Reset();
       return false;
     }
     mIsTiled = false;
--- a/gfx/layers/d3d9/TextureD3D9.h
+++ b/gfx/layers/d3d9/TextureD3D9.h
@@ -101,24 +101,24 @@ protected:
  */
 class DataTextureSourceD3D9 : public DataTextureSource
                             , public TextureSourceD3D9
                             , public TileIterator
 {
 public:
   DataTextureSourceD3D9(gfx::SurfaceFormat aFormat,
                         CompositorD3D9* aCompositor,
-                        TextureFlags aFlags = TextureFlags::DEFAULT,
+                        TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT,
                         StereoMode aStereoMode = StereoMode::MONO);
 
   DataTextureSourceD3D9(gfx::SurfaceFormat aFormat,
                         gfx::IntSize aSize,
                         CompositorD3D9* aCompositor,
                         IDirect3DTexture9* aTexture,
-                        TextureFlags aFlags = TextureFlags::DEFAULT);
+                        TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
 
   virtual ~DataTextureSourceD3D9();
 
   // DataTextureSource
 
   virtual bool Update(gfx::DataSourceSurface* aSurface,
                       nsIntRegion* aDestRegion = nullptr,
                       gfx::IntPoint* aSrcOffset = nullptr) MOZ_OVERRIDE;
--- a/gfx/layers/ipc/CompositorParent.cpp
+++ b/gfx/layers/ipc/CompositorParent.cpp
@@ -674,17 +674,17 @@ CompositorParent::CompositeToTarget(Draw
   if (executionTime > frameBudget) {
     printf_stderr("Compositor: Composite execution took %4.1f ms\n",
                   executionTime.ToMilliseconds());
   }
 #endif
 
   // 0 -> Full-tilt composite
   if (gfxPrefs::LayersCompositionFrameRate() == 0
-    || mLayerManager->GetCompositor()->GetDiagnosticTypes() & DiagnosticTypes::FLASH_BORDERS) {
+    || mLayerManager->GetCompositor()->GetDiagnosticTypes() & DIAGNOSTIC_FLASH_BORDERS) {
     // Special full-tilt composite mode for performance testing
     ScheduleComposition();
   }
 
   profiler_tracing("Paint", "Composite", TRACING_INTERVAL_END);
 }
 
 void
--- a/gfx/layers/ipc/ImageBridgeChild.cpp
+++ b/gfx/layers/ipc/ImageBridgeChild.cpp
@@ -643,17 +643,17 @@ ImageBridgeChild::CreateImageClient(Comp
   }
   return result.forget();
 }
 
 TemporaryRef<ImageClient>
 ImageBridgeChild::CreateImageClientNow(CompositableType aType)
 {
   RefPtr<ImageClient> client
-    = ImageClient::CreateImageClient(aType, this, TextureFlags::NO_FLAGS);
+    = ImageClient::CreateImageClient(aType, this, 0);
   MOZ_ASSERT(client, "failed to create ImageClient");
   if (client) {
     client->Connect();
   }
   return client.forget();
 }
 
 PGrallocBufferChild*
@@ -913,17 +913,17 @@ ImageBridgeChild::CreateTexture(const Su
 {
   return SendPTextureConstructor(aSharedData, aFlags);
 }
 
 void
 ImageBridgeChild::RemoveTextureFromCompositable(CompositableClient* aCompositable,
                                                 TextureClient* aTexture)
 {
-  if (aTexture->GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
+  if (aTexture->GetFlags() & TEXTURE_DEALLOCATE_CLIENT) {
     mTxn->AddEdit(OpRemoveTexture(nullptr, aCompositable->GetIPDLActor(),
                                   nullptr, aTexture->GetIPDLActor()));
   } else {
     mTxn->AddNoSwapEdit(OpRemoveTexture(nullptr, aCompositable->GetIPDLActor(),
                                         nullptr, aTexture->GetIPDLActor()));
   }
   // Hold texture until transaction complete.
   HoldUntilTransaction(aTexture);
--- a/gfx/layers/ipc/LayersMessages.ipdlh
+++ b/gfx/layers/ipc/LayersMessages.ipdlh
@@ -36,17 +36,16 @@ using mozilla::LayerMargin from "Units.h
 using mozilla::LayerPoint from "Units.h";
 using mozilla::LayerRect from "Units.h";
 using mozilla::layers::ScaleMode from "mozilla/layers/LayersTypes.h";
 using mozilla::layers::EventRegions from "mozilla/layers/LayersTypes.h";
 using mozilla::layers::DiagnosticTypes from "mozilla/layers/CompositorTypes.h";
 using struct mozilla::layers::FrameMetrics from "FrameMetrics.h";
 using mozilla::layers::FrameMetrics::ViewID from "FrameMetrics.h";
 using struct mozilla::layers::FenceHandle from "mozilla/layers/FenceUtils.h";
-using mozilla::layers::TextureIdentifier from "mozilla/layers/CompositorTypes.h";
 
 namespace mozilla {
 namespace layers {
 
 struct TargetConfig {
   nsIntRect naturalBounds;
   ScreenRotation rotation;
   nsIntRect clientBounds;
@@ -307,17 +306,17 @@ struct OpCreatedIncrementalTexture {
 struct OpPaintTextureRegion {
   PCompositable compositable;
   ThebesBufferData bufferData;
   nsIntRegion updatedRegion;
 };
 
 struct OpPaintTextureIncremental {
   PCompositable compositable;
-  TextureIdentifier textureId;
+  uint32_t textureId;
   SurfaceDescriptor image;
   nsIntRegion updatedRegion;
   nsIntRect bufferRect;
   nsIntPoint bufferRotation;
 };
 
 struct OpUpdatePictureRect {
   PCompositable compositable;
@@ -405,17 +404,17 @@ union Edit {
 
 struct OpContentBufferSwap {
   PCompositable compositable;
   nsIntRegion frontUpdatedRegion;
 };
 
 struct OpTextureSwap {
   PCompositable compositable;
-  TextureIdentifier textureId;
+  uint32_t textureId;
   SurfaceDescriptor image;
 };
 
 struct ReturnReleaseFence {
   PCompositable compositable;
   PTexture texture;
   FenceHandle fence;
 };
--- a/gfx/layers/ipc/PImageBridge.ipdl
+++ b/gfx/layers/ipc/PImageBridge.ipdl
@@ -8,17 +8,16 @@ include LayersMessages;
 include protocol PGrallocBuffer;
 include protocol PCompositable;
 include protocol PTexture;
 include ProtocolTypes;
 
 include "mozilla/GfxMessageUtils.h";
 
 using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h";
-using mozilla::layers::TextureFlags from "mozilla/layers/CompositorTypes.h";
 
 namespace mozilla {
 namespace layers {
 
 /**
  * The PImageBridge protocol is used to allow isolated threads or processes to push
  * frames directly to the compositor thread/process without relying on the main thread
  * which might be too busy dealing with content script.
@@ -47,15 +46,15 @@ parent:
   // counterpart so as to not race with the upcomming __delete__ message.
   // In the child side, the __delete__ messages are not sent right after Stop,
   // they are scheduled in the ImageBridgeChild's message queue in order to ensure
   // that all the messages from the parent side have been received and processed
   // before sending __delete__.
   sync Stop();
 
   sync PCompositable(TextureInfo aInfo) returns (uint64_t id);
-  async PTexture(SurfaceDescriptor aSharedData, TextureFlags aTextureFlags);
+  async PTexture(SurfaceDescriptor aSharedData, uint32_t aTextureFlags);
 };
 
 
 } // namespace
 } // namespace
 
--- a/gfx/layers/ipc/PLayerTransaction.ipdl
+++ b/gfx/layers/ipc/PLayerTransaction.ipdl
@@ -13,17 +13,16 @@ include protocol PGrallocBuffer;
 include protocol PLayer;
 include protocol PRenderFrame;
 include protocol PTexture;
 
 include "mozilla/GfxMessageUtils.h";
 
 using struct mozilla::layers::TextureInfo from "mozilla/layers/CompositorTypes.h";
 using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
-using mozilla::layers::TextureFlags from "mozilla/layers/CompositorTypes.h";
 
 /**
  * The layers protocol is spoken between thread contexts that manage
  * layer (sub)trees.  The protocol comprises atomically publishing
  * layer subtrees to a "shadow" thread context (which grafts the
  * subtree into its own tree), and atomically updating a published
  * subtree.  ("Atomic" in this sense is wrt painting.)
  */
@@ -70,17 +69,17 @@ parent:
    *   USAGE_HW_RENDER | USAGE_HW_TEXTURE
    *     - used for GL rendering to a buffer which the compositor
    *       treats as a texture
    */
   sync PGrallocBuffer(IntSize size, uint32_t format, uint32_t usage)
     returns (MaybeMagicGrallocBufferHandle handle);
   async PLayer();
   async PCompositable(TextureInfo aTextureInfo);
-  async PTexture(SurfaceDescriptor aSharedData, TextureFlags aTextureFlags);
+  async PTexture(SurfaceDescriptor aSharedData, uint32_t aTextureFlags);
 
   // The isFirstPaint flag can be used to indicate that this is the first update
   // for a particular document.
   sync Update(Edit[] cset, TargetConfig targetConfig, bool isFirstPaint, bool scheduleComposite)
     returns (EditReply[] reply);
 
   // Testing APIs
 
--- a/gfx/layers/ipc/ShadowLayers.cpp
+++ b/gfx/layers/ipc/ShadowLayers.cpp
@@ -161,17 +161,17 @@ struct AutoTxnEnd {
 
 void
 CompositableForwarder::IdentifyTextureHost(const TextureFactoryIdentifier& aIdentifier)
 {
   mTextureFactoryIdentifier = aIdentifier;
 }
 
 ShadowLayerForwarder::ShadowLayerForwarder()
- : mDiagnosticTypes(DiagnosticTypes::NO_DIAGNOSTIC)
+ : mDiagnosticTypes(DIAGNOSTIC_NONE)
  , mIsFirstPaint(false)
  , mWindowOverlayChanged(false)
 {
   mTxn = new Transaction();
 }
 
 ShadowLayerForwarder::~ShadowLayerForwarder()
 {
@@ -362,17 +362,17 @@ ShadowLayerForwarder::UpdatedTexture(Com
                                      nsIntRegion* aRegion)
 {
   MOZ_ASSERT(aCompositable);
   MOZ_ASSERT(aTexture);
   MOZ_ASSERT(aCompositable->GetIPDLActor());
   MOZ_ASSERT(aTexture->GetIPDLActor());
   MaybeRegion region = aRegion ? MaybeRegion(*aRegion)
                                : MaybeRegion(null_t());
-  if (aTexture->GetFlags() & TextureFlags::IMMEDIATE_UPLOAD) {
+  if (aTexture->GetFlags() & TEXTURE_IMMEDIATE_UPLOAD) {
     mTxn->AddPaint(OpUpdateTexture(nullptr, aCompositable->GetIPDLActor(),
                                    nullptr, aTexture->GetIPDLActor(),
                                    region));
   } else {
     mTxn->AddNoSwapPaint(OpUpdateTexture(nullptr, aCompositable->GetIPDLActor(),
                                          nullptr, aTexture->GetIPDLActor(),
                                          region));
   }
@@ -412,17 +412,17 @@ ShadowLayerForwarder::RemoveTextureFromC
                                                     TextureClient* aTexture)
 {
   MOZ_ASSERT(aCompositable);
   MOZ_ASSERT(aTexture);
   MOZ_ASSERT(aCompositable->GetIPDLActor());
   MOZ_ASSERT(aTexture->GetIPDLActor());
   mTxn->AddEdit(OpRemoveTexture(nullptr, aCompositable->GetIPDLActor(),
                                 nullptr, aTexture->GetIPDLActor()));
-  if (aTexture->GetFlags() & TextureFlags::DEALLOCATE_CLIENT) {
+  if (aTexture->GetFlags() & TEXTURE_DEALLOCATE_CLIENT) {
     mTxn->MarkSyncTransaction();
   }
   // Hold texture until transaction complete.
   HoldUntilTransaction(aTexture);
 }
 
 void
 ShadowLayerForwarder::RemoveTexture(TextureClient* aTexture)
--- a/gfx/layers/ipc/SharedPlanarYCbCrImage.cpp
+++ b/gfx/layers/ipc/SharedPlanarYCbCrImage.cpp
@@ -86,17 +86,17 @@ SharedPlanarYCbCrImage::SetData(const Pl
     Data data = aData;
     if (!Allocate(data)) {
       NS_WARNING("SharedPlanarYCbCrImage::SetData failed to allocate");
       return;
     }
   }
 
   MOZ_ASSERT(mTextureClient->AsTextureClientYCbCr());
-  if (!mTextureClient->Lock(OpenMode::OPEN_WRITE_ONLY)) {
+  if (!mTextureClient->Lock(OPEN_WRITE_ONLY)) {
     MOZ_ASSERT(false, "Failed to lock the texture.");
     return;
   }
   TextureClientAutoUnlock unlock(mTextureClient);
   if (!mTextureClient->AsTextureClientYCbCr()->UpdateYCbCr(aData)) {
     MOZ_ASSERT(false, "Failed to copy YCbCr data into the TextureClient");
     return;
   }
--- a/gfx/layers/opengl/CompositorOGL.cpp
+++ b/gfx/layers/opengl/CompositorOGL.cpp
@@ -798,54 +798,54 @@ CompositorOGL::CreateFBOWithTexture(cons
 }
 
 ShaderConfigOGL
 CompositorOGL::GetShaderConfigFor(Effect *aEffect, MaskType aMask) const
 {
   ShaderConfigOGL config;
 
   switch(aEffect->mType) {
-  case EffectTypes::SOLID_COLOR:
+  case EFFECT_SOLID_COLOR:
     config.SetRenderColor(true);
     break;
-  case EffectTypes::YCBCR:
+  case EFFECT_YCBCR:
     config.SetYCbCr(true);
     break;
-  case EffectTypes::COMPONENT_ALPHA:
+  case EFFECT_COMPONENT_ALPHA:
   {
     config.SetComponentAlpha(true);
     EffectComponentAlpha* effectComponentAlpha =
       static_cast<EffectComponentAlpha*>(aEffect);
     gfx::SurfaceFormat format = effectComponentAlpha->mOnWhite->GetFormat();
     config.SetRBSwap(format == gfx::SurfaceFormat::B8G8R8A8 ||
                      format == gfx::SurfaceFormat::B8G8R8X8);
     break;
   }
-  case EffectTypes::RENDER_TARGET:
+  case EFFECT_RENDER_TARGET:
     config.SetTextureTarget(mFBOTextureTarget);
     break;
   default:
   {
-    MOZ_ASSERT(aEffect->mType == EffectTypes::RGB);
+    MOZ_ASSERT(aEffect->mType == EFFECT_RGB);
     TexturedEffect* texturedEffect =
         static_cast<TexturedEffect*>(aEffect);
     TextureSourceOGL* source = texturedEffect->mTexture->AsSourceOGL();
     MOZ_ASSERT_IF(source->GetTextureTarget() == LOCAL_GL_TEXTURE_EXTERNAL,
                   source->GetFormat() == gfx::SurfaceFormat::R8G8B8A8);
     MOZ_ASSERT_IF(source->GetTextureTarget() == LOCAL_GL_TEXTURE_RECTANGLE_ARB,
                   source->GetFormat() == gfx::SurfaceFormat::R8G8B8A8 ||
                   source->GetFormat() == gfx::SurfaceFormat::R8G8B8X8 ||
                   source->GetFormat() == gfx::SurfaceFormat::R5G6B5);
     config = ShaderConfigFromTargetAndFormat(source->GetTextureTarget(),
                                              source->GetFormat());
     break;
   }
   }
-  config.SetMask2D(aMask == MaskType::Mask2d);
-  config.SetMask3D(aMask == MaskType::Mask3d);
+  config.SetMask2D(aMask == Mask2d);
+  config.SetMask3D(aMask == Mask3d);
   return config;
 }
 
 ShaderProgramOGL*
 CompositorOGL::GetShaderProgramFor(const ShaderConfigOGL &aConfig)
 {
   std::map<ShaderConfigOGL, ShaderProgramOGL *>::iterator iter = mPrograms.find(aConfig);
   if (iter != mPrograms.end())
@@ -904,18 +904,18 @@ CompositorOGL::DrawQuadInternal(const Re
 
   LayerScope::SendEffectChain(mGLContext, aEffectChain,
                               aRect.width, aRect.height);
 
   MaskType maskType;
   EffectMask* effectMask;
   TextureSourceOGL* sourceMask = nullptr;
   gfx::Matrix4x4 maskQuadTransform;
-  if (aEffectChain.mSecondaryEffects[EffectTypes::MASK]) {
-    effectMask = static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EffectTypes::MASK].get());
+  if (aEffectChain.mSecondaryEffects[EFFECT_MASK]) {
+    effectMask = static_cast<EffectMask*>(aEffectChain.mSecondaryEffects[EFFECT_MASK].get());
     sourceMask = effectMask->mMaskTexture->AsSourceOGL();
 
     // NS_ASSERTION(textureMask->IsAlpha(),
     //              "OpenGL mask layers must be backed by alpha surfaces");
 
     // We're assuming that the gl backend won't cheat and use NPOT
     // textures when glContext says it can't (which seems to happen
     // on a mac when you force POT textures)
@@ -927,28 +927,28 @@ CompositorOGL::DrawQuadInternal(const Re
     bounds = maskTransform.As2D().TransformBounds(bounds);
 
     maskQuadTransform._11 = 1.0f/bounds.width;
     maskQuadTransform._22 = 1.0f/bounds.height;
     maskQuadTransform._41 = float(-bounds.x)/bounds.width;
     maskQuadTransform._42 = float(-bounds.y)/bounds.height;
 
     maskType = effectMask->mIs3D
-                 ? MaskType::Mask3d
-                 : MaskType::Mask2d;
+                 ? Mask3d
+                 : Mask2d;
   } else {
-    maskType = MaskType::MaskNone;
+    maskType = MaskNone;
   }
 
   mPixelsFilled += aRect.width * aRect.height;
 
   // Determine the color if this is a color shader and fold the opacity into
   // the color since color shaders don't have an opacity uniform.
   Color color;
-  if (aEffectChain.mPrimaryEffect->mType == EffectTypes::SOLID_COLOR) {
+  if (aEffectChain.mPrimaryEffect->mType == EFFECT_SOLID_COLOR) {
     EffectSolidColor* effectSolidColor =
       static_cast<EffectSolidColor*>(aEffectChain.mPrimaryEffect.get());
     color = effectSolidColor->mColor;
 
     Float opacity = aOpacity * color.a;
     color.r *= opacity;
     color.g *= opacity;
     color.b *= opacity;
@@ -973,28 +973,28 @@ CompositorOGL::DrawQuadInternal(const Re
     TexturedEffect* texturedEffect =
         static_cast<TexturedEffect*>(aEffectChain.mPrimaryEffect.get());
     TextureSourceOGL* source = texturedEffect->mTexture->AsSourceOGL();
     // This is used by IOSurface that use 0,0...w,h coordinate rather then 0,0..1,1.
     program->SetTexCoordMultiplier(source->GetSize().width, source->GetSize().height);
   }
 
   switch (aEffectChain.mPrimaryEffect->mType) {
-    case EffectTypes::SOLID_COLOR: {
+    case EFFECT_SOLID_COLOR: {
       program->SetRenderColor(color);
 
-      if (maskType != MaskType::MaskNone) {
+      if (maskType != MaskNone) {
         BindMaskForProgram(program, sourceMask, LOCAL_GL_TEXTURE0, maskQuadTransform);
       }
 
       BindAndDrawQuad(program, aDrawMode);
     }
     break;
 
-  case EffectTypes::RGB: {
+  case EFFECT_RGB: {
       TexturedEffect* texturedEffect =
           static_cast<TexturedEffect*>(aEffectChain.mPrimaryEffect.get());
       TextureSource *source = texturedEffect->mTexture;
 
       if (!texturedEffect->mPremultiplied) {
         mGLContext->fBlendFuncSeparate(LOCAL_GL_SRC_ALPHA, LOCAL_GL_ONE_MINUS_SRC_ALPHA,
                                        LOCAL_GL_ONE, LOCAL_GL_ONE);
       }
@@ -1014,30 +1014,30 @@ CompositorOGL::DrawQuadInternal(const Re
         // code should not be needed!
         filter = gfx::Filter::POINT;
       }
 #endif
       source->AsSourceOGL()->BindTexture(LOCAL_GL_TEXTURE0, filter);
 
       program->SetTextureUnit(0);
 
-      if (maskType != MaskType::MaskNone) {
+      if (maskType != MaskNone) {
         BindMaskForProgram(program, sourceMask, LOCAL_GL_TEXTURE1, maskQuadTransform);
       }
 
       BindAndDrawQuadWithTextureRect(program, textureTransform,
                                      texturedEffect->mTextureCoords, source);
 
       if (!texturedEffect->mPremultiplied) {
         mGLContext->fBlendFuncSeparate(LOCAL_GL_ONE, LOCAL_GL_ONE_MINUS_SRC_ALPHA,
                                        LOCAL_GL_ONE, LOCAL_GL_ONE);
       }
     }
     break;
-  case EffectTypes::YCBCR: {
+  case EFFECT_YCBCR: {
       EffectYCbCr* effectYCbCr =
         static_cast<EffectYCbCr*>(aEffectChain.mPrimaryEffect.get());
       TextureSource* sourceYCbCr = effectYCbCr->mTexture;
       const int Y = 0, Cb = 1, Cr = 2;
       TextureSourceOGL* sourceY =  sourceYCbCr->GetSubSource(Y)->AsSourceOGL();
       TextureSourceOGL* sourceCb = sourceYCbCr->GetSubSource(Cb)->AsSourceOGL();
       TextureSourceOGL* sourceCr = sourceYCbCr->GetSubSource(Cr)->AsSourceOGL();
 
@@ -1047,59 +1047,59 @@ CompositorOGL::DrawQuadInternal(const Re
       }
 
       sourceY->BindTexture(LOCAL_GL_TEXTURE0, effectYCbCr->mFilter);
       sourceCb->BindTexture(LOCAL_GL_TEXTURE1, effectYCbCr->mFilter);
       sourceCr->BindTexture(LOCAL_GL_TEXTURE2, effectYCbCr->mFilter);
 
       program->SetYCbCrTextureUnits(Y, Cb, Cr);
 
-      if (maskType != MaskType::MaskNone) {
+      if (maskType != MaskNone) {
         BindMaskForProgram(program, sourceMask, LOCAL_GL_TEXTURE3, maskQuadTransform);
       }
       BindAndDrawQuadWithTextureRect(program,
                                      gfx3DMatrix(),
                                      effectYCbCr->mTextureCoords,
                                      sourceYCbCr->GetSubSource(Y));
     }
     break;
-  case EffectTypes::RENDER_TARGET: {
+  case EFFECT_RENDER_TARGET: {
       EffectRenderTarget* effectRenderTarget =
         static_cast<EffectRenderTarget*>(aEffectChain.mPrimaryEffect.get());
       RefPtr<CompositingRenderTargetOGL> surface
         = static_cast<CompositingRenderTargetOGL*>(effectRenderTarget->mRenderTarget.get());
 
       surface->BindTexture(LOCAL_GL_TEXTURE0, mFBOTextureTarget);
 
       // Drawing is always flipped, but when copying between surfaces we want to avoid
       // this, so apply a flip here to cancel the other one out.
       Matrix transform;
       transform.Translate(0.0, 1.0);
       transform.Scale(1.0f, -1.0f);
       program->SetTextureTransform(Matrix4x4::From2D(transform));
       program->SetTextureUnit(0);
 
-      if (maskType != MaskType::MaskNone) {
+      if (maskType != MaskNone) {
         sourceMask->BindTexture(LOCAL_GL_TEXTURE1, gfx::Filter::LINEAR);
         program->SetMaskTextureUnit(1);
         program->SetMaskLayerTransform(maskQuadTransform);
       }
 
       if (config.mFeatures & ENABLE_TEXTURE_RECT) {
         // 2DRect case, get the multiplier right for a sampler2DRect
         program->SetTexCoordMultiplier(aRect.width, aRect.height);
       }
 
       // Drawing is always flipped, but when copying between surfaces we want to avoid
       // this. Pass true for the flip parameter to introduce a second flip
       // that cancels the other one out.
       BindAndDrawQuad(program);
     }
     break;
-  case EffectTypes::COMPONENT_ALPHA: {
+  case EFFECT_COMPONENT_ALPHA: {
       MOZ_ASSERT(gfxPrefs::ComponentAlphaEnabled());
       EffectComponentAlpha* effectComponentAlpha =
         static_cast<EffectComponentAlpha*>(aEffectChain.mPrimaryEffect.get());
       TextureSourceOGL* sourceOnWhite = effectComponentAlpha->mOnWhite->AsSourceOGL();
       TextureSourceOGL* sourceOnBlack = effectComponentAlpha->mOnBlack->AsSourceOGL();
 
       if (!sourceOnBlack->IsValid() ||
           !sourceOnWhite->IsValid()) {
@@ -1109,17 +1109,17 @@ CompositorOGL::DrawQuadInternal(const Re
 
       sourceOnBlack->BindTexture(LOCAL_GL_TEXTURE0, effectComponentAlpha->mFilter);
       sourceOnWhite->BindTexture(LOCAL_GL_TEXTURE1, effectComponentAlpha->mFilter);
 
       program->SetBlackTextureUnit(0);
       program->SetWhiteTextureUnit(1);
       program->SetTextureTransform(gfx::Matrix4x4());
 
-      if (maskType != MaskType::MaskNone) {
+      if (maskType != MaskNone) {
         BindMaskForProgram(program, sourceMask, LOCAL_GL_TEXTURE2, maskQuadTransform);
       }
       // Pass 1.
       gl()->fBlendFuncSeparate(LOCAL_GL_ZERO, LOCAL_GL_ONE_MINUS_SRC_COLOR,
                                LOCAL_GL_ONE, LOCAL_GL_ONE);
       program->SetTexturePass2(false);
       BindAndDrawQuadWithTextureRect(program,
                                      gfx3DMatrix(),
--- a/gfx/layers/opengl/CompositorOGL.h
+++ b/gfx/layers/opengl/CompositorOGL.h
@@ -15,17 +15,17 @@
 #include "mozilla/Attributes.h"         // for MOZ_OVERRIDE, MOZ_FINAL
 #include "mozilla/RefPtr.h"             // for TemporaryRef, RefPtr
 #include "mozilla/gfx/2D.h"             // for DrawTarget
 #include "mozilla/gfx/BaseSize.h"       // for BaseSize
 #include "mozilla/gfx/Point.h"          // for IntSize, Point
 #include "mozilla/gfx/Rect.h"           // for Rect, IntRect
 #include "mozilla/gfx/Types.h"          // for Float, SurfaceFormat, etc
 #include "mozilla/layers/Compositor.h"  // for SurfaceInitMode, Compositor, etc
-#include "mozilla/layers/CompositorTypes.h"  // for MaskType::MaskType::NumMaskTypes, etc
+#include "mozilla/layers/CompositorTypes.h"  // for MaskType::NumMaskTypes, etc
 #include "mozilla/layers/LayersTypes.h"
 #include "nsAutoPtr.h"                  // for nsRefPtr, nsAutoPtr
 #include "nsCOMPtr.h"                   // for already_AddRefed
 #include "nsDebug.h"                    // for NS_ASSERTION, NS_WARNING
 #include "nsISupportsImpl.h"            // for MOZ_COUNT_CTOR, etc
 #include "nsSize.h"                     // for nsIntSize
 #include "nsTArray.h"                   // for nsAutoTArray, nsTArray, etc
 #include "nsThreadUtils.h"              // for nsRunnable
@@ -163,17 +163,17 @@ class CompositorOGL : public Compositor
   std::map<ShaderConfigOGL, ShaderProgramOGL*> mPrograms;
 public:
   CompositorOGL(nsIWidget *aWidget, int aSurfaceWidth = -1, int aSurfaceHeight = -1,
                 bool aUseExternalSurfaceSize = false);
 
   virtual ~CompositorOGL();
 
   virtual TemporaryRef<DataTextureSource>
-  CreateDataTextureSource(TextureFlags aFlags = TextureFlags::NO_FLAGS) MOZ_OVERRIDE;
+  CreateDataTextureSource(TextureFlags aFlags = 0) MOZ_OVERRIDE;
 
   virtual bool Initialize() MOZ_OVERRIDE;
 
   virtual void Destroy() MOZ_OVERRIDE;
 
   virtual TextureFactoryIdentifier GetTextureFactoryIdentifier() MOZ_OVERRIDE
   {
     return TextureFactoryIdentifier(LayersBackend::LAYERS_OPENGL,
@@ -353,17 +353,17 @@ private:
    */
   virtual void BeginFrame(const nsIntRegion& aInvalidRegion,
                           const gfx::Rect *aClipRectIn,
                           const gfx::Matrix& aTransform,
                           const gfx::Rect& aRenderBounds,
                           gfx::Rect *aClipRectOut = nullptr,
                           gfx::Rect *aRenderBoundsOut = nullptr) MOZ_OVERRIDE;
 
-  ShaderConfigOGL GetShaderConfigFor(Effect *aEffect, MaskType aMask = MaskType::MaskNone) const;
+  ShaderConfigOGL GetShaderConfigFor(Effect *aEffect, MaskType aMask = MaskNone) const;
   ShaderProgramOGL* GetShaderProgramFor(const ShaderConfigOGL &aConfig);
 
   /**
    * Create a FBO backed by a texture.
    * Note that the texture target type will be
    * of the type returned by FBOTextureTarget; different
    * shaders are required to sample from the different
    * texture types.
--- a/gfx/layers/opengl/GrallocTextureClient.cpp
+++ b/gfx/layers/opengl/GrallocTextureClient.cpp
@@ -140,20 +140,20 @@ GrallocTextureClientOGL::Lock(OpenMode a
 
   if (mMappedBuffer) {
     return true;
   }
 
   WaitReleaseFence();
 
   uint32_t usage = 0;
-  if (aMode & OpenMode::OPEN_READ) {
+  if (aMode & OPEN_READ) {
     usage |= GRALLOC_USAGE_SW_READ_OFTEN;
   }
-  if (aMode & OpenMode::OPEN_WRITE) {
+  if (aMode & OPEN_WRITE) {
     usage |= GRALLOC_USAGE_SW_WRITE_OFTEN;
   }
   int32_t rv = mGraphicBuffer->lock(usage, reinterpret_cast<void**>(&mMappedBuffer));
   if (rv) {
     mMappedBuffer = nullptr;
     NS_WARNING("Couldn't lock graphic buffer");
     return false;
   }
@@ -229,24 +229,24 @@ GrallocTextureClientOGL::AllocateForSurf
                    android::GraphicBuffer::USAGE_HW_TEXTURE;
 
   switch (mFormat) {
   case gfx::SurfaceFormat::R8G8B8A8:
     format = android::PIXEL_FORMAT_RGBA_8888;
     break;
   case gfx::SurfaceFormat::B8G8R8A8:
      format = android::PIXEL_FORMAT_RGBA_8888;
-     mFlags |= TextureFlags::RB_SWAPPED;
+     mFlags |= TEXTURE_RB_SWAPPED;
     break;
   case gfx::SurfaceFormat::R8G8B8X8:
     format = android::PIXEL_FORMAT_RGBX_8888;
     break;
   case gfx::SurfaceFormat::B8G8R8X8:
      format = android::PIXEL_FORMAT_RGBX_8888;
-     mFlags |= TextureFlags::RB_SWAPPED;
+     mFlags |= TEXTURE_RB_SWAPPED;
     break;
   case gfx::SurfaceFormat::R5G6B5:
     format = android::PIXEL_FORMAT_RGB_565;
     break;
   case gfx::SurfaceFormat::A8:
     NS_WARNING("gralloc does not support gfx::SurfaceFormat::A8");
     return false;
   default:
--- a/gfx/layers/opengl/GrallocTextureClient.h
+++ b/gfx/layers/opengl/GrallocTextureClient.h
@@ -35,21 +35,21 @@ namespace layers {
  * This is only used in Firefox OS
  */
 class GrallocTextureClientOGL : public BufferTextureClient
 {
 public:
   GrallocTextureClientOGL(GrallocBufferActor* aActor,
                           gfx::IntSize aSize,
                           gfx::BackendType aMoz2dBackend,
-                          TextureFlags aFlags = TextureFlags::DEFAULT);
+                          TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
   GrallocTextureClientOGL(ISurfaceAllocator* aAllocator,
                           gfx::SurfaceFormat aFormat,
                           gfx::BackendType aMoz2dBackend,
-                          TextureFlags aFlags = TextureFlags::DEFAULT);
+                          TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT);
 
   ~GrallocTextureClientOGL();
 
   virtual bool Lock(OpenMode aMode) MOZ_OVERRIDE;
 
   virtual void Unlock() MOZ_OVERRIDE;
 
   virtual bool ImplementsLocking() const MOZ_OVERRIDE { return true; }
--- a/gfx/layers/opengl/GrallocTextureHost.cpp
+++ b/gfx/layers/opengl/GrallocTextureHost.cpp
@@ -14,19 +14,18 @@
 
 namespace mozilla {
 namespace layers {
 
 using namespace android;
 
 static gfx::SurfaceFormat
 SurfaceFormatForAndroidPixelFormat(android::PixelFormat aFormat,
-                                   TextureFlags aFlags)
+                                   bool swapRB = false)
 {
-  bool swapRB = bool(aFlags & TextureFlags::RB_SWAPPED);
   switch (aFormat) {
   case android::PIXEL_FORMAT_BGRA_8888:
     return swapRB ? gfx::SurfaceFormat::R8G8B8A8 : gfx::SurfaceFormat::B8G8R8A8;
   case android::PIXEL_FORMAT_RGBA_8888:
     return swapRB ? gfx::SurfaceFormat::B8G8R8A8 : gfx::SurfaceFormat::R8G8B8A8;
   case android::PIXEL_FORMAT_RGBX_8888:
     return swapRB ? gfx::SurfaceFormat::B8G8R8X8 : gfx::SurfaceFormat::R8G8B8X8;
   case android::PIXEL_FORMAT_RGB_565:
@@ -286,17 +285,17 @@ GrallocTextureHostOGL::GrallocTextureHos
   if (mGrallocActor) {
     mGrallocActor->AddTextureHost(this);
     graphicBuffer = mGrallocActor->GetGraphicBuffer();
   }
 
   if (graphicBuffer) {
     format =
       SurfaceFormatForAndroidPixelFormat(graphicBuffer->getPixelFormat(),
-                                         aFlags);
+                                         aFlags & TEXTURE_RB_SWAPPED);
   }
   mTextureSource = new GrallocTextureSourceOGL(nullptr,
                                                graphicBuffer,
                                                format);
 }
 
 GrallocTextureHostOGL::~GrallocTextureHostOGL()
 {
@@ -365,22 +364,22 @@ GrallocTextureHostOGL::DeallocateDeviceD
 {
   mTextureSource->DeallocateDeviceData();
 }
 
 LayerRenderState
 GrallocTextureHostOGL::GetRenderState()
 {
   if (IsValid()) {
-    LayerRenderStateFlags flags = LayerRenderStateFlags::LAYER_RENDER_STATE_DEFAULT;
-    if (mFlags & TextureFlags::NEEDS_Y_FLIP) {
-      flags |= LayerRenderStateFlags::Y_FLIPPED;
+    uint32_t flags = 0;
+    if (mFlags & TEXTURE_NEEDS_Y_FLIP) {
+      flags |= LAYER_RENDER_STATE_Y_FLIPPED;
     }
-    if (mFlags & TextureFlags::RB_SWAPPED) {
-      flags |= LayerRenderStateFlags::FORMAT_RB_SWAP;
+    if (mFlags & TEXTURE_RB_SWAPPED) {
+      flags |= LAYER_RENDER_STATE_FORMAT_RB_SWAP;
     }
     return LayerRenderState(mTextureSource->mGraphicBuffer.get(),
                             gfx::ThebesIntSize(mSize),
                             flags,
                             this);
   }
 
   return LayerRenderState();
--- a/gfx/layers/opengl/TextureClientOGL.cpp
+++ b/gfx/layers/opengl/TextureClientOGL.cpp
@@ -18,17 +18,17 @@ namespace layers {
 class CompositableForwarder;
 
 SharedTextureClientOGL::SharedTextureClientOGL(TextureFlags aFlags)
   : TextureClient(aFlags)
   , mHandle(0)
   , mInverted(false)
 {
   // SharedTextureClient is always owned externally.
-  mFlags |= TextureFlags::DEALLOCATE_CLIENT;
+  mFlags |= TEXTURE_DEALLOCATE_CLIENT;
 }
 
 SharedTextureClientOGL::~SharedTextureClientOGL()
 {
   // the shared data is owned externally.
 }
 
 
@@ -51,17 +51,17 @@ SharedTextureClientOGL::InitWith(gl::Sha
 {
   MOZ_ASSERT(IsValid());
   MOZ_ASSERT(!IsAllocated());
   mHandle = aHandle;
   mSize = aSize;
   mShareType = aShareType;
   mInverted = aInverted;
   if (mInverted) {
-    AddFlags(TextureFlags::NEEDS_Y_FLIP);
+    AddFlags(TEXTURE_NEEDS_Y_FLIP);
   }
 }
 
 bool
 SharedTextureClientOGL::Lock(OpenMode mode)
 {
   MOZ_ASSERT(!mIsLocked);
   if (!IsValid() || !IsAllocated()) {
--- a/gfx/layers/opengl/TextureHostOGL.cpp
+++ b/gfx/layers/opengl/TextureHostOGL.cpp
@@ -101,30 +101,30 @@ CreateTextureHostOGL(const SurfaceDescri
   return result.forget();
 }
 
 static gl::TextureImage::Flags
 FlagsToGLFlags(TextureFlags aFlags)
 {
   uint32_t result = TextureImage::NoFlags;
 
-  if (aFlags & TextureFlags::USE_NEAREST_FILTER)
+  if (aFlags & TEXTURE_USE_NEAREST_FILTER)
     result |= TextureImage::UseNearestFilter;
-  if (aFlags & TextureFlags::NEEDS_Y_FLIP)
+  if (aFlags & TEXTURE_NEEDS_Y_FLIP)
     result |= TextureImage::NeedsYFlip;
-  if (aFlags & TextureFlags::DISALLOW_BIGIMAGE)
+  if (aFlags & TEXTURE_DISALLOW_BIGIMAGE)
     result |= TextureImage::DisallowBigImage;
 
   return static_cast<gl::TextureImage::Flags>(result);
 }
 
-static GLenum
-WrapMode(gl::GLContext *aGl, TextureFlags aFlags)
+GLenum
+WrapMode(gl::GLContext *aGl, bool aAllowRepeat)
 {
-  if ((aFlags & TextureFlags::ALLOW_REPEAT) &&
+  if (aAllowRepeat &&
       (aGl->IsExtensionSupported(GLContext::ARB_texture_non_power_of_two) ||
        aGl->IsExtensionSupported(GLContext::OES_texture_npot))) {
     return LOCAL_GL_REPEAT;
   }
   return LOCAL_GL_CLAMP_TO_EDGE;
 }
 
 CompositableDataGonkOGL::CompositableDataGonkOGL()
@@ -224,31 +224,31 @@ TextureImageTextureSourceOGL::Update(gfx
     return false;
   }
   MOZ_ASSERT(aSurface);
 
   IntSize size = aSurface->GetSize();
   if (!mTexImage ||
       (mTexImage->GetSize() != size && !aSrcOffset) ||
       mTexImage->GetContentType() != gfx::ContentForFormat(aSurface->GetFormat())) {
-    if (mFlags & TextureFlags::DISALLOW_BIGIMAGE) {
+    if (mFlags & TEXTURE_DISALLOW_BIGIMAGE) {
       mTexImage = CreateBasicTextureImage(mGL, size,
                                           gfx::ContentForFormat(aSurface->GetFormat()),
-                                          WrapMode(mGL, mFlags),
+                                          WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
                                           FlagsToGLFlags(mFlags),
                                           SurfaceFormatToImageFormat(aSurface->GetFormat()));
     } else {
       // XXX - clarify which size we want to use. IncrementalContentHost will
       // require the size of the destination surface to be different from
       // the size of aSurface.
       // See bug 893300 (tracks the implementation of ContentHost for new textures).
       mTexImage = CreateTextureImage(mGL,
                                      size,
                                      gfx::ContentForFormat(aSurface->GetFormat()),
-                                     WrapMode(mGL, mFlags),
+                                     WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
                                      FlagsToGLFlags(mFlags),
                                      SurfaceFormatToImageFormat(aSurface->GetFormat()));
     }
     ClearCachedFilter();
   }
 
   mTexImage->UpdateFromDataSource(aSurface, aDestRegion, aSrcOffset);
 
@@ -263,17 +263,17 @@ TextureImageTextureSourceOGL::EnsureBuff
                                            gfxContentType aContentType)
 {
   if (!mTexImage ||
       mTexImage->GetSize() != aSize.ToIntSize() ||
       mTexImage->GetContentType() != aContentType) {
     mTexImage = CreateTextureImage(mGL,
                                    aSize.ToIntSize(),
                                    aContentType,
-                                   WrapMode(mGL, mFlags),
+                                   WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
                                    FlagsToGLFlags(mFlags));
   }
   mTexImage->Resize(aSize.ToIntSize());
 }
 
 void
 TextureImageTextureSourceOGL::CopyTo(const nsIntRect& aSourceRect,
                                      DataTextureSource *aDest,
--- a/gfx/layers/opengl/TextureHostOGL.h
+++ b/gfx/layers/opengl/TextureHostOGL.h
@@ -191,17 +191,17 @@ protected:
  * GL texture(s).
  */
 class TextureImageTextureSourceOGL : public DataTextureSource
                                    , public TextureSourceOGL
                                    , public TileIterator
 {
 public:
   TextureImageTextureSourceOGL(gl::GLContext* aGL,
-                               TextureFlags aFlags = TextureFlags::DEFAULT)
+                               TextureFlags aFlags = TEXTURE_FLAGS_DEFAULT)
     : mGL(aGL)
     , mFlags(aFlags)
     , mIterating(false)
   {}
 
   // DataTextureSource
 
   virtual bool Update(gfx::DataSourceSurface* aSurface,
--- a/gfx/tests/gtest/TestTextures.cpp
+++ b/gfx/tests/gtest/TestTextures.cpp
@@ -146,17 +146,17 @@ void AssertYCbCrSurfacesEqual(PlanarYCbC
 // Run the test for a texture client and a surface
 void TestTextureClientSurface(TextureClient* texture, gfxImageSurface* surface) {
 
   // client allocation
   ASSERT_TRUE(texture->CanExposeDrawTarget());
   texture->AllocateForSurface(ToIntSize(surface->GetSize()));
   ASSERT_TRUE(texture->IsAllocated());
 
-  ASSERT_TRUE(texture->Lock(OpenMode::OPEN_READ_WRITE));
+  ASSERT_TRUE(texture->Lock(OPEN_READ_WRITE));
   // client painting
   RefPtr<DrawTarget> dt = texture->GetAsDrawTarget();
   RefPtr<SourceSurface> source =
     gfxPlatform::GetPlatform()->GetSourceSurfaceForSurface(dt, surface);
   dt->CopySurface(source, IntRect(IntPoint(), source->GetSize()), IntPoint());
 
   RefPtr<SourceSurface> snapshot = dt->Snapshot();
 
@@ -197,17 +197,17 @@ void TestTextureClientYCbCr(TextureClien
   // client allocation
   ASSERT_TRUE(client->AsTextureClientYCbCr() != nullptr);
   TextureClientYCbCr* texture = client->AsTextureClientYCbCr();
   texture->AllocateForYCbCr(ycbcrData.mYSize,
                             ycbcrData.mCbCrSize,
                             ycbcrData.mStereoMode);
   ASSERT_TRUE(client->IsAllocated());
 
-  ASSERT_TRUE(client->Lock(OpenMode::OPEN_READ_WRITE));
+  ASSERT_TRUE(client->Lock(OPEN_READ_WRITE));
   // client painting
   texture->UpdateYCbCr(ycbcrData);
   client->Unlock();
 
   // client serialization
   SurfaceDescriptor descriptor;
   ASSERT_TRUE(client->ToSurfaceDescriptor(descriptor));
 
@@ -265,17 +265,17 @@ TEST(Layers, TextureSerialization) {
     RefPtr<gfxImageSurface> surface = new gfxImageSurface(gfxIntSize(400,300), formats[f]);
     SetupSurface(surface.get());
     AssertSurfacesEqual(surface, surface);
 
     RefPtr<TextureClient> client
       = new MemoryTextureClient(nullptr,
                                 mozilla::gfx::ImageFormatToSurfaceFormat(surface->Format()),
                                 gfx::BackendType::CAIRO,
-                                TextureFlags::DEALLOCATE_CLIENT);
+                                TEXTURE_DEALLOCATE_CLIENT);
 
     TestTextureClientSurface(client, surface);
 
     // XXX - Test more texture client types.
   }
 }
 
 TEST(Layers, TextureYCbCrSerialization) {
@@ -302,14 +302,14 @@ TEST(Layers, TextureYCbCrSerialization) 
   clientData.mCrSkip = 0;
   clientData.mPicX = 0;
   clientData.mPicX = 0;
 
   RefPtr<TextureClient> client
     = new MemoryTextureClient(nullptr,
                               mozilla::gfx::SurfaceFormat::YUV,
                               gfx::BackendType::CAIRO,
-                              TextureFlags::DEALLOCATE_CLIENT);
+                              TEXTURE_DEALLOCATE_CLIENT);
 
   TestTextureClientYCbCr(client, clientData);
 
   // XXX - Test more texture client types.
 }
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -1391,28 +1391,28 @@ gfxPlatform::IsLangCJK(eFontPrefLang aLa
         default:
             return false;
     }
 }
 
 mozilla::layers::DiagnosticTypes
 gfxPlatform::GetLayerDiagnosticTypes()
 {
-  mozilla::layers::DiagnosticTypes type = DiagnosticTypes::NO_DIAGNOSTIC;
+  mozilla::layers::DiagnosticTypes type = DIAGNOSTIC_NONE;
   if (gfxPrefs::DrawLayerBorders()) {
-    type |= mozilla::layers::DiagnosticTypes::LAYER_BORDERS;
+    type |= mozilla::layers::DIAGNOSTIC_LAYER_BORDERS;
   }
   if (gfxPrefs::DrawTileBorders()) {
-    type |= mozilla::layers::DiagnosticTypes::TILE_BORDERS;
+    type |= mozilla::layers::DIAGNOSTIC_TILE_BORDERS;
   }
   if (gfxPrefs::DrawBigImageBorders()) {
-    type |= mozilla::layers::DiagnosticTypes::BIGIMAGE_BORDERS;
+    type |= mozilla::layers::DIAGNOSTIC_BIGIMAGE_BORDERS;
   }
   if (gfxPrefs::FlashLayerBorders()) {
-    type |= mozilla::layers::DiagnosticTypes::FLASH_BORDERS;
+    type |= mozilla::layers::DIAGNOSTIC_FLASH_BORDERS;
   }
   return type;
 }
 
 void
 gfxPlatform::GetLangPrefs(eFontPrefLang aPrefLangs[], uint32_t &aLen, eFontPrefLang aCharLang, eFontPrefLang aPageLang)
 {
     if (IsLangCJK(aCharLang)) {
--- a/mfbt/TypedEnum.h
+++ b/mfbt/TypedEnum.h
@@ -4,21 +4,50 @@
  * 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/. */
 
 /* Macros to emulate C++11 typed enums and enum classes. */
 
 #ifndef mozilla_TypedEnum_h
 #define mozilla_TypedEnum_h
 
-#include "mozilla/TypedEnumInternal.h"
+#include "mozilla/Attributes.h"
 #include "mozilla/MacroArgs.h"
 
 #if defined(__cplusplus)
 
+#if defined(__clang__)
+   /*
+    * Per Clang documentation, "Note that marketing version numbers should not
+    * be used to check for language features, as different vendors use different
+    * numbering schemes. Instead, use the feature checking macros."
+    */
+#  ifndef __has_extension
+#    define __has_extension __has_feature /* compatibility, for older versions of clang */
+#  endif
+#  if __has_extension(cxx_strong_enums)
+#    define MOZ_HAVE_CXX11_ENUM_TYPE
+#    define MOZ_HAVE_CXX11_STRONG_ENUMS
+#  endif
+#elif defined(__GNUC__)
+#  if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
+#    if MOZ_GCC_VERSION_AT_LEAST(4, 6, 3)
+#      define MOZ_HAVE_CXX11_ENUM_TYPE
+#      define MOZ_HAVE_CXX11_STRONG_ENUMS
+#    endif
+#  endif
+#elif defined(_MSC_VER)
+#  if _MSC_VER >= 1400
+#    define MOZ_HAVE_CXX11_ENUM_TYPE
+#  endif
+#  if _MSC_VER >= 1700
+#    define MOZ_HAVE_CXX11_STRONG_ENUMS
+#  endif
+#endif
+
 /**
  * MOZ_ENUM_TYPE specifies the underlying numeric type for an enum.  It's
  * specified by placing MOZ_ENUM_TYPE(type) immediately after the enum name in
  * its declaration, and before the opening curly brace, like
  *
  *   enum MyEnum MOZ_ENUM_TYPE(uint16_t)
  *   {
  *     A,
@@ -156,23 +185,19 @@
      class Name \
      { \
        public: \
          enum Enum MOZ_ENUM_TYPE(type) \
          {
 #  define MOZ_END_NESTED_ENUM_CLASS(Name) \
          }; \
          Name() {} \
-         MOZ_CONSTEXPR Name(Enum aEnum) : mEnum(aEnum) {} \
-         template<typename Other> \
-         explicit MOZ_CONSTEXPR Name(Other num) : mEnum((Enum)num) {} \
-         MOZ_CONSTEXPR operator Enum() const { return mEnum; } \
-         explicit MOZ_CONSTEXPR Name(const mozilla::CastableTypedEnumResult<Name>& aOther) \
-           : mEnum(aOther.get()) \
-         {} \
+         Name(Enum aEnum) : mEnum(aEnum) {} \
+         explicit Name(int num) : mEnum((Enum)num) {} \
+         operator Enum() const { return mEnum; } \
        private: \
          Enum mEnum; \
      };
 #  define MOZ_FINISH_NESTED_ENUM_CLASS(Name) \
      inline int operator+(const int&, const Name::Enum&) MOZ_DELETE; \
      inline int operator+(const Name::Enum&, const int&) MOZ_DELETE; \
      inline int operator-(const int&, const Name::Enum&) MOZ_DELETE; \
      inline int operator-(const Name::Enum&, const int&) MOZ_DELETE; \
@@ -200,16 +225,17 @@
      inline bool operator>=(const Name::Enum&, const int&) MOZ_DELETE; \
      inline bool operator<=(const int&, const Name::Enum&) MOZ_DELETE; \
      inline bool operator<=(const Name::Enum&, const int&) MOZ_DELETE; \
      inline bool operator!(const Name::Enum&) MOZ_DELETE; \
      inline bool operator&&(const bool&, const Name::Enum&) MOZ_DELETE; \
      inline bool operator&&(const Name::Enum&, const bool&) MOZ_DELETE; \
      inline bool operator||(const bool&, const Name::Enum&) MOZ_DELETE; \
      inline bool operator||(const Name::Enum&, const bool&) MOZ_DELETE; \
+     inline int operator~(const Name::Enum&) MOZ_DELETE; \
      inline int operator&(const int&, const Name::Enum&) MOZ_DELETE; \
      inline int operator&(const Name::Enum&, const int&) MOZ_DELETE; \
      inline int operator|(const int&, const Name::Enum&) MOZ_DELETE; \
      inline int operator|(const Name::Enum&, const int&) MOZ_DELETE; \
      inline int operator^(const int&, const Name::Enum&) MOZ_DELETE; \
      inline int operator^(const Name::Enum&, const int&) MOZ_DELETE; \
      inline int operator<<(const int&, const Name::Enum&) MOZ_DELETE; \
      inline int operator<<(const Name::Enum&, const int&) MOZ_DELETE; \
deleted file mode 100644
--- a/mfbt/TypedEnumBits.h
+++ /dev/null
@@ -1,182 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/. */
-
-/* MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS allows using a typed enum as bit flags. */
-
-#ifndef mozilla_TypedEnumBits_h
-#define mozilla_TypedEnumBits_h
-
-#include "mozilla/IntegerTypeTraits.h"
-#include "mozilla/TypedEnumInternal.h"
-
-namespace mozilla {
-
-#define MOZ_CASTABLETYPEDENUMRESULT_BINOP(Op, OtherType, ReturnType) \
-template<typename E> \
-MOZ_CONSTEXPR ReturnType \
-operator Op(const OtherType& e, const CastableTypedEnumResult<E>& r) \
-{ \
-  return ReturnType(e Op OtherType(r)); \
-} \
-template<typename E> \
-MOZ_CONSTEXPR ReturnType \
-operator Op(const CastableTypedEnumResult<E>& r, const OtherType& e) \
-{ \
-  return ReturnType(OtherType(r) Op e); \
-} \
-template<typename E> \
-MOZ_CONSTEXPR ReturnType \
-operator Op(const CastableTypedEnumResult<E>& r1, \
-            const CastableTypedEnumResult<E>& r2) \
-{ \
-  return ReturnType(OtherType(r1) Op OtherType(r2)); \
-}
-
-MOZ_CASTABLETYPEDENUMRESULT_BINOP(|, E, CastableTypedEnumResult<E>)
-MOZ_CASTABLETYPEDENUMRESULT_BINOP(&, E, CastableTypedEnumResult<E>)
-MOZ_CASTABLETYPEDENUMRESULT_BINOP(^, E, CastableTypedEnumResult<E>)
-MOZ_CASTABLETYPEDENUMRESULT_BINOP(==, E, bool)
-MOZ_CASTABLETYPEDENUMRESULT_BINOP(!=, E, bool)
-MOZ_CASTABLETYPEDENUMRESULT_BINOP(||, bool, bool)
-MOZ_CASTABLETYPEDENUMRESULT_BINOP(&&, bool, bool)
-
-template <typename E>
-MOZ_CONSTEXPR CastableTypedEnumResult<E>
-operator ~(const CastableTypedEnumResult<E>& r)
-{
-  return CastableTypedEnumResult<E>(~(E(r)));
-}
-
-#define MOZ_CASTABLETYPEDENUMRESULT_COMPOUND_ASSIGN_OP(Op) \
-template<typename E> \
-E& \
-operator Op(E& r1, \
-            const CastableTypedEnumResult<E>& r2) \
-{ \
-  return r1 Op E(r2); \
-}
-
-MOZ_CASTABLETYPEDENUMRESULT_COMPOUND_ASSIGN_OP(&=)
-MOZ_CASTABLETYPEDENUMRESULT_COMPOUND_ASSIGN_OP(|=)
-MOZ_CASTABLETYPEDENUMRESULT_COMPOUND_ASSIGN_OP(^=)
-
-#undef MOZ_CASTABLETYPEDENUMRESULT_COMPOUND_ASSIGN_OP
-
-#undef MOZ_CASTABLETYPEDENUMRESULT_BINOP
-
-#ifndef MOZ_HAVE_CXX11_STRONG_ENUMS
-
-#define MOZ_CASTABLETYPEDENUMRESULT_BINOP_EXTRA_NON_CXX11(Op, ReturnType) \
-template<typename E> \
-MOZ_CONSTEXPR ReturnType \
-operator Op(typename E::Enum e, const CastableTypedEnumResult<E>& r) \
-{ \
-  return ReturnType(e Op E(r)); \
-} \
-template<typename E> \
-MOZ_CONSTEXPR ReturnType \
-operator Op(const CastableTypedEnumResult<E>& r, typename E::Enum e) \
-{ \
-  return ReturnType(E(r) Op e); \
-}
-
-MOZ_CASTABLETYPEDENUMRESULT_BINOP_EXTRA_NON_CXX11(|, CastableTypedEnumResult<E>)
-MOZ_CASTABLETYPEDENUMRESULT_BINOP_EXTRA_NON_CXX11(&, CastableTypedEnumResult<E>)
-MOZ_CASTABLETYPEDENUMRESULT_BINOP_EXTRA_NON_CXX11(^, CastableTypedEnumResult<E>)
-MOZ_CASTABLETYPEDENUMRESULT_BINOP_EXTRA_NON_CXX11(==, bool)
-MOZ_CASTABLETYPEDENUMRESULT_BINOP_EXTRA_NON_CXX11(!=, bool)
-
-#undef MOZ_CASTABLETYPEDENUMRESULT_BINOP_EXTRA_NON_CXX11
-
-#endif // not MOZ_HAVE_CXX11_STRONG_ENUMS
-
-namespace detail {
-template<typename E>
-struct UnsignedIntegerTypeForEnum
-  : UnsignedStdintTypeForSize<sizeof(E)>
-{};
-}
-
-} // namespace mozilla
-
-#define MOZ_MAKE_ENUM_CLASS_BINOP_IMPL(Name, Op) \
-   inline MOZ_CONSTEXPR mozilla::CastableTypedEnumResult<Name> \
-   operator Op(Name a, Name b) \
-   { \
-     typedef mozilla::CastableTypedEnumResult<Name> Result; \
-     typedef mozilla::detail::UnsignedIntegerTypeForEnum<Name>::Type U; \
-     return Result(Name(U(a) Op U(b))); \
-   } \
- \
-   inline Name& \
-   operator Op##=(Name& a, Name b) \
-   { \
-     return a = a Op b; \
-   }
-
-#define MOZ_MAKE_ENUM_CLASS_OPS_IMPL(Name) \
-   MOZ_MAKE_ENUM_CLASS_BINOP_IMPL(Name, |) \
-   MOZ_MAKE_ENUM_CLASS_BINOP_IMPL(Name, &) \
-   MOZ_MAKE_ENUM_CLASS_BINOP_IMPL(Name, ^) \
-   inline MOZ_CONSTEXPR mozilla::CastableTypedEnumResult<Name> \
-   operator~(Name a) \
-   { \
-     typedef mozilla::CastableTypedEnumResult<Name> Result; \
-     typedef mozilla::detail::UnsignedIntegerTypeForEnum<Name>::Type U; \
-     return Result(Name(~(U(a)))); \
-   }
-
-#ifndef MOZ_HAVE_CXX11_STRONG_ENUMS
-#  define MOZ_MAKE_ENUM_CLASS_BITWISE_BINOP_EXTRA_NON_CXX11(Name, Op) \
-     inline MOZ_CONSTEXPR mozilla::CastableTypedEnumResult<Name> \
-     operator Op(Name a, Name::Enum b) \
-     { \
-       return a Op Name(b); \
-     } \
- \
-     inline MOZ_CONSTEXPR mozilla::CastableTypedEnumResult<Name> \
-     operator Op(Name::Enum a, Name b) \
-     { \
-       return Name(a) Op b; \
-     } \
- \
-     inline MOZ_CONSTEXPR mozilla::CastableTypedEnumResult<Name> \
-     operator Op(Name::Enum a, Name::Enum b) \
-     { \
-       return Name(a) Op Name(b); \
-     } \
- \
-     inline Name& \
-     operator Op##=(Name& a, Name::Enum b) \
-     { \
-       return a = a Op Name(b); \
-    }
-
-#  define MOZ_MAKE_ENUM_CLASS_OPS_EXTRA_NON_CXX11(Name) \
-     MOZ_MAKE_ENUM_CLASS_BITWISE_BINOP_EXTRA_NON_CXX11(Name, |) \
-     MOZ_MAKE_ENUM_CLASS_BITWISE_BINOP_EXTRA_NON_CXX11(Name, &) \
-     MOZ_MAKE_ENUM_CLASS_BITWISE_BINOP_EXTRA_NON_CXX11(Name, ^) \
-     inline MOZ_CONSTEXPR mozilla::CastableTypedEnumResult<Name> \
-     operator~(Name::Enum a) \
-     { \
-       return ~(Name(a)); \
-     }
-#endif
-
-/**
- * MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS generates standard bitwise operators
- * for the given enum type. Use this to enable using an enum type as bit-field.
- */
-#ifdef MOZ_HAVE_CXX11_STRONG_ENUMS
-#  define MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Name) \
-     MOZ_MAKE_ENUM_CLASS_OPS_IMPL(Name)
-#else
-#  define MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Name) \
-     MOZ_MAKE_ENUM_CLASS_OPS_IMPL(Name) \
-     MOZ_MAKE_ENUM_CLASS_OPS_EXTRA_NON_CXX11(Name)
-#endif
-
-#endif // mozilla_TypedEnumBits_h
deleted file mode 100644
--- a/mfbt/TypedEnumInternal.h
+++ /dev/null
@@ -1,112 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/. */
-
-/* Internal stuff needed by TypedEnum.h and TypedEnumBits.h. */
-
-// NOTE: When we can assume C++11 enum class support and TypedEnum.h goes away,
-// we should then consider folding TypedEnumInternal.h into TypedEnumBits.h.
-
-#ifndef mozilla_TypedEnumInternal_h
-#define mozilla_TypedEnumInternal_h
-
-#include "mozilla/Attributes.h"
-
-#if defined(__cplusplus)
-
-#if defined(__clang__)
-   /*
-    * Per Clang documentation, "Note that marketing version numbers should not
-    * be used to check for language features, as different vendors use different
-    * numbering schemes. Instead, use the feature checking macros."
-    */
-#  ifndef __has_extension
-#    define __has_extension __has_feature /* compatibility, for older versions of clang */
-#  endif
-#  if __has_extension(cxx_strong_enums)
-#    define MOZ_HAVE_CXX11_ENUM_TYPE
-#    define MOZ_HAVE_CXX11_STRONG_ENUMS
-#  endif
-#elif defined(__GNUC__)
-#  if defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L
-#    if MOZ_GCC_VERSION_AT_LEAST(4, 6, 3)
-#      define MOZ_HAVE_CXX11_ENUM_TYPE
-#      define MOZ_HAVE_CXX11_STRONG_ENUMS
-#    endif
-#  endif
-#elif defined(_MSC_VER)
-#  if _MSC_VER >= 1400
-#    define MOZ_HAVE_CXX11_ENUM_TYPE
-#  endif
-#  if _MSC_VER >= 1700
-#    define MOZ_HAVE_CXX11_STRONG_ENUMS
-#  endif
-#endif
-
-namespace mozilla {
-
-/*
- * The problem that CastableTypedEnumResult aims to solve is that
- * typed enums are not convertible to bool, and there is no way to make them
- * be, yet user code wants to be able to write
- *
- *   if (myFlags & Flags::SOME_PARTICULAR_FLAG)              (1)
- *
- * There are different approaches to solving this. Most of them require
- * adapting user code. For example, we could implement operator! and have
- * the user write
- *
- *   if (!!(myFlags & Flags::SOME_PARTICULAR_FLAG))          (2)
- *
- * Or we could supply a IsNonZero() or Any() function returning whether
- * an enum value is nonzero, and have the user write
- *
- *   if (Any(Flags & Flags::SOME_PARTICULAR_FLAG))           (3)
- *
- * But instead, we choose to preserve the original user syntax (1) as it
- * is inherently more readable, and to ease porting existing code to typed
- * enums. We achieve this by having operator& and other binary bitwise
- * operators have as return type a class, CastableTypedEnumResult,
- * that wraps a typed enum but adds bool convertibility.
- */
-template<typename E>
-class CastableTypedEnumResult
-{
-  private:
-    const E mValue;
-
-  public:
-    explicit MOZ_CONSTEXPR CastableTypedEnumResult(E value)
-      : mValue(value)
-    {}
-
-    MOZ_CONSTEXPR operator E() const { return mValue; }
-
-    template<typename DestinationType>
-    MOZ_EXPLICIT_CONVERSION MOZ_CONSTEXPR
-    operator DestinationType() const {
-      return DestinationType(mValue);
-    }
-
-    MOZ_CONSTEXPR bool operator !() const { return !bool(mValue); }
-
-#ifndef MOZ_HAVE_CXX11_STRONG_ENUMS
-    // This get() method is used to implement a constructor in the
-    // non-c++11 fallback path for MOZ_BEGIN_ENUM_CLASS, taking a
-    // CastableTypedEnumResult. If we try to implement it using the
-    // above conversion operator E(), then at least clang 3.3
-    // (when forced to take the non-c++11 fallback path) compiles
-    // this constructor to an infinite recursion. So we introduce this
-    // get() method, that does exactly the same as the conversion operator,
-    // to work around this.
-    MOZ_CONSTEXPR E get() const { return mValue; }
-#endif
-};
-
-} // namespace mozilla
-
-#endif // __cplusplus
-
-#endif // mozilla_TypedEnumInternal_h
--- a/mfbt/moz.build
+++ b/mfbt/moz.build
@@ -56,18 +56,16 @@ EXPORTS.mozilla = [
     'RefPtr.h',
     'RollingMean.h',
     'Scoped.h',
     'SHA1.h',
     'SplayTree.h',
     'TemplateLib.h',
     'ThreadLocal.h',
     'TypedEnum.h',
-    'TypedEnumBits.h',
-    'TypedEnumInternal.h',
     'Types.h',
     'TypeTraits.h',
     'Vector.h',
     'WeakPtr.h',
 ]
 
 if CONFIG['OS_ARCH'] == 'WINNT':
     EXPORTS.mozilla += [
--- a/mfbt/tests/TestTypedEnum.cpp
+++ b/mfbt/tests/TestTypedEnum.cpp
@@ -1,568 +1,40 @@
 /* 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 "mozilla/Assertions.h"
 #include "mozilla/TypedEnum.h"
-#include "mozilla/TypedEnumBits.h"
-
-#include <stdint.h>
-
-// A rough feature check for is_literal_type. Not very carefully checked.
-// Feel free to amend as needed.
-// We leave ANDROID out because it's using stlport which doesn't have std::is_literal_type.
-#if __cplusplus >= 201103L && !defined(ANDROID)
-#  if defined(__clang__)
-     /*
-      * Per Clang documentation, "Note that marketing version numbers should not
-      * be used to check for language features, as different vendors use different
-      * numbering schemes. Instead, use the feature checking macros."
-      */
-#    ifndef __has_extension
-#      define __has_extension __has_feature /* compatibility, for older versions of clang */
-#    endif
-#    if __has_extension(is_literal) && __has_include(<type_traits>)
-#      define MOZ_HAVE_IS_LITERAL
-#    endif
-#  elif defined(__GNUC__)
-#    if defined(__GXX_EXPERIMENTAL_CXX0X__)
-#      if MOZ_GCC_VERSION_AT_LEAST(4, 6, 0)
-#        define MOZ_HAVE_IS_LITERAL
-#      endif
-#    endif
-#  elif defined(_MSC_VER)
-#    if _MSC_VER >= 1700
-#      define MOZ_HAVE_IS_LITERAL
-#    endif
-#  endif
-#endif
-
-#ifdef MOZ_HAVE_IS_LITERAL
-#include <type_traits>
-template<typename T>
-void
-RequireLiteralType()
-{
-  static_assert(std::is_literal_type<T>::value, "Expected a literal type");
-}
-#else // not MOZ_HAVE_IS_LITERAL
-template<typename T>
-void
-RequireLiteralType()
-{
-}
-#endif
-
-template<typename T>
-void
-RequireLiteralType(const T&)
-{
-  RequireLiteralType<T>();
-}
 
 MOZ_BEGIN_ENUM_CLASS(AutoEnum)
   A,
-  B = -3,
-  C
+  B
 MOZ_END_ENUM_CLASS(AutoEnum)
 
+
 MOZ_BEGIN_ENUM_CLASS(CharEnum, char)
   A,
-  B = 3,
-  C
+  B
 MOZ_END_ENUM_CLASS(CharEnum)
 
-MOZ_BEGIN_ENUM_CLASS(AutoEnumBitField)
-  A = 0x10,
-  B = 0x20,
-  C
-MOZ_END_ENUM_CLASS(AutoEnumBitField)
-
-MOZ_BEGIN_ENUM_CLASS(CharEnumBitField, char)
-  A = 0x10,
-  B,
-  C = 0x40
-MOZ_END_ENUM_CLASS(CharEnumBitField)
-
 struct Nested
 {
   MOZ_BEGIN_NESTED_ENUM_CLASS(AutoEnum)
-    A,
-    B,
-    C = -1
+    C
   MOZ_END_NESTED_ENUM_CLASS(AutoEnum)
 
   MOZ_BEGIN_NESTED_ENUM_CLASS(CharEnum, char)
-    A = 4,
-    B,
-    C = 1
+    D = 4,
+    E
   MOZ_END_NESTED_ENUM_CLASS(CharEnum)
-
-  MOZ_BEGIN_NESTED_ENUM_CLASS(AutoEnumBitField)
-    A,
-    B = 0x20,
-    C
-  MOZ_END_NESTED_ENUM_CLASS(AutoEnumBitField)
-
-  MOZ_BEGIN_NESTED_ENUM_CLASS(CharEnumBitField, char)
-    A = 1,
-    B = 1,
-    C = 1
-  MOZ_END_NESTED_ENUM_CLASS(CharEnumBitField)
 };
 
-MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(AutoEnumBitField)
-MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(CharEnumBitField)
-MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Nested::AutoEnumBitField)
-MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Nested::CharEnumBitField)
-
-#define MAKE_STANDARD_BITFIELD_FOR_TYPE(IntType)                   \
-  MOZ_BEGIN_ENUM_CLASS(BitFieldFor_##IntType, IntType)             \
-    A = 1,                                                         \
-    B = 2,                                                         \
-    C = 4,                                                         \
-  MOZ_END_ENUM_CLASS(BitFieldFor_##IntType)                        \
-  MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(BitFieldFor_##IntType)
-
-MAKE_STANDARD_BITFIELD_FOR_TYPE(int8_t)
-MAKE_STANDARD_BITFIELD_FOR_TYPE(uint8_t)
-MAKE_STANDARD_BITFIELD_FOR_TYPE(int16_t)
-MAKE_STANDARD_BITFIELD_FOR_TYPE(uint16_t)
-MAKE_STANDARD_BITFIELD_FOR_TYPE(int32_t)
-MAKE_STANDARD_BITFIELD_FOR_TYPE(uint32_t)
-MAKE_STANDARD_BITFIELD_FOR_TYPE(int64_t)
-MAKE_STANDARD_BITFIELD_FOR_TYPE(uint64_t)
-MAKE_STANDARD_BITFIELD_FOR_TYPE(char)
-typedef signed char signed_char;
-MAKE_STANDARD_BITFIELD_FOR_TYPE(signed_char)
-typedef unsigned char unsigned_char;
-MAKE_STANDARD_BITFIELD_FOR_TYPE(unsigned_char)
-MAKE_STANDARD_BITFIELD_FOR_TYPE(short)
-typedef unsigned short unsigned_short;
-MAKE_STANDARD_BITFIELD_FOR_TYPE(unsigned_short)
-MAKE_STANDARD_BITFIELD_FOR_TYPE(int)
-typedef unsigned int unsigned_int;
-MAKE_STANDARD_BITFIELD_FOR_TYPE(unsigned_int)
-MAKE_STANDARD_BITFIELD_FOR_TYPE(long)
-typedef unsigned long unsigned_long;
-MAKE_STANDARD_BITFIELD_FOR_TYPE(unsigned_long)
-typedef long long long_long;
-MAKE_STANDARD_BITFIELD_FOR_TYPE(long_long)
-typedef unsigned long long unsigned_long_long;
-MAKE_STANDARD_BITFIELD_FOR_TYPE(unsigned_long_long)
-
-#undef MAKE_STANDARD_BITFIELD_FOR_TYPE
-
-template<typename T>
-void
-TestNonConvertibilityForOneType()
-{
-  using mozilla::IsConvertible;
-#ifdef MOZ_HAVE_CXX11_STRONG_ENUMS
-  static_assert(!IsConvertible<T, bool>::value, "should not be convertible");
-  static_assert(!IsConvertible<T, int>::value, "should not be convertible");
-  static_assert(!IsConvertible<T, uint64_t>::value, "should not be convertible");
-#endif
-
-  static_assert(!IsConvertible<bool, T>::value, "should not be convertible");
-  static_assert(!IsConvertible<int, T>::value, "should not be convertible");
-  static_assert(!IsConvertible<uint64_t, T>::value, "should not be convertible");
-}
-
-template<typename TypedEnum>
-void
-TestTypedEnumBasics()
-{
-  const TypedEnum a = TypedEnum::A;
-  int unused = int(a);
-  (void) unused;
-  RequireLiteralType(TypedEnum::A);
-  RequireLiteralType(a);
-  TestNonConvertibilityForOneType<TypedEnum>();
-}
-
-// Op wraps a bitwise binary operator, passed as a char template parameter,
-// and applies it to its arguments (t1, t2). For example,
-//
-//   Op<'|'>(t1, t2)
-//
-// is the same as
-//
-//   t1 | t2.
-//
-template<char o, typename T1, typename T2>
-auto Op(const T1& t1, const T2& t2)
-  -> decltype(t1 | t2) // See the static_assert's below --- the return type
-                       // depends solely on the operands type, not on the
-                       // choice of operation.
-{
-  using mozilla::IsSame;
-  static_assert(IsSame<decltype(t1 | t2), decltype(t1 & t2)>::value,
-                "binary ops should have the same result type");
-  static_assert(IsSame<decltype(t1 | t2), decltype(t1 ^ t2)>::value,
-                "binary ops should have the same result type");
-
-  static_assert(o == '|' ||
-                o == '&' ||
-                o == '^', "unexpected operator character");
-
-  return o == '|' ? t1 | t2
-       : o == '&' ? t1 & t2
-                  : t1 ^ t2;
-}
-
-// OpAssign wraps a bitwise binary operator, passed as a char template
-// parameter, and applies the corresponding compound-assignment operator to its
-// arguments (t1, t2). For example,
-//
-//   OpAssign<'|'>(t1, t2)
-//
-// is the same as
-//
-//   t1 |= t2.
-//
-template<char o, typename T1, typename T2>
-T1& OpAssign(T1& t1, const T2& t2)
-{
-  static_assert(o == '|' ||
-                o == '&' ||
-                o == '^', "unexpected operator character");
-
-  switch (o) {
-    case '|': return t1 |= t2;
-    case '&': return t1 &= t2;
-    case '^': return t1 ^= t2;
-    default: MOZ_CRASH();
-  }
-}
-
-// Tests a single binary bitwise operator, using a single set of three operands.
-// The operations tested are:
-//
-//   result = t1 Op t2;
-//   result Op= t3;
-//
-// Where Op is the operator specified by the char template parameter 'o' and can
-// be any of '|', '&', '^'.
-//
-// Note that the operands t1, t2, t3 are intentionally passed with free types
-// (separate template parameters for each) because their type may actually be
-// different from TypedEnum:
-//   1) Their type could be CastableTypedEnumResult<TypedEnum> if they are
-//      the result of a bitwise operation themselves;
-//   2) In the non-c++11 legacy path, the type of enum values is also
-//      different from TypedEnum.
-//
-template<typename TypedEnum, char o, typename T1, typename T2, typename T3>
-void TestBinOp(const T1& t1, const T2& t2, const T3& t3)
-{
-  typedef typename mozilla::detail::UnsignedIntegerTypeForEnum<TypedEnum>::Type
-          UnsignedIntegerType;
-
-  // Part 1:
-  // Test the bitwise binary operator i.e.
-  //   result = t1 Op t2;
-  auto result = Op<o>(t1, t2);
-
-  typedef decltype(result) ResultType;
-
-  RequireLiteralType<ResultType>();
-  TestNonConvertibilityForOneType<ResultType>();
-
-  UnsignedIntegerType unsignedIntegerResult
-    = Op<o>(UnsignedIntegerType(t1), UnsignedIntegerType(t2));
-
-  MOZ_RELEASE_ASSERT(unsignedIntegerResult == UnsignedIntegerType(result));
-  MOZ_RELEASE_ASSERT(unsignedIntegerResult == UnsignedIntegerType(TypedEnum(result)));
-  MOZ_RELEASE_ASSERT((!unsignedIntegerResult) == (!result));
-  MOZ_RELEASE_ASSERT((!!unsignedIntegerResult) == (!!result));
-  MOZ_RELEASE_ASSERT(bool(unsignedIntegerResult) == bool(result));
-
-  // Part 2:
-  // Test the compound-assignment operator, i.e.
-  //   result Op= t3;
-  TypedEnum newResult = result;
-  OpAssign<o>(newResult, t3);
-  UnsignedIntegerType unsignedIntegerNewResult = unsignedIntegerResult;
-  OpAssign<o>(unsignedIntegerNewResult, UnsignedIntegerType(t3));
-  MOZ_RELEASE_ASSERT(unsignedIntegerNewResult == UnsignedIntegerType(newResult));
-
-  // Part 3:
-  // Test additional boolean operators that we unfortunately had to add to
-  // CastableTypedEnumResult at some point to please some compiler,
-  // even though bool convertibility should have been enough.
-  MOZ_RELEASE_ASSERT(result == TypedEnum(result));
-  MOZ_RELEASE_ASSERT(!(result != TypedEnum(result)));
-  MOZ_RELEASE_ASSERT((result && true) == bool(result));
-  MOZ_RELEASE_ASSERT((result && false) == false);
-  MOZ_RELEASE_ASSERT((true && result) == bool(result));
-  MOZ_RELEASE_ASSERT((false && result && false) == false);
-  MOZ_RELEASE_ASSERT((result || false) == bool(result));
-  MOZ_RELEASE_ASSERT((result || true) == true);
-  MOZ_RELEASE_ASSERT((false || result) == bool(result));
-  MOZ_RELEASE_ASSERT((true || result) == true);
-}
-
-// Similar to TestBinOp but testing the unary ~ operator.
-template<typename TypedEnum, typename T>
-void TestTilde(const T& t)
-{
-  typedef typename mozilla::detail::UnsignedIntegerTypeForEnum<TypedEnum>::Type
-          UnsignedIntegerType;
-
-  auto result = ~t;
-
-  typedef decltype(result) ResultType;
-
-  RequireLiteralType<ResultType>();
-  TestNonConvertibilityForOneType<ResultType>();
-
-  UnsignedIntegerType unsignedIntegerResult = ~(UnsignedIntegerType(t));
-
-  MOZ_RELEASE_ASSERT(unsignedIntegerResult == UnsignedIntegerType(result));
-  MOZ_RELEASE_ASSERT(unsignedIntegerResult == UnsignedIntegerType(TypedEnum(result)));
-  MOZ_RELEASE_ASSERT((!unsignedIntegerResult) == (!result));
-  MOZ_RELEASE_ASSERT((!!unsignedIntegerResult) == (!!result));
-  MOZ_RELEASE_ASSERT(bool(unsignedIntegerResult) == bool(result));
-}
-
-// Helper dispatching a given triple of operands to all operator-specific
-// testing functions.
-template<typename TypedEnum, typename T1, typename T2, typename T3>
-void TestAllOpsForGivenOperands(const T1& t1, const T2& t2, const T3& t3)
-{
-  TestBinOp<TypedEnum, '|'>(t1, t2, t3);
-  TestBinOp<TypedEnum, '&'>(t1, t2, t3);
-  TestBinOp<TypedEnum, '^'>(t1, t2, t3);
-  TestTilde<TypedEnum>(t1);
-}
-
-// Helper building various triples of operands using a given operator,
-// and testing all operators with them.
-template<typename TypedEnum, char o>
-void TestAllOpsForOperandsBuiltUsingGivenOp()
-{
-  // The type of enum values like TypedEnum::A may be different from
-  // TypedEnum. That is the case in the legacy non-C++11 path. We want to
-  // ensure good test coverage even when these two types are distinct.
-  // To that effect, we have both 'auto' typed variables, preserving the
-  // original type of enum values, and 'plain' typed variables, that
-  // are plain TypedEnum's.
-
-  const TypedEnum a_plain = TypedEnum::A;
-  const TypedEnum b_plain = TypedEnum::B;
-  const TypedEnum c_plain = TypedEnum::C;
-
-  auto a_auto = TypedEnum::A;
-  auto b_auto = TypedEnum::B;
-  auto c_auto = TypedEnum::C;
-
-  auto ab_plain = Op<o>(a_plain, b_plain);
-  auto bc_plain = Op<o>(b_plain, c_plain);
-  auto ab_auto = Op<o>(a_auto, b_auto);
-  auto bc_auto = Op<o>(b_auto, c_auto);
-
-  // On each row below, we pass a triple of operands. Keep in mind that this
-  // is going to be received as (t1, t2, t3) and the actual tests performed
-  // will be of the form
-  //
-  //   result = t1 Op t2;
-  //   result Op= t3;
-  //
-  // For this reason, we carefully ensure that the values of (t1, t2)
-  // systematically cover all types of such pairs; to limit complexity,
-  // we are not so careful with t3, and we just try to pass t3's
-  // that may lead to nontrivial bitwise operations.
-  TestAllOpsForGivenOperands<TypedEnum>(a_plain,  b_plain,  c_plain);
-  TestAllOpsForGivenOperands<TypedEnum>(a_plain,  bc_plain, b_auto);
-  TestAllOpsForGivenOperands<TypedEnum>(ab_plain, c_plain,  a_plain);
-  TestAllOpsForGivenOperands<TypedEnum>(ab_plain, bc_plain, a_auto);
-
-  TestAllOpsForGivenOperands<TypedEnum>(a_plain,  b_auto,   c_plain);
-  TestAllOpsForGivenOperands<TypedEnum>(a_plain,  bc_auto,  b_auto);
-  TestAllOpsForGivenOperands<TypedEnum>(ab_plain, c_auto,   a_plain);
-  TestAllOpsForGivenOperands<TypedEnum>(ab_plain, bc_auto,  a_auto);
-
-  TestAllOpsForGivenOperands<TypedEnum>(a_auto,   b_plain,  c_plain);
-  TestAllOpsForGivenOperands<TypedEnum>(a_auto,   bc_plain, b_auto);
-  TestAllOpsForGivenOperands<TypedEnum>(ab_auto,  c_plain,  a_plain);
-  TestAllOpsForGivenOperands<TypedEnum>(ab_auto,  bc_plain, a_auto);
-
-  TestAllOpsForGivenOperands<TypedEnum>(a_auto,   b_auto,   c_plain);
-  TestAllOpsForGivenOperands<TypedEnum>(a_auto,   bc_auto,  b_auto);
-  TestAllOpsForGivenOperands<TypedEnum>(ab_auto,  c_auto,   a_plain);
-  TestAllOpsForGivenOperands<TypedEnum>(ab_auto,  bc_auto,  a_auto);
-}
-
-// Tests all bitwise operations on a given TypedEnum bitfield.
-template<typename TypedEnum>
-void
-TestTypedEnumBitField()
-{
-  TestTypedEnumBasics<TypedEnum>();
-
-  TestAllOpsForOperandsBuiltUsingGivenOp<TypedEnum, '|'>();
-  TestAllOpsForOperandsBuiltUsingGivenOp<TypedEnum, '&'>();
-  TestAllOpsForOperandsBuiltUsingGivenOp<TypedEnum, '^'>();
-}
-
-// Checks that enum bitwise expressions have the same non-convertibility properties as
-// c++11 enum classes do, i.e. not implicitly convertible to anything
-// (though *explicitly* convertible).
-void TestNoConversionsBetweenUnrelatedTypes()
-{
-  using mozilla::IsConvertible;
-
-  // Two typed enum classes having the same underlying integer type, to ensure that
-  // we would catch bugs accidentally allowing conversions in that case.
-  typedef CharEnumBitField T1;
-  typedef Nested::CharEnumBitField T2;
-
-  static_assert(!IsConvertible<T1, T2>::value,
-                "should not be convertible");
-  static_assert(!IsConvertible<T1, decltype(T2::A)>::value,
-                "should not be convertible");
-  static_assert(!IsConvertible<T1, decltype(T2::A | T2::B)>::value,
-                "should not be convertible");
-
-  static_assert(!IsConvertible<decltype(T1::A), T2>::value,
-                "should not be convertible");
-  static_assert(!IsConvertible<decltype(T1::A), decltype(T2::A)>::value,
-                "should not be convertible");
-  static_assert(!IsConvertible<decltype(T1::A), decltype(T2::A | T2::B)>::value,
-                "should not be convertible");
-
-  // The following are #ifdef MOZ_HAVE_EXPLICIT_CONVERSION because
-  // without support for explicit conversion operators, we can't easily have these
-  // bad conversions completely removed. They still do fail to compile in practice,
-  // but not in a way that we can static_assert on.
-#ifdef MOZ_HAVE_EXPLICIT_CONVERSION
-  static_assert(!IsConvertible<decltype(T1::A | T1::B), T2>::value,
-                "should not be convertible");
-  static_assert(!IsConvertible<decltype(T1::A | T1::B), decltype(T2::A)>::value,
-                "should not be convertible");
-  static_assert(!IsConvertible<decltype(T1::A | T1::B), decltype(T2::A | T2::B)>::value,
-                "should not be convertible");
-#endif
-}
-
-MOZ_BEGIN_ENUM_CLASS(Int8EnumWithHighBits, int8_t)
-  A = 0x20,
-  B = 0x40
-MOZ_END_ENUM_CLASS(Int8EnumWithHighBits)
-MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Int8EnumWithHighBits)
-
-MOZ_BEGIN_ENUM_CLASS(Uint8EnumWithHighBits, uint8_t)
-  A = 0x40,
-  B = 0x80
-MOZ_END_ENUM_CLASS(Uint8EnumWithHighBits)
-MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Uint8EnumWithHighBits)
-
-MOZ_BEGIN_ENUM_CLASS(Int16EnumWithHighBits, int16_t)
-  A = 0x2000,
-  B = 0x4000
-MOZ_END_ENUM_CLASS(Int16EnumWithHighBits)
-MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Int16EnumWithHighBits)
-
-MOZ_BEGIN_ENUM_CLASS(Uint16EnumWithHighBits, uint16_t)
-  A = 0x4000,
-  B = 0x8000
-MOZ_END_ENUM_CLASS(Uint16EnumWithHighBits)
-MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Uint16EnumWithHighBits)
-
-MOZ_BEGIN_ENUM_CLASS(Int32EnumWithHighBits, int32_t)
-  A = 0x20000000,
-  B = 0x40000000
-MOZ_END_ENUM_CLASS(Int32EnumWithHighBits)
-MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Int32EnumWithHighBits)
-
-MOZ_BEGIN_ENUM_CLASS(Uint32EnumWithHighBits, uint32_t)
-  A = 0x40000000u,
-  B = 0x80000000u
-MOZ_END_ENUM_CLASS(Uint32EnumWithHighBits)
-MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Uint32EnumWithHighBits)
-
-MOZ_BEGIN_ENUM_CLASS(Int64EnumWithHighBits, int64_t)
-  A = 0x2000000000000000ll,
-  B = 0x4000000000000000ll
-MOZ_END_ENUM_CLASS(Int64EnumWithHighBits)
-MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Int64EnumWithHighBits)
-
-MOZ_BEGIN_ENUM_CLASS(Uint64EnumWithHighBits, uint64_t)
-  A = 0x4000000000000000ull,
-  B = 0x8000000000000000ull
-MOZ_END_ENUM_CLASS(Uint64EnumWithHighBits)
-MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(Uint64EnumWithHighBits)
-
-// Checks that we don't accidentally truncate high bits by coercing to the wrong
-// integer type internally when implementing bitwise ops.
-template<typename EnumType, typename IntType>
-void TestIsNotTruncated()
-{
-  EnumType a = EnumType::A;
-  EnumType b = EnumType::B;
-  MOZ_RELEASE_ASSERT(IntType(a));
-  MOZ_RELEASE_ASSERT(IntType(b));
-  MOZ_RELEASE_ASSERT(a | EnumType::B);
-  MOZ_RELEASE_ASSERT(a | b);
-  MOZ_RELEASE_ASSERT(EnumType::A | EnumType::B);
-  EnumType c = EnumType::A | EnumType::B;
-  MOZ_RELEASE_ASSERT(IntType(c));
-  MOZ_RELEASE_ASSERT(c & c);
-  MOZ_RELEASE_ASSERT(c | c);
-  MOZ_RELEASE_ASSERT(c == (EnumType::A | EnumType::B));
-  MOZ_RELEASE_ASSERT(a != (EnumType::A | EnumType::B));
-  MOZ_RELEASE_ASSERT(b != (EnumType::A | EnumType::B));
-  MOZ_RELEASE_ASSERT(c & EnumType::A);
-  MOZ_RELEASE_ASSERT(c & EnumType::B);
-  EnumType d = EnumType::A;
-  d |= EnumType::B;
-  MOZ_RELEASE_ASSERT(d == c);
-}
+// Simply check that this compiles.
+const AutoEnum autoEnum = AutoEnum::A;
+const CharEnum charEnum = CharEnum::B;
+const Nested::AutoEnum nestedAutoEnum = Nested::AutoEnum::C;
+const Nested::CharEnum nestedCharEnum = Nested::CharEnum::D;
 
 int
 main()
 {
-  TestTypedEnumBasics<AutoEnum>();
-  TestTypedEnumBasics<CharEnum>();
-  TestTypedEnumBasics<Nested::AutoEnum>();
-  TestTypedEnumBasics<Nested::CharEnum>();
-
-  TestTypedEnumBitField<AutoEnumBitField>();
-  TestTypedEnumBitField<CharEnumBitField>();
-  TestTypedEnumBitField<Nested::AutoEnumBitField>();
-  TestTypedEnumBitField<Nested::CharEnumBitField>();
-
-  TestTypedEnumBitField<BitFieldFor_uint8_t>();
-  TestTypedEnumBitField<BitFieldFor_int8_t>();
-  TestTypedEnumBitField<BitFieldFor_uint16_t>();
-  TestTypedEnumBitField<BitFieldFor_int16_t>();
-  TestTypedEnumBitField<BitFieldFor_uint32_t>();
-  TestTypedEnumBitField<BitFieldFor_int32_t>();
-  TestTypedEnumBitField<BitFieldFor_uint64_t>();
-  TestTypedEnumBitField<BitFieldFor_int64_t>();
-  TestTypedEnumBitField<BitFieldFor_char>();
-  TestTypedEnumBitField<BitFieldFor_signed_char>();
-  TestTypedEnumBitField<BitFieldFor_unsigned_char>();
-  TestTypedEnumBitField<BitFieldFor_short>();
-  TestTypedEnumBitField<BitFieldFor_unsigned_short>();
-  TestTypedEnumBitField<BitFieldFor_int>();
-  TestTypedEnumBitField<BitFieldFor_unsigned_int>();
-  TestTypedEnumBitField<BitFieldFor_long>();
-  TestTypedEnumBitField<BitFieldFor_unsigned_long>();
-  TestTypedEnumBitField<BitFieldFor_long_long>();
-  TestTypedEnumBitField<BitFieldFor_unsigned_long_long>();
-
-  TestNoConversionsBetweenUnrelatedTypes();
-
-  TestIsNotTruncated<Int8EnumWithHighBits, int8_t>();
-  TestIsNotTruncated<Int16EnumWithHighBits, int16_t>();
-  TestIsNotTruncated<Int32EnumWithHighBits, int32_t>();
-  TestIsNotTruncated<Int64EnumWithHighBits, int64_t>();
-  TestIsNotTruncated<Uint8EnumWithHighBits, uint8_t>();
-  TestIsNotTruncated<Uint16EnumWithHighBits, uint16_t>();
-  TestIsNotTruncated<Uint32EnumWithHighBits, uint32_t>();
-  TestIsNotTruncated<Uint64EnumWithHighBits, uint64_t>();
-
-  return 0;
 }
--- a/widget/gonk/nativewindow/GonkBufferQueueJB.cpp
+++ b/widget/gonk/nativewindow/GonkBufferQueueJB.cpp
@@ -434,17 +434,17 @@ status_t GonkBufferQueue::dequeueBuffer(
     }  // end lock scope
 
     sp<GraphicBuffer> graphicBuffer;
     if (returnFlags & IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION) {
         RefPtr<GrallocTextureClientOGL> textureClient =
             new GrallocTextureClientOGL(ImageBridgeChild::GetSingleton(),
                                         gfx::SurfaceFormat::UNKNOWN,
                                         gfx::BackendType::NONE,
-                                        TextureFlags::DEALLOCATE_CLIENT);
+                                        TEXTURE_DEALLOCATE_CLIENT);
         usage |= GraphicBuffer::USAGE_HW_TEXTURE;
         bool result = textureClient->AllocateGralloc(IntSize(w, h), format, usage);
         sp<GraphicBuffer> graphicBuffer = textureClient->GetGraphicBuffer();
         if (!result || !graphicBuffer.get()) {
             ST_LOGE("dequeueBuffer: failed to alloc gralloc buffer");
             return -ENOMEM;
         }
 
--- a/widget/gonk/nativewindow/GonkBufferQueueKK.cpp
+++ b/widget/gonk/nativewindow/GonkBufferQueueKK.cpp
@@ -462,17 +462,17 @@ status_t GonkBufferQueue::dequeueBuffer(
     }  // end lock scope
 
     sp<GraphicBuffer> graphicBuffer;
     if (returnFlags & IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION) {
         RefPtr<GrallocTextureClientOGL> textureClient =
             new GrallocTextureClientOGL(ImageBridgeChild::GetSingleton(),
                                         gfx::SurfaceFormat::UNKNOWN,
                                         gfx::BackendType::NONE,
-                                        TextureFlags::DEALLOCATE_CLIENT);
+                                        TEXTURE_DEALLOCATE_CLIENT);
         usage |= GraphicBuffer::USAGE_HW_TEXTURE;
         bool result = textureClient->AllocateGralloc(IntSize(w, h), format, usage);
         sp<GraphicBuffer> graphicBuffer = textureClient->GetGraphicBuffer();
         if (!result || !graphicBuffer.get()) {
             ST_LOGE("dequeueBuffer: failed to alloc gralloc buffer");
             return -ENOMEM;
         }
 
--- a/widget/gonk/nativewindow/GonkNativeWindowICS.cpp
+++ b/widget/gonk/nativewindow/GonkNativeWindowICS.cpp
@@ -336,17 +336,17 @@ status_t GonkNativeWindow::dequeueBuffer
     }  // end lock scope
 
     sp<GraphicBuffer> graphicBuffer;
     if (alloc) {
         RefPtr<GrallocTextureClientOGL> textureClient =
             new GrallocTextureClientOGL(ImageBridgeChild::GetSingleton(),
                                         gfx::SurfaceFormat::UNKNOWN,
                                         gfx::BackendType::NONE,
-                                        TextureFlags::DEALLOCATE_CLIENT);
+                                        TEXTURE_DEALLOCATE_CLIENT);
         usage |= GraphicBuffer::USAGE_HW_TEXTURE;
         bool result = textureClient->AllocateGralloc(IntSize(w, h), format, usage);
         sp<GraphicBuffer> graphicBuffer = textureClient->GetGraphicBuffer();
         if (!result || !graphicBuffer.get()) {
             CNW_LOGE("dequeueBuffer: failed to alloc gralloc buffer");
             return -ENOMEM;
         }