Bug 913603 - Avoid needlessly including nsRect.h - r=jrmuizel
authorBenoit Jacob <bjacob@mozilla.com>
Fri, 06 Sep 2013 22:15:49 -0400
changeset 146055 eb9ce350a4adde7b645b30d2a6faaf80b5e62b85
parent 146054 d39afeecef6602ecb8704e82fd4661d1a8e9a594
child 146056 b4b1369c759540b56e4ba1528a136913d61ebb31
push id25236
push userphilringnalda@gmail.com
push dateSun, 08 Sep 2013 00:24:06 +0000
treeherdermozilla-central@4ca898d7db5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjrmuizel
bugs913603
milestone26.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 913603 - Avoid needlessly including nsRect.h - r=jrmuizel
accessible/src/mac/AccessibleWrap.h
content/html/content/src/nsClientRect.h
content/media/wmf/DXVA2Manager.h
dom/base/nsGlobalWindow.h
dom/plugins/ipc/PluginInterposeOSX.h
dom/plugins/ipc/PluginUtilsOSX.h
gfx/layers/composite/TextureHost.h
gfx/layers/d3d9/DeviceManagerD3D9.h
gfx/layers/opengl/LayerManagerOGLProgram.h
gfx/layers/opengl/TextureHostOGL.h
gfx/thebes/gfxAlphaRecovery.h
gfx/thebes/gfxD2DSurface.h
gfx/thebes/gfxQtNativeRenderer.h
gfx/thebes/gfxRect.h
gfx/thebes/gfxXlibNativeRenderer.h
image/src/ImageOps.h
image/src/imgDecoderObserver.h
image/src/imgFrame.cpp
layout/base/nsIPresShell.h
layout/base/nsPresState.h
layout/generic/nsFrame.h
layout/generic/nsIPageSequenceFrame.h
layout/generic/nsImageMap.h
layout/generic/nsPluginUtilsOSX.h
layout/mathml/nsMathMLChar.h
layout/svg/nsISVGChildFrame.h
layout/svg/nsSVGContainerFrame.h
layout/svg/nsSVGFilterFrame.h
layout/svg/nsSVGGeometryFrame.h
layout/svg/nsSVGIntegrationUtils.h
layout/svg/nsSVGPathGeometryFrame.h
layout/svg/nsSVGUtils.h
layout/tables/nsCellMap.h
widget/android/AndroidDirectTexture.h
widget/android/AndroidGraphicBuffer.h
widget/android/AndroidJavaWrappers.h
widget/gonk/nsAppShell.h
widget/windows/WinUtils.h
widget/windows/nsWindow.h
widget/windows/winrt/MetroUtils.cpp
widget/windows/winrt/MetroUtils.h
--- a/accessible/src/mac/AccessibleWrap.h
+++ b/accessible/src/mac/AccessibleWrap.h
@@ -11,17 +11,16 @@
 #define _AccessibleWrap_H_
 
 #include <objc/objc.h>
 
 #include "Accessible.h"
 #include "States.h"
 
 #include "nsCOMPtr.h"
-#include "nsRect.h"
 
 #include "nsTArray.h"
 #include "nsAutoPtr.h"
 
 #if defined(__OBJC__)
 @class mozAccessible;
 #endif
 
--- a/content/html/content/src/nsClientRect.h
+++ b/content/html/content/src/nsClientRect.h
@@ -4,23 +4,24 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef NSCLIENTRECT_H_
 #define NSCLIENTRECT_H_
 
 #include "nsIDOMClientRect.h"
 #include "nsIDOMClientRectList.h"
 #include "nsTArray.h"
-#include "nsRect.h"
 #include "nsCOMPtr.h"
 #include "nsAutoPtr.h"
 #include "nsWrapperCache.h"
 #include "nsCycleCollectionParticipant.h"
 #include "mozilla/Attributes.h"
 
