Bug 1158120 - Replace gfxIntSize by mozilla::gfx::IntSize in gfx/thebes part 1. r=nical
authorAmanda Sambath <amanda.sambath@phelma.grenoble-inp.fr>
Mon, 01 Jun 2015 10:26:19 +0200
changeset 277323 3eae6ca6d8224912983d8177ab863f0504dc5727
parent 277322 0d4f25a9ef1f1dd4ca72cebc84cacfd69745da4a
child 277324 7654212d5a471749f5b220f88ae2a5104162ef14
push id4932
push userjlund@mozilla.com
push dateMon, 10 Aug 2015 18:23:06 +0000
treeherdermozilla-beta@6dd5a4f5f745 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs1158120
milestone41.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 1158120 - Replace gfxIntSize by mozilla::gfx::IntSize in gfx/thebes part 1. r=nical
gfx/thebes/gfxASurface.cpp
gfx/thebes/gfxASurface.h
gfx/thebes/gfxAlphaRecovery.cpp
gfx/thebes/gfxAlphaRecoverySSE2.cpp
gfx/thebes/gfxBaseSharedMemorySurface.h
gfx/thebes/gfxBlur.cpp
gfx/thebes/gfxBlur.h
gfx/thebes/gfxD2DSurface.cpp
gfx/thebes/gfxD2DSurface.h
gfx/thebes/gfxDrawable.cpp
gfx/thebes/gfxDrawable.h
gfx/thebes/gfxImageSurface.cpp
gfx/thebes/gfxImageSurface.h
gfx/thebes/gfxPDFSurface.h
gfx/thebes/gfxPSSurface.cpp
gfx/thebes/gfxPSSurface.h
gfx/thebes/gfxQPainterSurface.cpp
gfx/thebes/gfxQPainterSurface.h
gfx/thebes/gfxQtNativeRenderer.cpp
gfx/thebes/gfxQtPlatform.cpp
gfx/thebes/gfxQuartzImageSurface.cpp
gfx/thebes/gfxQuartzImageSurface.h
gfx/thebes/gfxQuartzSurface.cpp
gfx/thebes/gfxQuartzSurface.h
gfx/thebes/gfxSharedImageSurface.h
gfx/thebes/gfxSharedQuartzSurface.h
gfx/thebes/gfxTeeSurface.cpp
gfx/thebes/gfxTeeSurface.h
gfx/thebes/gfxUtils.cpp
gfx/thebes/gfxUtils.h
gfx/thebes/gfxWindowsNativeDrawing.cpp
gfx/thebes/gfxWindowsNativeDrawing.h
gfx/thebes/gfxWindowsSurface.cpp
gfx/thebes/gfxWindowsSurface.h
gfx/thebes/gfxXlibNativeRenderer.cpp
gfx/thebes/gfxXlibSurface.cpp
gfx/thebes/gfxXlibSurface.h
--- a/gfx/thebes/gfxASurface.cpp
+++ b/gfx/thebes/gfxASurface.cpp
@@ -150,17 +150,17 @@ void
 gfxASurface::SetSurfaceWrapper(cairo_surface_t *csurf, gfxASurface *asurf)
 {
     if (!csurf)
         return;
     cairo_surface_set_user_data(csurf, &gfxasurface_pointer_key, asurf, SurfaceDestroyFunc);
 }
 
 already_AddRefed<gfxASurface>
