Bug 950143 - Remove the implicit conversion operator from nsIntSize to IntSize; r=roc
authorMs2ger <ms2ger@gmail.com>
Tue, 31 Dec 2013 10:06:12 +0100
changeset 177890 eea2c6adc5446789557138c6db306912b83e9e4a
parent 177889 aa3fedbb33294799ef8b80d2857b57b03f4ec6e6
child 177899 7be1a63ca99b6b2cab0c505cacd1f0f1a642cc9a
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersroc
bugs950143
milestone29.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 950143 - Remove the implicit conversion operator from nsIntSize to IntSize; r=roc
content/canvas/src/CanvasRenderingContext2D.cpp
content/media/MediaDecoderReader.cpp
content/media/MediaStreamGraph.cpp
content/media/omx/OmxDecoder.cpp
content/media/plugins/MediaPluginReader.cpp
content/media/webrtc/MediaEngineDefault.cpp
content/media/webrtc/MediaEngineTabVideoSource.cpp
content/media/webrtc/MediaEngineWebRTCVideo.cpp
dom/camera/GonkCameraControl.cpp
dom/plugins/base/nsPluginInstanceOwner.cpp
dom/plugins/ipc/PluginInstanceChild.cpp
dom/plugins/ipc/PluginInstanceParent.cpp
gfx/gl/GLTextureImage.cpp
gfx/gl/GLTextureImage.h
gfx/gl/SharedSurfaceGralloc.cpp
gfx/layers/ImageContainer.cpp
gfx/layers/client/ClientLayerManager.cpp
gfx/layers/client/ContentClient.cpp
gfx/layers/client/TextureClient.cpp
gfx/layers/composite/ContentHost.cpp
gfx/layers/d3d10/ImageLayerD3D10.cpp
gfx/layers/d3d11/CompositorD3D11.cpp
gfx/layers/d3d9/ImageLayerD3D9.cpp
gfx/layers/ipc/ShadowLayerUtilsX11.cpp
gfx/layers/ipc/ShadowLayers.cpp
gfx/layers/ipc/SharedPlanarYCbCrImage.cpp
gfx/layers/ipc/SharedRGBImage.cpp
gfx/layers/opengl/GrallocTextureClient.cpp
gfx/layers/opengl/TextureClientOGL.cpp
gfx/layers/opengl/TextureHostOGL.cpp
gfx/src/nsSize.h
gfx/tests/gtest/TestTextures.cpp
image/src/VectorImage.cpp
layout/base/FrameLayerBuilder.cpp
layout/generic/nsObjectFrame.cpp
layout/generic/nsVideoFrame.cpp
media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h
widget/gonk/nativewindow/GonkBufferQueue.cpp
widget/gonk/nativewindow/GonkNativeWindowICS.cpp
widget/gtk/nsWindow.cpp
--- a/content/canvas/src/CanvasRenderingContext2D.cpp
+++ b/content/canvas/src/CanvasRenderingContext2D.cpp
@@ -4075,13 +4075,13 @@ CanvasRenderingContext2D::MarkContextCle
   mIsEntireFrameInvalid = false;
   mInvalidateCount = 0;
 }
 
 
 bool
 CanvasRenderingContext2D::ShouldForceInactiveLayer(LayerManager *aManager)
 {
-  return !aManager->CanUseCanvasLayerForSize(gfxIntSize(mWidth, mHeight));
+  return !aManager->CanUseCanvasLayerForSize(IntSize(mWidth, mHeight));
 }
 
 }
 }
--- a/content/media/MediaDecoderReader.cpp
+++ b/content/media/MediaDecoderReader.cpp
@@ -13,16 +13,17 @@
 #include "ImageContainer.h"
 
 #include "mozilla/mozalloc.h"
 #include <stdint.h>
 #include <algorithm>
 
 namespace mozilla {
 
+using namespace mozilla::gfx;
 using layers::ImageContainer;
 using layers::PlanarYCbCrImage;
 using layers::PlanarYCbCrData;
 
 // Verify these values are sane. Once we've checked the frame sizes, we then
 // can do less integer overflow checking.
 static_assert(MAX_VIDEO_WIDTH < PlanarYCbCrImage::MAX_DIMENSION,
               "MAX_VIDEO_WIDTH is too large");
@@ -237,28 +238,28 @@ VideoData* VideoData::Create(VideoInfo& 
   }
   NS_ASSERTION(v->mImage->GetFormat() == PLANAR_YCBCR ||
                v->mImage->GetFormat() == GRALLOC_PLANAR_YCBCR,
                "Wrong format?");
   PlanarYCbCrImage* videoImage = static_cast<PlanarYCbCrImage*>(v->mImage.get());
 
   PlanarYCbCrData data;
   data.mYChannel = Y.mData + Y.mOffset;
-  data.mYSize = gfxIntSize(Y.mWidth, Y.mHeight);
+  data.mYSize = IntSize(Y.mWidth, Y.mHeight);
   data.mYStride = Y.mStride;
   data.mYSkip = Y.mSkip;
   data.mCbChannel = Cb.mData + Cb.mOffset;
   data.mCrChannel = Cr.mData + Cr.mOffset;
-  data.mCbCrSize = gfxIntSize(Cb.mWidth, Cb.mHeight);
+  data.mCbCrSize = IntSize(Cb.mWidth, Cb.mHeight);
   data.mCbCrStride = Cb.mStride;
   data.mCbSkip = Cb.mSkip;
   data.mCrSkip = Cr.mSkip;
   data.mPicX = aPicture.x;
   data.mPicY = aPicture.y;
-  data.mPicSize = gfxIntSize(aPicture.width, aPicture.height);
+  data.mPicSize = aPicture.Size().ToIntSize();
   data.mStereoMode = aInfo.mStereoMode;
 
   videoImage->SetDelayedConversion(true);
   if (!aImage) {
     videoImage->SetData(data);
   } else {
     videoImage->SetDataNoCopy(data);
   }
@@ -368,17 +369,17 @@ VideoData* VideoData::Create(VideoInfo& 
     return nullptr;
   }
   NS_ASSERTION(v->mImage->GetFormat() == GRALLOC_PLANAR_YCBCR,
                "Wrong format?");
   typedef mozilla::layers::GrallocImage GrallocImage;
   GrallocImage* videoImage = static_cast<GrallocImage*>(v->mImage.get());
   GrallocImage::GrallocData data;
 
-  data.mPicSize = gfxIntSize(aPicture.width, aPicture.height);
+  data.mPicSize = aPicture.Size().ToIntSize();
   data.mGraphicBuffer = aBuffer;
 
   videoImage->SetData(data);
 
   return v.forget();
 }
 #endif  // MOZ_OMX_DECODER
 
--- a/content/media/MediaStreamGraph.cpp
+++ b/content/media/MediaStreamGraph.cpp
@@ -22,16 +22,17 @@
 #include "AudioNodeStream.h"
 #include "AudioNodeExternalInputStream.h"
 #include <algorithm>
 #include "DOMMediaStream.h"
 #include "GeckoProfiler.h"
 
 using namespace mozilla::layers;
 using namespace mozilla::dom;
