Bug 1027763, part 2 - Make non-Moz2D callers of DrawTarget::GetType() call DrawTarget::GetBackendType() instead. r=Bas
authorJonathan Watt <jwatt@jwatt.org>
Thu, 19 Jun 2014 21:35:33 +0100
changeset 210495 4c3c8d6368f386255bcc2de53aa009587b31f076
parent 210494 157bfd025602803937ceeed1dcadc19244bbbe14
child 210496 002ba7646333a658535d1da4467bff2fa1649876
push id3857
push userraliiev@mozilla.com
push dateTue, 02 Sep 2014 16:39:23 +0000
treeherdermozilla-beta@5638b907b505 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersBas
bugs1027763
milestone33.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 1027763, part 2 - Make non-Moz2D callers of DrawTarget::GetType() call DrawTarget::GetBackendType() instead. r=Bas
content/canvas/src/CanvasGradient.h
content/canvas/src/CanvasRenderingContext2D.cpp
gfx/gl/GLTextureImage.cpp
gfx/layers/RotatedBuffer.cpp
gfx/thebes/gfxBlur.cpp
gfx/thebes/gfxContext.cpp
gfx/thebes/gfxDWriteFonts.cpp
gfx/thebes/gfxFont.cpp
gfx/thebes/gfxGradientCache.cpp
gfx/thebes/gfxPlatform.cpp
gfx/thebes/gfxPlatformMac.cpp
gfx/thebes/gfxQuartzNativeDrawing.cpp
gfx/thebes/gfxWindowsNativeDrawing.cpp
gfx/thebes/gfxWindowsPlatform.cpp
layout/base/FrameLayerBuilder.cpp
--- a/content/canvas/src/CanvasGradient.h
+++ b/content/canvas/src/CanvasGradient.h
@@ -31,17 +31,17 @@ public:
   Type GetType()
   {
     return mType;
   }
 
   mozilla::gfx::GradientStops *
   GetGradientStopsForTarget(mozilla::gfx::DrawTarget *aRT)
   {
-    if (mStops && mStops->GetBackendType() == aRT->GetType()) {
+    if (mStops && mStops->GetBackendType() == aRT->GetBackendType()) {
       return mStops;
     }
 
     mStops =
       gfx::gfxGradientCache::GetOrCreateGradientStops(aRT,
                                                       mRawStops,
                                                       gfx::ExtendMode::CLAMP);
 
--- a/content/canvas/src/CanvasRenderingContext2D.cpp
+++ b/content/canvas/src/CanvasRenderingContext2D.cpp
@@ -4561,33 +4561,33 @@ TemporaryRef<gfx::Path>
 CanvasPath::GetPath(const CanvasWindingRule& winding, const DrawTarget* aTarget) const
 {
   FillRule fillRule = FillRule::FILL_WINDING;
   if (winding == CanvasWindingRule::Evenodd) {
     fillRule = FillRule::FILL_EVEN_ODD;
   }
 
   if (mPath &&
-      (mPath->GetBackendType() == aTarget->GetType()) &&
+      (mPath->GetBackendType() == aTarget->GetBackendType()) &&
       (mPath->GetFillRule() == fillRule)) {
     return mPath;
   }
 
   if (!mPath) {
     // if there is no path, there must be a pathbuilder
     MOZ_ASSERT(mPathBuilder);
     mPath = mPathBuilder->Finish();
     if (!mPath)
       return mPath;
 
     mPathBuilder = nullptr;
   }
 
   // retarget our backend if we're used with a different backend
-  if (mPath->GetBackendType() != aTarget->GetType()) {
+  if (mPath->GetBackendType() != aTarget->GetBackendType()) {
     RefPtr<PathBuilder> tmpPathBuilder = aTarget->CreatePathBuilder(fillRule);
     mPath->StreamToSink(tmpPathBuilder);
     mPath = tmpPathBuilder->Finish();
   } else if (mPath->GetFillRule() != fillRule) {
     RefPtr<PathBuilder> tmpPathBuilder = mPath->CopyToBuilder(fillRule);
     mPath = tmpPathBuilder->Finish();
   }
 
--- a/gfx/gl/GLTextureImage.cpp
+++ b/gfx/gl/GLTextureImage.cpp
@@ -528,17 +528,17 @@ TiledTextureImage::EndUpdate()
 
         nsIntRegion subregion;
         subregion.And(mUpdateRegion, imageRect);
         if (subregion.IsEmpty())
             continue;
         subregion.MoveBy(-xPos, -yPos); // Tile-local space
         // copy tile from temp target
         gfx::DrawTarget* drawTarget = mImages[i]->BeginUpdate(subregion);
-        MOZ_ASSERT(drawTarget->GetType() == BackendType::CAIRO,
+        MOZ_ASSERT(drawTarget->GetBackendType() == BackendType::CAIRO,
                    "updateSnapshot should not have been converted to data");
         gfxUtils::ClipToRegion(drawTarget, subregion);
         Size size(updateData->GetSize().width,
                   updateData->GetSize().height);
         drawTarget->DrawSurface(updateData,
                                 Rect(Point(-xPos, -yPos), size),
                                 Rect(Point(0, 0), size),
                                 DrawSurfaceOptions(),
--- a/gfx/layers/RotatedBuffer.cpp
+++ b/gfx/layers/RotatedBuffer.cpp
@@ -95,17 +95,17 @@ RotatedBuffer::DrawBufferQuadrant(gfx::D
 
   gfx::Point quadrantTranslation(quadrantRect.x, quadrantRect.y);
 
   // direct2d is much slower when using OP_SOURCE so use OP_OVER and
   // (maybe) a clear instead. Normally we need to draw in a single operation
   // (to avoid flickering) but direct2d is ok since it defers rendering.
   // We should try abstract this logic in a helper when we have other use
   // cases.
-  if (aTarget->GetType() == BackendType::DIRECT2D && aOperator == CompositionOp::OP_SOURCE) {
+  if (aTarget->GetBackendType() == BackendType::DIRECT2D && aOperator == CompositionOp::OP_SOURCE) {
     aOperator = CompositionOp::OP_OVER;
     if (mDTBuffer->GetFormat() == SurfaceFormat::B8G8R8A8) {
       aTarget->ClearRect(ToRect(fillRect));
     }
   }
 
   RefPtr<gfx::SourceSurface> snapshot;
   if (aSource == BUFFER_BLACK) {
@@ -707,18 +707,18 @@ RotatedContentBuffer::BorrowDrawTargetFo
   }
   nsIntRegion* drawPtr = &aPaintState.mRegionToDraw;
   if (aIter) {
     // The iterators draw region currently only contains the bounds of the region,
     // this makes it the precise region.
     aIter->mDrawRegion.And(aIter->mDrawRegion, aPaintState.mRegionToDraw);
     drawPtr = &aIter->mDrawRegion;
   }
-  if (result->GetType() == BackendType::DIRECT2D ||
-      result->GetType() == BackendType::DIRECT2D1_1) {
+  if (result->GetBackendType() == BackendType::DIRECT2D ||
+      result->GetBackendType() == BackendType::DIRECT2D1_1) {
     drawPtr->SimplifyOutwardByArea(100 * 100);
   }
 
   if (aPaintState.mMode == SurfaceMode::SURFACE_COMPONENT_ALPHA) {
     MOZ_ASSERT(mDTBuffer && mDTBufferOnWhite);
     nsIntRegionRectIterator iter(*drawPtr);
     const nsIntRect *iterRect;
     while ((iterRect = iter.Next())) {
--- a/gfx/thebes/gfxBlur.cpp
+++ b/gfx/thebes/gfxBlur.cpp
@@ -317,17 +317,19 @@ GetCachedBlur(DrawTarget *aDT,
               const gfxIntSize& aBlurRadius,
               const gfxRect& aSkipRect,
               const gfxRect& aDirtyRect,
               IntPoint* aTopLeft)
 {
   if (!gBlurCache) {
     gBlurCache = new BlurCache();
   }
-  BlurCacheData* cached = gBlurCache->Lookup(aRect, aBlurRadius, aSkipRect, aDT->GetType(), &aDirtyRect);
+  BlurCacheData* cached = gBlurCache->Lookup(aRect, aBlurRadius, aSkipRect,
+                                             aDT->GetBackendType(),
+                                             &aDirtyRect);
   if (cached) {
     *aTopLeft = cached->mTopLeft;
     return cached->mBlur;
   }
   return nullptr;
 }
 
 void
@@ -336,24 +338,26 @@ CacheBlur(DrawTarget *aDT,
           const gfxIntSize& aBlurRadius,
           const gfxRect& aSkipRect,
           SourceSurface* aBlur,
           const IntPoint& aTopLeft,
           const gfxRect& aDirtyRect)
 {
   // If we already had a cached value with this key, but an incorrect dirty region then just update
   // the existing entry
-  if (BlurCacheData* cached = gBlurCache->Lookup(aRect, aBlurRadius, aSkipRect, aDT->GetType(), nullptr)) {
+  if (BlurCacheData* cached = gBlurCache->Lookup(aRect, aBlurRadius, aSkipRect,
+                                                 aDT->GetBackendType(),
+                                                 nullptr)) {
     cached->mBlur = aBlur;
     cached->mTopLeft = aTopLeft;
     cached->mDirtyRect = aDirtyRect;
     return;
   }
 
-  BlurCacheKey key(aRect, aBlurRadius, aSkipRect, aDT->GetType());
+  BlurCacheKey key(aRect, aBlurRadius, aSkipRect, aDT->GetBackendType());
   BlurCacheData* data = new BlurCacheData(aBlur, aTopLeft, aDirtyRect, key);
   if (!gBlurCache->RegisterEntry(data)) {
     delete data;
   }
 }
 
 void
 gfxAlphaBoxBlur::ShutdownBlurCache()
--- a/gfx/thebes/gfxContext.cpp
+++ b/gfx/thebes/gfxContext.cpp
@@ -150,17 +150,17 @@ gfxContext::~gfxContext()
 
 gfxASurface *
 gfxContext::OriginalSurface()
 {
     if (mCairo || mSurface) {
         return mSurface;
     }
 
-    if (mOriginalDT && mOriginalDT->GetType() == BackendType::CAIRO) {
+    if (mOriginalDT && mOriginalDT->GetBackendType() == BackendType::CAIRO) {
         cairo_surface_t *s =
             (cairo_surface_t*)mOriginalDT->GetNativeSurface(NativeSurfaceType::CAIRO_SURFACE);
         if (s) {
             mSurface = gfxASurface::Wrap(s);
             return mSurface;
         }
     }
     return nullptr;
@@ -177,17 +177,17 @@ gfxContext::CurrentSurface(gfxFloat *dx,
         nsRefPtr<gfxASurface> ret = mSurface;
         return ret.forget();
     }
 
     if (dx && dy)
         cairo_surface_get_device_offset(s, dx, dy);
     return gfxASurface::Wrap(s);
   } else {
-    if (mDT->GetType() == BackendType::CAIRO) {
+    if (mDT->GetBackendType() == BackendType::CAIRO) {
         cairo_surface_t *s =
             (cairo_surface_t*)mDT->GetNativeSurface(NativeSurfaceType::CAIRO_SURFACE);
         if (s) {
             if (dx && dy) {
                 *dx = -CurrentState().deviceOffset.x;
                 *dy = -CurrentState().deviceOffset.y;
             }
             return gfxASurface::Wrap(s);
@@ -204,17 +204,17 @@ gfxContext::CurrentSurface(gfxFloat *dx,
 
 cairo_t *
 gfxContext::GetCairo()
 {
   if (mCairo) {
     return mCairo;
   }
 
-  if (mDT->GetType() == BackendType::CAIRO) {
+  if (mDT->GetBackendType() == BackendType::CAIRO) {
     cairo_t *ctx =
       (cairo_t*)mDT->GetNativeSurface(NativeSurfaceType::CAIRO_CONTEXT);
     if (ctx) {
       return ctx;
     }
   }
 
   if (mRefCairo) {
@@ -303,17 +303,17 @@ already_AddRefed<gfxPath> gfxContext::Co
 void gfxContext::SetPath(gfxPath* path)
 {
   if (mCairo) {
     cairo_new_path(mCairo);
     if (path->mPath->status == CAIRO_STATUS_SUCCESS && path->mPath->num_data != 0)
         cairo_append_path(mCairo, path->mPath);
   } else {
     MOZ_ASSERT(path->mMoz2DPath, "Can't mix cairo and azure paths!");
-    MOZ_ASSERT(path->mMoz2DPath->GetBackendType() == mDT->GetType());
+    MOZ_ASSERT(path->mMoz2DPath->GetBackendType() == mDT->GetBackendType());
     mPath = path->mMoz2DPath;
     mPathBuilder = nullptr;
     mPathIsRect = false;
     mTransformChanged = false;
   }
 }
 
 gfxPoint
--- a/gfx/thebes/gfxDWriteFonts.cpp
+++ b/gfx/thebes/gfxDWriteFonts.cpp
@@ -705,17 +705,17 @@ gfxDWriteFont::AddSizeOfIncludingThis(Ma
 {
     aSizes->mFontInstances += aMallocSizeOf(this);
     AddSizeOfExcludingThis(aMallocSizeOf, aSizes);
 }
 
 TemporaryRef<ScaledFont>
 gfxDWriteFont::GetScaledFont(mozilla::gfx::DrawTarget *aTarget)
 {
-  bool wantCairo = aTarget->GetType() == BackendType::CAIRO;
+  bool wantCairo = aTarget->GetBackendType() == BackendType::CAIRO;
   if (mAzureScaledFont && mAzureScaledFontIsCairo == wantCairo) {
     return mAzureScaledFont;
   }
 
   NativeFont nativeFont;
   nativeFont.mType = NativeFontType::DWRITE_FONT_FACE;
   nativeFont.mFont = GetFontFace();
 
--- a/gfx/thebes/gfxFont.cpp
+++ b/gfx/thebes/gfxFont.cpp
@@ -2947,17 +2947,18 @@ struct GlyphBufferAzure {
             } else {
                 aDT->FillGlyphs(aFont, buf, ColorPattern(state.color),
                                 aDrawOptions, aOptions);
             }
         }
         if (int(aDrawMode) & int(DrawMode::GLYPH_PATH)) {
             aThebesContext->EnsurePathBuilder();
 			Matrix mat = aDT->GetTransform();
-            aFont->CopyGlyphsToBuilder(buf, aThebesContext->mPathBuilder, aDT->GetType(), &mat);
+            aFont->CopyGlyphsToBuilder(buf, aThebesContext->mPathBuilder,
+                                       aDT->GetBackendType(), &mat);
         }
         if ((int(aDrawMode) & (int(DrawMode::GLYPH_STROKE) | int(DrawMode::GLYPH_STROKE_UNDERNEATH))) ==
                               int(DrawMode::GLYPH_STROKE)) {
             FlushStroke(aDT, aContextPaint, aFont, aThebesContext, buf, state);
         }
 
         mNumGlyphs = 0;
     }
@@ -3286,17 +3287,17 @@ gfxFont::Draw(gfxTextRun *aTextRun, uint
         GetGlyphRenderingOptions();
 
       DrawOptions drawOptions;
       drawOptions.mAntialiasMode = Get2DAAMode(mAntialiasOption);
 
       // The cairo DrawTarget backend uses the cairo_scaled_font directly
       // and so has the font skew matrix applied already.
       if (mScaledFont &&
-          dt->GetType() != BackendType::CAIRO) {
+          dt->GetBackendType() != BackendType::CAIRO) {
         cairo_matrix_t matrix;
         cairo_scaled_font_get_font_matrix(mScaledFont, &matrix);
         if (matrix.xy != 0) {
           // If this matrix applies a skew, which can happen when drawing
           // oblique fonts, we will set the DrawTarget matrix to apply the
           // skew. We'll need to move the glyphs by the inverse of the skew to
           // get the glyphs positioned correctly in the new device space
           // though, since the font matrix should only be applied to drawing
--- a/gfx/thebes/gfxGradientCache.cpp
+++ b/gfx/thebes/gfxGradientCache.cpp
@@ -178,30 +178,33 @@ class GradientCache MOZ_FINAL : public n
 static GradientCache* gGradientCache = nullptr;
 
 GradientStops *
 gfxGradientCache::GetGradientStops(DrawTarget *aDT, nsTArray<GradientStop>& aStops, ExtendMode aExtend)
 {
   if (!gGradientCache) {
     gGradientCache = new GradientCache();
   }
-  GradientCacheData* cached = gGradientCache->Lookup(aStops, aExtend, aDT->GetType());
+  GradientCacheData* cached =
+    gGradientCache->Lookup(aStops, aExtend, aDT->GetBackendType());
   return cached ? cached->mStops : nullptr;
 }
 
 GradientStops *
 gfxGradientCache::GetOrCreateGradientStops(DrawTarget *aDT, nsTArray<GradientStop>& aStops, ExtendMode aExtend)
 {
   RefPtr<GradientStops> gs = GetGradientStops(aDT, aStops, aExtend);
   if (!gs) {
     gs = aDT->CreateGradientStops(aStops.Elements(), aStops.Length(), aExtend);
     if (!gs) {
       return nullptr;
     }
-    GradientCacheData *cached = new GradientCacheData(gs, GradientCacheKey(aStops, aExtend, aDT->GetType()));
+    GradientCacheData *cached =
+      new GradientCacheData(gs, GradientCacheKey(aStops, aExtend,
+                                                 aDT->GetBackendType()));
     if (!gGradientCache->RegisterEntry(cached)) {
       delete cached;
     }
   }
   return gs;
 }
 
 void
--- a/gfx/thebes/gfxPlatform.cpp
+++ b/gfx/thebes/gfxPlatform.cpp
@@ -650,33 +650,33 @@ gfxPlatform::GetSourceSurfaceForSurface(
     }
   }
 
   void *userData = aSurface->GetData(&kSourceSurface);
 
   if (userData) {
     SourceSurfaceUserData *surf = static_cast<SourceSurfaceUserData*>(userData);
 
-    if (surf->mSrcSurface->IsValid() && surf->mBackendType == aTarget->GetType()) {
+    if (surf->mSrcSurface->IsValid() && surf->mBackendType == aTarget->GetBackendType()) {
       return surf->mSrcSurface;
     }
     // We can just continue here as when setting new user data the destroy
     // function will be called for the old user data.
   }
 
   SurfaceFormat format;
   if (aSurface->GetContentType() == gfxContentType::ALPHA) {
     format = SurfaceFormat::A8;
   } else if (aSurface->GetContentType() == gfxContentType::COLOR) {
     format = SurfaceFormat::B8G8R8X8;
   } else {
     format = SurfaceFormat::B8G8R8A8;
   }
 
-  if (aTarget->GetType() == BackendType::CAIRO) {
+  if (aTarget->GetBackendType() == BackendType::CAIRO) {
     // If we're going to be used with a CAIRO DrawTarget, then just create a
     // SourceSurfaceCairo since we don't know the underlying type of the CAIRO
     // DrawTarget and can't pick a better surface type. Doing this also avoids
     // readback of aSurface's surface into memory if, for example, aSurface
     // wraps an xlib cairo surface (which can be important to avoid a major
     // slowdown).
     NativeSurface surf;
     surf.mFormat = format;
@@ -736,17 +736,17 @@ gfxPlatform::GetSourceSurfaceForSurface(
         // SourceSurfaceRawData object (even if aSurface is not a gfxImageSurface
         // object), which is why we need this separate check.
         return srcBuffer.forget();
       }
     }
   }
 
   if (!srcBuffer) {
-    MOZ_ASSERT(aTarget->GetType() != BackendType::CAIRO,
+    MOZ_ASSERT(aTarget->GetBackendType() != BackendType::CAIRO,
                "We already tried CreateSourceSurfaceFromNativeSurface with a "
                "DrawTargetCairo above");
     // We've run out of performant options. We now try creating a SourceSurface
     // using a temporary DrawTargetCairo and then optimizing it to aTarget's
     // actual type. The CreateSourceSurfaceFromNativeSurface() call will
     // likely create a DataSourceSurface (possibly involving copying and/or
     // readback), and the OptimizeSourceSurface may well copy again and upload
     // to the GPU. So, while this code path is rarely hit, hitting it may be
@@ -775,17 +775,17 @@ gfxPlatform::GetSourceSurfaceForSurface(
        static_cast<DataSourceSurfaceCairo*>(srcBuffer.get())->GetSurface() ==
          aSurface->CairoSurface())) {
     // See the "Note that the returned SourceSurfaceCairo..." comment above.
     return srcBuffer.forget();
   }
 
   // Add user data to aSurface so we can cache lookups in the future.
   SourceSurfaceUserData *srcSurfUD = new SourceSurfaceUserData;
-  srcSurfUD->mBackendType = aTarget->GetType();
+  srcSurfUD->mBackendType = aTarget->GetBackendType();
   srcSurfUD->mSrcSurface = srcBuffer;
   aSurface->SetData(&kSourceSurface, srcSurfUD, SourceBufferDestroy);
 
   return srcBuffer.forget();
 }
 
 TemporaryRef<DataSourceSurface>
 gfxPlatform::GetWrappedDataSourceSurface(gfxASurface* aSurface)
@@ -841,17 +841,17 @@ DataDrawTargetDestroy(void *aTarget)
 
 bool
 gfxPlatform::SupportsAzureContentForDrawTarget(DrawTarget* aTarget)
 {
   if (!aTarget) {
     return false;
   }
 
-  return SupportsAzureContentForType(aTarget->GetType());
+  return SupportsAzureContentForType(aTarget->GetBackendType());
 }
 
 bool
 gfxPlatform::UseAcceleratedSkiaCanvas()
 {
   return gfxPrefs::CanvasAzureAccelerated() &&
          mPreferredCanvasBackend == BackendType::SKIA;
 }
@@ -922,17 +922,17 @@ gfxPlatform::PurgeSkiaCache()
 
   mSkiaGlue->GetGrContext()->freeGpuResources();
 #endif
 }
 
 already_AddRefed<gfxASurface>
 gfxPlatform::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget)
 {
-  if (aTarget->GetType() == BackendType::CAIRO) {
+  if (aTarget->GetBackendType() == BackendType::CAIRO) {
     cairo_surface_t* csurf =
       static_cast<cairo_surface_t*>(aTarget->GetNativeSurface(NativeSurfaceType::CAIRO_SURFACE));
     if (csurf) {
       return gfxASurface::Wrap(csurf);
     }
   }
 
   // The semantics of this part of the function are sort of weird. If we
@@ -2067,17 +2067,17 @@ gfxPlatform::DisableBufferRotation()
 
   sBufferRotationCheckPref = false;
 }
 
 TemporaryRef<ScaledFont>
 gfxPlatform::GetScaledFontForFontWithCairoSkia(DrawTarget* aTarget, gfxFont* aFont)
 {
     NativeFont nativeFont;
-    if (aTarget->GetType() == BackendType::CAIRO || aTarget->GetType() == BackendType::SKIA) {
+    if (aTarget->GetBackendType() == BackendType::CAIRO || aTarget->GetBackendType() == BackendType::SKIA) {
         nativeFont.mType = NativeFontType::CAIRO_FONT_FACE;
         nativeFont.mFont = aFont->GetCairoScaledFont();
         return Factory::CreateScaledFontForNativeFont(nativeFont, aFont->GetAdjustedSize());
     }
 
     return nullptr;
 }
 
--- a/gfx/thebes/gfxPlatformMac.cpp
+++ b/gfx/thebes/gfxPlatformMac.cpp
@@ -378,27 +378,27 @@ gfxPlatformMac::ReadAntiAliasingThreshol
     }
 
     return threshold;
 }
 
 already_AddRefed<gfxASurface>
 gfxPlatformMac::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget)
 {
-  if (aTarget->GetType() == BackendType::COREGRAPHICS_ACCELERATED) {
+  if (aTarget->GetBackendType() == BackendType::COREGRAPHICS_ACCELERATED) {
     RefPtr<SourceSurface> source = aTarget->Snapshot();
     RefPtr<DataSourceSurface> sourceData = source->GetDataSurface();
     unsigned char* data = sourceData->GetData();
     nsRefPtr<gfxImageSurface> surf = new gfxImageSurface(data, ThebesIntSize(sourceData->GetSize()), sourceData->Stride(),
                                                          gfxImageFormat::ARGB32);
     // We could fix this by telling gfxImageSurface it owns data.
     nsRefPtr<gfxImageSurface> cpy = new gfxImageSurface(ThebesIntSize(sourceData->GetSize()), gfxImageFormat::ARGB32);
     cpy->CopyFrom(surf);
     return cpy.forget();
-  } else if (aTarget->GetType() == BackendType::COREGRAPHICS) {
+  } else if (aTarget->GetBackendType() == BackendType::COREGRAPHICS) {
     CGContextRef cg = static_cast<CGContextRef>(aTarget->GetNativeSurface(NativeSurfaceType::CGCONTEXT));
 
     //XXX: it would be nice to have an implicit conversion from IntSize to gfxIntSize
     IntSize intSize = aTarget->GetSize();
     gfxIntSize size(intSize.width, intSize.height);
 
     nsRefPtr<gfxASurface> surf =
       new gfxQuartzSurface(cg, size);
--- a/gfx/thebes/gfxQuartzNativeDrawing.cpp
+++ b/gfx/thebes/gfxQuartzNativeDrawing.cpp
@@ -30,17 +30,17 @@ gfxQuartzNativeDrawing::BeginNativeDrawi
   if (mContext->IsCairo()) {
     // We're past that now. Any callers that still supply a Cairo context
     // don't deserve native theming.
     NS_WARNING("gfxQuartzNativeDrawing being used with a gfxContext that is not backed by a DrawTarget");
     return nullptr;
   }
 
   DrawTarget *dt = mContext->GetDrawTarget();
-  if (dt->GetType() != BackendType::COREGRAPHICS || dt->IsDualDrawTarget()) {
+  if (dt->GetBackendType() != BackendType::COREGRAPHICS || dt->IsDualDrawTarget()) {
     IntSize backingSize(NSToIntFloor(mNativeRect.width * mBackingScale),
                         NSToIntFloor(mNativeRect.height * mBackingScale));
 
     if (backingSize.IsEmpty()) {
       return nullptr;
     }
 
     mDrawTarget = Factory::CreateDrawTarget(BackendType::COREGRAPHICS, backingSize, SurfaceFormat::B8G8R8A8);
--- a/gfx/thebes/gfxWindowsNativeDrawing.cpp
+++ b/gfx/thebes/gfxWindowsNativeDrawing.cpp
@@ -179,17 +179,17 @@ gfxWindowsNativeDrawing::BeginNativeDraw
         return nullptr;
     }
 }
 
 bool
 gfxWindowsNativeDrawing::IsDoublePass()
 {
     if (!mContext->IsCairo() &&
-        (mContext->GetDrawTarget()->GetType() != mozilla::gfx::BackendType::CAIRO ||
+        (mContext->GetDrawTarget()->GetBackendType() != mozilla::gfx::BackendType::CAIRO ||
          mContext->GetDrawTarget()->IsDualDrawTarget())) {
       return true;
     }
 
     nsRefPtr<gfxASurface> surf = mContext->CurrentSurface(&mDeviceOffset.x, &mDeviceOffset.y);
     if (!surf || surf->CairoStatus())
         return false;
     if (surf->GetType() != gfxSurfaceType::Win32 &&
--- a/gfx/thebes/gfxWindowsPlatform.cpp
+++ b/gfx/thebes/gfxWindowsPlatform.cpp
@@ -614,17 +614,17 @@ gfxWindowsPlatform::GetScaledFontForFont
 {
     if (aFont->GetType() == gfxFont::FONT_TYPE_DWRITE) {
         gfxDWriteFont *font = static_cast<gfxDWriteFont*>(aFont);
 
         NativeFont nativeFont;
         nativeFont.mType = NativeFontType::DWRITE_FONT_FACE;
         nativeFont.mFont = font->GetFontFace();
 
-        if (aTarget->GetType() == BackendType::CAIRO) {
+        if (aTarget->GetBackendType() == BackendType::CAIRO) {
           return Factory::CreateScaledFontWithCairo(nativeFont,
                                                     font->GetAdjustedSize(),
                                                     font->GetCairoScaledFont());
         }
 
         return Factory::CreateScaledFontForNativeFont(nativeFont,
                                                       font->GetAdjustedSize());
     }
@@ -633,30 +633,30 @@ gfxWindowsPlatform::GetScaledFontForFont
         "Fonts on windows should be GDI or DWrite!");
 
     NativeFont nativeFont;
     nativeFont.mType = NativeFontType::GDI_FONT_FACE;
     LOGFONT lf;
     GetObject(static_cast<gfxGDIFont*>(aFont)->GetHFONT(), sizeof(LOGFONT), &lf);
     nativeFont.mFont = &lf;
 
-    if (aTarget->GetType() == BackendType::CAIRO) {
+    if (aTarget->GetBackendType() == BackendType::CAIRO) {
       return Factory::CreateScaledFontWithCairo(nativeFont,
                                                 aFont->GetAdjustedSize(),
                                                 aFont->GetCairoScaledFont());
     }
 
     return Factory::CreateScaledFontForNativeFont(nativeFont, aFont->GetAdjustedSize());
 }
 
 already_AddRefed<gfxASurface>
 gfxWindowsPlatform::GetThebesSurfaceForDrawTarget(DrawTarget *aTarget)
 {
 #ifdef XP_WIN
-  if (aTarget->GetType() == BackendType::DIRECT2D) {
+  if (aTarget->GetBackendType() == BackendType::DIRECT2D) {
     if (!GetD2DDevice()) {
       // We no longer have a D2D device, can't do this.
       return nullptr;
     }
 
     RefPtr<ID3D10Texture2D> texture =
       static_cast<ID3D10Texture2D*>(aTarget->GetNativeSurface(NativeSurfaceType::D3D10_TEXTURE));
 
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -3733,17 +3733,17 @@ static bool ShouldDrawRectsSeparately(gf
 {
   if (!gfxPrefs::LayoutPaintRectsSeparately() ||
       aContext->IsCairo() ||
       aClip == DrawRegionClip::CLIP_NONE) {
     return false;
   }
 
   DrawTarget *dt = aContext->GetDrawTarget();
-  return dt->GetType() == BackendType::DIRECT2D;
+  return dt->GetBackendType() == BackendType::DIRECT2D;
 }
 
 static void DrawForcedBackgroundColor(gfxContext* aContext, Layer* aLayer, nscolor aBackgroundColor)
 {
   if (NS_GET_A(aBackgroundColor) > 0) {
     nsIntRect r = aLayer->GetVisibleRegion().GetBounds();
     aContext->NewPath();
     aContext->Rectangle(gfxRect(r.x, r.y, r.width, r.height));