-gfxASurface::Wrap (cairo_surface_t *csurf, const gfxIntSize& aSize)
+gfxASurface::Wrap (cairo_surface_t *csurf, const IntSize& aSize)
 {
     nsRefPtr<gfxASurface> result;
 
     /* Do we already have a wrapper for this surface? */
     result = GetSurfaceWrapper(csurf);
     if (result) {
         // fprintf(stderr, "Existing wrapper for %p -> %p\n", csurf, result);
         return result.forget();
--- a/gfx/thebes/gfxASurface.h
+++ b/gfx/thebes/gfxASurface.h
@@ -45,17 +45,17 @@ public:
     virtual nsrefcnt Release(void);
 #endif
 
 public:
 
     /** Wrap the given cairo surface and return a gfxASurface for it.
      * This adds a reference to csurf (owned by the returned gfxASurface).
      */
-    static already_AddRefed<gfxASurface> Wrap(cairo_surface_t *csurf, const gfxIntSize& aSize = gfxIntSize(-1, -1));
+    static already_AddRefed<gfxASurface> Wrap(cairo_surface_t *csurf, const mozilla::gfx::IntSize& aSize = mozilla::gfx::IntSize(-1, -1));
 
     /*** this DOES NOT addref the surface */
     cairo_surface_t *CairoSurface() {
         return mSurface;
     }
 
     gfxSurfaceType GetType() const;
 
@@ -216,17 +216,17 @@ protected:
     bool mAllowUseAsSource;
 };
 
 /**
  * An Unknown surface; used to wrap unknown cairo_surface_t returns from cairo
  */
 class gfxUnknownSurface : public gfxASurface {
 public:
-    gfxUnknownSurface(cairo_surface_t *surf, const gfxIntSize& aSize)
+    gfxUnknownSurface(cairo_surface_t *surf, const mozilla::gfx::IntSize& aSize)
         : mSize(aSize)
     {
         Init(surf, true);
     }
 
     virtual ~gfxUnknownSurface() { }
     virtual const nsIntSize GetSize() const override { return mSize; }
 
--- a/gfx/thebes/gfxAlphaRecovery.cpp
+++ b/gfx/thebes/gfxAlphaRecovery.cpp
@@ -9,17 +9,17 @@
 
 #define MOZILLA_SSE_INCLUDE_HEADER_FOR_SSE2
 #include "mozilla/SSE.h"
 
 /* static */ bool
 gfxAlphaRecovery::RecoverAlpha(gfxImageSurface* blackSurf,
                                const gfxImageSurface* whiteSurf)
 {
-    gfxIntSize size = blackSurf->GetSize();
+    mozilla::gfx::IntSize size = blackSurf->GetSize();
 
     if (size != whiteSurf->GetSize() ||
         (blackSurf->Format() != gfxImageFormat::ARGB32 &&
          blackSurf->Format() != gfxImageFormat::RGB24) ||
         (whiteSurf->Format() != gfxImageFormat::ARGB32 &&
          whiteSurf->Format() != gfxImageFormat::RGB24))
         return false;
 
--- a/gfx/thebes/gfxAlphaRecoverySSE2.cpp
+++ b/gfx/thebes/gfxAlphaRecoverySSE2.cpp
@@ -25,17 +25,17 @@ static uint32_t alphaMaski[] __attribute
 static uint32_t greenMaski[] = { 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00 };
 static uint32_t alphaMaski[] = { 0xff000000, 0xff000000, 0xff000000, 0xff000000 };
 #endif
 
 bool
 gfxAlphaRecovery::RecoverAlphaSSE2(gfxImageSurface* blackSurf,
                                    const gfxImageSurface* whiteSurf)
 {
-    gfxIntSize size = blackSurf->GetSize();
+    mozilla::gfx::IntSize size = blackSurf->GetSize();
 
     if (size != whiteSurf->GetSize() ||
         (blackSurf->Format() != gfxImageFormat::ARGB32 &&
          blackSurf->Format() != gfxImageFormat::RGB24) ||
         (whiteSurf->Format() != gfxImageFormat::ARGB32 &&
          whiteSurf->Format() != gfxImageFormat::RGB24))
         return false;
 
@@ -182,17 +182,17 @@ gfxAlphaRecovery::AlignRectForSubimageRe
     // ALIGN/BPP constant by using SIMD-ized alpha recovery.  So as
     // w*h diverges from w+h, the win factor approaches ALIGN/BPP.  We
     // only really care about the w*h >> w+h case anyway; others
     // should be fast enough even with the overhead.  (Unless the cost
     // of repainting the expanded rect is high, but in that case
     // SIMD-ized alpha recovery won't make a difference so this code
     // shouldn't be called.)
     //
-    gfxIntSize surfaceSize = aSurface->GetSize();
+    mozilla::gfx::IntSize surfaceSize = aSurface->GetSize();
     const int32_t stride = bpp * surfaceSize.width;
     if (stride != aSurface->Stride()) {
         NS_WARNING("Unexpected stride, falling back on slow alpha recovery");
         return aRect;
     }
 
     const int32_t x = aRect.x, y = aRect.y, w = aRect.width, h = aRect.height;
     const int32_t r = x + w;
--- a/gfx/thebes/gfxBaseSharedMemorySurface.h
+++ b/gfx/thebes/gfxBaseSharedMemorySurface.h
@@ -52,34 +52,34 @@ public:
      * the surface failed.
      *
      * NB: the *caller* is responsible for freeing the Shmem allocated
      * by this function.
      */
     template<class ShmemAllocator>
     static already_AddRefed<Sub>
     Create(ShmemAllocator* aAllocator,
-           const gfxIntSize& aSize,
+           const mozilla::gfx::IntSize& aSize,
            gfxImageFormat aFormat,
            SharedMemory::SharedMemoryType aShmType = SharedMemory::TYPE_BASIC)
     {
         return Create<ShmemAllocator, false>(aAllocator, aSize, aFormat, aShmType);
     }
 
     /**
      * Return a new gfxSharedImageSurface that wraps a shmem segment
      * already created by the Create() above.  Bad things will happen
      * if an attempt is made to wrap any other shmem segment.  Null is
      * returned if creating the surface failed.
      */
     static already_AddRefed<Sub>
     Open(const Shmem& aShmem)
     {
         SharedImageInfo* shmInfo = GetShmInfoPtr(aShmem);
-        gfxIntSize size(shmInfo->width, shmInfo->height);
+        mozilla::gfx::IntSize size(shmInfo->width, shmInfo->height);
         if (!gfxASurface::CheckSurfaceSize(size))
             return nullptr;
        
         gfxImageFormat format = (gfxImageFormat)shmInfo->format;
         long stride = gfxImageSurface::ComputeStride(size, format);
 
         nsRefPtr<Sub> s =
             new Sub(size,
@@ -88,34 +88,34 @@ public:
                     aShmem);
         // We didn't create this Shmem and so don't free it on errors
         return (s->CairoStatus() != 0) ? nullptr : s.forget();
     }
 
     template<class ShmemAllocator>
     static already_AddRefed<Sub>
     CreateUnsafe(ShmemAllocator* aAllocator,
-                 const gfxIntSize& aSize,
+                 const mozilla::gfx::IntSize& aSize,
                  gfxImageFormat aFormat,
                  SharedMemory::SharedMemoryType aShmType = SharedMemory::TYPE_BASIC)
     {
         return Create<ShmemAllocator, true>(aAllocator, aSize, aFormat, aShmType);
     }
 
     Shmem& GetShmem() { return mShmem; }
 
     static bool IsSharedImage(gfxASurface *aSurface)
     {
         return (aSurface
                 && aSurface->GetType() == gfxSurfaceType::Image
                 && aSurface->GetData(&SHM_KEY));
     }
 
 protected:
-    gfxBaseSharedMemorySurface(const gfxIntSize& aSize, long aStride, 
+    gfxBaseSharedMemorySurface(const mozilla::gfx::IntSize& aSize, long aStride, 
                                gfxImageFormat aFormat, 
                                const Shmem& aShmem)
       : Base(aShmem.get<unsigned char>(), aSize, aStride, aFormat)
     {
         MOZ_COUNT_CTOR(gfxBaseSharedMemorySurface);
 
         mShmem = aShmem;
         this->SetData(&SHM_KEY, this, nullptr);
@@ -147,26 +147,26 @@ private:
 
     int32_t
     GetReadCount()
     {
         SharedImageInfo* shmInfo = GetShmInfoPtr(mShmem);
         return shmInfo->readCount;
     }
 
-    static size_t GetAlignedSize(const gfxIntSize& aSize, long aStride)
+    static size_t GetAlignedSize(const mozilla::gfx::IntSize& aSize, long aStride)
     {
         #define MOZ_ALIGN_WORD(x) (((x) + 3) & ~3)
         return MOZ_ALIGN_WORD(sizeof(SharedImageInfo) + aSize.height * aStride);
     }
 
     template<class ShmemAllocator, bool Unsafe>
     static already_AddRefed<Sub>
     Create(ShmemAllocator* aAllocator,
-           const gfxIntSize& aSize,
+           const mozilla::gfx::IntSize& aSize,
            gfxImageFormat aFormat,
            SharedMemory::SharedMemoryType aShmType)
     {
         if (!gfxASurface::CheckSurfaceSize(aSize))
             return nullptr;
 
         Shmem shmem;
         long stride = gfxImageSurface::ComputeStride(aSize, aFormat);
--- a/gfx/thebes/gfxBlur.cpp
+++ b/gfx/thebes/gfxBlur.cpp
@@ -24,18 +24,18 @@ gfxAlphaBoxBlur::gfxAlphaBoxBlur()
 
 gfxAlphaBoxBlur::~gfxAlphaBoxBlur()
 {
   mContext = nullptr;
 }
 
 gfxContext*
 gfxAlphaBoxBlur::Init(const gfxRect& aRect,
-                      const gfxIntSize& aSpreadRadius,
-                      const gfxIntSize& aBlurRadius,
+                      const IntSize& aSpreadRadius,
+                      const IntSize& aBlurRadius,
                       const gfxRect* aDirtyRect,
                       const gfxRect* aSkipRect)
 {
     mozilla::gfx::Rect rect(Float(aRect.x), Float(aRect.y),
                             Float(aRect.width), Float(aRect.height));
     IntSize spreadRadius(aSpreadRadius.width, aSpreadRadius.height);
     IntSize blurRadius(aBlurRadius.width, aBlurRadius.height);
     UniquePtr<Rect> dirtyRect;
@@ -147,34 +147,34 @@ gfxAlphaBoxBlur::Paint(gfxContext* aDest
     if (!mask) {
       NS_ERROR("Failed to create mask!");
       return;
     }
 
     DrawBlur(aDestinationCtx, mask, topLeft, dirtyRect);
 }
 
-gfxIntSize gfxAlphaBoxBlur::CalculateBlurRadius(const gfxPoint& aStd)
+IntSize gfxAlphaBoxBlur::CalculateBlurRadius(const gfxPoint& aStd)
 {
     mozilla::gfx::Point std(Float(aStd.x), Float(aStd.y));
     IntSize size = AlphaBoxBlur::CalculateBlurRadius(std);
-    return gfxIntSize(size.width, size.height);
+    return IntSize(size.width, size.height);
 }
 
 struct BlurCacheKey : public PLDHashEntryHdr {
   typedef const BlurCacheKey& KeyType;
   typedef const BlurCacheKey* KeyTypePointer;
   enum { ALLOW_MEMMOVE = true };
 
   gfxRect mRect;
-  gfxIntSize mBlurRadius;
+  IntSize mBlurRadius;
   gfxRect mSkipRect;
   BackendType mBackend;
 
-  BlurCacheKey(const gfxRect& aRect, const gfxIntSize &aBlurRadius, const gfxRect& aSkipRect, BackendType aBackend)
+  BlurCacheKey(const gfxRect& aRect, const IntSize &aBlurRadius, const gfxRect& aSkipRect, BackendType aBackend)
     : mRect(aRect)
     , mBlurRadius(aBlurRadius)
     , mSkipRect(aSkipRect)
     , mBackend(aBackend)
   { }
 
   explicit BlurCacheKey(const BlurCacheKey* aOther)
     : mRect(aOther->mRect)
@@ -255,17 +255,17 @@ class BlurCache final : public nsExpirat
 
     virtual void NotifyExpired(BlurCacheData* aObject)
     {
       RemoveObject(aObject);
       mHashEntries.Remove(aObject->mKey);
     }
 
     BlurCacheData* Lookup(const gfxRect& aRect,
-                          const gfxIntSize& aBlurRadius,
+                          const IntSize& aBlurRadius,
                           const gfxRect& aSkipRect,
                           BackendType aBackendType,
                           const gfxRect* aDirtyRect)
     {
       BlurCacheData* blur =
         mHashEntries.Get(BlurCacheKey(aRect, aBlurRadius, aSkipRect, aBackendType));
 
       if (blur) {
@@ -304,17 +304,17 @@ class BlurCache final : public nsExpirat
     nsClassHashtable<BlurCacheKey, BlurCacheData> mHashEntries;
 };
 
 static BlurCache* gBlurCache = nullptr;
 
 SourceSurface*
 GetCachedBlur(DrawTarget *aDT,
               const gfxRect& aRect,
-              const gfxIntSize& aBlurRadius,
+              const IntSize& aBlurRadius,
               const gfxRect& aSkipRect,
               const gfxRect& aDirtyRect,
               IntPoint* aTopLeft)
 {
   if (!gBlurCache) {
     gBlurCache = new BlurCache();
   }
   BlurCacheData* cached = gBlurCache->Lookup(aRect, aBlurRadius, aSkipRect,
@@ -325,17 +325,17 @@ GetCachedBlur(DrawTarget *aDT,
     return cached->mBlur;
   }
   return nullptr;
 }
 
 void
 CacheBlur(DrawTarget *aDT,
           const gfxRect& aRect,
-          const gfxIntSize& aBlurRadius,
+          const IntSize& 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,
@@ -367,24 +367,24 @@ gfxAlphaBoxBlur::BlurRectangle(gfxContex
                                RectCornerRadii* aCornerRadii,
                                const gfxPoint& aBlurStdDev,
                                const gfxRGBA& aShadowColor,
                                const gfxRect& aDirtyRect,
                                const gfxRect& aSkipRect)
 {
   DrawTarget& aDrawTarget = *aDestinationCtx->GetDrawTarget();
 
-  gfxIntSize blurRadius = CalculateBlurRadius(aBlurStdDev);
+  IntSize blurRadius = CalculateBlurRadius(aBlurStdDev);
 
   IntPoint topLeft;
   RefPtr<SourceSurface> surface = GetCachedBlur(&aDrawTarget, aRect, blurRadius, aSkipRect, aDirtyRect, &topLeft);
   if (!surface) {
     // Create the temporary surface for blurring
     gfxAlphaBoxBlur blur;
-    gfxContext* blurCtx = blur.Init(aRect, gfxIntSize(), blurRadius, &aDirtyRect, &aSkipRect);
+    gfxContext* blurCtx = blur.Init(aRect, IntSize(), blurRadius, &aDirtyRect, &aSkipRect);
     if (!blurCtx) {
       return;
     }
     DrawTarget* blurDT = blurCtx->GetDrawTarget();
 
     Rect shadowGfxRect = ToRect(aRect);
     shadowGfxRect.Round();
 
--- a/gfx/thebes/gfxBlur.h
+++ b/gfx/thebes/gfxBlur.h
@@ -68,18 +68,18 @@ public:
      *  if available. This will be used for optimizing the blur operation. It
      *  is safe to pass nullptr here.
      *
      * @param aSkipRect A pointer to a rect, measured in device units, that
      *  represents an area where blurring is unnecessary and shouldn't be done
      *  for speed reasons. It is safe to pass nullptr here.
      */
     gfxContext* Init(const gfxRect& aRect,
-                     const gfxIntSize& aSpreadRadius,
-                     const gfxIntSize& aBlurRadius,
+                     const mozilla::gfx::IntSize& aSpreadRadius,
+                     const mozilla::gfx::IntSize& aBlurRadius,
                      const gfxRect* aDirtyRect,
                      const gfxRect* aSkipRect);
 
     /**
      * Returns the context that should be drawn to supply the alpha mask to be
      * blurred. If the returned surface is null, then there was an error in
      * its creation.
      */
@@ -101,17 +101,17 @@ public:
     void Paint(gfxContext* aDestinationCtx);
 
     /**
      * Calculates a blur radius that, when used with box blur, approximates
      * a Gaussian blur with the given standard deviation.  The result of
      * this function should be used as the aBlurRadius parameter to Init,
      * above.
      */
-    static gfxIntSize CalculateBlurRadius(const gfxPoint& aStandardDeviation);
+    static mozilla::gfx::IntSize CalculateBlurRadius(const gfxPoint& aStandardDeviation);
 
     /**
      * Blurs a coloured rectangle onto aDestinationCtx. This is equivalent
      * to calling Init(), drawing a rectangle onto the returned surface
      * and then calling Paint, but may let us optimize better in the
      * backend.
      *
      * @param aDestinationCtx      The destination to blur to.
--- a/gfx/thebes/gfxD2DSurface.cpp
+++ b/gfx/thebes/gfxD2DSurface.cpp
@@ -32,17 +32,17 @@ gfxD2DSurface::gfxD2DSurface(ID3D10Textu
         (cairo_content_t)(int)aContent));
 }
 
 gfxD2DSurface::gfxD2DSurface(cairo_surface_t *csurf)
 {
     Init(csurf, true);
 }
 
-gfxD2DSurface::gfxD2DSurface(const gfxIntSize& size,
+gfxD2DSurface::gfxD2DSurface(const mozilla::gfx::IntSize& size,
                              gfxImageFormat imageFormat)
 {
     Init(cairo_d2d_surface_create(
         gfxWindowsPlatform::GetPlatform()->GetD2DDevice(),
         (cairo_format_t)(int)imageFormat,
         size.width, size.height));
 }
 
@@ -89,13 +89,13 @@ gfxD2DSurface::ReleaseDC(const mozilla::
     cairo_rectangle_int_t rect;
     rect.x = aUpdatedRect->x;
     rect.y = aUpdatedRect->y;
     rect.width = aUpdatedRect->width;
     rect.height = aUpdatedRect->height;
     cairo_d2d_release_dc(CairoSurface(), &rect);
 }
 
-const gfxIntSize gfxD2DSurface::GetSize() const
+const mozilla::gfx::IntSize gfxD2DSurface::GetSize() const
 { 
-    return gfxIntSize(cairo_d2d_surface_get_width(mSurface),
+    return mozilla::gfx::IntSize(cairo_d2d_surface_get_width(mSurface),
                       cairo_d2d_surface_get_height(mSurface));
 }
\ No newline at end of file
--- a/gfx/thebes/gfxD2DSurface.h
+++ b/gfx/thebes/gfxD2DSurface.h
@@ -14,17 +14,17 @@
 struct ID3D10Texture2D;
 
 class gfxD2DSurface : public gfxASurface {
 public:
 
     gfxD2DSurface(HWND wnd,
                   gfxContentType aContent);
 
-    gfxD2DSurface(const gfxIntSize& size,
+    gfxD2DSurface(const mozilla::gfx::IntSize& size,
                   gfxImageFormat imageFormat = gfxImageFormat::RGB24);
 
     gfxD2DSurface(HANDLE handle, gfxContentType aContent);
 
     gfxD2DSurface(ID3D10Texture2D *texture, gfxContentType aContent);
 
     gfxD2DSurface(cairo_surface_t *csurf);
 
--- a/gfx/thebes/gfxDrawable.cpp
+++ b/gfx/thebes/gfxDrawable.cpp
@@ -14,17 +14,17 @@
 #include "gfxXlibSurface.h"
 #endif
 #include "mozilla/gfx/Logging.h"
 
 using namespace mozilla;
 using namespace mozilla::gfx;
 
 gfxSurfaceDrawable::gfxSurfaceDrawable(SourceSurface* aSurface,
-                                       const gfxIntSize aSize,
+                                       const IntSize aSize,
                                        const gfxMatrix aTransform)
  : gfxDrawable(aSize)
  , mSourceSurface(aSurface)
  , mTransform(aTransform)
 {
   if (!mSourceSurface) {
     gfxWarning() << "Creating gfxSurfaceDrawable with null SourceSurface";
   }
@@ -106,17 +106,17 @@ gfxSurfaceDrawable::DrawInternal(gfxCont
         dt->FillRect(fillRect, pattern,
                      DrawOptions(aOpacity,
                                  CompositionOpForOp(aContext->CurrentOperator()),
                                  aContext->CurrentAntialiasMode()));
     }
 }
 
 gfxCallbackDrawable::gfxCallbackDrawable(gfxDrawingCallback* aCallback,
-                                         const gfxIntSize aSize)
+                                         const IntSize aSize)
  : gfxDrawable(aSize)
  , mCallback(aCallback)
 {
 }
 
 already_AddRefed<gfxSurfaceDrawable>
 gfxCallbackDrawable::MakeSurfaceDrawable(const GraphicsFilter aFilter)
 {
@@ -157,17 +157,17 @@ gfxCallbackDrawable::Draw(gfxContext* aC
 
     if (mCallback)
         return (*mCallback)(aContext, aFillRect, aFilter, aTransform);
 
     return false;
 }
 
 gfxPatternDrawable::gfxPatternDrawable(gfxPattern* aPattern,
-                                       const gfxIntSize aSize)
+                                       const IntSize aSize)
  : gfxDrawable(aSize)
  , mPattern(aPattern)
 {
 }
 
 gfxPatternDrawable::~gfxPatternDrawable()
 {
 }
--- a/gfx/thebes/gfxDrawable.h
+++ b/gfx/thebes/gfxDrawable.h
@@ -18,17 +18,17 @@ class gfxPattern;
 /**
  * gfxDrawable
  * An Interface representing something that has an intrinsic size and can draw
  * itself repeatedly.
  */
 class gfxDrawable {
     NS_INLINE_DECL_REFCOUNTING(gfxDrawable)
 public:
-    explicit gfxDrawable(const gfxIntSize aSize)
+    explicit gfxDrawable(const mozilla::gfx::IntSize aSize)
      : mSize(aSize) {}
 
     /**
      * Draw into aContext filling aFillRect, possibly repeating, using aFilter.
      * aTransform is a userspace to "image"space matrix. For example, if Draw
      * draws using a gfxPattern, this is the matrix that should be set on the
      * pattern prior to rendering it.
      *  @return whether drawing was successful
@@ -44,32 +44,32 @@ public:
                                       const gfxRect& aSamplingRect,
                                       bool aRepeat,
                                       const GraphicsFilter& aFilter,
                                       gfxFloat aOpacity = 1.0)
     {
         return false;
     }
 
-    virtual gfxIntSize Size() { return mSize; }
+    virtual mozilla::gfx::IntSize Size() { return mSize; }
 
 protected:
     // Protected destructor, to discourage deletion outside of Release():
     virtual ~gfxDrawable() {}
 
-    const gfxIntSize mSize;
+    const mozilla::gfx::IntSize mSize;
 };
 
 /**
  * gfxSurfaceDrawable
  * A convenience implementation of gfxDrawable for surfaces.
  */
 class gfxSurfaceDrawable : public gfxDrawable {
 public:
-    gfxSurfaceDrawable(mozilla::gfx::SourceSurface* aSurface, const gfxIntSize aSize,
+    gfxSurfaceDrawable(mozilla::gfx::SourceSurface* aSurface, const mozilla::gfx::IntSize aSize,
                        const gfxMatrix aTransform = gfxMatrix());
     virtual ~gfxSurfaceDrawable() {}
 
     virtual bool Draw(gfxContext* aContext,
                         const gfxRect& aFillRect,
                         bool aRepeat,
                         const GraphicsFilter& aFilter,
                         gfxFloat aOpacity = 1.0,
@@ -120,17 +120,17 @@ public:
 };
 
 /**
  * gfxCallbackDrawable
  * A convenience implementation of gfxDrawable for callbacks.
  */
 class gfxCallbackDrawable : public gfxDrawable {
 public:
-    gfxCallbackDrawable(gfxDrawingCallback* aCallback, const gfxIntSize aSize);
+    gfxCallbackDrawable(gfxDrawingCallback* aCallback, const mozilla::gfx::IntSize aSize);
     virtual ~gfxCallbackDrawable() {}
 
     virtual bool Draw(gfxContext* aContext,
                         const gfxRect& aFillRect,
                         bool aRepeat,
                         const GraphicsFilter& aFilter,
                         gfxFloat aOpacity = 1.0,
                         const gfxMatrix& aTransform = gfxMatrix());
@@ -144,17 +144,17 @@ protected:
 
 /**
  * gfxPatternDrawable
  * A convenience implementation of gfxDrawable for patterns.
  */
 class gfxPatternDrawable : public gfxDrawable {
 public:
     gfxPatternDrawable(gfxPattern* aPattern,
-                       const gfxIntSize aSize);
+                       const mozilla::gfx::IntSize aSize);
     virtual ~gfxPatternDrawable();
 
     virtual bool Draw(gfxContext* aContext,
                         const gfxRect& aFillRect,
                         bool aRepeat,
                         const GraphicsFilter& aFilter,
                         gfxFloat aOpacity = 1.0,
                         const gfxMatrix& aTransform = gfxMatrix());
--- a/gfx/thebes/gfxImageSurface.cpp
+++ b/gfx/thebes/gfxImageSurface.cpp
@@ -34,32 +34,32 @@ gfxImageSurface::InitFromSurface(cairo_s
     mData = cairo_image_surface_get_data(csurf);
     mFormat = (gfxImageFormat) cairo_image_surface_get_format(csurf);
     mOwnsData = false;
     mStride = cairo_image_surface_get_stride(csurf);
 
     Init(csurf, true);
 }
 
-gfxImageSurface::gfxImageSurface(unsigned char *aData, const gfxIntSize& aSize,
+gfxImageSurface::gfxImageSurface(unsigned char *aData, const IntSize& aSize,
                                  long aStride, gfxImageFormat aFormat)
 {
     InitWithData(aData, aSize, aStride, aFormat);
 }
 
 void
 gfxImageSurface::MakeInvalid()
 {
-    mSize = gfxIntSize(-1, -1);
+    mSize = IntSize(-1, -1);
     mData = nullptr;
     mStride = 0;
 }
 
 void
-gfxImageSurface::InitWithData(unsigned char *aData, const gfxIntSize& aSize,
+gfxImageSurface::InitWithData(unsigned char *aData, const IntSize& aSize,
                               long aStride, gfxImageFormat aFormat)
 {
     mSize = aSize;
     mOwnsData = false;
     mData = aData;
     mFormat = aFormat;
     mStride = aStride;
 
@@ -94,17 +94,17 @@ TryAllocAlignedBytes(size_t aSize)
                               aSize) ?
              nullptr : ptr;
 #else
     // Oh well, hope that luck is with us in the allocator
     return malloc(aSize);
 #endif
 }
 
-gfxImageSurface::gfxImageSurface(const gfxIntSize& size, gfxImageFormat format, bool aClear)
+gfxImageSurface::gfxImageSurface(const IntSize& size, gfxImageFormat format, bool aClear)
  : mSize(size), mData(nullptr), mFormat(format)
 {
     AllocateAndInit(0, 0, aClear);
 }
 
 void 
 gfxImageSurface::AllocateAndInit(long aStride, int32_t aMinimalAllocation,
                                  bool aClear)
@@ -145,17 +145,17 @@ gfxImageSurface::AllocateAndInit(long aS
     Init(surface);
 
     if (mSurfaceValid) {
         RecordMemoryUsed(mSize.height * ComputeStride() +
                          sizeof(gfxImageSurface));
     }
 }
 
-gfxImageSurface::gfxImageSurface(const gfxIntSize& size, gfxImageFormat format,
+gfxImageSurface::gfxImageSurface(const IntSize& size, gfxImageFormat format,
                                  long aStride, int32_t aExtraBytes, bool aClear)
  : mSize(size), mData(nullptr), mFormat(format)
 {
     AllocateAndInit(aStride, aExtraBytes, aClear);
 }
 
 gfxImageSurface::gfxImageSurface(cairo_surface_t *csurf)
 {
@@ -171,17 +171,17 @@ gfxImageSurface::gfxImageSurface(cairo_s
 
 gfxImageSurface::~gfxImageSurface()
 {
     if (mOwnsData)
         free(mData);
 }
 
 /*static*/ long
-gfxImageSurface::ComputeStride(const gfxIntSize& aSize, gfxImageFormat aFormat)
+gfxImageSurface::ComputeStride(const IntSize& aSize, gfxImageFormat aFormat)
 {
     long stride;
 
     if (aFormat == gfxImageFormat::ARGB32)
         stride = aSize.width * 4;
     else if (aFormat == gfxImageFormat::RGB24)
         stride = aSize.width * 4;
     else if (aFormat == gfxImageFormat::RGB16_565)
@@ -219,17 +219,17 @@ gfxImageSurface::SizeOfIncludingThis(moz
 bool
 gfxImageSurface::SizeOfIsMeasured() const
 {
     return true;
 }
 
 // helper function for the CopyFrom methods
 static void
-CopyForStride(unsigned char* aDest, unsigned char* aSrc, const gfxIntSize& aSize, long aDestStride, long aSrcStride)
+CopyForStride(unsigned char* aDest, unsigned char* aSrc, const IntSize& aSize, long aDestStride, long aSrcStride)
 {
     if (aDestStride == aSrcStride) {
         memcpy (aDest, aSrc, aSrcStride * aSize.height);
     } else {
         int lineSize = std::min(aDestStride, aSrcStride);
         for (int i = 0; i < aSize.height; i++) {
             unsigned char* src = aSrc + aSrcStride * i;
             unsigned char* dst = aDest + aDestStride * i;
@@ -258,17 +258,17 @@ bool
 gfxImageSurface::CopyFrom (SourceSurface *aSurface)
 {
     mozilla::RefPtr<DataSourceSurface> data = aSurface->GetDataSurface();
 
     if (!data) {
         return false;
     }
 
-    gfxIntSize size(data->GetSize().width, data->GetSize().height);
+    IntSize size(data->GetSize().width, data->GetSize().height);
     if (size != mSize) {
         return false;
     }
 
     if (!FormatsAreCompatible(SurfaceFormatToImageFormat(aSurface->GetFormat()),
                               mFormat)) {
         return false;
     }
@@ -298,17 +298,17 @@ gfxImageSurface::CopyFrom(gfxImageSurfac
 bool
 gfxImageSurface::CopyTo(SourceSurface *aSurface) {
     mozilla::RefPtr<DataSourceSurface> data = aSurface->GetDataSurface();
 
     if (!data) {
         return false;
     }
 
-    gfxIntSize size(data->GetSize().width, data->GetSize().height);
+    IntSize size(data->GetSize().width, data->GetSize().height);
     if (size != mSize) {
         return false;
     }
 
     if (!FormatsAreCompatible(SurfaceFormatToImageFormat(aSurface->GetFormat()),
                               mFormat)) {
         return false;
     }
@@ -345,25 +345,25 @@ gfxImageSurface::GetSubimage(const gfxRe
 
     if (format == gfxImageFormat::ARGB32 &&
         GetOpaqueRect().Contains(aRect)) {
         format = gfxImageFormat::RGB24;
     }
 
     nsRefPtr<gfxSubimageSurface> image =
         new gfxSubimageSurface(this, subData,
-                               gfxIntSize((int)r.Width(), (int)r.Height()),
+                               IntSize((int)r.Width(), (int)r.Height()),
                                format);
 
     return image.forget();
 }
 
 gfxSubimageSurface::gfxSubimageSurface(gfxImageSurface* aParent,
                                        unsigned char* aData,
-                                       const gfxIntSize& aSize,
+                                       const IntSize& aSize,
                                        gfxImageFormat aFormat)
   : gfxImageSurface(aData, aSize, aParent->Stride(), aFormat)
   , mParent(aParent)
 {
 }
 
 already_AddRefed<gfxImageSurface>
 gfxImageSurface::GetAsImageSurface()
--- a/gfx/thebes/gfxImageSurface.h
+++ b/gfx/thebes/gfxImageSurface.h
@@ -34,54 +34,54 @@ public:
      * Construct an image surface around an existing buffer of image data.
      * @param aData A buffer containing the image data
      * @param aSize The size of the buffer
      * @param aStride The stride of the buffer
      * @param format Format of the data
      *
      * @see gfxImageFormat
      */
-    gfxImageSurface(unsigned char *aData, const gfxIntSize& aSize,
+    gfxImageSurface(unsigned char *aData, const mozilla::gfx::IntSize& aSize,
                     long aStride, gfxImageFormat aFormat);
 
     /**
      * Construct an image surface.
      * @param aSize The size of the buffer
      * @param format Format of the data
      *
      * @see gfxImageFormat
      */
-    gfxImageSurface(const gfxIntSize& size, gfxImageFormat format, bool aClear = true);
+    gfxImageSurface(const mozilla::gfx::IntSize& size, gfxImageFormat format, bool aClear = true);
 
     /**
      * Construct an image surface, with a specified stride and allowing the
      * allocation of more memory than required for the storage of the surface
      * itself.  When aStride and aMinimalAllocation are <=0, this constructor
      * is the equivalent of the preceeding one.
      *
      * @param format Format of the data
      * @param aSize The size of the buffer
      * @param aStride The stride of the buffer - if <=0, use ComputeStride()
      * @param aMinimalAllocation Allocate at least this many bytes.  If smaller
      *        than width * stride, or width*stride <=0, this value is ignored.
      * @param aClear 
      *
      * @see gfxImageFormat
      */
-    gfxImageSurface(const gfxIntSize& aSize, gfxImageFormat aFormat,
+    gfxImageSurface(const mozilla::gfx::IntSize& aSize, gfxImageFormat aFormat,
                     long aStride, int32_t aMinimalAllocation, bool aClear);
 
     explicit gfxImageSurface(cairo_surface_t *csurf);
 
     virtual ~gfxImageSurface();
 
     // ImageSurface methods
     gfxImageFormat Format() const { return mFormat; }
 
-    virtual const gfxIntSize GetSize() const override { return mSize; }
+    virtual const mozilla::gfx::IntSize GetSize() const override { return mSize; }
     int32_t Width() const { return mSize.width; }
     int32_t Height() const { return mSize.height; }
 
     /**
      * Distance in bytes between the start of a line and the start of the
      * next line.
      */
     int32_t Stride() const { return mStride; }
@@ -119,52 +119,52 @@ public:
     /* return new Subimage with pointing to original image starting from aRect.pos
      * and size of aRect.size. New subimage keeping current image reference
      */
     already_AddRefed<gfxSubimageSurface> GetSubimage(const gfxRect& aRect);
 
     virtual already_AddRefed<gfxImageSurface> GetAsImageSurface() override;
 
     /** See gfxASurface.h. */
-    static long ComputeStride(const gfxIntSize&, gfxImageFormat);
+    static long ComputeStride(const mozilla::gfx::IntSize&, gfxImageFormat);
 
     virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
         override;
     virtual size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
         override;
     virtual bool SizeOfIsMeasured() const override;
 
 protected:
     gfxImageSurface();
-    void InitWithData(unsigned char *aData, const gfxIntSize& aSize,
+    void InitWithData(unsigned char *aData, const mozilla::gfx::IntSize& aSize,
                       long aStride, gfxImageFormat aFormat);
     /**
      * See the parameters to the matching constructor.  This should only
      * be called once, in the constructor, which has already set mSize
      * and mFormat.
      */
     void AllocateAndInit(long aStride, int32_t aMinimalAllocation, bool aClear);
     void InitFromSurface(cairo_surface_t *csurf);
 
     long ComputeStride() const { return ComputeStride(mSize, mFormat); }
 
 
     void MakeInvalid();
 
-    gfxIntSize mSize;
+    mozilla::gfx::IntSize mSize;
     bool mOwnsData;
     unsigned char *mData;
     gfxImageFormat mFormat;
     long mStride;
 };
 
 class gfxSubimageSurface : public gfxImageSurface {
 protected:
     friend class gfxImageSurface;
     gfxSubimageSurface(gfxImageSurface* aParent,
                        unsigned char* aData,
-                       const gfxIntSize& aSize,
+                       const mozilla::gfx::IntSize& aSize,
                        gfxImageFormat aFormat);
 private:
     nsRefPtr<gfxImageSurface> mParent;
 };
 
 #endif /* GFX_IMAGESURFACE_H */
--- a/gfx/thebes/gfxPDFSurface.h
+++ b/gfx/thebes/gfxPDFSurface.h
@@ -24,19 +24,19 @@ public:
     virtual nsresult BeginPage();
     virtual nsresult EndPage();
     virtual void Finish();
 
     void SetDPI(double x, double y);
     void GetDPI(double *xDPI, double *yDPI);
 
     // this is in points!
-    virtual const gfxIntSize GetSize() const
+    virtual const mozilla::gfx::IntSize GetSize() const
     {
-        return gfxIntSize(mSize.width, mSize.height);
+        return mozilla::gfx::IntSize(mSize.width, mSize.height);
     }
 
 private:
     nsCOMPtr<nsIOutputStream> mStream;
     double mXDPI;
     double mYDPI;
     gfxSize mSize;
 };
--- a/gfx/thebes/gfxPSSurface.cpp
+++ b/gfx/thebes/gfxPSSurface.cpp
@@ -20,28 +20,28 @@ write_func(void *closure, const unsigned
     } while (length > 0);
     NS_ASSERTION(length == 0, "not everything was written to the file");
     return CAIRO_STATUS_SUCCESS;
 }
 
 gfxPSSurface::gfxPSSurface(nsIOutputStream *aStream, const gfxSize& aSizeInPoints, PageOrientation aOrientation)
     : mStream(aStream), mXDPI(-1), mYDPI(-1), mOrientation(aOrientation)
 {
-    mSize = gfxIntSize(aSizeInPoints.width, aSizeInPoints.height);
+    mSize = mozilla::gfx::IntSize(aSizeInPoints.width, aSizeInPoints.height);
 
     // The PS output does not specify the page size so to print
     // landscape we need to rotate the drawing 90 degrees and print on
     // portrait paper. If printing landscape, swap the width/height
     // supplied to cairo to select a portrait print area. gfxContext
     // will perform the rotation when GetRotateForLandscape() is TRUE.
-    gfxIntSize cairoSize;
+    mozilla::gfx::IntSize cairoSize;
     if (mOrientation == PORTRAIT) {
         cairoSize = mSize;
     } else {
-        cairoSize = gfxIntSize(mSize.height, mSize.width);
+        cairoSize = mozilla::gfx::IntSize(mSize.height, mSize.width);
     }
     cairo_surface_t* ps_surface = cairo_ps_surface_create_for_stream(write_func, (void*)mStream, cairoSize.width, cairoSize.height);
     cairo_ps_surface_restrict_to_level(ps_surface, CAIRO_PS_LEVEL_2);
     Init(ps_surface);
 }
 
 gfxPSSurface::~gfxPSSurface()
 {
--- a/gfx/thebes/gfxPSSurface.h
+++ b/gfx/thebes/gfxPSSurface.h
@@ -31,22 +31,22 @@ public:
     virtual void Finish();
 
     void SetDPI(double x, double y);
     void GetDPI(double *xDPI, double *yDPI);
 
     virtual bool GetRotateForLandscape() { return (mOrientation == LANDSCAPE); }
 
     // this is in points!
-    virtual const gfxIntSize GetSize() const
+    virtual const mozilla::gfx::IntSize GetSize() const
     {
         return mSize;
     }
 
 private:
     nsCOMPtr<nsIOutputStream> mStream;
     double mXDPI;
     double mYDPI;
-    gfxIntSize mSize;
+    mozilla::gfx::IntSize mSize;
     PageOrientation mOrientation;
 };
 
 #endif /* GFX_PSSURFACE_H */
--- a/gfx/thebes/gfxQPainterSurface.cpp
+++ b/gfx/thebes/gfxQPainterSurface.cpp
@@ -14,27 +14,27 @@ gfxQPainterSurface::gfxQPainterSurface(Q
 {
     cairo_surface_t *csurf = cairo_qt_surface_create (painter);
 
     mPainter = painter;
 
     Init (csurf);
 }
 
-gfxQPainterSurface::gfxQPainterSurface(const gfxIntSize& size, gfxImageFormat format)
+gfxQPainterSurface::gfxQPainterSurface(const mozilla::gfx::IntSize& size, gfxImageFormat format)
 {
     cairo_surface_t *csurf = cairo_qt_surface_create_with_qimage ((cairo_format_t) format,
                                                                         size.width,
                                                                         size.height);
     mPainter = cairo_qt_surface_get_qpainter (csurf);
 
     Init (csurf);
 }
 
-gfxQPainterSurface::gfxQPainterSurface(const gfxIntSize& size, gfxContentType content)
+gfxQPainterSurface::gfxQPainterSurface(const mozilla::gfx::IntSize& size, gfxContentType content)
 {
     cairo_surface_t *csurf = cairo_qt_surface_create_with_qpixmap ((cairo_content_t) content,
                                                                          size.width,
                                                                          size.height);
     mPainter = cairo_qt_surface_get_qpainter (csurf);
 
     Init (csurf);
 }
--- a/gfx/thebes/gfxQPainterSurface.h
+++ b/gfx/thebes/gfxQPainterSurface.h
@@ -13,18 +13,18 @@
 #ifdef CAIRO_HAS_QT_SURFACE
 
 class QPainter;
 class QImage;
 
 class gfxQPainterSurface : public gfxASurface {
 public:
     gfxQPainterSurface(QPainter *painter);
-    gfxQPainterSurface(const gfxIntSize& size, gfxImageFormat format);
-    gfxQPainterSurface(const gfxIntSize& size, gfxContentType content);
+    gfxQPainterSurface(const mozilla::gfx::IntSize& size, gfxImageFormat format);
+    gfxQPainterSurface(const mozilla::gfx::IntSize& size, gfxContentType content);
 
     gfxQPainterSurface(cairo_surface_t *csurf);
 
     virtual ~gfxQPainterSurface();
 
     QPainter *GetQPainter() { return mPainter; }
 
     QImage *GetQImage();
--- a/gfx/thebes/gfxQtNativeRenderer.cpp
+++ b/gfx/thebes/gfxQtNativeRenderer.cpp
@@ -25,17 +25,17 @@ gfxQtNativeRenderer::Draw(gfxContext* ct
         if (!foundVisual)
             return NS_ERROR_FAILURE;
 
         visual = vinfo.visual;
     }
 
     nsRefPtr<gfxXlibSurface> xsurf =
         gfxXlibSurface::Create(screen, visual,
-                               gfxIntSize(size.width, size.height));
+                               mozilla::gfx::IntSize(size.width, size.height));
 
     if (!isOpaque) {
         gfxUtils::ClearThebesSurface(xsurf);
     }
 
     nsresult rv = DrawWithXlib(xsurf->CairoSurface(), nsIntPoint(0, 0), nullptr, 0);
 
     if (NS_FAILED(rv))
--- a/gfx/thebes/gfxQtPlatform.cpp
+++ b/gfx/thebes/gfxQtPlatform.cpp
@@ -90,17 +90,17 @@ gfxQtPlatform::GetXScreen(QWindow* aWind
 
 already_AddRefed<gfxASurface>
 gfxQtPlatform::CreateOffscreenSurface(const IntSize& size,
                                       gfxContentType contentType)
 {
     gfxImageFormat imageFormat = OptimalFormatForContent(contentType);
 
     nsRefPtr<gfxASurface> newSurface =
-        new gfxImageSurface(gfxIntSize(size.width, size.height), imageFormat);
+        new gfxImageSurface(size, imageFormat);
 
     return newSurface.forget();
 }
 
 nsresult
 gfxQtPlatform::GetFontList(nsIAtom *aLangGroup,
                            const nsACString& aGenericFamily,
                            nsTArray<nsString>& aListOfFonts)
--- a/gfx/thebes/gfxQuartzImageSurface.cpp
+++ b/gfx/thebes/gfxQuartzImageSurface.cpp
@@ -23,30 +23,30 @@ gfxQuartzImageSurface::gfxQuartzImageSur
     Init (csurf, true);
     mSize = ComputeSize();
 }
 
 gfxQuartzImageSurface::~gfxQuartzImageSurface()
 {
 }
 
-gfxIntSize
+mozilla::gfx::IntSize
 gfxQuartzImageSurface::ComputeSize()
 {
   if (mSurfaceValid) {
     cairo_surface_t* isurf = cairo_quartz_image_surface_get_image(mSurface);
     if (isurf) {
-      return gfxIntSize(cairo_image_surface_get_width(isurf),
-                        cairo_image_surface_get_height(isurf));
+      return mozilla::gfx::IntSize(cairo_image_surface_get_width(isurf),
+                                   cairo_image_surface_get_height(isurf));
     }
   }
 
   // If we reach here then something went wrong. Just use the same default
   // value as gfxASurface::GetSize.
-  return gfxIntSize(-1, -1);
+  return mozilla::gfx::IntSize(-1, -1);
 }
 
 int32_t
 gfxQuartzImageSurface::KnownMemoryUsed()
 {
   // This surface doesn't own any memory itself, but we want to report here the
   // amount of memory that the surface it wraps uses.
   nsRefPtr<gfxImageSurface> imgSurface = GetAsImageSurface();
--- a/gfx/thebes/gfxQuartzImageSurface.h
+++ b/gfx/thebes/gfxQuartzImageSurface.h
@@ -15,18 +15,18 @@ class gfxQuartzImageSurface : public gfx
 public:
     explicit gfxQuartzImageSurface(gfxImageSurface *imageSurface);
     explicit gfxQuartzImageSurface(cairo_surface_t *csurf);
 
     virtual ~gfxQuartzImageSurface();
 
     already_AddRefed<gfxImageSurface> GetAsImageSurface();
     virtual int32_t KnownMemoryUsed();
-    virtual const gfxIntSize GetSize() const { return gfxIntSize(mSize.width, mSize.height); }
+    virtual const mozilla::gfx::IntSize GetSize() const { return mSize; }
 
 protected:
-    gfxIntSize mSize;
+    mozilla::gfx::IntSize mSize;
 
 private:
-    gfxIntSize ComputeSize();
+    mozilla::gfx::IntSize ComputeSize();
 };
 
 #endif /* GFX_QUARTZIMAGESURFACE_H */
--- a/gfx/thebes/gfxQuartzSurface.cpp
+++ b/gfx/thebes/gfxQuartzSurface.cpp
@@ -7,23 +7,23 @@
 #include "gfxContext.h"
 #include "gfxImageSurface.h"
 
 #include "cairo-quartz.h"
 
 void
 gfxQuartzSurface::MakeInvalid()
 {
-    mSize = gfxIntSize(-1, -1);    
+    mSize = mozilla::gfx::IntSize(-1, -1);
 }
 
 gfxQuartzSurface::gfxQuartzSurface(const gfxSize& desiredSize, gfxImageFormat format)
     : mCGContext(nullptr), mSize(desiredSize)
 {
-    gfxIntSize size((unsigned int) floor(desiredSize.width),
+    mozilla::gfx::IntSize size((unsigned int) floor(desiredSize.width),
                     (unsigned int) floor(desiredSize.height));
     if (!CheckSurfaceSize(size))
         MakeInvalid();
 
     unsigned int width = static_cast<unsigned int>(mSize.width);
     unsigned int height = static_cast<unsigned int>(mSize.height);
 
     cairo_surface_t *surf = cairo_quartz_surface_create
@@ -38,17 +38,17 @@ gfxQuartzSurface::gfxQuartzSurface(const
       RecordMemoryUsed(mSize.height * 4 + sizeof(gfxQuartzSurface));
     }
 }
 
 gfxQuartzSurface::gfxQuartzSurface(CGContextRef context,
                                    const gfxSize& desiredSize)
     : mCGContext(context), mSize(desiredSize)
 {
-    gfxIntSize size((unsigned int) floor(desiredSize.width),
+    mozilla::gfx::IntSize size((unsigned int) floor(desiredSize.width),
                     (unsigned int) floor(desiredSize.height));
     if (!CheckSurfaceSize(size))
         MakeInvalid();
 
     unsigned int width = static_cast<unsigned int>(mSize.width);
     unsigned int height = static_cast<unsigned int>(mSize.height);
 
     cairo_surface_t *surf =
@@ -59,17 +59,17 @@ gfxQuartzSurface::gfxQuartzSurface(CGCon
 
     Init(surf);
     if (mSurfaceValid) {
       RecordMemoryUsed(mSize.height * 4 + sizeof(gfxQuartzSurface));
     }
 }
 
 gfxQuartzSurface::gfxQuartzSurface(CGContextRef context,
-                                   const gfxIntSize& size)
+                                   const mozilla::gfx::IntSize& size)
     : mCGContext(context), mSize(size)
 {
     if (!CheckSurfaceSize(size))
         MakeInvalid();
 
     unsigned int width = static_cast<unsigned int>(mSize.width);
     unsigned int height = static_cast<unsigned int>(mSize.height);
 
@@ -81,32 +81,32 @@ gfxQuartzSurface::gfxQuartzSurface(CGCon
 
     Init(surf);
     if (mSurfaceValid) {
       RecordMemoryUsed(mSize.height * 4 + sizeof(gfxQuartzSurface));
     }
 }
 
 gfxQuartzSurface::gfxQuartzSurface(cairo_surface_t *csurf,
-                                   const gfxIntSize& aSize) :
+                                   const mozilla::gfx::IntSize& aSize) :
     mSize(aSize)
 {
     mCGContext = cairo_quartz_surface_get_cg_context (csurf);
     CGContextRetain (mCGContext);
 
     Init(csurf, true);
 }
 
 gfxQuartzSurface::gfxQuartzSurface(unsigned char *data,
                                    const gfxSize& desiredSize,
                                    long stride,
                                    gfxImageFormat format)
     : mCGContext(nullptr), mSize(desiredSize)
 {
-    gfxIntSize size((unsigned int) floor(desiredSize.width),
+    mozilla::gfx::IntSize size((unsigned int) floor(desiredSize.width),
                     (unsigned int) floor(desiredSize.height));
     if (!CheckSurfaceSize(size))
         MakeInvalid();
 
     unsigned int width = static_cast<unsigned int>(mSize.width);
     unsigned int height = static_cast<unsigned int>(mSize.height);
 
     cairo_surface_t *surf = cairo_quartz_surface_create_for_data
@@ -118,17 +118,17 @@ gfxQuartzSurface::gfxQuartzSurface(unsig
 
     Init(surf);
     if (mSurfaceValid) {
       RecordMemoryUsed(mSize.height * stride + sizeof(gfxQuartzSurface));
     }
 }
 
 gfxQuartzSurface::gfxQuartzSurface(unsigned char *data,
-                                   const gfxIntSize& aSize,
+                                   const mozilla::gfx::IntSize& aSize,
                                    long stride,
                                    gfxImageFormat format)
     : mCGContext(nullptr), mSize(aSize.width, aSize.height)
 {
     if (!CheckSurfaceSize(aSize))
         MakeInvalid();
 
     cairo_surface_t *surf = cairo_quartz_surface_create_for_data
@@ -141,17 +141,17 @@ gfxQuartzSurface::gfxQuartzSurface(unsig
     Init(surf);
     if (mSurfaceValid) {
       RecordMemoryUsed(mSize.height * stride + sizeof(gfxQuartzSurface));
     }
 }
 
 already_AddRefed<gfxASurface>
 gfxQuartzSurface::CreateSimilarSurface(gfxContentType aType,
-                                       const gfxIntSize& aSize)
+                                       const mozilla::gfx::IntSize& aSize)
 {
     cairo_surface_t *surface =
         cairo_quartz_surface_create_cg_layer(mSurface, (cairo_content_t)aType,
                                              aSize.width, aSize.height);
     if (cairo_surface_status(surface)) {
         cairo_surface_destroy(surface);
         return nullptr;
     }
--- a/gfx/thebes/gfxQuartzSurface.h
+++ b/gfx/thebes/gfxQuartzSurface.h
@@ -14,27 +14,27 @@
 
 class gfxContext;
 class gfxImageSurface;
 
 class gfxQuartzSurface : public gfxASurface {
 public:
     gfxQuartzSurface(const gfxSize& size, gfxImageFormat format);
     gfxQuartzSurface(CGContextRef context, const gfxSize& size);
-    gfxQuartzSurface(CGContextRef context, const gfxIntSize& size);
-    gfxQuartzSurface(cairo_surface_t *csurf, const gfxIntSize& aSize);
+    gfxQuartzSurface(CGContextRef context, const mozilla::gfx::IntSize& size);
+    gfxQuartzSurface(cairo_surface_t *csurf, const mozilla::gfx::IntSize& aSize);
     gfxQuartzSurface(unsigned char *data, const gfxSize& size, long stride, gfxImageFormat format);
-    gfxQuartzSurface(unsigned char *data, const gfxIntSize& size, long stride, gfxImageFormat format);
+    gfxQuartzSurface(unsigned char *data, const mozilla::gfx::IntSize& size, long stride, gfxImageFormat format);
 
     virtual ~gfxQuartzSurface();
 
     virtual already_AddRefed<gfxASurface> CreateSimilarSurface(gfxContentType aType,
-                                                               const gfxIntSize& aSize);
+                                                               const mozilla::gfx::IntSize& aSize);
 
-    virtual const gfxIntSize GetSize() const { return gfxIntSize(mSize.width, mSize.height); }
+    virtual const mozilla::gfx::IntSize GetSize() const { return mozilla::gfx::IntSize(mSize.width, mSize.height); }
 
     CGContextRef GetCGContext() { return mCGContext; }
 
     CGContextRef GetCGContextWithClip(gfxContext *ctx);
 
     already_AddRefed<gfxImageSurface> GetAsImageSurface();
 
 protected:
--- a/gfx/thebes/gfxSharedImageSurface.h
+++ b/gfx/thebes/gfxSharedImageSurface.h
@@ -9,16 +9,16 @@
 
 #include "gfxBaseSharedMemorySurface.h"
 
 class gfxSharedImageSurface : public gfxBaseSharedMemorySurface<gfxImageSurface, gfxSharedImageSurface>
 {
   typedef gfxBaseSharedMemorySurface<gfxImageSurface, gfxSharedImageSurface> Super;
   friend class gfxBaseSharedMemorySurface<gfxImageSurface, gfxSharedImageSurface>;
 private:
-    gfxSharedImageSurface(const gfxIntSize& aSize, long aStride, 
-                          gfxImageFormat aFormat, 
+    gfxSharedImageSurface(const mozilla::gfx::IntSize& aSize, long aStride,
+                          gfxImageFormat aFormat,
                           const mozilla::ipc::Shmem& aShmem)
       : Super(aSize, aStride, aFormat, aShmem)
     {}
 };
 
 #endif /* GFX_SHARED_IMAGESURFACE_H */
--- a/gfx/thebes/gfxSharedQuartzSurface.h
+++ b/gfx/thebes/gfxSharedQuartzSurface.h
@@ -10,16 +10,16 @@
 #include "gfxBaseSharedMemorySurface.h"
 #include "gfxQuartzSurface.h"
 
 class gfxSharedQuartzSurface : public gfxBaseSharedMemorySurface<gfxQuartzSurface, gfxSharedQuartzSurface>
 {
   typedef gfxBaseSharedMemorySurface<gfxQuartzSurface, gfxSharedQuartzSurface> Super;
   friend class gfxBaseSharedMemorySurface<gfxQuartzSurface, gfxSharedQuartzSurface>;
 private:
-    gfxSharedQuartzSurface(const gfxIntSize& aSize, long aStride, 
-                           gfxImageFormat aFormat, 
+    gfxSharedQuartzSurface(const mozilla::gfx::IntSize& aSize, long aStride,
+                           gfxImageFormat aFormat,
                            const mozilla::ipc::Shmem& aShmem)
       : Super(aSize, aStride, aFormat, aShmem)
     {}
 };
 
 #endif /* GFX_SHARED_QUARTZSURFACE_H */
--- a/gfx/thebes/gfxTeeSurface.cpp
+++ b/gfx/thebes/gfxTeeSurface.cpp
@@ -20,17 +20,17 @@ gfxTeeSurface::gfxTeeSurface(gfxASurface
     cairo_surface_t *csurf = cairo_tee_surface_create(aSurfaces[0]->CairoSurface());
     Init(csurf, false);
 
     for (int32_t i = 1; i < aSurfaceCount; ++i) {
         cairo_tee_surface_add(csurf, aSurfaces[i]->CairoSurface());
     }
 }
 
-const gfxIntSize
+const mozilla::gfx::IntSize
 gfxTeeSurface::GetSize() const
 {
     nsRefPtr<gfxASurface> master = Wrap(cairo_tee_surface_index(mSurface, 0));
     return master->GetSize();
 }
 
 void
 gfxTeeSurface::GetSurfaces(nsTArray<nsRefPtr<gfxASurface> >* aSurfaces)
--- a/gfx/thebes/gfxTeeSurface.h
+++ b/gfx/thebes/gfxTeeSurface.h
@@ -21,17 +21,17 @@ template<class T> class nsRefPtr;
  * underlying surfaces --- which also applies the device transforms of the
  * underlying surfaces.
  */
 class gfxTeeSurface : public gfxASurface {
 public:
     explicit gfxTeeSurface(cairo_surface_t *csurf);
     gfxTeeSurface(gfxASurface **aSurfaces, int32_t aSurfaceCount);
 
-    virtual const gfxIntSize GetSize() const;
+    virtual const mozilla::gfx::IntSize GetSize() const;
 
     /**
      * Returns the list of underlying surfaces.
      */
     void GetSurfaces(nsTArray<nsRefPtr<gfxASurface> > *aSurfaces);
 };
 
 #endif /* GFX_TEESURFACE_H */
--- a/gfx/thebes/gfxUtils.cpp
+++ b/gfx/thebes/gfxUtils.cpp
@@ -74,17 +74,17 @@ void mozilla_dump_image(void* bytes, int
     case 4:
     default:
         format = SurfaceFormat::R8G8B8A8;
         break;
     }
 
     RefPtr<DataSourceSurface> surf =
         Factory::CreateWrappingDataSourceSurface((uint8_t*)bytes, strideBytes,
-                                                 gfx::IntSize(width, height),
+                                                 IntSize(width, height),
                                                  format);
     gfxUtils::DumpAsDataURI(surf);
 }
 
 }
 
 static const uint8_t PremultiplyValue(uint8_t a, uint8_t v) {
     return gfxUtils::sPremultiplyTable[a*256+v];
@@ -435,17 +435,17 @@ CreateSamplingRestrictedDrawable(gfxDraw
 
     // if 'needed' is empty, nothing will be drawn since aFill
     // must be entirely outside the clip region, so it doesn't
     // matter what we do here, but we should avoid trying to
     // create a zero-size surface.
     if (needed.IsEmpty())
         return nullptr;
 
-    gfxIntSize size(int32_t(needed.Width()), int32_t(needed.Height()));
+    IntSize size(int32_t(needed.Width()), int32_t(needed.Height()));
 
     RefPtr<DrawTarget> target =
       gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(size, aFormat);
     if (!target) {
       return nullptr;
     }
 
     nsRefPtr<gfxContext> tmpCtx = new gfxContext(target);
@@ -853,17 +853,17 @@ gfxUtils::GfxRectToIntRect(const gfxRect
   *aOut = IntRect(int32_t(aIn.X()), int32_t(aIn.Y()),
   int32_t(aIn.Width()), int32_t(aIn.Height()));
   return gfxRect(aOut->x, aOut->y, aOut->width, aOut->height).IsEqualEdges(aIn);
 }
 
 void
 gfxUtils::GetYCbCrToRGBDestFormatAndSize(const PlanarYCbCrData& aData,
                                          gfxImageFormat& aSuggestedFormat,
-                                         gfxIntSize& aSuggestedSize)
+                                         IntSize& aSuggestedSize)
 {
   YUVType yuvtype =
     TypeFromSize(aData.mYSize.width,
                       aData.mYSize.height,
                       aData.mCbCrSize.width,
                       aData.mCbCrSize.height);
 
   // 'prescale' is true if the scaling is to be done as part of the
@@ -907,17 +907,17 @@ gfxUtils::GetYCbCrToRGBDestFormatAndSize
   if (!prescale) {
     aSuggestedSize = aData.mPicSize;
   }
 }
 
 void
 gfxUtils::ConvertYCbCrToRGB(const PlanarYCbCrData& aData,
                             const gfxImageFormat& aDestFormat,
-                            const gfxIntSize& aDestSize,
+                            const IntSize& aDestSize,
                             unsigned char* aDestBuffer,
                             int32_t aStride)
 {
   // ConvertYCbCrToRGB et al. assume the chroma planes are rounded up if the
   // luma plane is odd sized.
   MOZ_ASSERT((aData.mCbCrSize.width == aData.mYSize.width ||
               aData.mCbCrSize.width == (aData.mYSize.width + 1) >> 1) &&
              (aData.mCbCrSize.height == aData.mYSize.height ||
--- a/gfx/thebes/gfxUtils.h
+++ b/gfx/thebes/gfxUtils.h
@@ -139,27 +139,27 @@ public:
      *   if the desired format is not supported.
      * @param aSuggestedSize will be set to the picture size from aData
      *   if either the suggested size was {0,0}
      *   or simultaneous scaling and conversion is not supported.
      */
     static void
     GetYCbCrToRGBDestFormatAndSize(const mozilla::layers::PlanarYCbCrData& aData,
                                    gfxImageFormat& aSuggestedFormat,
-                                   gfxIntSize& aSuggestedSize);
+                                   mozilla::gfx::IntSize& aSuggestedSize);
 
     /**
      * Convert YCbCrImage into RGB aDestBuffer
      * Format and Size parameters must have
      *   been passed to GetYCbCrToRGBDestFormatAndSize
      */
     static void
     ConvertYCbCrToRGB(const mozilla::layers::PlanarYCbCrData& aData,
                       const gfxImageFormat& aDestFormat,
-                      const gfxIntSize& aDestSize,
+                      const mozilla::gfx::IntSize& aDestSize,
                       unsigned char* aDestBuffer,
                       int32_t aStride);
 
     /**
      * Clears surface to aColor (which defaults to transparent black).
      */
     static void ClearThebesSurface(gfxASurface* aSurface,
                                    mozilla::gfx::IntRect* aRect = nullptr,
--- a/gfx/thebes/gfxWindowsNativeDrawing.cpp
+++ b/gfx/thebes/gfxWindowsNativeDrawing.cpp
@@ -112,32 +112,32 @@ gfxWindowsNativeDrawing::BeginNativeDraw
             if (mTransformType == TRANSLATION_ONLY || !(mNativeDrawFlags & CAN_AXIS_ALIGNED_SCALE)) {
                 mScale = gfxSize(1.0, 1.0);
 
                 // Add 1 to the surface size; it's guaranteed to not be incorrect,
                 // and it fixes bug 382458
                 // There's probably a better fix, but I haven't figured out
                 // the root cause of the problem.
                 mTempSurfaceSize =
-                    gfxIntSize((int32_t) ceil(mNativeRect.Width() + 1),
+                    IntSize((int32_t) ceil(mNativeRect.Width() + 1),
                                (int32_t) ceil(mNativeRect.Height() + 1));
             } else {
                 // figure out the scale factors
                 mScale = m.ScaleFactors(true);
 
                 mWorldTransform.eM11 = (FLOAT) mScale.width;
                 mWorldTransform.eM12 = 0.0f;
                 mWorldTransform.eM21 = 0.0f;
                 mWorldTransform.eM22 = (FLOAT) mScale.height;
                 mWorldTransform.eDx  = 0.0f;
                 mWorldTransform.eDy  = 0.0f;
 
                 // See comment above about "+1"
                 mTempSurfaceSize =
-                    gfxIntSize((int32_t) ceil(mNativeRect.Width() * mScale.width + 1),
+                    IntSize((int32_t) ceil(mNativeRect.Width() * mScale.width + 1),
                                (int32_t) ceil(mNativeRect.Height() * mScale.height + 1));
             }
         }
     }
 
     if (mRenderState == RENDER_STATE_NATIVE_DRAWING) {
         // we can just do native drawing directly to the context's surface
 
--- a/gfx/thebes/gfxWindowsNativeDrawing.h
+++ b/gfx/thebes/gfxWindowsNativeDrawing.h
@@ -108,12 +108,12 @@ private:
     gfxSize mScale;
     XFORM mWorldTransform;
 
     // saved state
     nsRefPtr<gfxWindowsSurface> mWinSurface, mBlackSurface, mWhiteSurface;
     HDC mDC;
     XFORM mOldWorldTransform;
     POINT mOrigViewportOrigin;
-    gfxIntSize mTempSurfaceSize;
+    mozilla::gfx::IntSize mTempSurfaceSize;
 };
 
 #endif
--- a/gfx/thebes/gfxWindowsSurface.cpp
+++ b/gfx/thebes/gfxWindowsSurface.cpp
@@ -38,45 +38,45 @@ gfxWindowsSurface::gfxWindowsSurface(IDi
     mOwnsDC(false), mForPrinting(false), mDC(0), mWnd(nullptr)
 {
     cairo_surface_t *surf = cairo_win32_surface_create_with_d3dsurface9(surface);
     Init(surf);
 }
 
 
 void
-gfxWindowsSurface::MakeInvalid(gfxIntSize& size)
+gfxWindowsSurface::MakeInvalid(mozilla::gfx::IntSize& size)
 {
-    size = gfxIntSize(-1, -1);
+    size = mozilla::gfx::IntSize(-1, -1);
 }
 
-gfxWindowsSurface::gfxWindowsSurface(const gfxIntSize& realSize, gfxImageFormat imageFormat) :
+gfxWindowsSurface::gfxWindowsSurface(const mozilla::gfx::IntSize& realSize, gfxImageFormat imageFormat) :
     mOwnsDC(false), mForPrinting(false), mWnd(nullptr)
 {
-    gfxIntSize size(realSize);
+    mozilla::gfx::IntSize size(realSize);
     if (!CheckSurfaceSize(size))
         MakeInvalid(size);
 
     cairo_surface_t *surf = cairo_win32_surface_create_with_dib((cairo_format_t)(int)imageFormat,
                                                                 size.width, size.height);
 
     Init(surf);
 
     if (CairoStatus() == CAIRO_STATUS_SUCCESS) {
         mDC = cairo_win32_surface_get_dc(CairoSurface());
         RecordMemoryUsed(size.width * size.height * 4 + sizeof(gfxWindowsSurface));
     } else {
         mDC = nullptr;
     }
 }
 
-gfxWindowsSurface::gfxWindowsSurface(HDC dc, const gfxIntSize& realSize, gfxImageFormat imageFormat) :
+gfxWindowsSurface::gfxWindowsSurface(HDC dc, const mozilla::gfx::IntSize& realSize, gfxImageFormat imageFormat) :
     mOwnsDC(false), mForPrinting(false), mWnd(nullptr)
 {
-    gfxIntSize size(realSize);
+    mozilla::gfx::IntSize size(realSize);
     if (!CheckSurfaceSize(size))
         MakeInvalid(size);
 
     cairo_surface_t *surf = cairo_win32_surface_create_with_ddb(dc, (cairo_format_t)(int)imageFormat,
                                                                 size.width, size.height);
 
     Init(surf);
 
@@ -113,17 +113,17 @@ gfxWindowsSurface::InitWithDC(uint32_t f
         Init(cairo_win32_surface_create_with_alpha(mDC));
     } else {
         Init(cairo_win32_surface_create(mDC));
     }
 }
 
 already_AddRefed<gfxASurface>
 gfxWindowsSurface::CreateSimilarSurface(gfxContentType aContent,
-                                        const gfxIntSize& aSize)
+                                        const mozilla::gfx::IntSize& aSize)
 {
     if (!mSurface || !mSurfaceValid) {
         return nullptr;
     }
 
     cairo_surface_t *surface;
     if (!mForPrinting && GetContentType() == gfxContentType::COLOR_ALPHA) {
         // When creating a similar surface to a transparent surface, ensure
@@ -278,27 +278,27 @@ gfxWindowsSurface::EndPage()
     if (result <= 0)
         return NS_ERROR_FAILURE;
     return NS_OK;
 #else
     return NS_ERROR_FAILURE;
 #endif
 }
 
-const gfxIntSize 
+const mozilla::gfx::IntSize
 gfxWindowsSurface::GetSize() const
 {
     if (!mSurfaceValid) {
         NS_WARNING ("GetImageSurface on an invalid (null) surface; who's calling this without checking for surface errors?");
-        return gfxIntSize(-1, -1);
+        return mozilla::gfx::IntSize(-1, -1);
     }
 
     NS_ASSERTION(mSurface != nullptr, "CairoSurface() shouldn't be nullptr when mSurfaceValid is TRUE!");
 
-    return gfxIntSize(cairo_win32_surface_get_width(mSurface),
+    return mozilla::gfx::IntSize(cairo_win32_surface_get_width(mSurface),
                       cairo_win32_surface_get_height(mSurface));
 }
 
 gfxMemoryLocation
 gfxWindowsSurface::GetMemoryLocation() const
 {
     return gfxMemoryLocation::IN_PROCESS_NONHEAP;
 }
--- a/gfx/thebes/gfxWindowsSurface.h
+++ b/gfx/thebes/gfxWindowsSurface.h
@@ -29,28 +29,28 @@ public:
 
     gfxWindowsSurface(HWND wnd, uint32_t flags = 0);
     gfxWindowsSurface(HDC dc, uint32_t flags = 0);
 
     // Create from a shared d3d9surface
     gfxWindowsSurface(IDirect3DSurface9 *surface, uint32_t flags = 0);
 
     // Create a DIB surface
-    gfxWindowsSurface(const gfxIntSize& size,
+    gfxWindowsSurface(const mozilla::gfx::IntSize& size,
                       gfxImageFormat imageFormat = gfxImageFormat::RGB24);
 
     // Create a DDB surface; dc may be nullptr to use the screen DC
     gfxWindowsSurface(HDC dc,
-                      const gfxIntSize& size,
+                      const mozilla::gfx::IntSize& size,
                       gfxImageFormat imageFormat = gfxImageFormat::RGB24);
 
     gfxWindowsSurface(cairo_surface_t *csurf);
 
     virtual already_AddRefed<gfxASurface> CreateSimilarSurface(gfxContentType aType,
-                                                               const gfxIntSize& aSize);
+                                                               const mozilla::gfx::IntSize& aSize);
 
     void InitWithDC(uint32_t flags);
 
     virtual ~gfxWindowsSurface();
 
     HDC GetDC();
 
     HDC GetDCWithClip(gfxContext *);
@@ -58,24 +58,24 @@ public:
     already_AddRefed<gfxImageSurface> GetAsImageSurface();
 
     nsresult BeginPrinting(const nsAString& aTitle, const nsAString& aPrintToFileName);
     nsresult EndPrinting();
     nsresult AbortPrinting();
     nsresult BeginPage();
     nsresult EndPage();
 
-    const gfxIntSize GetSize() const;
+    const mozilla::gfx::IntSize GetSize() const;
 
     // The memory used by this surface lives in this process's address space,
     // but not in the heap.
     virtual gfxMemoryLocation GetMemoryLocation() const;
 
 private:
-    void MakeInvalid(gfxIntSize& size);
+    void MakeInvalid(mozilla::gfx::IntSize& size);
 
     bool mOwnsDC;
     bool mForPrinting;
 
     HDC mDC;
     HWND mWnd;
 };
 
--- a/gfx/thebes/gfxXlibNativeRenderer.cpp
+++ b/gfx/thebes/gfxXlibNativeRenderer.cpp
@@ -407,17 +407,17 @@ CreateTempXlibSurface (cairo_surface_t* 
     }
 
     Drawable drawable =
         (screen == target_screen && cairoTargetType == CAIRO_SURFACE_TYPE_XLIB) ?
         cairo_xlib_surface_get_drawable (cairoTarget) : RootWindowOfScreen(screen);
 
     cairo_surface_t *surface =
         gfxXlibSurface::CreateCairoSurface(screen, visual,
-                                           gfxIntSize(size.width, size.height),
+                                           IntSize(size.width, size.height),
                                            drawable);
     if (!surface) {
         return nullptr;
     }
 
     if (drawIsOpaque ||
         cairo_surface_get_content(surface) == CAIRO_CONTENT_COLOR_ALPHA) {
         NATIVE_DRAWING_NOTE(drawIsOpaque ?
@@ -443,17 +443,17 @@ gfxXlibNativeRenderer::DrawOntoTempSurfa
        surface anyway */
     nsresult rv = DrawWithXlib(tempXlibSurface, offset, nullptr, 0);
     cairo_surface_mark_dirty(tempXlibSurface);
     return NS_SUCCEEDED(rv);
 }
 
 static already_AddRefed<gfxImageSurface>
 CopyXlibSurfaceToImage(cairo_surface_t *tempXlibSurface,
-                       gfxIntSize size,
+                       IntSize size,
                        gfxImageFormat format)
 {
     nsRefPtr<gfxImageSurface> result = new gfxImageSurface(size, format);
 
     cairo_t* copyCtx = cairo_create(result->CairoSurface());
     cairo_set_source_surface(copyCtx, tempXlibSurface, 0, 0);
     cairo_set_operator(copyCtx, CAIRO_OPERATOR_SOURCE);
     cairo_paint(copyCtx);
--- a/gfx/thebes/gfxXlibSurface.cpp
+++ b/gfx/thebes/gfxXlibSurface.cpp
@@ -22,36 +22,36 @@
 using namespace mozilla;
 
 gfxXlibSurface::gfxXlibSurface(Display *dpy, Drawable drawable, Visual *visual)
     : mPixmapTaken(false), mDisplay(dpy), mDrawable(drawable)
 #if defined(GL_PROVIDER_GLX)
     , mGLXPixmap(None)
 #endif
 {
-    const gfxIntSize size = DoSizeQuery();
+    const gfx::IntSize size = DoSizeQuery();
     cairo_surface_t *surf = cairo_xlib_surface_create(dpy, drawable, visual, size.width, size.height);
     Init(surf);
 }
 
-gfxXlibSurface::gfxXlibSurface(Display *dpy, Drawable drawable, Visual *visual, const gfxIntSize& size)
+gfxXlibSurface::gfxXlibSurface(Display *dpy, Drawable drawable, Visual *visual, const gfx::IntSize& size)
     : mPixmapTaken(false), mDisplay(dpy), mDrawable(drawable)
 #if defined(GL_PROVIDER_GLX)
     , mGLXPixmap(None)
 #endif
 {
     NS_ASSERTION(CheckSurfaceSize(size, XLIB_IMAGE_SIDE_SIZE_LIMIT),
                  "Bad size");
 
     cairo_surface_t *surf = cairo_xlib_surface_create(dpy, drawable, visual, size.width, size.height);
     Init(surf);
 }
 
 gfxXlibSurface::gfxXlibSurface(Screen *screen, Drawable drawable, XRenderPictFormat *format,
-                               const gfxIntSize& size)
+                               const gfx::IntSize& size)
     : mPixmapTaken(false), mDisplay(DisplayOfScreen(screen)),
       mDrawable(drawable)
 #if defined(GL_PROVIDER_GLX)
       , mGLXPixmap(None)
 #endif
 {
     NS_ASSERTION(CheckSurfaceSize(size, XLIB_IMAGE_SIDE_SIZE_LIMIT),
                  "Bad Size");
@@ -87,17 +87,17 @@ gfxXlibSurface::~gfxXlibSurface()
 #endif
     // gfxASurface's destructor calls RecordMemoryFreed().
     if (mPixmapTaken) {
         XFreePixmap (mDisplay, mDrawable);
     }
 }
 
 static Drawable
-CreatePixmap(Screen *screen, const gfxIntSize& size, unsigned int depth,
+CreatePixmap(Screen *screen, const gfx::IntSize& size, unsigned int depth,
              Drawable relatedDrawable)
 {
     if (!gfxASurface::CheckSurfaceSize(size, XLIB_IMAGE_SIDE_SIZE_LIMIT))
         return None;
 
     if (relatedDrawable == None) {
         relatedDrawable = RootWindowOfScreen(screen);
     }
@@ -117,17 +117,17 @@ gfxXlibSurface::TakePixmap()
 
     // The bit depth returned from Cairo is technically int, but this is
     // the last place we'd be worried about that scenario.
     unsigned int bitDepth = cairo_xlib_surface_get_depth(CairoSurface());
     MOZ_ASSERT((bitDepth % 8) == 0, "Memory used not recorded correctly");    
 
     // Divide by 8 because surface_get_depth gives us the number of *bits* per
     // pixel.
-    gfxIntSize size = GetSize();
+    gfx::IntSize size = GetSize();
     CheckedInt32 totalBytes = CheckedInt32(size.width) * CheckedInt32(size.height) * (bitDepth/8);
 
     // Don't do anything in the "else" case.  We could add INT32_MAX, but that
     // would overflow the memory used counter.  It would also mean we tried for
     // a 2G image.  For now, we'll just assert,
     MOZ_ASSERT(totalBytes.isValid(),"Did not expect to exceed 2Gb image");
     if (totalBytes.isValid()) {
         RecordMemoryUsed(totalBytes.value());
@@ -156,17 +156,17 @@ DestroyPixmap(void *data)
     DestroyPixmapClosure *closure = static_cast<DestroyPixmapClosure*>(data);
     XFreePixmap(DisplayOfScreen(closure->mScreen), closure->mPixmap);
     delete closure;
 }
 
 /* static */
 cairo_surface_t *
 gfxXlibSurface::CreateCairoSurface(Screen *screen, Visual *visual,
-                                   const gfxIntSize& size, Drawable relatedDrawable)
+                                   const gfx::IntSize& size, Drawable relatedDrawable)
 {
     Drawable drawable =
         CreatePixmap(screen, size, DepthOfVisual(screen, visual),
                      relatedDrawable);
     if (!drawable)
         return nullptr;
 
     cairo_surface_t* surface =
@@ -182,17 +182,17 @@ gfxXlibSurface::CreateCairoSurface(Scree
     cairo_surface_set_user_data(surface, &gDestroyPixmapKey,
                                 closure, DestroyPixmap);
     return surface;
 }
 
 /* static */
 already_AddRefed<gfxXlibSurface>
 gfxXlibSurface::Create(Screen *screen, Visual *visual,
-                       const gfxIntSize& size, Drawable relatedDrawable)
+                       const gfx::IntSize& size, Drawable relatedDrawable)
 {
     Drawable drawable =
         CreatePixmap(screen, size, DepthOfVisual(screen, visual),
                      relatedDrawable);
     if (!drawable)
         return nullptr;
 
     nsRefPtr<gfxXlibSurface> result =
@@ -203,17 +203,17 @@ gfxXlibSurface::Create(Screen *screen, V
         return nullptr;
 
     return result.forget();
 }
 
 /* static */
 already_AddRefed<gfxXlibSurface>
 gfxXlibSurface::Create(Screen *screen, XRenderPictFormat *format,
-                       const gfxIntSize& size, Drawable relatedDrawable)
+                       const gfx::IntSize& size, Drawable relatedDrawable)
 {
     Drawable drawable =
         CreatePixmap(screen, size, format->depth, relatedDrawable);
     if (!drawable)
         return nullptr;
 
     nsRefPtr<gfxXlibSurface> result =
         new gfxXlibSurface(screen, drawable, format, size);
@@ -227,17 +227,17 @@ gfxXlibSurface::Create(Screen *screen, X
 
 static bool GetForce24bppPref()
 {
     return Preferences::GetBool("mozilla.widget.force-24bpp", false);
 }
 
 already_AddRefed<gfxASurface>
 gfxXlibSurface::CreateSimilarSurface(gfxContentType aContent,
-                                     const gfxIntSize& aSize)
+                                     const gfx::IntSize& aSize)
 {
     if (!mSurface || !mSurfaceValid) {
       return nullptr;
     }
 
     if (aContent == gfxContentType::COLOR) {
         // cairo_surface_create_similar will use a matching visual if it can.
         // However, systems with 16-bit or indexed default visuals may benefit
@@ -251,17 +251,17 @@ gfxXlibSurface::CreateSimilarSurface(gfx
                 // Cairo only performs simple self-copies as desired if it
                 // knows that this is a Pixmap surface.  It only knows that
                 // surfaces are pixmap surfaces if it creates the Pixmap
                 // itself, so we use cairo_surface_create_similar with a
                 // temporary reference surface to indicate the format.
                 Screen* screen = cairo_xlib_surface_get_screen(CairoSurface());
                 nsRefPtr<gfxXlibSurface> depth24reference =
                     gfxXlibSurface::Create(screen, format,
-                                           gfxIntSize(1, 1), mDrawable);
+                                           gfx::IntSize(1, 1), mDrawable);
                 if (depth24reference)
                     return depth24reference->
                         gfxASurface::CreateSimilarSurface(aContent, aSize);
             }
         }
     }
 
     return gfxASurface::CreateSimilarSurface(aContent, aSize);
@@ -274,41 +274,41 @@ gfxXlibSurface::Finish()
     if (mGLXPixmap) {
         gl::sGLXLibrary.DestroyPixmap(mDisplay, mGLXPixmap);
         mGLXPixmap = None;
     }
 #endif
     gfxASurface::Finish();
 }
 
-const gfxIntSize
+const gfx::IntSize
 gfxXlibSurface::GetSize() const
 {
     if (!mSurfaceValid)
-        return gfxIntSize(0,0);
+        return gfx::IntSize(0,0);
 
-    return gfxIntSize(cairo_xlib_surface_get_width(mSurface),
+    return gfx::IntSize(cairo_xlib_surface_get_width(mSurface),
                       cairo_xlib_surface_get_height(mSurface));
 }
 
-const gfxIntSize
+const gfx::IntSize
 gfxXlibSurface::DoSizeQuery()
 {
     // figure out width/height/depth
     Window root_ignore;
     int x_ignore, y_ignore;
     unsigned int bwidth_ignore, width, height, depth;
 
     XGetGeometry(mDisplay,
                  mDrawable,
                  &root_ignore, &x_ignore, &y_ignore,
                  &width, &height,
                  &bwidth_ignore, &depth);
 
-    return gfxIntSize(width, height);
+    return gfx::IntSize(width, height);
 }
 
 class DisplayTable {
 public:
     static bool GetColormapAndVisual(Screen* screen,
                                        XRenderPictFormat* format,
                                        Visual* visual, Colormap* colormap,
                                        Visual** visualForColormap);
--- a/gfx/thebes/gfxXlibSurface.h
+++ b/gfx/thebes/gfxXlibSurface.h
@@ -26,47 +26,47 @@
 class gfxXlibSurface final : public gfxASurface {
 public:
     // construct a wrapper around the specified drawable with dpy/visual.
     // Will use XGetGeometry to query the window/pixmap size.
     gfxXlibSurface(Display *dpy, Drawable drawable, Visual *visual);
 
     // construct a wrapper around the specified drawable with dpy/visual,
     // and known width/height.
-    gfxXlibSurface(Display *dpy, Drawable drawable, Visual *visual, const gfxIntSize& size);
+    gfxXlibSurface(Display *dpy, Drawable drawable, Visual *visual, const mozilla::gfx::IntSize& size);
 
     // construct a wrapper around the specified drawable with dpy/format,
     // and known width/height.
     gfxXlibSurface(Screen *screen, Drawable drawable, XRenderPictFormat *format,
-                   const gfxIntSize& size);
+                   const mozilla::gfx::IntSize& size);
 
     explicit gfxXlibSurface(cairo_surface_t *csurf);
 
     // create a new Pixmap and wrapper surface.
     // |relatedDrawable| provides a hint to the server for determining whether
     // the pixmap should be in video or system memory.  It must be on
     // |screen| (if specified).
     static already_AddRefed<gfxXlibSurface>
-    Create(Screen *screen, Visual *visual, const gfxIntSize& size,
+    Create(Screen *screen, Visual *visual, const mozilla::gfx::IntSize& size,
            Drawable relatedDrawable = None);
     static cairo_surface_t *
-    CreateCairoSurface(Screen *screen, Visual *visual, const gfxIntSize& size,
+    CreateCairoSurface(Screen *screen, Visual *visual, const mozilla::gfx::IntSize& size,
                        Drawable relatedDrawable = None);
     static already_AddRefed<gfxXlibSurface>
-    Create(Screen* screen, XRenderPictFormat *format, const gfxIntSize& size,
+    Create(Screen* screen, XRenderPictFormat *format, const mozilla::gfx::IntSize& size,
            Drawable relatedDrawable = None);
 
     virtual ~gfxXlibSurface();
 
     virtual already_AddRefed<gfxASurface>
     CreateSimilarSurface(gfxContentType aType,
-                         const gfxIntSize& aSize) override;
+                         const mozilla::gfx::IntSize& aSize) override;
     virtual void Finish() override;
 
-    virtual const gfxIntSize GetSize() const override;
+    virtual const mozilla::gfx::IntSize GetSize() const override;
 
     Display* XDisplay() { return mDisplay; }
     Screen* XScreen();
     Drawable XDrawable() { return mDrawable; }
     XRenderPictFormat* XRenderFormat();
 
     static int DepthOfVisual(const Screen* screen, const Visual* visual);
     static Visual* FindVisual(Screen* screen, gfxImageFormat format);
@@ -107,16 +107,16 @@ public:
 
 protected:
     // if TakePixmap() has been called on this
     bool mPixmapTaken;
     
     Display *mDisplay;
     Drawable mDrawable;
 
-    const gfxIntSize DoSizeQuery();
+    const mozilla::gfx::IntSize DoSizeQuery();
 
 #if defined(GL_PROVIDER_GLX)
     GLXPixmap mGLXPixmap;
 #endif
 };
 
 #endif /* GFX_XLIBSURFACE_H */