Bug 1111290 - Part 1: Remove MOZ_(BEGIN|END)_ENUM_CLASS. r=waldo
authorMasatoshi Kimura <VYV03354@nifty.ne.jp>
Mon, 26 Jan 2015 07:22:07 +0900
changeset 225619 e7d1736f58e1772dced6c6b16f6e5105b1ab9625
parent 225618 833121ab1df423448c09b59fe10e9af388fe2d7e
child 225620 2fab2faa7f9d5778fcb5aa3a733a96f4350de90c
push id28172
push usercbook@mozilla.com
push dateMon, 26 Jan 2015 13:09:46 +0000
treeherdermozilla-central@4368f3945690 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerswaldo
bugs1111290
milestone38.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1111290 - Part 1: Remove MOZ_(BEGIN|END)_ENUM_CLASS. r=waldo
dom/canvas/WebGLTexelConversions.h
dom/canvas/WebGLTypes.h
dom/html/HTMLCanvasElement.h
dom/media/webaudio/MediaBufferDecoder.cpp
dom/workers/ServiceWorkerCommon.h
editor/libeditor/nsEditor.h
gfx/2d/DrawCommand.h
gfx/2d/Logging.h
gfx/2d/Types.h
gfx/gl/AndroidNativeWindow.h
gfx/gl/GLContext.h
gfx/gl/GLContextFeatures.cpp
gfx/gl/GLContextTypes.h
gfx/gl/SurfaceTypes.h
gfx/layers/CompositorTypes.h
gfx/layers/ImageTypes.h
gfx/layers/LayersTypes.h
gfx/src/FilterSupport.h
gfx/src/nsRegion.h
gfx/thebes/DrawMode.h
gfx/thebes/GraphicsFilter.h
gfx/thebes/gfxTypes.h
gfx/thebes/gfxVR.h
image/decoders/EXIF.h
image/src/Orientation.h
image/src/RasterImage.h
image/src/SurfaceCache.h
image/src/imgFrame.h
image/src/imgLoader.h
js/src/frontend/FoldConstants.cpp
js/src/jit/IonTypes.h
js/src/jsapi.h
layout/base/UnitTransforms.h
layout/generic/nsIFrame.h
layout/style/nsCSSParser.cpp
layout/style/nsCSSRuleProcessor.cpp
mfbt/EnumeratedArray.h
mfbt/tests/TestTypedEnum.cpp
widget/android/NativeJSContainer.cpp
widget/cocoa/VibrancyManager.h
--- a/dom/canvas/WebGLTexelConversions.h
+++ b/dom/canvas/WebGLTexelConversions.h
@@ -142,21 +142,21 @@ unpackFromFloat16(uint16_t v)
     }
 
     f32Bits |= uint32_t(exp + (-15 + 127)) << 23;
     f32Bits |= uint32_t(v & 0x03FF) << 13;
 
     return f32Value;
 }
 