+struct nsRect;
+
 class nsClientRect MOZ_FINAL : public nsIDOMClientRect
                              , public nsWrapperCache
 {
 public:
   nsClientRect(nsISupports* aParent)
     : mParent(aParent), mX(0.0), mY(0.0), mWidth(0.0), mHeight(0.0)
   {
     SetIsDOMBinding();
--- a/content/media/wmf/DXVA2Manager.h
+++ b/content/media/wmf/DXVA2Manager.h
@@ -4,19 +4,19 @@
  * 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/. */
 #if !defined(DXVA2Manager_h_)
 #define DXVA2Manager_h_
 
 #include "WMF.h"
 #include "nsAutoPtr.h"
 #include "mozilla/Mutex.h"
-#include "nsRect.h"
 
-class nsIntSize;
+struct nsIntSize;
+struct nsIntRect;
 
 namespace mozilla {
 
 namespace layers {
 class Image;
 class ImageContainer;
 }
 
--- a/dom/base/nsGlobalWindow.h
+++ b/dom/base/nsGlobalWindow.h
@@ -29,17 +29,16 @@
 #include "nsIDOMJSWindow.h"
 #include "nsIDOMChromeWindow.h"
 #include "nsIScriptGlobalObject.h"
 #include "nsITimer.h"
 #include "nsIDOMModalContentWindow.h"
 #include "nsEventListenerManager.h"
 #include "nsIPrincipal.h"
 #include "nsSize.h"
-#include "nsRect.h"
 #include "mozFlushType.h"
 #include "prclist.h"
 #include "nsIDOMStorageEvent.h"
 #include "nsFrameMessageManager.h"
 #include "mozilla/LinkedList.h"
 #include "mozilla/TimeStamp.h"
 #include "nsIInlineEventHandlers.h"
 #include "nsWrapperCacheInlines.h"
@@ -93,17 +92,18 @@ class nsDOMWindowList;
 class nsLocation;
 class nsScreen;
 class nsHistory;
 class nsGlobalWindowObserver;
 class nsGlobalWindow;
 class nsDOMEventTargetHelper;
 class nsDOMWindowUtils;
 class nsIIdleService;
-class nsIntSize;
+struct nsIntSize;
+struct nsRect;
 
 class nsWindowSizes;
 
 namespace mozilla {
 namespace dom {
 class BarProp;
 class Gamepad;
 class Navigator;
--- a/dom/plugins/ipc/PluginInterposeOSX.h
+++ b/dom/plugins/ipc/PluginInterposeOSX.h
@@ -28,17 +28,16 @@
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
 #ifndef DOM_PLUGINS_IPC_PLUGININTERPOSEOSX_H
 #define DOM_PLUGINS_IPC_PLUGININTERPOSEOSX_H
 
 #include "base/basictypes.h"
 #include "nsPoint.h"
 #include "npapi.h"
-#include "nsRect.h"
 
 // Make this includable from non-Objective-C code.
 #ifndef __OBJC__
 class NSCursor;
 #else
 #import <Cocoa/Cocoa.h>
 #endif
 
--- a/dom/plugins/ipc/PluginUtilsOSX.h
+++ b/dom/plugins/ipc/PluginUtilsOSX.h
@@ -3,19 +3,20 @@
 /* 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/. */
 
 #ifndef dom_plugins_PluginUtilsOSX_h
 #define dom_plugins_PluginUtilsOSX_h 1
 
 #include "npapi.h"
-#include "nsRect.h"
 #include "mozilla/gfx/QuartzSupport.h"
 
+struct nsIntRect;
+
 namespace mozilla {
 namespace plugins {
 namespace PluginUtilsOSX {
 
 // Need to call back into the browser's message loop to process event.
 typedef void (*RemoteProcessEvents) (void*);
 
 NPError ShowCocoaContextMenu(void* aMenu, int aX, int aY, void* pluginModule, RemoteProcessEvents remoteEvent);
--- a/gfx/layers/composite/TextureHost.h
+++ b/gfx/layers/composite/TextureHost.h
@@ -16,26 +16,25 @@
 #include "mozilla/gfx/2D.h"             // for DataSourceSurface
 #include "mozilla/gfx/Point.h"          // for IntSize, IntPoint
 #include "mozilla/gfx/Types.h"          // for SurfaceFormat, etc
 #include "mozilla/layers/CompositorTypes.h"  // for TextureFlags, etc
 #include "mozilla/layers/LayersTypes.h"  // for LayerRenderState, etc
 #include "mozilla/mozalloc.h"           // for operator delete
 #include "nsCOMPtr.h"                   // for already_AddRefed
 #include "nsDebug.h"                    // for NS_RUNTIMEABORT
-#include "nsRect.h"                     // for nsIntRect
 #include "nsRegion.h"                   // for nsIntRegion
 #include "nsTraceRefcnt.h"              // for MOZ_COUNT_CTOR, etc
 #include "nscore.h"                     // for nsACString
 
 class gfxImageSurface;
 class gfxReusableSurfaceWrapper;
 struct nsIntPoint;
 struct nsIntSize;
-
+struct nsIntRect;
 
 namespace mozilla {
 namespace ipc {
 class Shmem;
 }
 
 namespace layers {
 
--- a/gfx/layers/d3d9/DeviceManagerD3D9.h
+++ b/gfx/layers/d3d9/DeviceManagerD3D9.h
@@ -2,22 +2,23 @@
  * 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/. */
 
 #ifndef GFX_DEVICEMANAGERD3D9_H
 #define GFX_DEVICEMANAGERD3D9_H
 
 #include "gfxTypes.h"
-#include "nsRect.h"
 #include "nsAutoPtr.h"
 #include "d3d9.h"
 #include "nsTArray.h"
 #include "mozilla/layers/CompositorTypes.h"
 
+struct nsIntRect;
+
 namespace mozilla {
 namespace layers {
 
 class DeviceManagerD3D9;
 class LayerD3D9;
 class Nv3DVUtils;
 class Layer;
 
--- a/gfx/layers/opengl/LayerManagerOGLProgram.h
+++ b/gfx/layers/opengl/LayerManagerOGLProgram.h
@@ -11,21 +11,21 @@
 #include "gfxASurface.h"                // for gfxASurface, etc
 #include "mozilla/Assertions.h"         // for MOZ_ASSERT, etc
 #include "mozilla/RefPtr.h"             // for RefPtr
 #include "mozilla/gfx/Matrix.h"         // for Matrix4x4
 #include "mozilla/gfx/Rect.h"           // for Rect
 #include "mozilla/gfx/Types.h"
 #include "nsDebug.h"                    // for NS_ASSERTION
 #include "nsPoint.h"                    // for nsIntPoint
-#include "nsRect.h"                     // for nsIntRect
 #include "nsTArray.h"                   // for nsTArray
 #include "mozilla/layers/CompositorTypes.h"
 
 struct gfxRGBA;
+struct nsIntRect;
 
 namespace mozilla {
 namespace gl {
 class GLContext;
 }
 namespace layers {
 
 class Layer;
--- a/gfx/layers/opengl/TextureHostOGL.h
+++ b/gfx/layers/opengl/TextureHostOGL.h
@@ -23,28 +23,28 @@
 #include "mozilla/layers/LayersSurfaces.h"  // for SurfaceDescriptor
 #include "mozilla/layers/LayersTypes.h"  // for MOZ_LAYERS_HAVE_LOG
 #include "mozilla/layers/TextureHost.h"  // for DeprecatedTextureHost, etc
 #include "mozilla/mozalloc.h"           // for operator delete, etc
 #include "nsAutoPtr.h"                  // for nsRefPtr
 #include "nsCOMPtr.h"                   // for already_AddRefed
 #include "nsDebug.h"                    // for NS_WARNING
 #include "nsISupportsImpl.h"            // for TextureImage::Release, etc
-#include "nsRect.h"                     // for nsIntRect
-#include "nsSize.h"                     // for nsIntSize
 #include "nsTraceRefcnt.h"              // for MOZ_COUNT_CTOR, etc
 #include "LayerManagerOGLProgram.h"     // for ShaderProgramType, etc
 #ifdef MOZ_WIDGET_GONK
 #include <ui/GraphicBuffer.h>
 #endif
 
 class gfxImageSurface;
 class gfxReusableSurfaceWrapper;
 class nsIntRegion;
 struct nsIntPoint;
+struct nsIntRect;
+struct nsIntSize;
 
 namespace mozilla {
 namespace gfx {
 class DataSourceSurface;
 class SurfaceStream;
 }
 
 namespace layers {
--- a/gfx/thebes/gfxAlphaRecovery.h
+++ b/gfx/thebes/gfxAlphaRecovery.h
@@ -4,17 +4,18 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef _GFXALPHARECOVERY_H_
 #define _GFXALPHARECOVERY_H_
 
 #include "gfxContext.h"
 #include "gfxImageSurface.h"
 #include "mozilla/SSE.h"
-#include "nsRect.h"
+
+struct nsIntRect;
 
 class gfxAlphaRecovery {
 public:
     struct Analysis {
         bool uniformColor;
         bool uniformAlpha;
         gfxFloat alpha;
         gfxFloat r, g, b;
--- a/gfx/thebes/gfxD2DSurface.h
+++ b/gfx/thebes/gfxD2DSurface.h
@@ -3,21 +3,21 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef GFX_D2DSURFACE_H
 #define GFX_D2DSURFACE_H
 
 #include "gfxASurface.h"
 #include "nsPoint.h"
-#include "nsRect.h"
 
 #include <windows.h>
 
 struct ID3D10Texture2D;
+struct nsIntRect;
 
 class gfxD2DSurface : public gfxASurface {
 public:
 
     gfxD2DSurface(HWND wnd,
                   gfxContentType aContent);
 
     gfxD2DSurface(const gfxIntSize& size,
--- a/gfx/thebes/gfxQtNativeRenderer.h
+++ b/gfx/thebes/gfxQtNativeRenderer.h
@@ -5,19 +5,19 @@
 
 #ifndef GFXQTNATIVERENDER_H_
 #define GFXQTNATIVERENDER_H_
 
 #include "gfxColor.h"
 #include "gfxASurface.h"
 #include "gfxContext.h"
 #include "gfxXlibSurface.h"
-#include "nsRect.h"
 
 class QRect;
+struct nsIntRect;
 
 /**
  * This class lets us take code that draws into an Xlib surface drawable and lets us
  * use it to draw into any Thebes context. The user should subclass this class,
  * override NativeDraw, and then call Draw(). The drawing will be subjected
  * to all Thebes transformations, clipping etc.
  */
 class gfxQtNativeRenderer {
--- a/gfx/thebes/gfxRect.h
+++ b/gfx/thebes/gfxRect.h
@@ -6,20 +6,20 @@
 #ifndef GFX_RECT_H
 #define GFX_RECT_H
 
 #include "nsAlgorithm.h"
 #include "gfxTypes.h"
 #include "gfxPoint.h"
 #include "gfxCore.h"
 #include "nsDebug.h"
+#include "nsRect.h"
 #include "mozilla/gfx/BaseMargin.h"
 #include "mozilla/gfx/BaseRect.h"
 #include "mozilla/Assertions.h"
-#include "nsRect.h"
 
 struct gfxMargin : public mozilla::gfx::BaseMargin<gfxFloat, gfxMargin> {
   typedef mozilla::gfx::BaseMargin<gfxFloat, gfxMargin> Super;
 
   // Constructors
   gfxMargin() : Super() {}
   gfxMargin(const gfxMargin& aMargin) : Super(aMargin) {}
   gfxMargin(gfxFloat aTop, gfxFloat aRight, gfxFloat aBottom, gfxFloat aLeft)
--- a/gfx/thebes/gfxXlibNativeRenderer.h
+++ b/gfx/thebes/gfxXlibNativeRenderer.h
@@ -3,22 +3,24 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef GFXXLIBNATIVERENDER_H_
 #define GFXXLIBNATIVERENDER_H_
 
 #include "gfxColor.h"
 #include "nsAutoPtr.h"
-#include "nsRect.h"
 #include <X11/Xlib.h>
 
 class gfxASurface;
 class gfxXlibSurface;
 class gfxContext;
+struct nsIntRect;
+struct nsIntPoint;
+struct nsIntSize;
 
 /**
  * This class lets us take code that draws into an X drawable and lets us
  * use it to draw into any Thebes context. The user should subclass this class,
  * override DrawWithXib, and then call Draw(). The drawing will be subjected
  * to all Thebes transformations, clipping etc.
  */
 class gfxXlibNativeRenderer {
--- a/image/src/ImageOps.h
+++ b/image/src/ImageOps.h
@@ -3,20 +3,20 @@
  * 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/. */
 
 #ifndef MOZILLA_IMAGELIB_IMAGEOPS_H_
 #define MOZILLA_IMAGELIB_IMAGEOPS_H_
 
 #include "nsCOMPtr.h"
-#include "nsRect.h"
 #include "Orientation.h"
 
 class imgIContainer;
+struct nsIntRect;
 
 namespace mozilla {
 namespace image {
 
 class Image;
 
 class ImageOps
 {
--- a/image/src/imgDecoderObserver.h
+++ b/image/src/imgDecoderObserver.h
@@ -2,19 +2,20 @@
  * 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/. */
 
 #ifndef MOZILLA_IMAGELIB_IMGDECODEROBSERVER_H_
 #define MOZILLA_IMAGELIB_IMGDECODEROBSERVER_H_
 
 #include "nsRect.h"
-#include "mozilla/RefPtr.h"
 #include "mozilla/WeakPtr.h"
 
+struct nsIntRect;
+
 /**
  * imgDecoderObserver interface
  *
  * This interface is used to observe Decoder objects.
  *
  * We make the distinction here between "load" and "decode" notifications. Load
  * notifications are fired as the image is loaded from the network or
  * filesystem. Decode notifications are fired as the image is decoded. If an
--- a/image/src/imgFrame.cpp
+++ b/image/src/imgFrame.cpp
@@ -15,16 +15,17 @@
 #include "gfxUtils.h"
 
 static bool gDisableOptimize = false;
 
 #include "cairo.h"
 #include "GeckoProfiler.h"
 #include "mozilla/Likely.h"
 #include "mozilla/MemoryReporting.h"
+#include "nsMargin.h"
 
 #if defined(XP_WIN)
 
 #include "gfxWindowsPlatform.h"
 
 /* Whether to use the windows surface; only for desktop win32 */
 #define USE_WIN_SURFACE 1
 
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -26,17 +26,16 @@
 #include "nsHashKeys.h"
 #include "nsISupports.h"
 #include "nsQueryFrame.h"
 #include "nsCoord.h"
 #include "nsColor.h"
 #include "nsEvent.h"
 #include "nsCompatibility.h"
 #include "nsFrameManagerBase.h"
-#include "nsRect.h"
 #include "mozFlushType.h"
 #include "nsWeakReference.h"
 #include <stdio.h> // for FILE definition
 #include "nsChangeHint.h"
 #include "nsRefPtrHashtable.h"
 #include "nsEventStates.h"
 #include "nsPresArena.h"
 #include "nsIImageLoadingContent.h"
@@ -69,16 +68,17 @@ class gfxASurface;
 class gfxContext;
 class nsIDOMEvent;
 class nsDisplayList;
 class nsDisplayListBuilder;
 class nsPIDOMWindow;
 struct nsPoint;
 struct nsIntPoint;
 struct nsIntRect;
+struct nsRect;
 class nsRegion;
 class nsRefreshDriver;
 class nsARefreshObserver;
 #ifdef ACCESSIBILITY
 class nsAccessibilityService;
 namespace mozilla {
 namespace a11y {
 class DocAccessible;
--- a/layout/base/nsPresState.h
+++ b/layout/base/nsPresState.h
@@ -8,17 +8,16 @@
  * is not
  */
 
 #ifndef nsPresState_h_
 #define nsPresState_h_
 
 #include "nsPoint.h"
 #include "nsAutoPtr.h"
-#include "nsRect.h"
 
 class nsPresState
 {
 public:
   nsPresState()
     : mContentData(nullptr)
     , mScrollState(0, 0)
     , mDisabledSet(false)
--- a/layout/generic/nsFrame.h
+++ b/layout/generic/nsFrame.h
@@ -6,17 +6,16 @@
 /* base class of all rendering objects */
 
 #ifndef nsFrame_h___
 #define nsFrame_h___
 
 #include "mozilla/Attributes.h"
 #include "mozilla/Likely.h"
 #include "nsBox.h"
-#include "nsRect.h"
 #include "prlog.h"
 
 #include "nsIPresShell.h"
 #include "nsHTMLReflowState.h"
 #include "nsHTMLParts.h"
 #include "nsISelectionDisplay.h"
 
 /**
@@ -93,16 +92,17 @@
   { return aShell->AllocateFrame(nsQueryFrame::class##_id, sz); } \
   nsQueryFrame::FrameIID class::GetFrameId()                      \
   { return nsQueryFrame::class##_id; }
 
 //----------------------------------------------------------------------
 
 struct nsBoxLayoutMetrics;
 class nsDisplayBackgroundImage;
+struct nsRect;
 
 /**
  * Implementation of a simple frame that's not splittable and has no
  * child frames.
  *
  * Sets the NS_FRAME_SYNCHRONIZE_FRAME_AND_VIEW bit, so the default
  * behavior is to keep the frame and view position and size in sync.
  */
--- a/layout/generic/nsIPageSequenceFrame.h
+++ b/layout/generic/nsIPageSequenceFrame.h
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* 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/. */
 #ifndef nsIPageSequenceFrame_h___
 #define nsIPageSequenceFrame_h___
 
 #include "nsQueryFrame.h"
-#include "nsRect.h"
+#include "nsCoord.h"
 
 class nsPresContext;
 class nsIPrintSettings;
 class nsITimerCallback;
 
 /**
  * Interface for accessing special capabilities of the page sequence frame.
  *
--- a/layout/generic/nsImageMap.h
+++ b/layout/generic/nsImageMap.h
@@ -8,23 +8,23 @@
 #ifndef nsImageMap_h
 #define nsImageMap_h
 
 #include "nsCOMPtr.h"
 #include "nsCoord.h"
 #include "nsTArray.h"
 #include "nsStubMutationObserver.h"
 #include "nsIDOMEventListener.h"
-#include "nsRect.h"
 
 class Area;
 class nsRenderingContext;
 class nsImageFrame;
 class nsIFrame;
 class nsIContent;
+struct nsRect;
 
 class nsImageMap : public nsStubMutationObserver,
                    public nsIDOMEventListener
 {
 public:
   nsImageMap();
 
   nsresult Init(nsImageFrame* aImageFrame, nsIContent* aMap);
--- a/layout/generic/nsPluginUtilsOSX.h
+++ b/layout/generic/nsPluginUtilsOSX.h
@@ -5,20 +5,21 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // We can use Carbon in this header but not Cocoa. Cocoa pointers must be void.
 
 #ifndef __LP64__
 #import <Carbon/Carbon.h>
 #endif
 
-#include "nsRect.h"
 #include "nsIWidget.h"
 #include "npapi.h"
 
+struct nsRect;
+
 // We use void pointers to avoid exporting native event types to cross-platform code.
 
 #ifndef __LP64__
 // Get the rect for an entire top-level Carbon window in screen coords.
 void NS_NPAPI_CarbonWindowFrame(WindowRef aWindow, nsRect& outRect);
 #endif
 
 // Get the rect for an entire top-level Cocoa window in screen coords.
--- a/layout/mathml/nsMathMLChar.h
+++ b/layout/mathml/nsMathMLChar.h
@@ -11,17 +11,16 @@
 #include "nsRect.h"
 #include "nsString.h"
 #include "nsBoundingMetrics.h"
 
 class nsGlyphTable;
 class nsIFrame;
 class nsDisplayListBuilder;
 class nsDisplayListSet;
-class nsRect;
 class nsPresContext;
 class nsRenderingContext;
 class nsBoundingMetrics;
 class nsStyleContext;
 class nsFont;
 
 // Hints for Stretch() to indicate criteria for stretching
 enum {
--- a/layout/svg/nsISVGChildFrame.h
+++ b/layout/svg/nsISVGChildFrame.h
@@ -3,24 +3,25 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef __NS_ISVGCHILDFRAME_H__
 #define __NS_ISVGCHILDFRAME_H__
 
 #include "gfxRect.h"
 #include "nsQueryFrame.h"
-#include "nsRect.h"
 
 class nsIFrame;
 class nsRenderingContext;
 
 struct gfxMatrix;
 struct nsPoint;
 class SVGBBox;
+struct nsRect;
+struct nsIntRect;
 
 namespace mozilla {
 class SVGAnimatedLengthList;
 class SVGAnimatedNumberList;
 class SVGLengthList;
 class SVGNumberList;
 class SVGUserUnitList;
 }
--- a/layout/svg/nsSVGContainerFrame.h
+++ b/layout/svg/nsSVGContainerFrame.h
@@ -3,32 +3,33 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef NS_SVGCONTAINERFRAME_H
 #define NS_SVGCONTAINERFRAME_H
 
 #include "mozilla/Attributes.h"
 #include "gfxMatrix.h"
-#include "gfxRect.h"
 #include "nsContainerFrame.h"
 #include "nsFrame.h"
 #include "nsIFrame.h"
 #include "nsISVGChildFrame.h"
 #include "nsQueryFrame.h"
 #include "nsRect.h"
 #include "nsSVGUtils.h"
 
 class nsFrameList;
 class nsIContent;
 class nsIPresShell;
 class nsRenderingContext;
 class nsStyleContext;
 
 struct nsPoint;
+struct nsRect;
+struct nsIntRect;
 
 typedef nsContainerFrame nsSVGContainerFrameBase;
 
 /**
  * Base class for SVG container frames. Frame sub-classes that do not
  * display their contents directly (such as the frames for <marker> or
  * <pattern>) just inherit this class. Frame sub-classes that do or can
  * display their contents directly (such as the frames for inner-<svg> or
--- a/layout/svg/nsSVGFilterFrame.h
+++ b/layout/svg/nsSVGFilterFrame.h
@@ -4,30 +4,31 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef __NS_SVGFILTERFRAME_H__
 #define __NS_SVGFILTERFRAME_H__
 
 #include "mozilla/Attributes.h"
 #include "nsFrame.h"
 #include "nsQueryFrame.h"
-#include "nsRect.h"
 #include "nsSVGContainerFrame.h"
 #include "nsSVGUtils.h"
 
 class nsIAtom;
 class nsIContent;
 class nsIFrame;
 class nsIPresShell;
 class nsRenderingContext;
 class nsStyleContext;
 class nsSVGFilterPaintCallback;
 class nsSVGIntegerPair;
 class nsSVGLength2;
 
+struct nsRect;
+
 namespace mozilla {
 namespace dom {
 class SVGFilterElement;
 }
 }
 
 typedef nsSVGContainerFrame nsSVGFilterFrameBase;
 
--- a/layout/svg/nsSVGGeometryFrame.h
+++ b/layout/svg/nsSVGGeometryFrame.h
@@ -8,17 +8,16 @@
 #define __NS_SVGGEOMETRYFRAME_H__
 
 #include "mozilla/Attributes.h"
 #include "gfxMatrix.h"
 #include "gfxTypes.h"
 #include "nsFrame.h"
 #include "nsIFrame.h"
 #include "nsQueryFrame.h"
-#include "nsRect.h"
 
 class gfxContext;
 class nsIContent;
 class nsStyleContext;
 class nsSVGPaintServerFrame;
 
 struct nsStyleSVGPaint;
 
--- a/layout/svg/nsSVGIntegrationUtils.h
+++ b/layout/svg/nsSVGIntegrationUtils.h
@@ -4,23 +4,25 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef NSSVGINTEGRATIONUTILS_H_
 #define NSSVGINTEGRATIONUTILS_H_
 
 #include "gfxMatrix.h"
 #include "gfxPattern.h"
 #include "gfxRect.h"
-#include "nsRect.h"
 
 class nsDisplayList;
 class nsDisplayListBuilder;
 class nsIFrame;
 class nsRenderingContext;
 
+struct nsRect;
+struct nsIntRect;
+
 namespace mozilla {
 namespace layers {
 class LayerManager;
 }
 }
 
 struct nsPoint;
 struct nsSize;
--- a/layout/svg/nsSVGPathGeometryFrame.h
+++ b/layout/svg/nsSVGPathGeometryFrame.h
@@ -8,31 +8,32 @@
 
 #include "mozilla/Attributes.h"
 #include "gfxMatrix.h"
 #include "gfxRect.h"
 #include "nsFrame.h"
 #include "nsISVGChildFrame.h"
 #include "nsLiteralString.h"
 #include "nsQueryFrame.h"
-#include "nsRect.h"
 #include "nsSVGGeometryFrame.h"
 #include "nsSVGUtils.h"
 
 class gfxContext;
 class nsDisplaySVGPathGeometry;
 class nsIAtom;
 class nsIFrame;
 class nsIPresShell;
 class nsRenderingContext;
 class nsStyleContext;
 class nsSVGMarkerFrame;
 class nsSVGMarkerProperty;
 
 struct nsPoint;
+struct nsRect;
+struct nsIntRect;
 
 typedef nsSVGGeometryFrame nsSVGPathGeometryFrameBase;
 
 class nsSVGPathGeometryFrame : public nsSVGPathGeometryFrameBase,
                                public nsISVGChildFrame
 {
   friend nsIFrame*
   NS_NewSVGPathGeometryFrame(nsIPresShell* aPresShell, nsStyleContext* aContext);
--- a/layout/svg/nsSVGUtils.h
+++ b/layout/svg/nsSVGUtils.h
@@ -16,18 +16,16 @@
 #include "gfxRect.h"
 #include "nsAlgorithm.h"
 #include "nsChangeHint.h"
 #include "nsColor.h"
 #include "nsCOMPtr.h"
 #include "nsID.h"
 #include "nsISupportsBase.h"
 #include "nsMathUtils.h"
-#include "nsPoint.h"
-#include "nsRect.h"
 #include "nsStyleStruct.h"
 #include "mozilla/Constants.h"
 #include <algorithm>
 
 class gfxASurface;
 class gfxContext;
 class gfxImageSurface;
 class gfxPattern;
@@ -46,16 +44,19 @@ class nsSVGGeometryFrame;
 class nsSVGLength2;
 class nsSVGOuterSVGFrame;
 class nsSVGPathGeometryFrame;
 class nsTextFrame;
 class gfxTextObjectPaint;
 
 struct nsStyleSVG;
 struct nsStyleSVGPaint;
+struct nsRect;
+struct nsIntRect;
+struct nsPoint;
 
 namespace mozilla {
 class SVGAnimatedPreserveAspectRatio;
 class SVGPreserveAspectRatio;
 namespace dom {
 class Element;
 } // namespace dom
 } // namespace mozilla
--- a/layout/tables/nsCellMap.h
+++ b/layout/tables/nsCellMap.h
@@ -4,32 +4,32 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 #ifndef nsCellMap_h__
 #define nsCellMap_h__
 
 #include "nscore.h"
 #include "celldata.h"
 #include "nsTArray.h"
 #include "nsTArray.h"
-#include "nsRect.h"
 #include "nsCOMPtr.h"
 #include "nsAlgorithm.h"
 #include "nsAutoPtr.h"
 #include <algorithm>
 
 #undef DEBUG_TABLE_CELLMAP
 
 class nsTableColFrame;
 class nsTableCellFrame;
 class nsTableRowFrame;
 class nsTableRowGroupFrame;
 class nsTableFrame;
 class nsCellMap;
 class nsPresContext;
 class nsCellMapColumnIterator;
+struct nsIntRect;
 
 struct nsColInfo
 {
   int32_t mNumCellsOrig; // number of cells originating in the col
   int32_t mNumCellsSpan; // number of cells spanning into the col via colspans (not rowspans)
 
   nsColInfo();
   nsColInfo(int32_t aNumCellsOrig,
--- a/widget/android/AndroidDirectTexture.h
+++ b/widget/android/AndroidDirectTexture.h
@@ -2,20 +2,21 @@
  * 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/. */
 
 #ifndef AndroidDirectTexture_h_
 #define AndroidDirectTexture_h_
 
 #include "gfxASurface.h"
-#include "nsRect.h"
 #include "mozilla/Mutex.h"
 #include "AndroidGraphicBuffer.h"
 
+struct nsIntRect;
+
 namespace mozilla {
 
 /**
  * This is a thread safe wrapper around AndroidGraphicBuffer that handles
  * double buffering. Each call to Bind() flips the buffer when necessary.
  *
  * You need to be careful when destroying an instance of this class. If either
  * buffer is locked by the application of the driver/hardware, bad things will
--- a/widget/android/AndroidGraphicBuffer.h
+++ b/widget/android/AndroidGraphicBuffer.h
@@ -2,21 +2,22 @@
  * 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/. */
 
 #ifndef AndroidGraphicBuffer_h_
 #define AndroidGraphicBuffer_h_
 
 #include "gfxASurface.h"
-#include "nsRect.h"
 
 typedef void* EGLImageKHR;
 typedef void* EGLClientBuffer;
 
+struct nsIntRect;
+
 namespace mozilla {
 
 /**
  * This class allows access to Android's direct texturing mechanism. Locking
  * the buffer gives you a pointer you can read/write to directly. It is fully
  * threadsafe, but you probably really want to use the AndroidDirectTexture
  * class which will handle double buffering.
  *
--- a/widget/android/AndroidJavaWrappers.h
+++ b/widget/android/AndroidJavaWrappers.h
@@ -6,17 +6,16 @@
 #ifndef AndroidJavaWrappers_h__
 #define AndroidJavaWrappers_h__
 
 #include <jni.h>
 #include <android/input.h>
 #include <android/log.h>
 
 #include "nsGeoPosition.h"
-#include "nsPoint.h"
 #include "nsRect.h"
 #include "nsString.h"
 #include "nsTArray.h"
 #include "nsIObserver.h"
 #include "mozilla/gfx/Rect.h"
 #include "mozilla/dom/Touch.h"
 #include "InputData.h"
 #include "Units.h"
--- a/widget/gonk/nsAppShell.h
+++ b/widget/gonk/nsAppShell.h
@@ -15,17 +15,16 @@
 
 #ifndef nsAppShell_h
 #define nsAppShell_h
 
 #include <queue>
 
 #include "mozilla/Mutex.h"
 #include "nsBaseAppShell.h"
-#include "nsRect.h"
 #include "nsTArray.h"
 
 #include "utils/RefBase.h"
 
 namespace mozilla {
 bool ProcessNextEvent();
 void NotifyEvent();
 }
--- a/widget/windows/WinUtils.h
+++ b/widget/windows/WinUtils.h
@@ -9,32 +9,32 @@
 #include "nscore.h"
 #include <windows.h>
 #include <shobjidl.h>
 #include <uxtheme.h>
 #include <dwmapi.h>
 #include "nsAutoPtr.h"
 #include "nsString.h"
 #include "nsRegion.h"
-#include "nsRect.h"
 
 #include "nsThreadUtils.h"
 #include "nsICryptoHash.h"
 #ifdef MOZ_PLACES
 #include "nsIFaviconService.h"
 #endif
 #include "nsIDownloader.h"
 #include "nsIURI.h"
 #include "nsIWidget.h"
 
 #include "mozilla/Attributes.h"
 
 class nsWindow;
 class nsWindowBase;
 struct KeyPair;
+struct nsIntRect;
 
 namespace mozilla {
 namespace widget {
 
 // More complete QS definitions for MsgWaitForMultipleObjects() and
 // GetQueueStatus() that include newer win8 specific defines.
 
 #ifndef QS_RAWINPUT
--- a/widget/windows/nsWindow.h
+++ b/widget/windows/nsWindow.h
@@ -20,16 +20,17 @@
 #include "nsTArray.h"
 #include "nsEvent.h"
 #include "gfxWindowsSurface.h"
 #include "nsWindowDbg.h"
 #include "cairo.h"
 #include "nsITimer.h"
 #include "nsRegion.h"
 #include "mozilla/TimeStamp.h"
+#include "nsMargin.h"
 
 #ifdef CAIRO_HAS_D2D_SURFACE
 #include "gfxD2DSurface.h"
 #endif
 
 #include "nsWinGesture.h"
 
 #include "WindowHook.h"
--- a/widget/windows/winrt/MetroUtils.cpp
+++ b/widget/windows/winrt/MetroUtils.cpp
@@ -16,16 +16,17 @@
 #include "nsIWebNavigation.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIDOMWindow.h"
 #include "nsIDOMChromeWindow.h"
 #include "nsIWindowMediator.h"
 #include "nsIURI.h"
 #include "prlog.h"
 #include "nsIObserverService.h"
+#include "nsRect.h"
 
 #include <wrl/wrappers/corewrappers.h>
 #include <windows.ui.applicationsettings.h>
 #include <windows.graphics.display.h>
 
 using namespace ABI::Windows::UI::ApplicationSettings;
 
 using namespace mozilla;
--- a/widget/windows/winrt/MetroUtils.h
+++ b/widget/windows/winrt/MetroUtils.h
@@ -4,17 +4,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #pragma once
 
 #include "nsDebug.h"
 #include "nsThreadUtils.h"
 #include "nsString.h"
 #include "nsPoint.h"
-#include "nsRect.h"
 
 #include "mozwrlbase.h"
 
 #include <stdio.h>
 #include <windows.foundation.h>
 #include <windows.ui.viewmanagement.h>
 
 void Log(const char *fmt, ...);
@@ -44,16 +43,17 @@ void LogW(const wchar_t *fmt, ...);
   }
 
 // MS Point helpers
 #define POINT_CEIL_X(position) (uint32_t)ceil(position.X)
 #define POINT_CEIL_Y(position) (uint32_t)ceil(position.Y)
 
 class nsIBrowserDOMWindow;
 class nsIDOMWindow;
+struct nsIntRect;
 
 namespace mozilla {
 namespace widget {
 namespace winrt {
 
 template<unsigned int size, typename T>
 HRESULT ActivateGenericInstance(wchar_t const (&RuntimeClassName)[size], Microsoft::WRL::ComPtr<T>& aOutObject) {
   Microsoft::WRL::ComPtr<IActivationFactory> factory;