+using namespace mozilla::gfx;
 
 namespace mozilla {
 
 #ifdef PR_LOGGING
 PRLogModuleInfo* gMediaStreamGraphLog;
 #define STREAM_LOG(type, msg) PR_LOG(gMediaStreamGraphLog, type, msg)
 #else
 #define STREAM_LOG(type, msg)
@@ -890,17 +891,17 @@ SetImageToBlackPixel(PlanarYCbCrImage* a
 {
   uint8_t blackPixel[] = { 0x10, 0x80, 0x80 };
 
   PlanarYCbCrData data;
   data.mYChannel = blackPixel;
   data.mCbChannel = blackPixel + 1;
   data.mCrChannel = blackPixel + 2;
   data.mYStride = data.mCbCrStride = 1;
-  data.mPicSize = data.mYSize = data.mCbCrSize = gfxIntSize(1, 1);
+  data.mPicSize = data.mYSize = data.mCbCrSize = IntSize(1, 1);
   aImage->SetData(data);
 }
 
 void
 MediaStreamGraphImpl::PlayVideo(MediaStream* aStream)
 {
   MOZ_ASSERT(mRealtime, "Should only attempt to play video in realtime mode");
 
--- a/content/media/omx/OmxDecoder.cpp
+++ b/content/media/omx/OmxDecoder.cpp
@@ -33,16 +33,17 @@
 PRLogModuleInfo *gOmxDecoderLog;
 #define LOG(type, msg...) PR_LOG(gOmxDecoderLog, type, (msg))
 #else
 #define LOG(x...)
 #endif
 
 using namespace MPAPI;
 using namespace mozilla;
+using namespace mozilla::gfx;
 
 namespace mozilla {
 
 class ReleaseOmxDecoderRunnable : public nsRunnable
 {
 public:
   ReleaseOmxDecoderRunnable(const android::sp<android::OmxDecoder>& aOmxDecoder)
   : mOmxDecoder(aOmxDecoder)
@@ -823,17 +824,17 @@ bool OmxDecoder::ReadVideo(VideoFrame *a
       descriptor = mNativeWindow->getSurfaceDescriptorFromBuffer(mVideoBuffer->graphicBuffer().get());
     }
 
     if (descriptor) {
       // Change the descriptor's size to video's size. There are cases that
       // GraphicBuffer's size and actual video size is different.
       // See Bug 850566.
       mozilla::layers::SurfaceDescriptorGralloc newDescriptor = descriptor->get_SurfaceDescriptorGralloc();
-      newDescriptor.size() = nsIntSize(mVideoWidth, mVideoHeight);
+      newDescriptor.size() = IntSize(mVideoWidth, mVideoHeight);
 
       mozilla::layers::SurfaceDescriptor descWrapper(newDescriptor);
       aFrame->mGraphicBuffer = new mozilla::layers::VideoGraphicBuffer(this, mVideoBuffer, descWrapper);
       aFrame->mRotation = mVideoRotation;
       aFrame->mTimeUs = timeUs;
       aFrame->mKeyFrame = keyFrame;
       aFrame->Y.mWidth = mVideoWidth;
       aFrame->Y.mHeight = mVideoHeight;
--- a/content/media/plugins/MediaPluginReader.cpp
+++ b/content/media/plugins/MediaPluginReader.cpp
@@ -12,16 +12,18 @@
 #include "MediaPluginDecoder.h"
 #include "MediaPluginHost.h"
 #include "MediaDecoderStateMachine.h"
 #include "ImageContainer.h"
 #include "AbstractMediaDecoder.h"
 
 namespace mozilla {
 
+using namespace mozilla::gfx;
+
 typedef mozilla::layers::Image Image;
 typedef mozilla::layers::PlanarYCbCrImage PlanarYCbCrImage;
 
 MediaPluginReader::MediaPluginReader(AbstractMediaDecoder *aDecoder,
                                      const nsACString& aContentType) :
   MediaDecoderReader(aDecoder),
   mType(aContentType),
   mPlugin(nullptr),
@@ -388,29 +390,29 @@ MediaPluginReader::ImageBufferCallback::
   uint8_t *buffer = yuvImage->AllocateAndGetNewBuffer(frameSize * 3 / 2);
 
   mozilla::layers::PlanarYCbCrData frameDesc;
 
   frameDesc.mYChannel = buffer;
   frameDesc.mCbChannel = buffer + frameSize;
   frameDesc.mCrChannel = buffer + frameSize * 5 / 4;
 
-  frameDesc.mYSize = gfxIntSize(aWidth, aHeight);
-  frameDesc.mCbCrSize = gfxIntSize(aWidth / 2, aHeight / 2);
+  frameDesc.mYSize = IntSize(aWidth, aHeight);
+  frameDesc.mCbCrSize = IntSize(aWidth / 2, aHeight / 2);
 
   frameDesc.mYStride = aWidth;
   frameDesc.mCbCrStride = aWidth / 2;
 
   frameDesc.mYSkip = 0;
   frameDesc.mCbSkip = 0;
   frameDesc.mCrSkip = 0;
 
   frameDesc.mPicX = 0;
   frameDesc.mPicY = 0;
-  frameDesc.mPicSize = gfxIntSize(aWidth, aHeight);
+  frameDesc.mPicSize = IntSize(aWidth, aHeight);
 
   yuvImage->SetDataNoCopy(frameDesc);
 
   return buffer;
 }
 
 already_AddRefed<Image>
 MediaPluginReader::ImageBufferCallback::GetImage()
--- a/content/media/webrtc/MediaEngineDefault.cpp
+++ b/content/media/webrtc/MediaEngineDefault.cpp
@@ -20,16 +20,18 @@
 #include "nsISupportsUtils.h"
 #endif
 
 #define VIDEO_RATE USECS_PER_S
 #define AUDIO_RATE 16000
 #define AUDIO_FRAME_LENGTH ((AUDIO_RATE * MediaEngine::DEFAULT_AUDIO_TIMER_MS) / 1000)
 namespace mozilla {
 
+using namespace mozilla::gfx;
+
 NS_IMPL_ISUPPORTS1(MediaEngineDefaultVideoSource, nsITimerCallback)
 /**
  * Default video source.
  */
 
 MediaEngineDefaultVideoSource::MediaEngineDefaultVideoSource()
   : mTimer(nullptr), mMonitor("Fake video")
 {
@@ -87,25 +89,25 @@ static void AllocateSolidColorFrame(laye
   int cbLen = yLen>>2;
   int crLen = cbLen;
   uint8_t* frame = (uint8_t*) PR_Malloc(yLen+cbLen+crLen);
   memset(frame, aY, yLen);
   memset(frame+yLen, aCb, cbLen);
   memset(frame+yLen+cbLen, aCr, crLen);
 
   aData.mYChannel = frame;
-  aData.mYSize = gfxIntSize(aWidth, aHeight);
+  aData.mYSize = IntSize(aWidth, aHeight);
   aData.mYStride = aWidth;
   aData.mCbCrStride = aWidth>>1;
   aData.mCbChannel = frame + yLen;
   aData.mCrChannel = aData.mCbChannel + cbLen;
-  aData.mCbCrSize = gfxIntSize(aWidth>>1, aHeight>>1);
+  aData.mCbCrSize = IntSize(aWidth>>1, aHeight>>1);
   aData.mPicX = 0;
   aData.mPicY = 0;
-  aData.mPicSize = gfxIntSize(aWidth, aHeight);
+  aData.mPicSize = IntSize(aWidth, aHeight);
   aData.mStereoMode = STEREO_MODE_MONO;
 }
 
 static void ReleaseFrame(layers::PlanarYCbCrData& aData)
 {
   PR_Free(aData.mYChannel);
 }
 
--- a/content/media/webrtc/MediaEngineTabVideoSource.cpp
+++ b/content/media/webrtc/MediaEngineTabVideoSource.cpp
@@ -13,16 +13,18 @@
 #include "nsIDOMDocument.h"
 #include "nsITabSource.h"
 #include "MediaEngineTabVideoSource.h"
 #include "VideoUtils.h"
 #include "nsServiceManagerUtils.h"
 #include "nsIPrefService.h"
 namespace mozilla {
 
+using namespace mozilla::gfx;
+
 NS_IMPL_ISUPPORTS1(MediaEngineTabVideoSource, MediaEngineVideoSource)
 
 MediaEngineTabVideoSource::MediaEngineTabVideoSource()
   : mName(NS_LITERAL_STRING("share tab")), mUuid(NS_LITERAL_STRING("uuid")),
   mMonitor("MediaEngineTabVideoSource")
 {
 }
 
@@ -166,17 +168,17 @@ NotifyPull(MediaStreamGraph*, SourceMedi
       aLastEndTime = target;
     }
   }
 }
 
 void
 MediaEngineTabVideoSource::Draw() {
 
-  nsIntSize size(mBufW, mBufH);
+  IntSize size(mBufW, mBufH);
 
   nsresult rv;
   float scale = 1.0;
 
   nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(mWindow);
 
   if (!win) {
     return;
@@ -236,18 +238,18 @@ MediaEngineTabVideoSource::Draw() {
            nsPresContext::CSSPixelsToAppUnits(srcW / scale),
            nsPresContext::CSSPixelsToAppUnits(srcH / scale));
 
   gfxImageFormat format = gfxImageFormatRGB24;
   uint32_t stride = gfxASurface::FormatStrideForWidth(format, size.width);
 
   nsRefPtr<layers::ImageContainer> container = layers::LayerManager::CreateImageContainer();
   nsRefPtr<gfxASurface> surf;
-  surf = new gfxImageSurface(static_cast<unsigned char*>(mData), size,
-                             stride, format);
+  surf = new gfxImageSurface(static_cast<unsigned char*>(mData),
+                             ThebesIntSize(size), stride, format);
   if (surf->CairoStatus() != 0) {
     return;
   }
   nsRefPtr<gfxContext> context = new gfxContext(surf);
   gfxPoint pt(0, 0);
   context->Translate(pt);
   context->Scale(scale * size.width / srcW, scale * size.height / srcH);
   rv = presShell->RenderDocument(r, renderDocFlags, bgColor, context);
--- a/content/media/webrtc/MediaEngineWebRTCVideo.cpp
+++ b/content/media/webrtc/MediaEngineWebRTCVideo.cpp
@@ -6,16 +6,18 @@
 #include "Layers.h"
 #include "ImageTypes.h"
 #include "ImageContainer.h"
 #include "nsMemory.h"
 #include "mtransport/runnable_utils.h"
 
 namespace mozilla {
 
+using namespace mozilla::gfx;
+
 #ifdef PR_LOGGING
 extern PRLogModuleInfo* GetMediaManagerLog();
 #define LOG(msg) PR_LOG(GetMediaManagerLog(), PR_LOG_DEBUG, msg)
 #define LOGFRAME(msg) PR_LOG(GetMediaManagerLog(), 6, msg)
 #else
 #define LOG(msg)
 #define LOGFRAME(msg)
 #endif
@@ -72,25 +74,25 @@ MediaEngineWebRTCVideoSource::DeliverFra
   layers::PlanarYCbCrImage* videoImage = static_cast<layers::PlanarYCbCrImage*>(image.get());
 
   uint8_t* frame = static_cast<uint8_t*> (buffer);
   const uint8_t lumaBpp = 8;
   const uint8_t chromaBpp = 4;
 
   layers::PlanarYCbCrData data;
   data.mYChannel = frame;
-  data.mYSize = gfxIntSize(mWidth, mHeight);
+  data.mYSize = IntSize(mWidth, mHeight);
   data.mYStride = mWidth * lumaBpp/ 8;
   data.mCbCrStride = mWidth * chromaBpp / 8;
   data.mCbChannel = frame + mHeight * data.mYStride;
   data.mCrChannel = data.mCbChannel + mHeight * data.mCbCrStride / 2;
-  data.mCbCrSize = gfxIntSize(mWidth/ 2, mHeight/ 2);
+  data.mCbCrSize = IntSize(mWidth/ 2, mHeight/ 2);
   data.mPicX = 0;
   data.mPicY = 0;
-  data.mPicSize = gfxIntSize(mWidth, mHeight);
+  data.mPicSize = IntSize(mWidth, mHeight);
   data.mStereoMode = STEREO_MODE_MONO;
 
   videoImage->SetData(data);
 
 #ifdef DEBUG
   static uint32_t frame_num = 0;
   LOGFRAME(("frame %d (%dx%d); timestamp %u, render_time %lu", frame_num++,
             mWidth, mHeight, time_stamp, render_time));
--- a/dom/camera/GonkCameraControl.cpp
+++ b/dom/camera/GonkCameraControl.cpp
@@ -41,16 +41,17 @@
 #include "DOMCameraControl.h"
 #include "GonkRecorderProfiles.h"
 #include "GonkCameraControl.h"
 #include "CameraCommon.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::layers;
+using namespace mozilla::gfx;
 using namespace android;
 
 /**
  * See bug 783682.  Most camera implementations, despite claiming they
  * support 'yuv420p' as a preview format, actually ignore this setting
  * and return 'yuv420sp' data anyway.  We have come across a new implementation
  * that, while reporting that 'yuv420p' is supported *and* has been accepted,
  * still returns the frame data in 'yuv420sp' anyway.  So for now, since
@@ -1688,17 +1689,17 @@ GonkFrameBuilder(Image* aImage, void* aB
 {
   /**
    * Cast the generic Image back to our platform-specific type and
    * populate it.
    */
   GrallocImage* videoImage = static_cast<GrallocImage*>(aImage);
   GrallocImage::GrallocData data;
   data.mGraphicBuffer = static_cast<layers::GraphicBufferLocked*>(aBuffer);
-  data.mPicSize = gfxIntSize(aWidth, aHeight);
+  data.mPicSize = IntSize(aWidth, aHeight);
   videoImage->SetData(data);
 }
 
 void
 ReceiveFrame(nsGonkCameraControl* gc, layers::GraphicBufferLocked* aBuffer)
 {
   if (!gc->ReceiveFrame(aBuffer, ImageFormat::GRALLOC_PLANAR_YCBCR, GonkFrameBuilder)) {
     aBuffer->Unlock();
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -175,17 +175,17 @@ nsPluginInstanceOwner::GetImageContainer
   nsRefPtr<Image> img = container->CreateImage(&format, 1);
 
   SharedTextureImage::Data data;
   data.mHandle = mInstance->CreateSharedHandle();
   data.mShareType = mozilla::gl::SameProcess;
   data.mInverted = mInstance->Inverted();
 
   LayoutDeviceRect r = GetPluginRect();
-  data.mSize = gfxIntSize(r.width, r.height);
+  data.mSize = gfx::IntSize(r.width, r.height);
 
   SharedTextureImage* pluginImage = static_cast<SharedTextureImage*>(img.get());
   pluginImage->SetData(data);
 
   container->SetCurrentImageInTransaction(img);
 
   float xResolution = mObjectFrame->PresContext()->GetRootPresContext()->PresShell()->GetXResolution();
   float yResolution = mObjectFrame->PresContext()->GetRootPresContext()->PresShell()->GetYResolution();
@@ -1507,17 +1507,17 @@ already_AddRefed<ImageContainer> nsPlugi
   data.mHandle = gl::CreateSharedHandle(mInstance->GLContext(),
                                         data.mShareType,
                                         aVideoInfo->mSurfaceTexture,
                                         gl::SurfaceTexture);
 
   // The logic below for Honeycomb is just a guess, but seems to work. We don't have a separate
   // inverted flag for video.
   data.mInverted = AndroidBridge::Bridge()->IsHoneycomb() ? true : mInstance->Inverted();
-  data.mSize = gfxIntSize(aVideoInfo->mDimensions.width, aVideoInfo->mDimensions.height);
+  data.mSize = gfx::IntSize(aVideoInfo->mDimensions.width, aVideoInfo->mDimensions.height);
 
   SharedTextureImage* pluginImage = static_cast<SharedTextureImage*>(img.get());
   pluginImage->SetData(data);
   container->SetCurrentImageInTransaction(img);
 
   return container.forget();
 }
 
--- a/dom/plugins/ipc/PluginInstanceChild.cpp
+++ b/dom/plugins/ipc/PluginInstanceChild.cpp
@@ -31,16 +31,17 @@ using mozilla::gfx::SharedDIBSurface;
 #include "mozilla/ipc/MessageChannel.h"
 #include "mozilla/AutoRestore.h"
 #include "ImageContainer.h"
 
 using namespace mozilla;
 using mozilla::ipc::ProcessChild;
 using namespace mozilla::plugins;
 using namespace mozilla::layers;
+using namespace mozilla::gfx;
 using namespace std;
 
 #ifdef MOZ_WIDGET_GTK
 
 #include <gtk/gtk.h>
 #if (MOZ_WIDGET_GTK == 3)
 #include <gtk/gtkx.h>
 #endif
@@ -2573,32 +2574,32 @@ PluginInstanceChild::NPN_FinalizeAsyncSu
                 return NPERR_GENERIC_ERROR;
             }
 
             {
                 CrossProcessMutexAutoLock autoLock(*mRemoteImageDataMutex);
                 RemoteImageData *data = mRemoteImageData;
                 if (data->mBitmap.mData == bitmapData->mRemotePtr) {
                     data->mBitmap.mData = nullptr;
-                    data->mSize = gfxIntSize(0, 0);
+                    data->mSize = IntSize(0, 0);
                     data->mWasUpdated = true;
                 }
             }
 
             return DeallocateAsyncBitmapSurface(surface);
         }
 #ifdef XP_WIN
     case NPDrawingModelAsyncWindowsDXGISurface: {
             
             {
                 CrossProcessMutexAutoLock autoLock(*mRemoteImageDataMutex);
                 RemoteImageData *data = mRemoteImageData;
                 if (data->mTextureHandle == surface->sharedHandle) {
                     data->mTextureHandle = nullptr;
-                    data->mSize = gfxIntSize(0, 0);
+                    data->mSize = IntSize(0, 0);
                     data->mWasUpdated = true;
                 }
             }
 
             SendReleaseDXGISharedSurface(surface->sharedHandle);
             return NPERR_NO_ERROR;
         }
 #endif
@@ -2614,43 +2615,43 @@ PluginInstanceChild::NPN_SetCurrentAsync
         return;
     }
 
     RemoteImageData *data = mRemoteImageData;
 
     if (!surface) {
         CrossProcessMutexAutoLock autoLock(*mRemoteImageDataMutex);
         data->mBitmap.mData = nullptr;
-        data->mSize = gfxIntSize(0, 0);
+        data->mSize = IntSize(0, 0);
         data->mWasUpdated = true;
     } else {
         switch (mDrawingModel) {
         case NPDrawingModelAsyncBitmapSurface:
             {
                 AsyncBitmapData *bitmapData;
         
                 if (!mAsyncBitmaps.Get(surface, &bitmapData)) {
                     return;
                 }
               
                 CrossProcessMutexAutoLock autoLock(*mRemoteImageDataMutex);
                 data->mBitmap.mData = (unsigned char*)bitmapData->mRemotePtr;
-                data->mSize = gfxIntSize(surface->size.width, surface->size.height);
+                data->mSize = IntSize(surface->size.width, surface->size.height);
                 data->mFormat = surface->format == NPImageFormatBGRX32 ?
                                 RemoteImageData::BGRX32 : RemoteImageData::BGRA32;
                 data->mBitmap.mStride = surface->bitmap.stride;
                 data->mWasUpdated = true;
                 break;
             }
 #ifdef XP_WIN
         case NPDrawingModelAsyncWindowsDXGISurface:
             {
                 CrossProcessMutexAutoLock autoLock(*mRemoteImageDataMutex);
                 data->mType = RemoteImageData::DXGI_TEXTURE_HANDLE;
-                data->mSize = gfxIntSize(surface->size.width, surface->size.height);
+                data->mSize = IntSize(surface->size.width, surface->size.height);
                 data->mFormat = surface->format == NPImageFormatBGRX32 ?
                                 RemoteImageData::BGRX32 : RemoteImageData::BGRA32;
                 data->mTextureHandle = surface->sharedHandle;
 
                 data->mWasUpdated = true;
                 break;
             }
 #endif
--- a/dom/plugins/ipc/PluginInstanceParent.cpp
+++ b/dom/plugins/ipc/PluginInstanceParent.cpp
@@ -639,17 +639,17 @@ PluginInstanceParent::RecvShow(const NPR
 
         ImageContainer *container = GetImageContainer();
         ImageFormat format = CAIRO_SURFACE;
         nsRefPtr<Image> image = container->CreateImage(&format, 1);
         NS_ASSERTION(image->GetFormat() == CAIRO_SURFACE, "Wrong format?");
         CairoImage* cairoImage = static_cast<CairoImage*>(image.get());
         CairoImage::Data cairoData;
         cairoData.mSurface = surface;
-        cairoData.mSize = surface->GetSize();
+        cairoData.mSize = surface->GetSize().ToIntSize();
         cairoImage->SetData(cairoData);
 
         container->SetCurrentImage(cairoImage);
     }
     else if (mImageContainer) {
         mImageContainer->SetCurrentImage(nullptr);
     }
 
--- a/gfx/gl/GLTextureImage.cpp
+++ b/gfx/gl/GLTextureImage.cpp
@@ -54,36 +54,36 @@ TileGenFunc(GLContext* gl,
             return TileGenFuncCGL(gl, aSize, aContentType, aFlags, aImageFormat);
 #endif
         case ContextTypeEGL:
             return TileGenFuncEGL(gl, aSize, aContentType, aFlags, aImageFormat);
         default:
             return nullptr;
     }
 }
+
 already_AddRefed<TextureImage>
-
 TextureImage::Create(GLContext* gl,
                      const nsIntSize& size,
                      TextureImage::ContentType contentType,
                      GLenum wrapMode,
                      TextureImage::Flags flags)
 {
-    return CreateTextureImage(gl, size, contentType, wrapMode, flags);
+    return Create(gl, size.ToIntSize(), contentType, wrapMode, flags);
 }
 
 // Moz2D equivalent...
 already_AddRefed<TextureImage>
 TextureImage::Create(GLContext* gl,
                      const gfx::IntSize& size,
                      TextureImage::ContentType contentType,
                      GLenum wrapMode,
                      TextureImage::Flags flags)
 {
-    return Create(gl, ThebesIntSize(size), contentType, wrapMode, flags);
+    return CreateTextureImage(gl, size, contentType, wrapMode, flags);
 }
 
 bool
 TextureImage::UpdateFromDataSource(gfx::DataSourceSurface *aSurface,
                                    const nsIntRegion* aDestRegion,
                                    const gfx::IntPoint* aSrcPoint)
 {
     nsIntRegion destRegion = aDestRegion ? *aDestRegion
@@ -270,17 +270,17 @@ BasicTextureImage::Resize(const gfx::Int
 
 gfx::IntSize TextureImage::GetSize() const {
   return mSize;
 }
 
 TextureImage::TextureImage(const gfx::IntSize& aSize,
              GLenum aWrapMode, ContentType aContentType,
              Flags aFlags)
-    : mSize(ThebesIntSize(aSize))
+    : mSize(aSize)
     , mWrapMode(aWrapMode)
     , mContentType(aContentType)
     , mFilter(GraphicsFilter::FILTER_GOOD)
     , mFlags(aFlags)
 {}
 
 BasicTextureImage::BasicTextureImage(GLuint aTexture,
                                      const nsIntSize& aSize,
--- a/gfx/gl/GLTextureImage.h
+++ b/gfx/gl/GLTextureImage.h
@@ -218,17 +218,17 @@ protected:
      * must allocate resources successfully before returning the new
      * TextureImage from GLContext::CreateTextureImage().  That is,
      * clients must not be given partially-constructed TextureImages.
      */
     TextureImage(const nsIntSize& aSize,
                  GLenum aWrapMode, ContentType aContentType,
                  Flags aFlags = NoFlags,
                  ImageFormat aImageFormat = gfxImageFormatUnknown)
-        : mSize(aSize)
+        : mSize(aSize.ToIntSize())
         , mWrapMode(aWrapMode)
         , mContentType(aContentType)
         , mImageFormat(aImageFormat)
         , mFilter(GraphicsFilter::FILTER_GOOD)
         , mFlags(aFlags)
     {}
 
     // Moz2D equivalent...
--- a/gfx/gl/SharedSurfaceGralloc.cpp
+++ b/gfx/gl/SharedSurfaceGralloc.cpp
@@ -70,17 +70,17 @@ SharedSurface_Gralloc::Create(GLContext*
     if (!HasExtensions(egl, prodGL))
         return nullptr;
 
     SurfaceDescriptor baseDesc;
     SurfaceDescriptorGralloc desc;
 
     gfxContentType type = hasAlpha ? GFX_CONTENT_COLOR_ALPHA
                                                 : GFX_CONTENT_COLOR;
-    if (!allocator->AllocSurfaceDescriptorWithCaps(size, type, USING_GL_RENDERING_ONLY, &baseDesc))
+    if (!allocator->AllocSurfaceDescriptorWithCaps(size.ToIntSize(), type, USING_GL_RENDERING_ONLY, &baseDesc))
         return false;
 
     if (baseDesc.type() != SurfaceDescriptor::TSurfaceDescriptorGralloc) {
         allocator->DestroySharedSurface(&baseDesc);
         return false;
     }
 
     desc = baseDesc.get_SurfaceDescriptorGralloc();
--- a/gfx/layers/ImageContainer.cpp
+++ b/gfx/layers/ImageContainer.cpp
@@ -312,17 +312,17 @@ ImageContainer::LockCurrentAsSurface(gfx
       nsRefPtr<gfxImageSurface> newSurf =
         new gfxImageSurface(mRemoteData->mBitmap.mData,
                             ThebesIntSize(mRemoteData->mSize),
                             mRemoteData->mBitmap.mStride,
                             mRemoteData->mFormat == RemoteImageData::BGRX32 ?
                                                    gfxImageFormatARGB32 :
                                                    gfxImageFormatRGB24);
 
-      *aSize = newSurf->GetSize();
+      *aSize = newSurf->GetSize().ToIntSize();
     
       return newSurf.forget();
     }
 
     *aSize = mActiveImage->GetSize();
     return mActiveImage->GetAsSurface();
   }
 
@@ -377,17 +377,17 @@ ImageContainer::GetCurrentSize()
     CrossProcessMutexAutoLock autoLock(*mRemoteDataMutex);
 
     // We don't need to ensure we have an active image here, as we need to
     // be in the mutex anyway, and this is easiest to return from there.
     return mRemoteData->mSize;
   }
 
   if (!mActiveImage) {
-    return gfx::IntSize(0,0);
+    return gfx::IntSize(0, 0);
   }
 
   return mActiveImage->GetSize();
 }
 
 void
 ImageContainer::SetRemoteImageData(RemoteImageData *aData, CrossProcessMutex *aMutex)
 {
--- a/gfx/layers/client/ClientLayerManager.cpp
+++ b/gfx/layers/client/ClientLayerManager.cpp
@@ -268,17 +268,17 @@ ClientLayerManager::MakeSnapshotIfRequir
   if (!mShadowTarget) {
     return;
   }
   if (mWidget) {
     if (CompositorChild* remoteRenderer = GetRemoteRenderer()) {
       nsIntRect bounds;
       mWidget->GetBounds(bounds);
       SurfaceDescriptor inSnapshot, snapshot;
-      if (mForwarder->AllocSurfaceDescriptor(bounds.Size(),
+      if (mForwarder->AllocSurfaceDescriptor(bounds.Size().ToIntSize(),
                                              GFX_CONTENT_COLOR_ALPHA,
                                              &inSnapshot) &&
           // The compositor will usually reuse |snapshot| and return
           // it through |outSnapshot|, but if it doesn't, it's
           // responsible for freeing |snapshot|.
           remoteRenderer->SendMakeSnapshot(inSnapshot, &snapshot)) {
         AutoOpenSurface opener(OPEN_READ_ONLY, snapshot);
         gfxASurface* source = opener.Get();
--- a/gfx/layers/client/ContentClient.cpp
+++ b/gfx/layers/client/ContentClient.cpp
@@ -1142,27 +1142,27 @@ ContentClientIncremental::BeginPaintBuff
     nsRefPtr<gfxASurface> onBlack = GetUpdateSurface(BUFFER_BLACK, drawRegionCopy);
     nsRefPtr<gfxASurface> onWhite = GetUpdateSurface(BUFFER_WHITE, result.mRegionToDraw);
     if (onBlack && onWhite) {
       NS_ASSERTION(result.mRegionToDraw == drawRegionCopy,
                    "BeginUpdate should always modify the draw region in the same way!");
       FillSurface(onBlack, result.mRegionToDraw, nsIntPoint(drawBounds.x, drawBounds.y), gfxRGBA(0.0, 0.0, 0.0, 1.0));
       FillSurface(onWhite, result.mRegionToDraw, nsIntPoint(drawBounds.x, drawBounds.y), gfxRGBA(1.0, 1.0, 1.0, 1.0));
       MOZ_ASSERT(gfxPlatform::GetPlatform()->SupportsAzureContent());
-      RefPtr<DrawTarget> onBlackDT = gfxPlatform::GetPlatform()->CreateDrawTargetForUpdateSurface(onBlack, onBlack->GetSize());
-      RefPtr<DrawTarget> onWhiteDT = gfxPlatform::GetPlatform()->CreateDrawTargetForUpdateSurface(onWhite, onWhite->GetSize());
+      RefPtr<DrawTarget> onBlackDT = gfxPlatform::GetPlatform()->CreateDrawTargetForUpdateSurface(onBlack, onBlack->GetSize().ToIntSize());
+      RefPtr<DrawTarget> onWhiteDT = gfxPlatform::GetPlatform()->CreateDrawTargetForUpdateSurface(onWhite, onWhite->GetSize().ToIntSize());
       RefPtr<DrawTarget> dt = Factory::CreateDualDrawTarget(onBlackDT, onWhiteDT);
       result.mContext = new gfxContext(dt);
     } else {
       result.mContext = nullptr;
     }
   } else {
     nsRefPtr<gfxASurface> surf = GetUpdateSurface(BUFFER_BLACK, result.mRegionToDraw);
     MOZ_ASSERT(gfxPlatform::GetPlatform()->SupportsAzureContent());
-    RefPtr<DrawTarget> dt = gfxPlatform::GetPlatform()->CreateDrawTargetForUpdateSurface(surf, surf->GetSize());
+    RefPtr<DrawTarget> dt = gfxPlatform::GetPlatform()->CreateDrawTargetForUpdateSurface(surf, surf->GetSize().ToIntSize());
     result.mContext = new gfxContext(dt);
   }
   if (!result.mContext) {
     NS_WARNING("unable to get context for update");
     return result;
   }
   result.mContext->Translate(-gfxPoint(drawBounds.x, drawBounds.y));
 
@@ -1221,17 +1221,17 @@ ContentClientIncremental::GetUpdateSurfa
                                            nsIntRegion& aUpdateRegion)
 {
   nsIntRect rgnSize = aUpdateRegion.GetBounds();
   if (!mBufferRect.Contains(rgnSize)) {
     NS_ERROR("update outside of image");
     return nullptr;
   }
   SurfaceDescriptor desc;
-  if (!mForwarder->AllocSurfaceDescriptor(gfxIntSize(rgnSize.width, rgnSize.height),
+  if (!mForwarder->AllocSurfaceDescriptor(rgnSize.Size().ToIntSize(),
                                           mContentType,
                                           &desc)) {
     NS_WARNING("creating SurfaceDescriptor failed!");
     return nullptr;
   }
 
   nsRefPtr<gfxASurface> tmpASurface =
     ShadowLayerForwarder::OpenDescriptor(OPEN_READ_WRITE, desc);
--- a/gfx/layers/client/TextureClient.cpp
+++ b/gfx/layers/client/TextureClient.cpp
@@ -528,18 +528,18 @@ BufferTextureClient::UpdateYCbCr(const P
   MOZ_ASSERT(mFormat == gfx::FORMAT_YUV, "This textureClient can only use YCbCr data");
   MOZ_ASSERT(!IsImmutable());
   MOZ_ASSERT(IsValid());
   MOZ_ASSERT(aData.mCbSkip == aData.mCrSkip);
 
   YCbCrImageDataSerializer serializer(GetBuffer());
   MOZ_ASSERT(serializer.IsValid());
   if (!serializer.CopyData(aData.mYChannel, aData.mCbChannel, aData.mCrChannel,
-                           ThebesIntSize(aData.mYSize), aData.mYStride,
-                           ThebesIntSize(aData.mCbCrSize), aData.mCbCrStride,
+                           aData.mYSize, aData.mYStride,
+                           aData.mCbCrSize, aData.mCbCrStride,
                            aData.mYSkip, aData.mCbSkip)) {
     NS_WARNING("Failed to copy image data!");
     return false;
   }
 
   if (TextureRequiresLocking(mFlags)) {
     // We don't have support for proper locking yet, so we'll
     // have to be immutable instead.
@@ -630,18 +630,18 @@ DeprecatedTextureClientShmem::EnsureAllo
   if (aSize != mSize ||
       aContentType != mContentType ||
       !IsSurfaceDescriptorValid(mDescriptor)) {
     ReleaseResources();
 
     mContentType = aContentType;
     mSize = aSize;
 
-    if (!mForwarder->AllocSurfaceDescriptor(gfxIntSize(mSize.width, mSize.height),
-                                            mContentType, &mDescriptor)) {
+    if (!mForwarder->AllocSurfaceDescriptor(mSize, mContentType,
+                                            &mDescriptor)) {
       NS_WARNING("creating SurfaceDescriptor failed!");
     }
     if (mContentType == GFX_CONTENT_COLOR_ALPHA) {
       gfxASurface* surface = GetSurface();
       if (!surface) {
         return false;
       }
       nsRefPtr<gfxContext> context = new gfxContext(surface);
@@ -880,18 +880,18 @@ AutoLockYCbCrClient::Update(PlanarYCbCrI
   if (!EnsureDeprecatedTextureClient(aImage)) {
     return false;
   }
 
   ipc::Shmem& shmem = mDescriptor->get_YCbCrImage().data();
 
   YCbCrImageDataSerializer serializer(shmem.get<uint8_t>());
   if (!serializer.CopyData(data->mYChannel, data->mCbChannel, data->mCrChannel,
-                           ThebesIntSize(data->mYSize), data->mYStride,
-                           ThebesIntSize(data->mCbCrSize), data->mCbCrStride,
+                           data->mYSize, data->mYStride,
+                           data->mCbCrSize, data->mCbCrStride,
                            data->mYSkip, data->mCbSkip)) {
     NS_WARNING("Failed to copy image data!");
     return false;
   }
   return true;
 }
 
 bool AutoLockYCbCrClient::EnsureDeprecatedTextureClient(PlanarYCbCrImage* aImage)
--- a/gfx/layers/composite/ContentHost.cpp
+++ b/gfx/layers/composite/ContentHost.cpp
@@ -518,17 +518,17 @@ ContentHostSingleBuffered::UpdateThebes(
 
   // updated is in screen coordinates. Convert it to buffer coordinates.
   nsIntRegion destRegion(aUpdated);
   destRegion.MoveBy(-aData.rect().TopLeft());
 
   // Correct for rotation
   destRegion.MoveBy(aData.rotation());
 
-  IntSize size = aData.rect().Size();
+  IntSize size = aData.rect().Size().ToIntSize();
   nsIntRect destBounds = destRegion.GetBounds();
   destRegion.MoveBy((destBounds.x >= size.width) ? -size.width : 0,
                     (destBounds.y >= size.height) ? -size.height : 0);
 
   // There's code to make sure that updated regions don't cross rotation
   // boundaries, so assert here that this is the case
   MOZ_ASSERT((destBounds.x % size.width) + destBounds.width <= size.width,
                "updated region lies across rotation boundaries!");
@@ -615,17 +615,17 @@ DeprecatedContentHostSingleBuffered::Upd
 
   // updated is in screen coordinates. Convert it to buffer coordinates.
   nsIntRegion destRegion(aUpdated);
   destRegion.MoveBy(-aData.rect().TopLeft());
 
   // Correct for rotation
   destRegion.MoveBy(aData.rotation());
 
-  IntSize size = aData.rect().Size();
+  IntSize size = aData.rect().Size().ToIntSize();
   nsIntRect destBounds = destRegion.GetBounds();
   destRegion.MoveBy((destBounds.x >= size.width) ? -size.width : 0,
                     (destBounds.y >= size.height) ? -size.height : 0);
 
   // There's code to make sure that updated regions don't cross rotation
   // boundaries, so assert here that this is the case
   MOZ_ASSERT((destBounds.x % size.width) + destBounds.width <= size.width,
                "updated region lies across rotation boundaries!");
--- a/gfx/layers/d3d10/ImageLayerD3D10.cpp
+++ b/gfx/layers/d3d10/ImageLayerD3D10.cpp
@@ -409,17 +409,17 @@ ImageLayerD3D10::GetAsTexture(gfx::IntSi
   if (!image) {
     return nullptr;
   }
 
   if (image->GetFormat() != ImageFormat::CAIRO_SURFACE) {
     return nullptr;
   }
 
-  *aSize = gfx::ThebesIntSize(image->GetSize());
+  *aSize = image->GetSize();
   bool dontCare;
   nsRefPtr<ID3D10ShaderResourceView> result = GetImageSRView(image, dontCare);
   return result.forget();
 }
 
 already_AddRefed<gfxASurface>
 RemoteDXGITextureImage::GetAsSurface()
 {
--- a/gfx/layers/d3d11/CompositorD3D11.cpp
+++ b/gfx/layers/d3d11/CompositorD3D11.cpp
@@ -783,17 +783,17 @@ CompositorD3D11::UpdateRenderTarget()
   nsRefPtr<ID3D11Texture2D> backBuf;
 
   hr = mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)backBuf.StartAssignment());
   if (FAILED(hr)) {
     return;
   }
 
   mDefaultRT = new CompositingRenderTargetD3D11(backBuf, IntPoint(0, 0));
-  mDefaultRT->SetSize(mSize);
+  mDefaultRT->SetSize(mSize.ToIntSize());
 }
 
 bool
 CompositorD3D11::CreateShaders()
 {
   HRESULT hr;
 
   hr = mDevice->CreateVertexShader(LayerQuadVS,
--- a/gfx/layers/d3d9/ImageLayerD3D9.cpp
+++ b/gfx/layers/d3d9/ImageLayerD3D9.cpp
@@ -563,15 +563,15 @@ ImageLayerD3D9::GetAsTexture(gfx::IntSiz
   }
 
   if (image->GetFormat() != CAIRO_SURFACE &&
       image->GetFormat() != REMOTE_IMAGE_BITMAP) {
     return nullptr;
   }
 
   bool dontCare;
-  *aSize = gfx::ThebesIntSize(image->GetSize());
+  *aSize = image->GetSize();
   nsRefPtr<IDirect3DTexture9> result = GetTexture(image, dontCare);
   return result.forget();
 }
 
 } /* layers */
 } /* mozilla */
--- a/gfx/layers/ipc/ShadowLayerUtilsX11.cpp
+++ b/gfx/layers/ipc/ShadowLayerUtilsX11.cpp
@@ -71,17 +71,17 @@ TakeAndDestroyXlibSurface(SurfaceDescrip
   surf->TakePixmap();
   *aSurface = SurfaceDescriptor();
   // the Pixmap is destroyed when |surf| goes out of scope
   return true;
 }
 
 SurfaceDescriptorX11::SurfaceDescriptorX11(gfxXlibSurface* aSurf)
   : mId(aSurf->XDrawable())
-  , mSize(aSurf->GetSize())
+  , mSize(aSurf->GetSize().ToIntSize())
 {
   const XRenderPictFormat *pictFormat = aSurf->XRenderFormat();
   if (pictFormat) {
     mFormat = pictFormat->id;
   } else {
     mFormat = cairo_xlib_surface_get_visual(aSurf->CairoSurface())->visualid;
   }
 }
--- a/gfx/layers/ipc/ShadowLayers.cpp
+++ b/gfx/layers/ipc/ShadowLayers.cpp
@@ -664,18 +664,18 @@ ShadowLayerForwarder::GetDescriptorSurfa
   gfxASurface** aSurface)
 {
   gfx::IntSize size;
   if (PlatformGetDescriptorSurfaceSize(aDescriptor, aMode, &size, aSurface)) {
     return size;
   }
 
   nsRefPtr<gfxASurface> surface = OpenDescriptor(aMode, aDescriptor);
-  size = surface->GetSize();
-  *aSurface = surface.forget().get();
+  size = surface->GetSize().ToIntSize();
+  surface.forget(aSurface);
   return size;
 }
 
 /*static*/ gfxImageFormat
 ShadowLayerForwarder::GetDescriptorSurfaceImageFormat(
   const SurfaceDescriptor& aDescriptor, OpenMode aMode,
   gfxASurface** aSurface)
 {
@@ -824,17 +824,17 @@ AutoOpenSurface::ImageFormat()
   return ShadowLayerForwarder::GetDescriptorSurfaceImageFormat(
     mDescriptor, mMode, getter_AddRefs(mSurface));
 }
 
 gfx::IntSize
 AutoOpenSurface::Size()
 {
   if (mSurface) {
-    return mSurface->GetSize();
+    return mSurface->GetSize().ToIntSize();
   }
   return ShadowLayerForwarder::GetDescriptorSurfaceSize(
     mDescriptor, mMode, getter_AddRefs(mSurface));
 }
 
 gfxASurface*
 AutoOpenSurface::Get()
 {
--- a/gfx/layers/ipc/SharedPlanarYCbCrImage.cpp
+++ b/gfx/layers/ipc/SharedPlanarYCbCrImage.cpp
@@ -241,19 +241,19 @@ DeprecatedSharedPlanarYCbCrImage::SetDat
   // shmem.
   mBufferSize = YCbCrImageDataSerializer::ComputeMinBufferSize(mData.mYSize,
                                                                mData.mCbCrSize);
   mSize = mData.mPicSize;
 
   YCbCrImageDataSerializer serializer(mShmem.get<uint8_t>());
   MOZ_ASSERT(aData.mCbSkip == aData.mCrSkip);
   if (!serializer.CopyData(aData.mYChannel, aData.mCbChannel, aData.mCrChannel,
-                          ThebesIntSize(aData.mYSize), aData.mYStride,
-                          ThebesIntSize(aData.mCbCrSize), aData.mCbCrStride,
-                          aData.mYSkip, aData.mCbSkip)) {
+                           aData.mYSize, aData.mYStride,
+                           aData.mCbCrSize, aData.mCbCrStride,
+                           aData.mYSkip, aData.mCbSkip)) {
     NS_WARNING("Failed to copy image data!");
   }
   mData.mYChannel = serializer.GetYData();
   mData.mCbChannel = serializer.GetCbData();
   mData.mCrChannel = serializer.GetCrData();
 }
 
 // needs to be overriden because the parent class sets mBuffer which we
--- a/gfx/layers/ipc/SharedRGBImage.cpp
+++ b/gfx/layers/ipc/SharedRGBImage.cpp
@@ -69,17 +69,17 @@ CreateSharedRGBImage(ImageContainer *aIm
 
   if (!image) {
     NS_WARNING("Failed to create DeprecatedSharedRGBImage");
     return nullptr;
   }
 
   if (gfxPlatform::GetPlatform()->UseDeprecatedTextures()) {
     nsRefPtr<DeprecatedSharedRGBImage> rgbImageDep = static_cast<DeprecatedSharedRGBImage*>(image.get());
-    rgbImageDep->mSize = gfxIntSize(aSize.width, aSize.height);
+    rgbImageDep->mSize = aSize.ToIntSize();
     rgbImageDep->mImageFormat = aImageFormat;
 
     if (!rgbImageDep->AllocateBuffer(aSize, aImageFormat)) {
       NS_WARNING("Failed to allocate shared memory for DeprecatedSharedRGBImage");
       return nullptr;
     }
     return rgbImageDep.forget();
   }
@@ -213,17 +213,17 @@ SharedRGBImage::GetBuffer()
 
   ImageDataSerializer serializer(mTextureClient->GetBuffer());
   return serializer.GetData();
 }
 
 gfx::IntSize
 SharedRGBImage::GetSize()
 {
-  return ThebesIntSize(mSize);
+  return mSize;
 }
 
 size_t
 SharedRGBImage::GetBufferSize()
 {
   return mTextureClient ? mTextureClient->GetBufferSize()
                         : 0;
 }
--- a/gfx/layers/opengl/GrallocTextureClient.cpp
+++ b/gfx/layers/opengl/GrallocTextureClient.cpp
@@ -11,16 +11,17 @@
 #include "mozilla/layers/ISurfaceAllocator.h"
 #include "mozilla/layers/ShadowLayerUtilsGralloc.h"
 #include "GrallocImages.h"
 #include "gfx2DGlue.h"
 
 namespace mozilla {
 namespace layers {
 
+using namespace mozilla::gfx;
 using namespace android;
 
 class GraphicBufferLockedTextureClientData : public TextureClientData {
 public:
   GraphicBufferLockedTextureClientData(GraphicBufferLocked* aBufferLocked)
     : mBufferLocked(aBufferLocked)
   {
     MOZ_COUNT_CTOR(GrallocTextureClientData);
@@ -56,17 +57,18 @@ public:
     MOZ_ASSERT(!mGrallocActor, "Forgot to unlock the GraphicBufferLocked?");
   }
 
   virtual void DeallocateSharedData(ISurfaceAllocator* allocator) MOZ_OVERRIDE
   {
     // We just need to wrap the actor in a SurfaceDescriptor because that's what
     // ISurfaceAllocator uses as input, we don't care about the other parameters.
     SurfaceDescriptor sd = SurfaceDescriptorGralloc(nullptr, mGrallocActor,
-                                                    nsIntSize(0,0), false, false);
+                                                    IntSize(0, 0),
+                                                    false, false);
     allocator->DestroySharedSurface(&sd);
     mGrallocActor = nullptr;
   }
 
 private:
   GrallocBufferActor* mGrallocActor;
 };
 
@@ -116,17 +118,18 @@ GrallocTextureClientOGL::~GrallocTexture
     // leak.
     if (mBufferLocked) {
       mBufferLocked->Unlock();
     } else {
       MOZ_ASSERT(mCompositable);
       // We just need to wrap the actor in a SurfaceDescriptor because that's what
       // ISurfaceAllocator uses as input, we don't care about the other parameters.
       SurfaceDescriptor sd = SurfaceDescriptorGralloc(nullptr, mGrallocActor,
-                                                      nsIntSize(0,0), false, false);
+                                                      IntSize(0, 0),
+                                                      false, false);
       mCompositable->GetForwarder()->DestroySharedSurface(&sd);
     }
   }
 }
 
 void
 GrallocTextureClientOGL::InitWith(GrallocBufferActor* aActor, gfx::IntSize aSize)
 {
--- a/gfx/layers/opengl/TextureClientOGL.cpp
+++ b/gfx/layers/opengl/TextureClientOGL.cpp
@@ -33,18 +33,17 @@ SharedTextureClientOGL::~SharedTextureCl
 
 bool
 SharedTextureClientOGL::ToSurfaceDescriptor(SurfaceDescriptor& aOutDescriptor)
 {
   MOZ_ASSERT(IsValid());
   if (!IsAllocated()) {
     return false;
   }
-  nsIntSize nsSize(mSize.width, mSize.height);
-  aOutDescriptor = SharedTextureDescriptor(mShareType, mHandle, nsSize, mInverted);
+  aOutDescriptor = SharedTextureDescriptor(mShareType, mHandle, mSize, mInverted);
   return true;
 }
 
 void
 SharedTextureClientOGL::InitWith(gl::SharedTextureHandle aHandle,
                                  gfx::IntSize aSize,
                                  gl::SharedTextureShareType aShareType,
                                  bool aInverted)
--- a/gfx/layers/opengl/TextureHostOGL.cpp
+++ b/gfx/layers/opengl/TextureHostOGL.cpp
@@ -231,17 +231,17 @@ TextureImageTextureSourceOGL::Update(gfx
 {
   MOZ_ASSERT(mGL);
   if (!mGL) {
     NS_WARNING("trying to update TextureImageTextureSourceOGL without a GLContext");
     return false;
   }
   MOZ_ASSERT(aSurface);
 
-  nsIntSize size = ThebesIntSize(aSurface->GetSize());
+  IntSize size = aSurface->GetSize();
   if (!mTexImage ||
       mTexImage->GetSize() != size ||
       mTexImage->GetContentType() != gfx::ContentForFormat(aSurface->GetFormat())) {
     if (mAllowBigImage) {
       // XXX - clarify which size we want to use. IncrementalContentHost will
       // require the size of the destination surface to be different from
       // the size of aSurface.
       // See bug 893300 (tracks the implementation of ContentHost for new textures).
@@ -496,25 +496,25 @@ TextureImageDeprecatedTextureHostOGL::Se
   }
 }
 
 void
 TextureImageDeprecatedTextureHostOGL::EnsureBuffer(const nsIntSize& aSize,
                                          gfxContentType aContentType)
 {
   if (!mTexture ||
-      mTexture->GetSize() != aSize ||
+      mTexture->GetSize() != aSize.ToIntSize() ||
       mTexture->GetContentType() != aContentType) {
     mTexture = CreateTextureImage(mGL,
-                                  aSize,
+                                  aSize.ToIntSize(),
                                   aContentType,
                                   WrapMode(mGL, mFlags & TEXTURE_ALLOW_REPEAT),
                                   FlagsToGLFlags(mFlags));
   }
-  mTexture->Resize(aSize);
+  mTexture->Resize(aSize.ToIntSize());
 }
 
 void
 TextureImageDeprecatedTextureHostOGL::CopyTo(const nsIntRect& aSourceRect,
                                    DeprecatedTextureHost *aDest,
                                    const nsIntRect& aDestRect)
 {
   MOZ_ASSERT(aDest->AsSourceOGL(), "Incompatible destination type!");
--- a/gfx/src/nsSize.h
+++ b/gfx/src/nsSize.h
@@ -32,17 +32,20 @@ struct nsSize : public mozilla::gfx::Bas
 
 struct nsIntSize : public mozilla::gfx::BaseSize<int32_t, nsIntSize> {
   typedef mozilla::gfx::BaseSize<int32_t, nsIntSize> Super;
 
   nsIntSize() : Super() {}
   nsIntSize(int32_t aWidth, int32_t aHeight) : Super(aWidth, aHeight) {}
 
   inline nsSize ToAppUnits(nscoord aAppUnitsPerPixel) const;
-  operator mozilla::gfx::IntSize() const { return mozilla::gfx::IntSize(width, height); };
+  mozilla::gfx::IntSize ToIntSize() const
+  {
+    return mozilla::gfx::IntSize(width, height);
+  };
 };
 
 inline nsIntSize
 nsSize::ScaleToNearestPixels(float aXScale, float aYScale,
                              nscoord aAppUnitsPerPixel) const
 {
   return nsIntSize(
       NSToIntRoundUp(NSAppUnitsToDoublePixels(width, aAppUnitsPerPixel) * aXScale),
--- a/gfx/tests/gtest/TestTextures.cpp
+++ b/gfx/tests/gtest/TestTextures.cpp
@@ -237,19 +237,19 @@ TEST(Layers, TextureYCbCrSerialization) 
   SetupSurface(ySurface.get());
   SetupSurface(cbSurface.get());
   SetupSurface(crSurface.get());
 
   PlanarYCbCrData clientData;
   clientData.mYChannel = ySurface->Data();
   clientData.mCbChannel = cbSurface->Data();
   clientData.mCrChannel = crSurface->Data();
-  clientData.mYSize = ySurface->GetSize();
-  clientData.mPicSize = ySurface->GetSize();
-  clientData.mCbCrSize = cbSurface->GetSize();
+  clientData.mYSize = ySurface->GetSize().ToIntSize();
+  clientData.mPicSize = ySurface->GetSize().ToIntSize();
+  clientData.mCbCrSize = cbSurface->GetSize().ToIntSize();
   clientData.mYStride = ySurface->Stride();
   clientData.mCbCrStride = cbSurface->Stride();
   clientData.mStereoMode = STEREO_MODE_MONO;
   clientData.mYSkip = 0;
   clientData.mCbSkip = 0;
   clientData.mCrSkip = 0;
   clientData.mCrSkip = 0;
   clientData.mPicX = 0;
--- a/image/src/VectorImage.cpp
+++ b/image/src/VectorImage.cpp
@@ -846,17 +846,17 @@ VectorImage::CreateDrawableAndShow(const
     return Show(svgDrawable, aParams);
 
   // If the image is too big to fit in the cache, don't go any further.
   if (!SurfaceCache::CanHold(aParams.imageRect.Size()))
     return Show(svgDrawable, aParams);
 
   // Try to create an offscreen surface.
   mozilla::RefPtr<mozilla::gfx::DrawTarget> target =
-   gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(aParams.imageRect.Size(), gfx::FORMAT_B8G8R8A8);
+   gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget(aParams.imageRect.Size().ToIntSize(), gfx::FORMAT_B8G8R8A8);
 
   // If we couldn't create the draw target, it was probably because it would end
   // up way too big. Generally it also wouldn't fit in the cache, but the prefs
   // could be set such that the cache isn't the limiting factor.
   if (!target)
     return Show(svgDrawable, aParams);
 
   nsRefPtr<gfxContext> ctx = new gfxContext(target);
--- a/layout/base/FrameLayerBuilder.cpp
+++ b/layout/base/FrameLayerBuilder.cpp
@@ -3783,18 +3783,18 @@ ContainerState::SetupMaskLayer(Layer *aL
 
   const MaskLayerImageCache::MaskLayerImageKey* lookupKey = newKey;
 
   // check to see if we can reuse a mask image
   nsRefPtr<ImageContainer> container =
     GetMaskLayerImageCache()->FindImageFor(&lookupKey);
 
   if (!container) {
-    nsIntSize surfaceSizeInt = nsIntSize(NSToIntCeil(surfaceSize.width),
-                                         NSToIntCeil(surfaceSize.height));
+    IntSize surfaceSizeInt(NSToIntCeil(surfaceSize.width),
+                           NSToIntCeil(surfaceSize.height));
     // no existing mask image, so build a new one
     nsRefPtr<gfxASurface> surface =
       aLayer->Manager()->CreateOptimalMaskSurface(surfaceSizeInt);
 
     // fail if we can't get the right surface
     if (!surface || surface->CairoStatus()) {
       NS_WARNING("Could not create surface for mask layer.");
       SetClipCount(thebesData, 0);
--- a/layout/generic/nsObjectFrame.cpp
+++ b/layout/generic/nsObjectFrame.cpp
@@ -3,16 +3,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* rendering objects for replaced elements implemented by a plugin */
 
 #include "nsObjectFrame.h"
 
+#include "gfx2DGlue.h"
 #include "mozilla/BasicEvents.h"
 #ifdef XP_WIN
 // This is needed for DoublePassRenderingEvent.
 #include "mozilla/plugins/PluginMessageUtils.h"
 #endif
 
 #include "nscore.h"
 #include "nsCOMPtr.h"
@@ -140,16 +141,17 @@ extern "C" {
   extern void DisposeGWorld(GWorldPtr offscreenGWorld)
     __attribute__((weak_import));
   #endif /* __QDOFFSCREEN__ */
 }
 
 #endif /* #if defined(XP_MACOSX) && !defined(__LP64__) */
 
 using namespace mozilla;
+using namespace mozilla::gfx;
 using namespace mozilla::layers;
 
 class PluginBackgroundSink : public ReadbackSink {
 public:
   PluginBackgroundSink(nsObjectFrame* aFrame, uint64_t aStartSequenceNumber)
     : mLastSequenceNumber(aStartSequenceNumber), mFrame(aFrame) {}
   ~PluginBackgroundSink()
   {
@@ -1522,17 +1524,17 @@ nsObjectFrame::BuildLayer(nsDisplayListB
     return nullptr;
 
   // window is in "display pixels", but size needs to be in device pixels
   double scaleFactor = 1.0;
   if (NS_FAILED(mInstanceOwner->GetContentsScaleFactor(&scaleFactor))) {
     scaleFactor = 1.0;
   }
   int intScaleFactor = ceil(scaleFactor);
-  gfxIntSize size(window->width * intScaleFactor, window->height * intScaleFactor);
+  IntSize size(window->width * intScaleFactor, window->height * intScaleFactor);
 
   nsRect area = GetContentRectRelativeToSelf() + aItem->ToReferenceFrame();
   gfxRect r = nsLayoutUtils::RectToGfxRect(area, PresContext()->AppUnitsPerDevPixel());
   // to provide crisper and faster drawing.
   r.Round();
   nsRefPtr<Layer> layer =
     (aManager->GetLayerBuilder()->GetLeafLayerFor(aBuilder, aItem));
 
@@ -1607,21 +1609,21 @@ nsObjectFrame::BuildLayer(nsDisplayListB
     if (!layer) {
       layer = aManager->CreateReadbackLayer();
       if (!layer)
         return nullptr;
     }
     NS_ASSERTION(layer->GetType() == Layer::TYPE_READBACK, "Bad layer type");
 
     ReadbackLayer* readback = static_cast<ReadbackLayer*>(layer.get());
-    if (readback->GetSize() != nsIntSize(size.width, size.height)) {
+    if (readback->GetSize() != ThebesIntSize(size)) {
       // This will destroy any old background sink and notify us that the
       // background is now unknown
       readback->SetSink(nullptr);
-      readback->SetSize(nsIntSize(size.width, size.height));
+      readback->SetSize(ThebesIntSize(size));
 
       if (mBackgroundSink) {
         // Maybe we still have a background sink associated with another
         // readback layer that wasn't recycled for some reason? Unhook it
         // now so that if this frame goes away, it doesn't have a dangling
         // reference to us.
         mBackgroundSink->Destroy();
       }
@@ -1634,17 +1636,17 @@ nsObjectFrame::BuildLayer(nsDisplayListB
     }
   }
 
   // Set a transform on the layer to draw the plugin in the right place
   gfxMatrix transform;
   transform.Translate(r.TopLeft() + aContainerParameters.mOffset);
 
   layer->SetBaseTransform(gfx3DMatrix::From2D(transform));
-  layer->SetVisibleRegion(nsIntRect(0, 0, size.width, size.height));
+  layer->SetVisibleRegion(ThebesIntRect(IntRect(IntPoint(0, 0), size)));
   return layer.forget();
 }
 
 void
 nsObjectFrame::PaintPlugin(nsDisplayListBuilder* aBuilder,
                            nsRenderingContext& aRenderingContext,
                            const nsRect& aDirtyRect, const nsRect& aPluginRect)
 {
--- a/layout/generic/nsVideoFrame.cpp
+++ b/layout/generic/nsVideoFrame.cpp
@@ -26,16 +26,17 @@
 #include "ImageContainer.h"
 #include "ImageLayers.h"
 #include "nsContentList.h"
 #include <algorithm>
 
 using namespace mozilla;
 using namespace mozilla::layers;
 using namespace mozilla::dom;
+using namespace mozilla::gfx;
 
 nsIFrame*
 NS_NewHTMLVideoFrame(nsIPresShell* aPresShell, nsStyleContext* aContext)
 {
   return new (aPresShell) nsVideoFrame(aContext);
 }
 
 NS_IMPL_FRAMEARENA_HELPERS(nsVideoFrame)
@@ -193,18 +194,18 @@ nsVideoFrame::BuildLayer(nsDisplayListBu
                       presContext->AppUnitsToGfxUnits(area.y),
                       presContext->AppUnitsToGfxUnits(area.width),
                       presContext->AppUnitsToGfxUnits(area.height));
   r = CorrectForAspectRatio(r, videoSize);
   r.Round();
   if (r.IsEmpty()) {
     return nullptr;
   }
-  gfxIntSize scaleHint(static_cast<int32_t>(r.Width()),
-                       static_cast<int32_t>(r.Height()));
+  IntSize scaleHint(static_cast<int32_t>(r.Width()),
+                    static_cast<int32_t>(r.Height()));
   container->SetScaleHint(scaleHint);
 
   nsRefPtr<ImageLayer> layer = static_cast<ImageLayer*>
     (aManager->GetLayerBuilder()->GetLeafLayerFor(aBuilder, aItem));
   if (!layer) {
     layer = aManager->CreateImageLayer();
     if (!layer)
       return nullptr;
--- a/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
+++ b/media/webrtc/signaling/src/mediapipeline/MediaPipeline.cpp
@@ -37,16 +37,17 @@
 #include "transportlayerdtls.h"
 #include "transportlayerice.h"
 #include "runnable_utils.h"
 #include "gfxImageSurface.h"
 #include "libyuv/convert.h"
 #include "mozilla/gfx/Point.h"
 
 using namespace mozilla;
+using namespace mozilla::gfx;
 
 // Logging context
 MOZ_MTLOG_MODULE("mediapipeline")
 
 namespace mozilla {
 
 static char kDTLSExporterLabel[] = "EXTRACTOR-dtls_srtp";
 
@@ -1207,25 +1208,25 @@ void MediaPipelineReceiveVideo::Pipeline
 
   layers::PlanarYCbCrImage* videoImage = static_cast<layers::PlanarYCbCrImage*>(image.get());
   uint8_t* frame = const_cast<uint8_t*>(static_cast<const uint8_t*> (buffer));
   const uint8_t lumaBpp = 8;
   const uint8_t chromaBpp = 4;
 
   layers::PlanarYCbCrData data;
   data.mYChannel = frame;
-  data.mYSize = gfxIntSize(width_, height_);
+  data.mYSize = IntSize(width_, height_);
   data.mYStride = width_ * lumaBpp/ 8;
   data.mCbCrStride = width_ * chromaBpp / 8;
   data.mCbChannel = frame + height_ * data.mYStride;
   data.mCrChannel = data.mCbChannel + height_ * data.mCbCrStride / 2;
-  data.mCbCrSize = gfxIntSize(width_/ 2, height_/ 2);
+  data.mCbCrSize = IntSize(width_/ 2, height_/ 2);
   data.mPicX = 0;
   data.mPicY = 0;
-  data.mPicSize = gfxIntSize(width_, height_);
+  data.mPicSize = IntSize(width_, height_);
   data.mStereoMode = STEREO_MODE_MONO;
 
   videoImage->SetData(data);
 
   image_ = image.forget();
 #endif
 }
 
--- a/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h
+++ b/media/webrtc/signaling/src/peerconnection/PeerConnectionMedia.h
@@ -89,16 +89,17 @@ Fake_AudioGenerator(DOMMediaStream* aStr
   int mCount;
 };
 
 /* Temporary for providing video data */
 #ifdef MOZILLA_INTERNAL_API
 class Fake_VideoGenerator {
  public:
   typedef mozilla::DOMMediaStream DOMMediaStream;
+  typedef mozilla::gfx::IntSize IntSize;
 
   Fake_VideoGenerator(DOMMediaStream* aStream) {
     mStream = aStream;
     mCount = 0;
     mTimer = do_CreateInstance("@mozilla.org/timer;1");
     MOZ_ASSERT(mTimer);
 
     // Make a track
@@ -130,25 +131,25 @@ class Fake_VideoGenerator {
     ++gen->mCount;
     memset(frame, (gen->mCount / 8) & 0xff, len); // Rotating colors
 
     const uint8_t lumaBpp = 8;
     const uint8_t chromaBpp = 4;
 
     mozilla::layers::PlanarYCbCrData data;
     data.mYChannel = frame;
-    data.mYSize = gfxIntSize(WIDTH, HEIGHT);
+    data.mYSize = IntSize(WIDTH, HEIGHT);
     data.mYStride = (int32_t) (WIDTH * lumaBpp / 8.0);
     data.mCbCrStride = (int32_t) (WIDTH * chromaBpp / 8.0);
     data.mCbChannel = frame + HEIGHT * data.mYStride;
     data.mCrChannel = data.mCbChannel + HEIGHT * data.mCbCrStride / 2;
-    data.mCbCrSize = gfxIntSize(WIDTH / 2, HEIGHT / 2);
+    data.mCbCrSize = IntSize(WIDTH / 2, HEIGHT / 2);
     data.mPicX = 0;
     data.mPicY = 0;
-    data.mPicSize = gfxIntSize(WIDTH, HEIGHT);
+    data.mPicSize = IntSize(WIDTH, HEIGHT);
     data.mStereoMode = mozilla::STEREO_MODE_MONO;
 
     // SetData copies data, so we can free the frame
     planar->SetData(data);
     PR_Free(frame);
 
     // AddTrack takes ownership of segment
     mozilla::VideoSegment *segment = new mozilla::VideoSegment();
--- a/widget/gonk/nativewindow/GonkBufferQueue.cpp
+++ b/widget/gonk/nativewindow/GonkBufferQueue.cpp
@@ -32,16 +32,18 @@
 #define ST_LOGV(...) __android_log_print(ANDROID_LOG_VERBOSE, LOG_TAG, __VA_ARGS__)
 #define ST_LOGD(...) __android_log_print(ANDROID_LOG_DEBUG, LOG_TAG, __VA_ARGS__)
 #define ST_LOGI(...) __android_log_print(ANDROID_LOG_INFO, LOG_TAG, __VA_ARGS__)
 #define ST_LOGW(...) __android_log_print(ANDROID_LOG_WARN, LOG_TAG, __VA_ARGS__)
 #define ST_LOGE(...) __android_log_print(ANDROID_LOG_ERROR, LOG_TAG, __VA_ARGS__)
 
 #define ATRACE_BUFFER_INDEX(index)
 
+using namespace mozilla;
+using namespace mozilla::gfx;
 using namespace mozilla::layers;
 
 namespace android {
 
 // Get an ID that's unique within this process.
 static int32_t createProcessUniqueId() {
     static volatile int32_t globalCounter = 0;
     return android_atomic_inc(&globalCounter);
@@ -405,17 +407,17 @@ status_t GonkBufferQueue::dequeueBuffer(
     SurfaceDescriptor desc;
     ImageBridgeChild* ibc;
     sp<GraphicBuffer> graphicBuffer;
     if (returnFlags & IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION) {
         usage |= GraphicBuffer::USAGE_HW_TEXTURE;
         status_t error;
         ibc = ImageBridgeChild::GetSingleton();
         ST_LOGD("dequeueBuffer: about to alloc surface descriptor");
-        ibc->AllocSurfaceDescriptorGralloc(gfxIntSize(w, h),
+        ibc->AllocSurfaceDescriptorGralloc(IntSize(w, h),
                                            format,
                                            usage,
                                            &desc);
         // We can only use a gralloc buffer here.  If we didn't get
         // one back, something went wrong.
         ST_LOGD("dequeueBuffer: got surface descriptor");
         if (SurfaceDescriptor::TSurfaceDescriptorGralloc != desc.type()) {
             MOZ_ASSERT(SurfaceDescriptor::T__None == desc.type());
--- a/widget/gonk/nativewindow/GonkNativeWindowICS.cpp
+++ b/widget/gonk/nativewindow/GonkNativeWindowICS.cpp
@@ -27,16 +27,18 @@
  * NSPR_LOG_MODULES=Camera:N environment variable, where N >= 3.
  *
  * CNW_LOGE() is always enabled.
  */
 #define CNW_LOGD(...)   DOM_CAMERA_LOGI(__VA_ARGS__)
 #define CNW_LOGE(...)   {(void)printf_stderr(__VA_ARGS__);}
 
 using namespace android;
+using namespace mozilla;
+using namespace mozilla::gfx;
 using namespace mozilla::layers;
 
 GonkNativeWindow::GonkNativeWindow() :
     mDefaultWidth(1),
     mDefaultHeight(1),
     mPixelFormat(PIXEL_FORMAT_RGBA_8888),
     mBufferCount(MIN_BUFFER_SLOTS + 1),
     mConnectedApi(NO_CONNECTED_API),
@@ -333,17 +335,17 @@ status_t GonkNativeWindow::dequeueBuffer
     SurfaceDescriptor desc;
     ImageBridgeChild* ibc;
     sp<GraphicBuffer> graphicBuffer;
     if (alloc) {
         usage |= GraphicBuffer::USAGE_HW_TEXTURE;
         status_t error;
         ibc = ImageBridgeChild::GetSingleton();
         CNW_LOGD("dequeueBuffer: about to alloc surface descriptor");
-        ibc->AllocSurfaceDescriptorGralloc(gfxIntSize(w, h),
+        ibc->AllocSurfaceDescriptorGralloc(IntSize(w, h),
                                            format,
                                            usage,
                                            &desc);
         // We can only use a gralloc buffer here.  If we didn't get
         // one back, something went wrong.
         CNW_LOGD("dequeueBuffer: got surface descriptor");
         if (SurfaceDescriptor::TSurfaceDescriptorGralloc != desc.type()) {
             MOZ_ASSERT(SurfaceDescriptor::T__None == desc.type());
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -2284,18 +2284,17 @@ nsWindow::UpdateAlpha(gfxPattern* aPatte
       if (drawTarget) {
           drawTarget->FillRect(Rect(0, 0, aBoundsRect.width, aBoundsRect.height),
                                *aPattern->GetPattern(drawTarget),
                                DrawOptions(1.0, OP_SOURCE));
       }
       UpdateTranslucentWindowAlphaInternal(aBoundsRect, imageBuffer, stride);
   } else {
       nsRefPtr<gfxImageSurface> img =
-          new gfxImageSurface(ThebesIntSize(aBoundsRect.Size()),
-                              gfxImageFormatA8);
+          new gfxImageSurface(aBoundsRect.Size(), gfxImageFormatA8);
       if (img && !img->CairoStatus()) {
           img->SetDeviceOffset(-aBoundsRect.TopLeft());
 
           nsRefPtr<gfxContext> imgCtx = new gfxContext(img);
           imgCtx->SetPattern(aPattern);
           imgCtx->SetOperator(gfxContext::OPERATOR_SOURCE);
           imgCtx->Paint();