-MOZ_BEGIN_ENUM_CLASS(WebGLTexelPremultiplicationOp, int)
+enum class WebGLTexelPremultiplicationOp : int {
     None,
     Premultiply,
     Unpremultiply
-MOZ_END_ENUM_CLASS(WebGLTexelPremultiplicationOp)
+};
 
 namespace WebGLTexelConversions {
 
 template<MOZ_ENUM_CLASS_ENUM_TYPE(WebGLTexelFormat) Format>
 struct IsFloatFormat
 {
     static const bool Value =
         Format == WebGLTexelFormat::RGBA32F ||
--- a/dom/canvas/WebGLTypes.h
+++ b/dom/canvas/WebGLTypes.h
@@ -41,66 +41,66 @@ namespace mozilla {
  *       with zero bytes, which means it's either opaque or transparent black
  *       depending on whether the image format has alpha.
  *
  * Why are there _two_ separate enums there, WebGLContextFakeBlackStatus
  * and WebGLTextureFakeBlackStatus? That's because each texture must know the precise
  * reason why it needs to be faked (incomplete texture vs. uninitialized image data),
  * whereas the WebGL context can only know whether _any_ faking is currently needed at all.
  */
-MOZ_BEGIN_ENUM_CLASS(WebGLContextFakeBlackStatus, uint8_t)
+enum class WebGLContextFakeBlackStatus : uint8_t {
   Unknown,
   NotNeeded,
   Needed
-MOZ_END_ENUM_CLASS(WebGLContextFakeBlackStatus)
+};
 
-MOZ_BEGIN_ENUM_CLASS(WebGLTextureFakeBlackStatus, uint8_t)
+enum class WebGLTextureFakeBlackStatus : uint8_t {
   Unknown,
   NotNeeded,
   IncompleteTexture,
   UninitializedImageData
-MOZ_END_ENUM_CLASS(WebGLTextureFakeBlackStatus)
+};
 
 /*
  * Implementing WebGL (or OpenGL ES 2.0) on top of desktop OpenGL requires
  * emulating the vertex attrib 0 array when it's not enabled. Indeed,
  * OpenGL ES 2.0 allows drawing without vertex attrib 0 array enabled, but
  * desktop OpenGL does not allow that.
  */
-MOZ_BEGIN_ENUM_CLASS(WebGLVertexAttrib0Status, uint8_t)
+enum class WebGLVertexAttrib0Status : uint8_t {
     Default, // default status - no emulation needed
     EmulatedUninitializedArray, // need an artificial attrib 0 array, but contents may be left uninitialized
     EmulatedInitializedArray // need an artificial attrib 0 array, and contents must be initialized
-MOZ_END_ENUM_CLASS(WebGLVertexAttrib0Status)
+};
 
 /*
  * Enum to track the status of image data (renderbuffer or texture image) presence
  * and initialization.
  *
  * - NoImageData is the initial state before any image data is allocated.
  * - InitializedImageData is the state after image data is allocated and initialized.
  * - UninitializedImageData is an intermediate state where data is allocated but not
  *   initialized. It is the state that renderbuffers are in after a renderbufferStorage call,
  *   and it is the state that texture images are in after a texImage2D call with null data.
  */
-MOZ_BEGIN_ENUM_CLASS(WebGLImageDataStatus, uint8_t)
+enum class WebGLImageDataStatus : uint8_t {
     NoImageData,
     UninitializedImageData,
     InitializedImageData
-MOZ_END_ENUM_CLASS(WebGLImageDataStatus)
+};
 
 /*
  * The formats that may participate, either as source or destination formats,
  * in WebGL texture conversions. This includes:
  *  - all the formats accepted by WebGL.texImage2D, e.g. RGBA4444
  *  - additional formats provided by extensions, e.g. RGB32F
  *  - additional source formats, depending on browser details, used when uploading
  *    textures from DOM elements. See gfxImageSurface::Format().
  */
-MOZ_BEGIN_ENUM_CLASS(WebGLTexelFormat, uint8_t)
+enum class WebGLTexelFormat : uint8_t {
     // returned by SurfaceFromElementResultToImageSurface to indicate absence of image data
     None,
     // common value for formats for which format conversions are not supported
     FormatNotSupportingAnyConversion,
     // dummy pseudo-format meaning "use the other format".
     // For example, if SrcFormat=Auto and DstFormat=RGB8, then the source
     // is implicitly treated as being RGB8 itself.
     Auto,
@@ -123,34 +123,34 @@ MOZ_BEGIN_ENUM_CLASS(WebGLTexelFormat, u
     RGB32F, // OES_texture_float
     // 4-channel formats
     RGBA8,
     BGRA8, // used for DOM elements
     RGBA5551,
     RGBA4444,
     RGBA16F, // OES_texture_half_float
     RGBA32F // OES_texture_float
-MOZ_END_ENUM_CLASS(WebGLTexelFormat)
+};
 
-MOZ_BEGIN_ENUM_CLASS(WebGLTexImageFunc, uint8_t)
+enum class WebGLTexImageFunc : uint8_t {
     TexImage,
     TexSubImage,
     CopyTexImage,
     CopyTexSubImage,
     CompTexImage,
     CompTexSubImage,
-MOZ_END_ENUM_CLASS(WebGLTexImageFunc)
+};
 
-MOZ_BEGIN_ENUM_CLASS(WebGLTexDimensions, uint8_t)
+enum class WebGLTexDimensions : uint8_t {
     Tex2D,
     Tex3D
-MOZ_END_ENUM_CLASS(WebGLTexDimensions)
+};
 
 // Please keep extensions in alphabetic order.
-MOZ_BEGIN_ENUM_CLASS(WebGLExtensionID, uint8_t)
+enum class WebGLExtensionID : uint8_t {
     ANGLE_instanced_arrays,
     EXT_blend_minmax,
     EXT_color_buffer_half_float,
     EXT_frag_depth,
     EXT_sRGB,
     EXT_shader_texture_lod,
     EXT_texture_filter_anisotropic,
     OES_element_index_uint,
@@ -167,13 +167,13 @@ MOZ_BEGIN_ENUM_CLASS(WebGLExtensionID, u
     WEBGL_compressed_texture_s3tc,
     WEBGL_debug_renderer_info,
     WEBGL_debug_shaders,
     WEBGL_depth_texture,
     WEBGL_draw_buffers,
     WEBGL_lose_context,
     Max,
     Unknown
-MOZ_END_ENUM_CLASS(WebGLExtensionID)
+};
 
 } // namespace mozilla
 
 #endif
--- a/dom/html/HTMLCanvasElement.h
+++ b/dom/html/HTMLCanvasElement.h
@@ -31,21 +31,21 @@ class SourceSurface;
 
 namespace dom {
 
 class File;
 class FileCallback;
 class HTMLCanvasPrintState;
 class PrintCallback;
 
-MOZ_BEGIN_ENUM_CLASS(CanvasContextType, uint8_t)
+enum class CanvasContextType : uint8_t {
   Canvas2D,
   WebGL1,
   WebGL2
-MOZ_END_ENUM_CLASS(CanvasContextType)
+};
 
 class HTMLCanvasElement MOZ_FINAL : public nsGenericHTMLElement,
                                     public nsIDOMHTMLCanvasElement
 {
   enum {
     DEFAULT_CANVAS_WIDTH = 300,
     DEFAULT_CANVAS_HEIGHT = 150
   };
--- a/dom/media/webaudio/MediaBufferDecoder.cpp
+++ b/dom/media/webaudio/MediaBufferDecoder.cpp
@@ -77,21 +77,21 @@ private:
   // Therefore, it is not safe to do anything fancy with it in this class.
   // Really, this class is only used because nsRunnableMethod doesn't support
   // methods accepting arguments.
   WebAudioDecodeJob& mDecodeJob;
   WebAudioDecodeJob::ResultFn mFunction;
   WebAudioDecodeJob::ErrorCode mErrorCode;
 };
 
-MOZ_BEGIN_ENUM_CLASS(PhaseEnum, int)
+enum class PhaseEnum : int {
   Decode,
   AllocateBuffer,
   Done
-MOZ_END_ENUM_CLASS(PhaseEnum)
+};
 
 class MediaDecodeTask : public nsRunnable
 {
 public:
   MediaDecodeTask(const char* aContentType, uint8_t* aBuffer,
                   uint32_t aLength,
                   WebAudioDecodeJob& aDecodeJob)
     : mContentType(aContentType)
--- a/dom/workers/ServiceWorkerCommon.h
+++ b/dom/workers/ServiceWorkerCommon.h
@@ -7,19 +7,19 @@
 #ifndef mozilla_dom_ServiceWorkerCommon_h
 #define mozilla_dom_ServiceWorkerCommon_h
 
 namespace mozilla {
 namespace dom {
 
 // Use multiples of 2 since they can be bitwise ORed when calling
 // InvalidateServiceWorkerRegistrationWorker.
-MOZ_BEGIN_ENUM_CLASS(WhichServiceWorker)
+enum class WhichServiceWorker {
   INSTALLING_WORKER = 1,
   WAITING_WORKER    = 2,
   ACTIVE_WORKER     = 4,
-MOZ_END_ENUM_CLASS(WhichServiceWorker)
+};
 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(WhichServiceWorker)
 
 } // dom namespace
 } // mozilla namespace
 
 #endif // mozilla_dom_ServiceWorkerCommon_h
--- a/editor/libeditor/nsEditor.h
+++ b/editor/libeditor/nsEditor.h
@@ -85,17 +85,17 @@ struct IMEState;
 } // namespace widget
 } // namespace mozilla
 
 #define kMOZEditorBogusNodeAttrAtom nsGkAtoms::mozeditorbogusnode
 #define kMOZEditorBogusNodeValue NS_LITERAL_STRING("TRUE")
 
 // This is int32_t instead of int16_t because nsIInlineSpellChecker.idl's
 // spellCheckAfterEditorChange is defined to take it as a long.
-MOZ_BEGIN_ENUM_CLASS(EditAction, int32_t)
+enum class EditAction : int32_t {
   ignore = -1,
   none = 0,
   undo,
   redo,
   insertNode,
   createNode,
   deleteNode,
   splitNode,
@@ -123,17 +123,17 @@ MOZ_BEGIN_ENUM_CLASS(EditAction, int32_t
   insertQuotation     = 3009,
   htmlPaste           = 3012,
   loadHTML            = 3013,
   resetTextProperties = 3014,
   setAbsolutePosition = 3015,
   removeAbsolutePosition = 3016,
   decreaseZIndex      = 3017,
   increaseZIndex      = 3018
-MOZ_END_ENUM_CLASS(EditAction)
+};
 
 inline bool operator!(const EditAction& aOp)
 {
   return aOp == EditAction::none;
 }
 
 /** implementation of an editor object.  it will be the controller/focal point 
  *  for the main editor services. i.e. the GUIManager, publishing, transaction 
--- a/gfx/2d/DrawCommand.h
+++ b/gfx/2d/DrawCommand.h
@@ -8,17 +8,17 @@
 
 #include "2D.h"
 #include "Filters.h"
 #include <vector>
 
 namespace mozilla {
 namespace gfx {
 
-MOZ_BEGIN_ENUM_CLASS(CommandType, int8_t)
+enum class CommandType : int8_t {
   DRAWSURFACE = 0,
   DRAWFILTER,
   DRAWSURFACEWITHSHADOW,
   CLEARRECT,
   COPYSURFACE,
   COPYRECT,
   FILLRECT,
   STROKERECT,
@@ -27,17 +27,17 @@ MOZ_BEGIN_ENUM_CLASS(CommandType, int8_t
   FILL,
   FILLGLYPHS,
   MASK,
   MASKSURFACE,
   PUSHCLIP,
   PUSHCLIPRECT,
   POPCLIP,
   SETTRANSFORM
-MOZ_END_ENUM_CLASS(CommandType)
+};
 
 class DrawingCommand
 {
 public:
   virtual ~DrawingCommand() {}
 
   virtual void ExecuteOnDT(DrawTarget* aDT, const Matrix& aTransform) = 0;
 
--- a/gfx/2d/Logging.h
+++ b/gfx/2d/Logging.h
@@ -220,21 +220,21 @@ class NoLog
 public:
   NoLog() {}
   ~NoLog() {}
 
   template<typename T>
   NoLog &operator <<(const T &aLogText) { return *this; }
 };
 
-MOZ_BEGIN_ENUM_CLASS(LogOptions, int)
+enum class LogOptions : int {
   NoNewline = 0x01,
   AutoPrefix = 0x02,
   AssertOnCall = 0x04
-MOZ_END_ENUM_CLASS(LogOptions)
+};
 
 template<typename T>
 struct Hexa {
   explicit Hexa(T aVal) : mVal(aVal) {}
   T mVal;
 };
 template<typename T>
 Hexa<T> hexa(T val) { return Hexa<T>(val); }
--- a/gfx/2d/Types.h
+++ b/gfx/2d/Types.h
@@ -11,56 +11,56 @@
 #include <stddef.h>
 #include <stdint.h>
 
 namespace mozilla {
 namespace gfx {
 
 typedef float Float;
 
-MOZ_BEGIN_ENUM_CLASS(SurfaceType, int8_t)
+enum class SurfaceType : int8_t {
   DATA, /* Data surface - bitmap in memory */
   D2D1_BITMAP, /* Surface wrapping a ID2D1Bitmap */
   D2D1_DRAWTARGET, /* Surface made from a D2D draw target */
   CAIRO, /* Surface wrapping a cairo surface */
   CAIRO_IMAGE, /* Data surface wrapping a cairo image surface */
   COREGRAPHICS_IMAGE, /* Surface wrapping a CoreGraphics Image */
   COREGRAPHICS_CGCONTEXT, /* Surface wrapping a CG context */
   SKIA, /* Surface wrapping a Skia bitmap */
   DUAL_DT, /* Snapshot of a dual drawtarget */
   D2D1_1_IMAGE, /* A D2D 1.1 ID2D1Image SourceSurface */
   RECORDING, /* Surface used for recording */
   TILED /* Surface from a tiled DrawTarget */
-MOZ_END_ENUM_CLASS(SurfaceType)
+};
 
-MOZ_BEGIN_ENUM_CLASS(SurfaceFormat, int8_t)
+enum class SurfaceFormat : int8_t {
   B8G8R8A8,
   B8G8R8X8,
   R8G8B8A8,
   R8G8B8X8,
   R5G6B5,
   A8,
   YUV,
   UNKNOWN
-MOZ_END_ENUM_CLASS(SurfaceFormat)
+};
 
 inline bool IsOpaque(SurfaceFormat aFormat)
 {
   switch (aFormat) {
   case SurfaceFormat::B8G8R8X8:
   case SurfaceFormat::R8G8B8X8:
   case SurfaceFormat::R5G6B5:
   case SurfaceFormat::YUV:
     return true;
   default:
     return false;
   }
 }
 
-MOZ_BEGIN_ENUM_CLASS(FilterType, int8_t)
+enum class FilterType : int8_t {
   BLEND = 0,
   TRANSFORM,
   MORPHOLOGY,
   COLOR_MATRIX,
   FLOOD,
   TILE,
   TABLE_TRANSFER,
   DISCRETE_TRANSFER,
@@ -77,76 +77,76 @@ MOZ_BEGIN_ENUM_CLASS(FilterType, int8_t)
   POINT_SPECULAR,
   SPOT_DIFFUSE,
   SPOT_SPECULAR,
   DISTANT_DIFFUSE,
   DISTANT_SPECULAR,
   CROP,
   PREMULTIPLY,
   UNPREMULTIPLY
-MOZ_END_ENUM_CLASS(FilterType)
+};
 
-MOZ_BEGIN_ENUM_CLASS(DrawTargetType, int8_t)
+enum class DrawTargetType : int8_t {
   SOFTWARE_RASTER = 0,
   HARDWARE_RASTER,
   VECTOR
-MOZ_END_ENUM_CLASS(DrawTargetType)
+};
 
-MOZ_BEGIN_ENUM_CLASS(BackendType, int8_t)
+enum class BackendType : int8_t {
   NONE = 0,
   DIRECT2D,
   COREGRAPHICS,
   COREGRAPHICS_ACCELERATED,
   CAIRO,
   SKIA,
   RECORDING,
   DIRECT2D1_1
-MOZ_END_ENUM_CLASS(BackendType)
+};
 
-MOZ_BEGIN_ENUM_CLASS(FontType, int8_t)
+enum class FontType : int8_t {
   DWRITE,
   GDI,
   MAC,
   SKIA,
   CAIRO,
   COREGRAPHICS
-MOZ_END_ENUM_CLASS(FontType)
+};
 
-MOZ_BEGIN_ENUM_CLASS(NativeSurfaceType, int8_t)
+enum class NativeSurfaceType : int8_t {
   D3D10_TEXTURE,
   CAIRO_SURFACE,
   CAIRO_CONTEXT,
   CGCONTEXT,
   CGCONTEXT_ACCELERATED,
   OPENGL_TEXTURE
-MOZ_END_ENUM_CLASS(NativeSurfaceType)
+};
 
-MOZ_BEGIN_ENUM_CLASS(NativeFontType, int8_t)
+enum class NativeFontType : int8_t {
   DWRITE_FONT_FACE,
   GDI_FONT_FACE,
   MAC_FONT_FACE,
   SKIA_FONT_FACE,
   CAIRO_FONT_FACE
-MOZ_END_ENUM_CLASS(NativeFontType)
+};
 
-MOZ_BEGIN_ENUM_CLASS(FontStyle, int8_t)
+enum class FontStyle : int8_t {
   NORMAL,
   ITALIC,
   BOLD,
   BOLD_ITALIC
-MOZ_END_ENUM_CLASS(FontStyle)
+};
 
-MOZ_BEGIN_ENUM_CLASS(FontHinting, int8_t)
+enum class FontHinting : int8_t {
   NONE,
   LIGHT,
   NORMAL,
   FULL
-MOZ_END_ENUM_CLASS(FontHinting)
+};
 
-MOZ_BEGIN_ENUM_CLASS(CompositionOp, int8_t)
+enum class CompositionOp : int8_t {
   OP_OVER,
   OP_ADD,
   OP_ATOP,
   OP_OUT,
   OP_IN,
   OP_SOURCE,
   OP_DEST_IN,
   OP_DEST_OUT,
@@ -164,68 +164,68 @@ MOZ_BEGIN_ENUM_CLASS(CompositionOp, int8
   OP_SOFT_LIGHT,
   OP_DIFFERENCE,
   OP_EXCLUSION,
   OP_HUE,
   OP_SATURATION,
   OP_COLOR,
   OP_LUMINOSITY,
   OP_COUNT
-MOZ_END_ENUM_CLASS(CompositionOp)
+};
 
-MOZ_BEGIN_ENUM_CLASS(ExtendMode, int8_t)
+enum class ExtendMode : int8_t {
   CLAMP,
   REPEAT,
   REFLECT
-MOZ_END_ENUM_CLASS(ExtendMode)
+};
 
-MOZ_BEGIN_ENUM_CLASS(FillRule, int8_t)
+enum class FillRule : int8_t {
   FILL_WINDING,
   FILL_EVEN_ODD
-MOZ_END_ENUM_CLASS(FillRule)
+};
 
-MOZ_BEGIN_ENUM_CLASS(AntialiasMode, int8_t)
+enum class AntialiasMode : int8_t {
   NONE,
   GRAY,
   SUBPIXEL,
   DEFAULT
-MOZ_END_ENUM_CLASS(AntialiasMode)
+};
 
-MOZ_BEGIN_ENUM_CLASS(Filter, int8_t)
+enum class Filter : int8_t {
   GOOD,
   LINEAR,
   POINT
-MOZ_END_ENUM_CLASS(Filter)
+};
 
-MOZ_BEGIN_ENUM_CLASS(PatternType, int8_t)
+enum class PatternType : int8_t {
   COLOR,
   SURFACE,
   LINEAR_GRADIENT,
   RADIAL_GRADIENT
-MOZ_END_ENUM_CLASS(PatternType)
+};
 
-MOZ_BEGIN_ENUM_CLASS(JoinStyle, int8_t)
+enum class JoinStyle : int8_t {
   BEVEL,
   ROUND,
   MITER, //!< Mitered if within the miter limit, else, if the backed supports
          //!< it (D2D), the miter is clamped. If the backend does not support
          //!< miter clamping the behavior is as for MITER_OR_BEVEL.
   MITER_OR_BEVEL //!< Mitered if within the miter limit, else beveled.
-MOZ_END_ENUM_CLASS(JoinStyle)
+};
 
-MOZ_BEGIN_ENUM_CLASS(CapStyle, int8_t)
+enum class CapStyle : int8_t {
   BUTT,
   ROUND,
   SQUARE
-MOZ_END_ENUM_CLASS(CapStyle)
+};
 
-MOZ_BEGIN_ENUM_CLASS(SamplingBounds, int8_t)
+enum class SamplingBounds : int8_t {
   UNBOUNDED,
   BOUNDED
-MOZ_END_ENUM_CLASS(SamplingBounds)
+};
 
 /* Color is stored in non-premultiplied form */
 struct Color
 {
 public:
   Color()
     : r(0.0f), g(0.0f), b(0.0f), a(0.0f)
   {}
--- a/gfx/gl/AndroidNativeWindow.h
+++ b/gfx/gl/AndroidNativeWindow.h
@@ -14,22 +14,22 @@
 #include "nsISupports.h"
 #include "mozilla/TypedEnum.h"
 #include "mozilla/gfx/2D.h"
 
 
 namespace mozilla {
 namespace gl {
 
-MOZ_BEGIN_ENUM_CLASS(AndroidWindowFormat)
+enum class AndroidWindowFormat {
   Unknown = -1,
   RGBA_8888 = 1,
   RGBX_8888 = 1 << 1,
   RGB_565 = 1 << 2
-MOZ_END_ENUM_CLASS(AndroidWindowFormat)
+};
 
 /**
  * This class is a wrapper around Android's SurfaceTexture class.
  * Usage is pretty much exactly like the Java class, so see
  * the Android documentation for details.
  */
 class AndroidNativeWindow {
   NS_INLINE_DECL_THREADSAFE_REFCOUNTING(AndroidNativeWindow)
--- a/gfx/gl/GLContext.h
+++ b/gfx/gl/GLContext.h
@@ -79,17 +79,17 @@ namespace mozilla {
     namespace layers {
         class ColorTextureLayerProgram;
     }
 }
 
 namespace mozilla {
 namespace gl {
 
-MOZ_BEGIN_ENUM_CLASS(GLFeature)
+enum class GLFeature {
     bind_buffer_offset,
     blend_minmax,
     clear_buffers,
     copy_buffer,
     depth_texture,
     draw_buffers,
     draw_instanced,
     draw_range_elements,
@@ -129,53 +129,53 @@ MOZ_BEGIN_ENUM_CLASS(GLFeature)
     texture_half_float_linear,
     texture_non_power_of_two,
     texture_storage,
     transform_feedback2,
     uniform_buffer_object,
     uniform_matrix_nonsquare,
     vertex_array_object,
     EnumMax
-MOZ_END_ENUM_CLASS(GLFeature)
-
-MOZ_BEGIN_ENUM_CLASS(ContextProfile, uint8_t)
+};
+
+enum class ContextProfile : uint8_t {
     Unknown = 0,
     OpenGL, // only for IsAtLeast's <profile> parameter
     OpenGLCore,
     OpenGLCompatibility,
     OpenGLES
-MOZ_END_ENUM_CLASS(ContextProfile)
-
-MOZ_BEGIN_ENUM_CLASS(GLVendor)
+};
+
+enum class GLVendor {
     Intel,
     NVIDIA,
     ATI,
     Qualcomm,
     Imagination,
     Nouveau,
     Vivante,
     VMware,
     Other
-MOZ_END_ENUM_CLASS(GLVendor)
-
-MOZ_BEGIN_ENUM_CLASS(GLRenderer)
+};
+
+enum class GLRenderer {
     Adreno200,
     Adreno205,
     AdrenoTM200,
     AdrenoTM205,
     AdrenoTM320,
     SGX530,
     SGX540,
     Tegra,
     AndroidEmulator,
     GalliumLlvmpipe,
     IntelHD3000,
     MicrosoftBasicRenderDriver,
     Other
-MOZ_END_ENUM_CLASS(GLRenderer)
+};
 
 class GLContext
     : public GLLibraryLoader
     , public GenericAtomicRefCounted
 {
 // -----------------------------------------------------------------------------
 // basic enums
 public:
--- a/gfx/gl/GLContextFeatures.cpp
+++ b/gfx/gl/GLContextFeatures.cpp
@@ -11,38 +11,38 @@
 #include "nsCocoaFeatures.h"
 #endif
 
 namespace mozilla {
 namespace gl {
 
 const size_t kMAX_EXTENSION_GROUP_SIZE = 5;
 
-MOZ_BEGIN_ENUM_CLASS(GLVersion, uint32_t)
+enum class GLVersion : uint32_t {
     NONE  = 0,   // Feature is not supported natively by GL
     GL1_2 = 120,
     GL1_3 = 130,
     GL2   = 200,
     GL2_1 = 210,
     GL3   = 300,
     GL3_1 = 310,
     GL3_2 = 320,
     GL3_3 = 330,
     GL4   = 400,
     GL4_1 = 410,
     GL4_2 = 420,
     GL4_3 = 430,
-MOZ_END_ENUM_CLASS(GLVersion)
+};
 
-MOZ_BEGIN_ENUM_CLASS(GLESVersion, uint32_t)
+enum class GLESVersion : uint32_t {
     NONE  = 0,   // Feature is not support natively by GL ES
     ES2   = 200,
     ES3   = 300,
     ES3_1 = 310,
-MOZ_END_ENUM_CLASS(GLESVersion)
+};
 
 // ARB_ES2_compatibility is natively supported in OpenGL 4.1.
 static const GLVersion kGLCoreVersionForES2Compat = GLVersion::GL4_1;
 
 // ARB_ES3_compatibility is natively supported in OpenGL 4.3.
 static const GLVersion kGLCoreVersionForES3Compat = GLVersion::GL4_3;
 
 struct FeatureInfo
--- a/gfx/gl/GLContextTypes.h
+++ b/gfx/gl/GLContextTypes.h
@@ -9,28 +9,28 @@
 #include "GLTypes.h"
 #include "mozilla/TypedEnum.h"
 
 namespace mozilla {
 namespace gl {
 
 class GLContext;
 
-MOZ_BEGIN_ENUM_CLASS(GLContextType)
+enum class GLContextType {
     Unknown,
     WGL,
     CGL,
     GLX,
     EGL
-MOZ_END_ENUM_CLASS(GLContextType)
+};
 
-MOZ_BEGIN_ENUM_CLASS(OriginPos, uint8_t)
+enum class OriginPos : uint8_t {
   TopLeft,
   BottomLeft
-MOZ_END_ENUM_CLASS(OriginPos)
+};
 
 struct GLFormats
 {
     // Constructs a zeroed object:
     GLFormats();
 
     GLenum color_texInternalFormat;
     GLenum color_texFormat;
--- a/gfx/gl/SurfaceTypes.h
+++ b/gfx/gl/SurfaceTypes.h
@@ -62,36 +62,36 @@ struct SurfaceCaps MOZ_FINAL
         SurfaceCaps caps;
 
         caps.any = true;
 
         return caps;
     }
 };
 
-MOZ_BEGIN_ENUM_CLASS(SharedSurfaceType, uint8_t)
+enum class SharedSurfaceType : uint8_t {
     Unknown = 0,
 
     Basic,
     GLTextureShare,
     EGLImageShare,
     EGLSurfaceANGLE,
     DXGLInterop,
     DXGLInterop2,
     Gralloc,
     IOSurface,
 
     Max
-MOZ_END_ENUM_CLASS(SharedSurfaceType)
+};
 
-MOZ_BEGIN_ENUM_CLASS(AttachmentType, uint8_t)
+enum class AttachmentType : uint8_t {
     Screen = 0,
 
     GLTexture,
     GLRenderbuffer,
 
     Max
-MOZ_END_ENUM_CLASS(AttachmentType)
+};
 
 } /* namespace gfx */
 } /* namespace mozilla */
 
 #endif /* SURFACE_TYPES_H_ */
--- a/gfx/layers/CompositorTypes.h
+++ b/gfx/layers/CompositorTypes.h
@@ -20,17 +20,17 @@ namespace mozilla {
 namespace layers {
 
 /**
  * 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.
  */
-MOZ_BEGIN_ENUM_CLASS(TextureFlags, uint32_t)
+enum class TextureFlags : uint32_t {
   NO_FLAGS           = 0,
   // Use nearest-neighbour texture filtering (as opposed to linear filtering).
   USE_NEAREST_FILTER = 1 << 0,
   // The compositor assumes everything is origin-top-left by default.
   ORIGIN_BOTTOM_LEFT = 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,
@@ -62,105 +62,105 @@ MOZ_BEGIN_ENUM_CLASS(TextureFlags, uint3
   IMMEDIATE_UPLOAD   = 1 << 8,
   // The texture is part of a component-alpha pair
   COMPONENT_ALPHA    = 1 << 9,
 
   // OR union of all valid bits
   ALL_BITS           = (1 << 10) - 1,
   // the default flags
   DEFAULT = NO_FLAGS
-MOZ_END_ENUM_CLASS(TextureFlags)
+};
 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(TextureFlags)
 
 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::IMMUTABLE));
 }
 
 /**
  * The type of debug diagnostic to enable.
  */
-MOZ_BEGIN_ENUM_CLASS(DiagnosticTypes, uint8_t)
+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)
 
 #define DIAGNOSTIC_FLASH_COUNTER_MAX 100
 
 /**
  * Information about the object that is being diagnosed.
  */
-MOZ_BEGIN_ENUM_CLASS(DiagnosticFlags, uint16_t)
+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)
 
 /**
  * See gfx/layers/Effects.h
  */
-MOZ_BEGIN_ENUM_CLASS(EffectTypes, uint8_t)
+enum class EffectTypes : uint8_t {
   MASK,
   BLEND_MODE,
   COLOR_MATRIX,
   MAX_SECONDARY, // sentinel for the count of secondary effect types
   RGB,
   YCBCR,
   COMPONENT_ALPHA,
   SOLID_COLOR,
   RENDER_TARGET,
   VR_DISTORTION,
   MAX  //sentinel for the count of all effect types
-MOZ_END_ENUM_CLASS(EffectTypes)
+};
 
 /**
  * How the Compositable should manage textures.
  */
-MOZ_BEGIN_ENUM_CLASS(CompositableType, uint8_t)
+enum class CompositableType : uint8_t {
   UNKNOWN,
   CONTENT_INC,     // painted layer interface, only sends incremental
                    // updates to a texture on the compositor side.
   CONTENT_TILED,   // tiled painted layer
   IMAGE,           // image with single buffering
   IMAGE_OVERLAY,   // image without buffer
   IMAGE_BRIDGE,    // ImageBridge protocol
   CONTENT_SINGLE,  // painted layer interface, single buffering
   CONTENT_DOUBLE,  // painted layer interface, double buffering
   COUNT
-MOZ_END_ENUM_CLASS(CompositableType)
+};
 
 /**
  * How the texture host is used for composition,
  * XXX - Only used by ContentClientIncremental
  */
-MOZ_BEGIN_ENUM_CLASS(DeprecatedTextureHostFlags, uint8_t)
+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
                                       // from the previous texture.
   ALL_BITS = (1 << 2) - 1
-MOZ_END_ENUM_CLASS(DeprecatedTextureHostFlags)
+};
 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(DeprecatedTextureHostFlags)
 
 #ifdef XP_WIN
 typedef void* SyncHandle;
 #else
 typedef uintptr_t SyncHandle;
 #endif // XP_WIN
 
@@ -196,23 +196,23 @@ 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 - We don't really need this, it will be removed along with the incremental
  * ContentClient/Host.
  */
-MOZ_BEGIN_ENUM_CLASS(TextureIdentifier, uint8_t)
+enum class TextureIdentifier : uint8_t {
   Front = 1,
   Back = 2,
   OnWhiteFront = 3,
   OnWhiteBack = 4,
   HighBound
-MOZ_END_ENUM_CLASS(TextureIdentifier)
+};
 
 /**
  * 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.
  */
@@ -244,31 +244,31 @@ struct TextureInfo
   }
 };
 
 /**
  * How a SurfaceDescriptor will be opened.
  *
  * See ShadowLayerForwarder::OpenDescriptor for example.
  */
-MOZ_BEGIN_ENUM_CLASS(OpenMode, uint8_t)
+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)
 
 // 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 class MaskType : uint8_t {
   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/ImageTypes.h
+++ b/gfx/layers/ImageTypes.h
@@ -5,17 +5,17 @@
 
 #ifndef GFX_IMAGETYPES_H
 #define GFX_IMAGETYPES_H
 
 #include "mozilla/TypedEnum.h"
 
 namespace mozilla {
 
-MOZ_BEGIN_ENUM_CLASS(ImageFormat)
+enum class ImageFormat {
   /**
    * The PLANAR_YCBCR format creates a PlanarYCbCrImage. All backends should
    * support this format, because the Ogg video decoder depends on it.
    * The maximum image width and height is 16384.
    */
   PLANAR_YCBCR,
 
   /**
@@ -79,21 +79,21 @@ MOZ_BEGIN_ENUM_CLASS(ImageFormat)
    */
   D3D9_RGB32_TEXTURE,
 
   /**
    * An Image type carries an opaque handle once for each stream.
    * The opaque handle would be a platform specific identifier.
    */
   OVERLAY_IMAGE
-MOZ_END_ENUM_CLASS(ImageFormat)
+};
 
-MOZ_BEGIN_ENUM_CLASS(StereoMode)
+enum class StereoMode {
   MONO,
   LEFT_RIGHT,
   RIGHT_LEFT,
   BOTTOM_TOP,
   TOP_BOTTOM
-MOZ_END_ENUM_CLASS(StereoMode)
+};
 
 } // namespace
 
 #endif
--- a/gfx/layers/LayersTypes.h
+++ b/gfx/layers/LayersTypes.h
@@ -41,58 +41,58 @@ class GraphicBuffer;
 namespace mozilla {
 namespace layers {
 
 class TextureHost;
 
 #undef NONE
 #undef OPAQUE
 
-MOZ_BEGIN_ENUM_CLASS(LayersBackend, int8_t)
+enum class LayersBackend : int8_t {
   LAYERS_NONE = 0,
   LAYERS_BASIC,
   LAYERS_OPENGL,
   LAYERS_D3D9,
   LAYERS_D3D10,
   LAYERS_D3D11,
   LAYERS_CLIENT,
   LAYERS_LAST
-MOZ_END_ENUM_CLASS(LayersBackend)
+};
 
-MOZ_BEGIN_ENUM_CLASS(BufferMode, int8_t)
+enum class BufferMode : int8_t {
   BUFFER_NONE,
   BUFFERED
-MOZ_END_ENUM_CLASS(BufferMode)
+};
 
-MOZ_BEGIN_ENUM_CLASS(DrawRegionClip, int8_t)
+enum class DrawRegionClip : int8_t {
   DRAW,
   NONE
-MOZ_END_ENUM_CLASS(DrawRegionClip)
+};
 
-MOZ_BEGIN_ENUM_CLASS(SurfaceMode, int8_t)
+enum class SurfaceMode : int8_t {
   SURFACE_NONE = 0,
   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)
+enum class LayerRenderStateFlags : int8_t {
   LAYER_RENDER_STATE_DEFAULT = 0,
   ORIGIN_BOTTOM_LEFT = 1 << 0,
   BUFFER_ROTATION = 1 << 1,
   // Notify Composer2D to swap the RB pixels of gralloc buffer
   FORMAT_RB_SWAP = 1 << 2,
   // We record opaqueness here alongside the actual surface we're going to
   // render. This avoids confusion when a layer might return different kinds
   // of surfaces over time (e.g. video frames).
   OPAQUE = 1 << 3
-MOZ_END_ENUM_CLASS(LayerRenderStateFlags)
+};
 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(LayerRenderStateFlags)
 
 // 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)
@@ -146,22 +146,22 @@ struct LayerRenderState {
   android::sp<android::GraphicBuffer> mSurface;
   int32_t mOverlayId;
   // size of mSurface
   nsIntSize mSize;
   TextureHost* mTexture;
 #endif
 };
 
-MOZ_BEGIN_ENUM_CLASS(ScaleMode, int8_t)
+enum class ScaleMode : int8_t {
   SCALE_NONE,
   STRETCH,
   SENTINEL
 // Unimplemented - PRESERVE_ASPECT_RATIO_CONTAIN
-MOZ_END_ENUM_CLASS(ScaleMode)
+};
 
 struct EventRegions {
   nsIntRegion mHitRegion;
   nsIntRegion mDispatchToContentHitRegion;
 
   EventRegions()
   {
   }
--- a/gfx/src/FilterSupport.h
+++ b/gfx/src/FilterSupport.h
@@ -157,31 +157,31 @@ enum AttributeName {
   eLastAttributeName
 };
 
 class DrawTarget;
 class SourceSurface;
 class FilterNode;
 struct FilterAttribute;
 
-MOZ_BEGIN_ENUM_CLASS(AttributeType)
+enum class AttributeType {
   eBool,
   eUint,
   eFloat,
   eSize,
   eIntSize,
   eIntPoint,
   eMatrix,
   eMatrix5x4,
   ePoint3D,
   eColor,
   eAttributeMap,
   eFloats,
   Max
-MOZ_END_ENUM_CLASS(AttributeType)
+};
 
 // Limits
 const float kMaxStdDeviation = 500;
 
 // A class that stores values of different types, keyed by an attribute name.
 // The Get*() methods assert that they're called for the same type that the
 // attribute was Set() with.
 // AttributeMaps can be nested because AttributeMap is a valid attribute type.
@@ -226,26 +226,26 @@ public:
   typedef bool (*AttributeHandleCallback)(AttributeName aName, AttributeType aType, void* aUserData);
   void EnumerateRead(AttributeHandleCallback aCallback, void* aUserData) const;
   uint32_t Count() const;
 
 private:
   mutable nsClassHashtable<nsUint32HashKey, FilterAttribute>  mMap;
 };
 
-MOZ_BEGIN_ENUM_CLASS(ColorSpace)
+enum class ColorSpace {
   SRGB,
   LinearRGB,
   Max
-MOZ_END_ENUM_CLASS(ColorSpace)
+};
 
-MOZ_BEGIN_ENUM_CLASS(AlphaModel)
+enum class AlphaModel {
   Unpremultiplied,
   Premultiplied
-MOZ_END_ENUM_CLASS(AlphaModel)
+};
 
 class ColorModel {
 public:
   static ColorModel PremulSRGB()
   {
     return ColorModel(ColorSpace::SRGB, AlphaModel::Premultiplied);
   }
 
@@ -263,17 +263,17 @@ public:
   {
     return (uint8_t(mColorSpace) << 1) + uint8_t(mAlphaModel);
   }
 
   ColorSpace mColorSpace;
   AlphaModel mAlphaModel;
 };
 
-MOZ_BEGIN_ENUM_CLASS(PrimitiveType)
+enum class PrimitiveType {
   Empty = 0,
   Blend,
   Morphology,
   ColorMatrix,
   Flood,
   Tile,
   ComponentTransfer,
   ConvolveMatrix,
@@ -284,17 +284,17 @@ MOZ_BEGIN_ENUM_CLASS(PrimitiveType)
   Merge,
   Image,
   GaussianBlur,
   DropShadow,
   DiffuseLighting,
   SpecularLighting,
   ToAlpha,
   Max
-MOZ_END_ENUM_CLASS(PrimitiveType)
+};
 
 /**
  * A data structure to carry attributes for a given primitive that's part of a
  * filter. Will be serializable via IPDL, so it must not contain complex
  * functionality.
  * Used as part of a FilterDescription.
  */
 class FilterPrimitiveDescription MOZ_FINAL {
--- a/gfx/src/nsRegion.h
+++ b/gfx/src/nsRegion.h
@@ -35,22 +35,22 @@ class gfx3DMatrix;
  * representation. This means that nsIntRegion will have more predictable
  * performance characteristics than the old nsRegion and should not become
  * degenerate.
  *
  * The pixman region code originates from X11 which has spread to a variety of
  * projects including Qt, Gtk, Wine. It should perform reasonably well.
  */
 
-MOZ_BEGIN_ENUM_CLASS(VisitSide)
+enum class VisitSide {
 	TOP,
 	BOTTOM,
 	LEFT,
 	RIGHT
-MOZ_END_ENUM_CLASS(VisitSide)
+};
 
 class nsRegionRectIterator;
 
 class nsRegion
 {
 
   friend class nsRegionRectIterator;
 
--- a/gfx/thebes/DrawMode.h
+++ b/gfx/thebes/DrawMode.h
@@ -4,24 +4,24 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef DrawMode_h
 #define DrawMode_h
 
 #include "mozilla/TypedEnum.h"
 
 // Options for how the text should be drawn
-MOZ_BEGIN_ENUM_CLASS(DrawMode, int)
+enum class DrawMode : int {
   // GLYPH_FILL and GLYPH_STROKE draw into the current context
   //  and may be used together with bitwise OR.
   GLYPH_FILL = 1,
   // Note: using GLYPH_STROKE will destroy the current path.
   GLYPH_STROKE = 2,
   // Appends glyphs to the current path. Can NOT be used with
   //  GLYPH_FILL or GLYPH_STROKE.
   GLYPH_PATH = 4,
   // When GLYPH_FILL and GLYPH_STROKE are both set, draws the
   //  stroke underneath the fill.
   GLYPH_STROKE_UNDERNEATH = 8
-MOZ_END_ENUM_CLASS(DrawMode)
+};
 
 #endif
 
--- a/gfx/thebes/GraphicsFilter.h
+++ b/gfx/thebes/GraphicsFilter.h
@@ -3,20 +3,20 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef GraphicsFilter_h
 #define GraphicsFilter_h
 
 #include "mozilla/TypedEnum.h"
 
-MOZ_BEGIN_ENUM_CLASS(GraphicsFilter, int)
+enum class GraphicsFilter : int {
   FILTER_FAST,
   FILTER_GOOD,
   FILTER_BEST,
   FILTER_NEAREST,
   FILTER_BILINEAR,
   FILTER_GAUSSIAN,
   FILTER_SENTINEL
-MOZ_END_ENUM_CLASS(GraphicsFilter)
+};
 
 #endif
 
--- a/gfx/thebes/gfxTypes.h
+++ b/gfx/thebes/gfxTypes.h
@@ -34,36 +34,36 @@ typedef double gfxFloat;
  *                    punctuation break and whitespace break (bug 389710).
  *                   As and when we implement it, text-wrap: unrestricted will
  *                    mean that priorities are ignored and all line-break
  *                    opportunities are equal.
  *
  * @see gfxTextRun::BreakAndMeasureText
  * @see nsLineLayout::NotifyOptionalBreakPosition
  */
-MOZ_BEGIN_ENUM_CLASS(gfxBreakPriority)
+enum class gfxBreakPriority {
   eNoBreak       = 0,
   eWordWrapBreak,
   eNormalBreak
-MOZ_END_ENUM_CLASS(gfxBreakPriority)
+};
 
 /**
   * The format for an image surface. For all formats with alpha data, 0
   * means transparent, 1 or 255 means fully opaque.
   */
-MOZ_BEGIN_ENUM_CLASS(gfxImageFormat)
+enum class gfxImageFormat {
   ARGB32, ///< ARGB data in native endianness, using premultiplied alpha
   RGB24,  ///< xRGB data in native endianness
   A8,     ///< Only an alpha channel
   A1,     ///< Packed transparency information (one byte refers to 8 pixels)
   RGB16_565,  ///< RGB_565 data in native endianness
   Unknown
-MOZ_END_ENUM_CLASS(gfxImageFormat)
+};
 
-MOZ_BEGIN_ENUM_CLASS(gfxSurfaceType)
+enum class gfxSurfaceType {
   Image,
   PDF,
   PS,
   Xlib,
   Xcb,
   Glitz,           // unused, but needed for cairo parity
   Quartz,
   Win32,
@@ -80,29 +80,29 @@ MOZ_BEGIN_ENUM_CLASS(gfxSurfaceType)
   GL,
   DRM,
   Tee,
   XML,
   Skia,
   Subsurface,
   D2D,
   Max
-MOZ_END_ENUM_CLASS(gfxSurfaceType)
+};
 
-MOZ_BEGIN_ENUM_CLASS(gfxContentType)
+enum class gfxContentType {
   COLOR       = 0x1000,
   ALPHA       = 0x2000,
   COLOR_ALPHA = 0x3000,
   SENTINEL    = 0xffff
-MOZ_END_ENUM_CLASS(gfxContentType)
+};
 
 /**
   * The memory used by a gfxASurface (as reported by KnownMemoryUsed()) can
   * either live in this process's heap, in this process but outside the
   * heap, or in another process altogether.
   */
-MOZ_BEGIN_ENUM_CLASS(gfxMemoryLocation)
+enum class gfxMemoryLocation {
   IN_PROCESS_HEAP,
   IN_PROCESS_NONHEAP,
   OUT_OF_PROCESS
-MOZ_END_ENUM_CLASS(gfxMemoryLocation)
+};
 
 #endif /* GFX_TYPES_H */
--- a/gfx/thebes/gfxVR.h
+++ b/gfx/thebes/gfxVR.h
@@ -12,20 +12,20 @@
 #include "nsRefPtr.h"
 
 #include "mozilla/gfx/2D.h"
 #include "mozilla/EnumeratedArray.h"
 
 namespace mozilla {
 namespace gfx {
 
-MOZ_BEGIN_ENUM_CLASS(VRHMDType, uint16_t)
+enum class VRHMDType : uint16_t {
   Oculus,
   NumHMDTypes
-MOZ_END_ENUM_CLASS(VRHMDType)
+};
 
 struct VRFieldOfView {
   static VRFieldOfView FromCSSPerspectiveInfo(double aPerspectiveDistance,
                                               const Point& aPerspectiveOrigin,
                                               const Point& aTransformOrigin,
                                               const Rect& aContentRectangle)
   {
     /**/
--- a/image/decoders/EXIF.h
+++ b/image/decoders/EXIF.h
@@ -10,21 +10,21 @@
 #include "mozilla/TypedEnum.h"
 #include "nsDebug.h"
 
 #include "Orientation.h"
 
 namespace mozilla {
 namespace image {
 
-MOZ_BEGIN_ENUM_CLASS(ByteOrder, uint8_t)
+enum class ByteOrder : uint8_t {
   Unknown,
   LittleEndian,
   BigEndian
-MOZ_END_ENUM_CLASS(ByteOrder)
+};
 
 struct EXIFData
 {
   EXIFData() { }
   explicit EXIFData(Orientation aOrientation) : orientation(aOrientation) { }
 
   const Orientation orientation;
 };
--- a/image/src/Orientation.h
+++ b/image/src/Orientation.h
@@ -7,27 +7,27 @@
 #define MOZILLA_IMAGELIB_ORIENTATION_H_
 
 #include <stdint.h>
 #include "mozilla/TypedEnum.h"
 
 namespace mozilla {
 namespace image {
 
-MOZ_BEGIN_ENUM_CLASS(Angle, uint8_t)
+enum class Angle : uint8_t {
   D0,
   D90,
   D180,
   D270
-MOZ_END_ENUM_CLASS(Angle)
+};
 
-MOZ_BEGIN_ENUM_CLASS(Flip, uint8_t)
+enum class Flip : uint8_t {
   Unflipped,
   Horizontal
-MOZ_END_ENUM_CLASS(Flip)
+};
 
 /**
  * A struct that describes an image's orientation as a rotation optionally
  * followed by a reflection. This may be used to be indicate an image's inherent
  * orientation or a desired orientation for the image.
  */
 struct Orientation
 {
--- a/image/src/RasterImage.h
+++ b/image/src/RasterImage.h
@@ -128,21 +128,21 @@ class Image;
 }
 
 namespace image {
 
 class Decoder;
 class FrameAnimator;
 class SourceBuffer;
 
-MOZ_BEGIN_ENUM_CLASS(DecodeStrategy, uint8_t)
+enum class DecodeStrategy : uint8_t {
   ASYNC,
   SYNC_FOR_SMALL_IMAGES,
   SYNC_IF_POSSIBLE
-MOZ_END_ENUM_CLASS(DecodeStrategy)
+};
 
 class RasterImage MOZ_FINAL : public ImageResource
                             , public nsIProperties
                             , public SupportsWeakPtr<RasterImage>
 #ifdef DEBUG
                             , public imgIContainerDebug
 #endif
 {
--- a/image/src/SurfaceCache.h
+++ b/image/src/SurfaceCache.h
@@ -112,26 +112,26 @@ VectorSurfaceKey(const gfx::IntSize& aSi
                  float aAnimationTime)
 {
   // We don't care about aFlags for VectorImage because none of the flags we
   // have right now influence VectorImage's rendering. If we add a new flag that
   // *does* affect how a VectorImage renders, we'll have to change this.
   return SurfaceKey(aSize, aSVGContext, aAnimationTime, 0);
 }
 
-MOZ_BEGIN_ENUM_CLASS(Lifetime, uint8_t)
+enum class Lifetime : uint8_t {
   Transient,
   Persistent
-MOZ_END_ENUM_CLASS(Lifetime)
+};
 
-MOZ_BEGIN_ENUM_CLASS(InsertOutcome, uint8_t)
+enum class InsertOutcome : uint8_t {
   SUCCESS,                 // Success (but see Insert documentation).
   FAILURE,                 // Couldn't insert (e.g., for capacity reasons).
   FAILURE_ALREADY_PRESENT  // A surface with the same key is already present.
-MOZ_END_ENUM_CLASS(InsertOutcome)
+};
 
 /**
  * SurfaceCache is an imagelib-global service that allows caching of temporary
  * surfaces. Surfaces normally expire from the cache automatically if they go
  * too long without being accessed.
  *
  * SurfaceCache does not hold surfaces directly; instead, it holds imgFrame
  * objects, which hold surfaces but also layer on additional features specific
--- a/image/src/imgFrame.h
+++ b/image/src/imgFrame.h
@@ -18,38 +18,38 @@
 
 namespace mozilla {
 namespace image {
 
 class ImageRegion;
 class DrawableFrameRef;
 class RawAccessFrameRef;
 
-MOZ_BEGIN_ENUM_CLASS(BlendMethod, int8_t)
+enum class BlendMethod : int8_t {
   // All color components of the frame, including alpha, overwrite the current
   // contents of the frame's output buffer region.
   SOURCE,
 
   // The frame should be composited onto the output buffer based on its alpha,
   // using a simple OVER operation.
   OVER
-MOZ_END_ENUM_CLASS(BlendMethod)
+};
 
-MOZ_BEGIN_ENUM_CLASS(DisposalMethod, int8_t)
+enum class DisposalMethod : int8_t {
   CLEAR_ALL = -1,  // Clear the whole image, revealing what's underneath.
   NOT_SPECIFIED,   // Leave the frame and let the new frame draw on top.
   KEEP,            // Leave the frame and let the new frame draw on top.
   CLEAR,           // Clear the frame's area, revealing what's underneath.
   RESTORE_PREVIOUS // Restore the previous (composited) frame.
-MOZ_END_ENUM_CLASS(DisposalMethod)
+};
 
-MOZ_BEGIN_ENUM_CLASS(Opacity, uint8_t)
+enum class Opacity : uint8_t {
   OPAQUE,
   SOME_TRANSPARENCY
-MOZ_END_ENUM_CLASS(Opacity)
+};
 
 
 /**
  * AnimationData contains all of the information necessary for using an imgFrame
  * as part of an animation.
  *
  * It includes pointers to the raw image data of the underlying imgFrame, but
  * does not own that data. A RawAccessFrameRef for the underlying imgFrame must
--- a/image/src/imgLoader.h
+++ b/image/src/imgLoader.h
@@ -201,20 +201,20 @@ public:
   const_iterator end() const;
 
 private:
   queueContainer mQueue;
   bool mDirty;
   uint32_t mSize;
 };
 
-MOZ_BEGIN_ENUM_CLASS(AcceptedMimeTypes, uint8_t)
+enum class AcceptedMimeTypes : uint8_t {
   IMAGES,
   IMAGES_AND_DOCUMENTS,
-MOZ_END_ENUM_CLASS(AcceptedMimeTypes)
+};
 
 class imgLoader MOZ_FINAL : public imgILoader,
                             public nsIContentSniffer,
                             public imgICache,
                             public nsSupportsWeakReference,
                             public nsIObserver
 {
   virtual ~imgLoader();
--- a/js/src/frontend/FoldConstants.cpp
+++ b/js/src/frontend/FoldConstants.cpp
@@ -247,29 +247,29 @@ Boolish(ParseNode *pn)
 
       default:
         return Unknown;
     }
 }
 
 // Expressions that appear in a few specific places are treated specially
 // during constant folding. This enum tells where a parse node appears.
-MOZ_BEGIN_ENUM_CLASS(SyntacticContext, int)
+enum class SyntacticContext : int {
     // pn is an expression, and it appears in a context where only its side
     // effects and truthiness matter: the condition of an if statement,
     // conditional expression, while loop, or for(;;) loop; or an operand of &&
     // or || in such a context.
     Condition,
 
     // pn is the operand of the 'delete' keyword.
     Delete,
 
     // Any other syntactic context.
     Other
-MOZ_END_ENUM_CLASS(SyntacticContext)
+};
 
 static SyntacticContext
 condIf(const ParseNode *pn, ParseNodeKind kind)
 {
     return pn->isKind(kind) ? SyntacticContext::Condition : SyntacticContext::Other;
 }
 
 static bool
--- a/js/src/jit/IonTypes.h
+++ b/js/src/jit/IonTypes.h
@@ -627,25 +627,25 @@ enum ABIFunctionType
         (ArgType_General << (ArgType_Shift * 2)),
 
     // int f(int, double)
     Args_Int_IntDouble = Args_General0 |
         (ArgType_Double << (ArgType_Shift * 1)) |
         (ArgType_General << (ArgType_Shift * 2))
 };
 
-MOZ_BEGIN_ENUM_CLASS(BarrierKind, uint32_t)
+enum class BarrierKind : uint32_t {
     // No barrier is needed.
     NoBarrier,
 
     // The barrier only has to check the value's type tag is in the TypeSet.
     // Specific object types don't have to be checked.
     TypeTagOnly,
 
     // Check if the value is in the TypeSet, including the object type if it's
     // an object.
     TypeSet
-MOZ_END_ENUM_CLASS(BarrierKind)
+};
 
 } // namespace jit
 } // namespace js
 
 #endif /* jit_IonTypes_h */
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -4475,21 +4475,21 @@ GetSymbolFor(JSContext *cx, HandleString
  *
  * This function is infallible. If it returns null, that means the symbol's
  * [[Description]] is undefined.
  */
 JS_PUBLIC_API(JSString *)
 GetSymbolDescription(HandleSymbol symbol);
 
 /* Well-known symbols. */
-MOZ_BEGIN_ENUM_CLASS(SymbolCode, uint32_t)
+enum class SymbolCode : uint32_t {
     iterator,                       // well-known Symbol.iterator
     InSymbolRegistry = 0xfffffffe,  // created by Symbol.for() or JS::GetSymbolFor()
     UniqueSymbol = 0xffffffff       // created by Symbol() or JS::NewSymbol()
-MOZ_END_ENUM_CLASS(SymbolCode)
+};
 
 /* For use in loops that iterate over the well-known symbols. */
 const size_t WellKnownSymbolLimit = 1;
 
 /*
  * Return the SymbolCode telling what sort of symbol `symbol` is.
  *
  * A symbol's SymbolCode never changes once it is created.
--- a/layout/base/UnitTransforms.h
+++ b/layout/base/UnitTransforms.h
@@ -14,29 +14,29 @@ namespace mozilla {
 
 // Convenience functions for converting an entity from one strongly-typed
 // coordinate system to another without changing the values it stores (this
 // can be thought of as a cast).
 // To use these functions, you must provide a justification for each use!
 // Feel free to add more justifications to PixelCastJustification, along with
 // a comment that explains under what circumstances it is appropriate to use.
 
-MOZ_BEGIN_ENUM_CLASS(PixelCastJustification, uint8_t)
+enum class PixelCastJustification : uint8_t {
   // For the root layer, Screen Pixel = Parent Layer Pixel.
   ScreenIsParentLayerForRoot,
   // For the root composition size we want to view it as layer pixels in any layer
   ParentLayerToLayerForRootComposition,
   // The Layer coordinate space for one layer is the ParentLayer coordinate
   // space for its children
   MovingDownToChildren,
   // The transform that is usually used to convert between two coordinate
   // systems is not available (for example, because the object that stores it
   // is being destroyed), so fall back to the identity.
   TransformNotAvailable
-MOZ_END_ENUM_CLASS(PixelCastJustification)
+};
 
 template <class TargetUnits, class SourceUnits>
 gfx::SizeTyped<TargetUnits> ViewAs(const gfx::SizeTyped<SourceUnits>& aSize, PixelCastJustification) {
   return gfx::SizeTyped<TargetUnits>(aSize.width, aSize.height);
 }
 template <class TargetUnits, class SourceUnits>
 gfx::IntSizeTyped<TargetUnits> ViewAs(const gfx::IntSizeTyped<SourceUnits>& aSize, PixelCastJustification) {
   return gfx::IntSizeTyped<TargetUnits>(aSize.width, aSize.height);
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -311,20 +311,20 @@ typedef uint32_t nsReflowStatus;
 void NS_MergeReflowStatusInto(nsReflowStatus* aPrimary,
                               nsReflowStatus aSecondary);
 
 //----------------------------------------------------------------------
 
 /**
  * DidReflow status values.
  */
-MOZ_BEGIN_ENUM_CLASS(nsDidReflowStatus, uint32_t)
+enum class nsDidReflowStatus : uint32_t {
   NOT_FINISHED,
   FINISHED
-MOZ_END_ENUM_CLASS(nsDidReflowStatus)
+};
 
 /**
  * When there is no scrollable overflow rect, the visual overflow rect
  * may be stored as four 1-byte deltas each strictly LESS THAN 0xff, for
  * the four edges of the rectangle, or the four bytes may be read as a
  * single 32-bit "overflow-rect type" value including at least one 0xff
  * byte as an indicator that the value does NOT represent four deltas.
  * If all four deltas are zero, this means that no overflow rect has
--- a/layout/style/nsCSSParser.cpp
+++ b/layout/style/nsCSSParser.cpp
@@ -69,24 +69,24 @@ nsCSSProps::kParserVariantTable[eCSSProp
 // in the grid-template-columns and grid-template-rows properties,
 // to limit high memory usage from small stylesheets.
 // Must be a positive integer. Should be large-ish.
 #define GRID_TEMPLATE_MAX_REPETITIONS 10000
 
 // End-of-array marker for mask arguments to ParseBitmaskValues
 #define MASK_END_VALUE  (-1)
 
-MOZ_BEGIN_ENUM_CLASS(CSSParseResult, int32_t)
+enum class CSSParseResult : int32_t {
   // Parsed something successfully:
   Ok,
   // Did not find what we were looking for, but did not consume any token:
   NotFound,
   // Unexpected token or token value, too late for UngetToken() to be enough:
   Error
-MOZ_END_ENUM_CLASS(CSSParseResult)
+};
 
 namespace {
 
 // Rule processing function
 typedef void (* RuleAppendFunc) (css::Rule* aRule, void* aData);
 static void AssignRuleToPointer(css::Rule* aRule, void* aPointer);
 static void AppendRuleToSheet(css::Rule* aRule, void* aParser);
 
--- a/layout/style/nsCSSRuleProcessor.cpp
+++ b/layout/style/nsCSSRuleProcessor.cpp
@@ -1402,34 +1402,34 @@ struct NodeMatchContext {
   {
   }
 };
 
 /**
  * Additional information about a selector (without combinators) that is
  * being matched.
  */
-MOZ_BEGIN_ENUM_CLASS(SelectorMatchesFlags, uint8_t)
+enum class SelectorMatchesFlags : uint8_t {
   NONE = 0,
 
   // The selector's flags are unknown.  This happens when you don't know
   // if you're starting from the top of a selector.  Only used in cases
   // where it's acceptable for matching to return a false positive.
   // (It's not OK to return a false negative.)
   UNKNOWN = 1 << 0,
 
   // The selector is part of a compound selector which has been split in
   // half, where the other half is a pseudo-element.  The current
   // selector is not a pseudo-element itself.
   HAS_PSEUDO_ELEMENT = 1 << 1,
 
   // The selector is part of an argument to a functional pseudo-class or
   // pseudo-element.
   IS_PSEUDO_CLASS_ARGUMENT = 1 << 2
-MOZ_END_ENUM_CLASS(SelectorMatchesFlags)
+};
 MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS(SelectorMatchesFlags)
 
 static bool ValueIncludes(const nsSubstring& aValueList,
                             const nsSubstring& aValue,
                             const nsStringComparator& aComparator)
 {
   const char16_t *p = aValueList.BeginReading(),
               *p_end = aValueList.EndReading();
--- a/mfbt/EnumeratedArray.h
+++ b/mfbt/EnumeratedArray.h
@@ -22,21 +22,21 @@ namespace mozilla {
  * This provides type safety by guarding at compile time against accidentally
  * indexing such arrays with unrelated values. This also removes the need
  * for manual casting when using a typed enum value to index arrays.
  *
  * Aside from the typing of indices, EnumeratedArray is similar to Array.
  *
  * Example:
  *
- *   MOZ_BEGIN_ENUM_CLASS(AnimalSpecies)
+ *   enum class AnimalSpecies {
  *     Cow,
  *     Sheep,
  *     Count
- *   MOZ_END_ENUM_CLASS(AnimalSpecies)
+ *   };
  *
  *   EnumeratedArray<AnimalSpecies, AnimalSpecies::Count, int> headCount;
  *
  *   headCount[AnimalSpecies::Cow] = 17;
  *   headCount[AnimalSpecies::Sheep] = 30;
  *
  */
 template<typename IndexType,
--- a/mfbt/tests/TestTypedEnum.cpp
+++ b/mfbt/tests/TestTypedEnum.cpp
@@ -50,39 +50,39 @@ RequireLiteralType()
 
 template<typename T>
 void
 RequireLiteralType(const T&)
 {
   RequireLiteralType<T>();
 }
 
-MOZ_BEGIN_ENUM_CLASS(AutoEnum)
+enum class AutoEnum {
   A,
   B = -3,
   C
-MOZ_END_ENUM_CLASS(AutoEnum)
+};
 
-MOZ_BEGIN_ENUM_CLASS(CharEnum, char)
+enum class CharEnum : char {
   A,
   B = 3,
   C
-MOZ_END_ENUM_CLASS(CharEnum)
+};
 
-MOZ_BEGIN_ENUM_CLASS(AutoEnumBitField)
+enum class AutoEnumBitField {
   A = 0x10,
   B = 0x20,
   C
-MOZ_END_ENUM_CLASS(AutoEnumBitField)
+};
 
-MOZ_BEGIN_ENUM_CLASS(CharEnumBitField, char)
+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
   MOZ_END_NESTED_ENUM_CLASS(AutoEnum)
@@ -107,21 +107,21 @@ struct Nested
 };
 
 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)             \
+  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)
@@ -438,62 +438,62 @@ void TestNoConversionsBetweenUnrelatedTy
                 "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)
+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)
+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)
+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)
+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)
+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)
+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)
+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)
+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;
--- a/widget/android/NativeJSContainer.cpp
+++ b/widget/android/NativeJSContainer.cpp
@@ -640,20 +640,20 @@ struct HasProperty
     }
 
     static Type FromValue(JNIEnv* env, jobject instance,
                           JSContext* cx, JS::HandleValue val) {
         return JNI_TRUE;
     }
 };
 
-MOZ_BEGIN_ENUM_CLASS(FallbackOption)
+enum class FallbackOption {
     THROW,
     RETURN,
-MOZ_END_ENUM_CLASS(FallbackOption)
+};
 
 template <class Property>
 typename Property::Type
 GetProperty(JNIEnv* env, jobject instance, jstring name,
             FallbackOption option = FallbackOption::THROW,
             typename Property::Type fallback = typename Property::Type())
 {
     MOZ_ASSERT(env);
--- a/widget/cocoa/VibrancyManager.h
+++ b/widget/cocoa/VibrancyManager.h
@@ -17,21 +17,21 @@
 
 @class NSColor;
 @class NSView;
 class nsChildView;
 class nsIntRegion;
 
 namespace mozilla {
 
-MOZ_BEGIN_ENUM_CLASS(VibrancyType)
+enum class VibrancyType {
   LIGHT,
   DARK,
   TOOLTIP
-MOZ_END_ENUM_CLASS(VibrancyType)
+};
 
 /**
  * VibrancyManager takes care of updating the vibrant regions of a window.
  * Vibrancy is a visual look that was introduced on OS X starting with 10.10.
  * An app declares vibrant window regions to the window server, and the window
  * server will display a blurred rendering of the screen contents from behind
  * the window in these areas, behind the actual window contents. Consequently,
  * the effect is only visible in areas where the window contents are not