Bug 1220923 - Make nsIntRegion a typedef for IntRegionTyped<UnknownUnits>. r=nical
authorBotond Ballo <botond@mozilla.com>
Wed, 04 Nov 2015 11:49:49 -0500
changeset 305601 cbb8ebcecadc06a43d56e65851acdd65e789ad5f
parent 305600 6011756702d34de3872314fbcb4b7c85f53b0d1b
child 305602 e1d1d11909a4feceb354c9ba8fdbbdb840aeaf73
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnical
bugs1220923
milestone45.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 1220923 - Make nsIntRegion a typedef for IntRegionTyped<UnknownUnits>. r=nical
gfx/gl/GLUploadHelpers.h
gfx/layers/Compositor.h
gfx/layers/ReadbackProcessor.h
gfx/layers/composite/ImageHost.cpp
gfx/layers/composite/ImageHost.h
gfx/layers/opengl/TextureHostOGL.h
gfx/src/RegionTyped.h
gfx/src/moz.build
gfx/src/nsIScriptableRegion.idl
gfx/src/nsRegion.h
gfx/src/nsRegionFwd.h
gfx/thebes/gfxUtils.h
layout/base/Units.h
layout/base/nsIPresShell.h
layout/svg/nsSVGIntegrationUtils.h
widget/cocoa/VibrancyManager.h
widget/nsIWidget.h
widget/nsIWidgetListener.h
widget/windows/nsWindow.h
xpcom/glue/nsTArray.h
--- a/gfx/gl/GLUploadHelpers.h
+++ b/gfx/gl/GLUploadHelpers.h
@@ -4,18 +4,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef GLUploadHelpers_h_
 #define GLUploadHelpers_h_
 
 #include "GLDefs.h"
 #include "mozilla/gfx/Types.h"
 #include "nsPoint.h"
-
-class nsIntRegion;
+#include "nsRegionFwd.h"
 
 namespace mozilla {
 
 namespace gfx {
 class DataSourceSurface;
 } // namespace gfx
 
 namespace gl {
--- a/gfx/layers/Compositor.h
+++ b/gfx/layers/Compositor.h
@@ -101,17 +101,16 @@
  * interfaces:
  * - Compositor (ex. CompositorOGL)
  * - TextureHost (ex. SurfaceTextureHost)
  * Depending on the type of data that needs to be serialized, you may need to
  * add specific TextureClient implementations.
  */
 
 class nsIWidget;
-class nsIntRegion;
 
 namespace mozilla {
 namespace gfx {
 class Matrix;
 class Matrix4x4;
 class DrawTarget;
 } // namespace gfx
 
--- a/gfx/layers/ReadbackProcessor.h
+++ b/gfx/layers/ReadbackProcessor.h
@@ -3,19 +3,18 @@
  * 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_READBACKPROCESSOR_H
 #define GFX_READBACKPROCESSOR_H
 
 #include <stdint.h>                     // for uint64_t
 #include "nsRect.h"                     // for mozilla::gfx::IntRect
+#include "nsRegionFwd.h"                // for nsIntRegion
 #include "nsTArray.h"                   // for nsTArray
- 
-class nsIntRegion;
 
 namespace mozilla {
 namespace layers {
 
 class ContainerLayer;
 class ReadbackLayer;
 class PaintedLayer;
 
--- a/gfx/layers/composite/ImageHost.cpp
+++ b/gfx/layers/composite/ImageHost.cpp
@@ -12,18 +12,16 @@
 #include "mozilla/layers/Effects.h"     // for TexturedEffect, Effect, etc
 #include "mozilla/layers/ImageContainerParent.h"
 #include "mozilla/layers/LayerManagerComposite.h"     // for TexturedEffect, Effect, etc
 #include "nsAString.h"
 #include "nsDebug.h"                    // for NS_WARNING, NS_ASSERTION
 #include "nsPrintfCString.h"            // for nsPrintfCString
 #include "nsString.h"                   // for nsAutoCString
 
-class nsIntRegion;
-
 #define BIAS_TIME_MS 1.0
 
 namespace mozilla {
 namespace gfx {
 class Matrix4x4;
 } // namespace gfx
 
 using namespace gfx;
--- a/gfx/layers/composite/ImageHost.h
+++ b/gfx/layers/composite/ImageHost.h
@@ -15,20 +15,19 @@
 #include "mozilla/gfx/Types.h"          // for Filter
 #include "mozilla/layers/CompositorTypes.h"  // for TextureInfo, etc
 #include "mozilla/layers/LayersSurfaces.h"  // for SurfaceDescriptor
 #include "mozilla/layers/LayersTypes.h"  // for LayerRenderState, etc
 #include "mozilla/layers/TextureHost.h"  // for TextureHost, etc
 #include "mozilla/mozalloc.h"           // for operator delete
 #include "nsCOMPtr.h"                   // for already_AddRefed
 #include "nsRect.h"                     // for mozilla::gfx::IntRect
+#include "nsRegionFwd.h"                // for nsIntRegion
 #include "nscore.h"                     // for nsACString
 
-class nsIntRegion;
-
 namespace mozilla {
 namespace gfx {
 class Matrix4x4;
 } // namespace gfx
 namespace layers {
 
 class Compositor;
 struct EffectChain;
--- a/gfx/layers/opengl/TextureHostOGL.h
+++ b/gfx/layers/opengl/TextureHostOGL.h
@@ -24,20 +24,19 @@
 #include "mozilla/layers/CompositorTypes.h"  // for TextureFlags
 #include "mozilla/layers/LayersSurfaces.h"  // for SurfaceDescriptor
 #include "mozilla/layers/TextureHost.h"  // for TextureHost, 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 "nsRegionFwd.h"                // for nsIntRegion
 #include "OGLShaderProgram.h"           // for ShaderProgramType, etc
 
-class nsIntRegion;
-
 namespace mozilla {
 namespace gfx {
 class DataSourceSurface;
 } // namespace gfx
 
 namespace gl {
 class AndroidSurfaceTexture;
 } // namespace gl
deleted file mode 100644
--- a/gfx/src/RegionTyped.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C++; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* 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_RegionTyped_h
-#define mozilla_RegionTyped_h
-
-#include "nsRegion.h"
-#include "mozilla/gfx/Rect.h"
-
-namespace mozilla {
-
-namespace gfx {
-
-template <class units>
-class IntRegionTyped :
-    public BaseIntRegion<IntRegionTyped<units>, IntRectTyped<units>, IntPointTyped<units>, IntMarginTyped<units>>
-{
-  typedef BaseIntRegion<IntRegionTyped<units>, IntRectTyped<units>, IntPointTyped<units>, IntMarginTyped<units>> Super;
-public:
-  // Forward constructors.
-  IntRegionTyped() {}
-  MOZ_IMPLICIT IntRegionTyped(const IntRectTyped<units>& aRect) : Super(aRect) {}
-  IntRegionTyped(const IntRegionTyped& aRegion) : Super(aRegion) {}
-  IntRegionTyped(IntRegionTyped&& aRegion) : Super(mozilla::Move(aRegion)) {}
-
-  // Assignment operators need to be forwarded as well, otherwise the compiler
-  // will declare deleted ones.
-  IntRegionTyped& operator=(const IntRegionTyped& aRegion)
-  {
-    return Super::operator=(aRegion);
-  }
-  IntRegionTyped& operator=(IntRegionTyped&& aRegion)
-  {
-    return Super::operator=(mozilla::Move(aRegion));
-  }
-
-  static IntRegionTyped FromUntyped(const nsIntRegion& aRegion)
-  {
-    return IntRegionTyped(aRegion.Impl());
-  }
-private:
-  // This is deliberately private, so calling code uses FromUntyped().
-  explicit IntRegionTyped(const nsRegion& aRegion) : Super(aRegion) {}
-};
-
-} // namespace gfx
-
-} // namespace mozilla
-
-
-
-#endif /* mozilla_RegionTyped_h */
--- a/gfx/src/moz.build
+++ b/gfx/src/moz.build
@@ -27,30 +27,27 @@ EXPORTS += [
     'nsFont.h',
     'nsFontMetrics.h',
     'nsGfxCIID.h',
     'nsITheme.h',
     'nsMargin.h',
     'nsPoint.h',
     'nsRect.h',
     'nsRegion.h',
+    'nsRegionFwd.h',
     'nsRenderingContext.h',
     'nsSize.h',
     'nsThemeConstants.h',
     'nsTransform2D.h',
 ]
 
 EXPORTS.mozilla += [
     'AppUnits.h',
 ]
 
-EXPORTS.mozilla.gfx += [
-    'RegionTyped.h',
-]
-
 if CONFIG['MOZ_X11']:
     EXPORTS.mozilla += ['X11Util.h']
     SOURCES += [
         'X11Util.cpp',
     ]
 
 UNIFIED_SOURCES += [
     'DriverCrashGuard.cpp',
--- a/gfx/src/nsIScriptableRegion.idl
+++ b/gfx/src/nsIScriptableRegion.idl
@@ -2,17 +2,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/. */
 
 #include "nsISupports.idl"
 
 %{C++
-class nsIntRegion;
+#include "nsRegionFwd.h"
 %}
 
 native nsIntRegion(nsIntRegion);
 
 
 [scriptable, uuid(a5f44cc7-2820-489b-b817-ae8a08506ff6)]
 interface nsIScriptableRegion : nsISupports
 {
--- a/gfx/src/nsRegion.h
+++ b/gfx/src/nsRegion.h
@@ -10,21 +10,21 @@
 #include <stdint.h>                     // for uint32_t, uint64_t
 #include <sys/types.h>                  // for int32_t
 #include "mozilla/ToString.h"           // for mozilla::ToString
 #include "nsCoord.h"                    // for nscoord
 #include "nsError.h"                    // for nsresult
 #include "nsPoint.h"                    // for nsIntPoint, nsPoint
 #include "nsRect.h"                     // for mozilla::gfx::IntRect, nsRect
 #include "nsMargin.h"                   // for nsIntMargin
+#include "nsRegionFwd.h"                // for nsIntRegion
 #include "nsStringGlue.h"               // for nsCString
 #include "xpcom-config.h"               // for CPP_THROW_NEW
 #include "mozilla/Move.h"               // for mozilla::Move
 
-class nsIntRegion;
 namespace mozilla {
 namespace gfx {
 class Matrix4x4;
 } // namespace gfx
 } // namespace mozilla
 
 #include "pixman.h"
 
@@ -816,35 +816,47 @@ private:
     return *static_cast<Derived*>(this);
   }
   const Derived& This() const
   {
     return *static_cast<const Derived*>(this);
   }
 };
 
-} // namespace gfx
-} // namespace mozilla
-
-class nsIntRegion : public mozilla::gfx::BaseIntRegion<nsIntRegion, mozilla::gfx::IntRect, nsIntPoint, nsIntMargin>
+template <class units>
+class IntRegionTyped :
+    public BaseIntRegion<IntRegionTyped<units>, IntRectTyped<units>, IntPointTyped<units>, IntMarginTyped<units>>
 {
+  typedef BaseIntRegion<IntRegionTyped<units>, IntRectTyped<units>, IntPointTyped<units>, IntMarginTyped<units>> Super;
 public:
   // Forward constructors.
-  nsIntRegion() {}
-  MOZ_IMPLICIT nsIntRegion(const mozilla::gfx::IntRect& aRect) : BaseIntRegion(aRect) {}
-  nsIntRegion(const nsIntRegion& aRegion) : BaseIntRegion(aRegion) {}
-  nsIntRegion(nsIntRegion&& aRegion) : BaseIntRegion(mozilla::Move(aRegion)) {}
+  IntRegionTyped() {}
+  MOZ_IMPLICIT IntRegionTyped(const IntRectTyped<units>& aRect) : Super(aRect) {}
+  IntRegionTyped(const IntRegionTyped& aRegion) : Super(aRegion) {}
+  IntRegionTyped(IntRegionTyped&& aRegion) : Super(mozilla::Move(aRegion)) {}
 
   // Assignment operators need to be forwarded as well, otherwise the compiler
   // will declare deleted ones.
-  nsIntRegion& operator=(const nsIntRegion& aRegion)
+  IntRegionTyped& operator=(const IntRegionTyped& aRegion)
   {
-    return BaseIntRegion::operator=(aRegion);
+    return Super::operator=(aRegion);
+  }
+  IntRegionTyped& operator=(IntRegionTyped&& aRegion)
+  {
+    return Super::operator=(mozilla::Move(aRegion));
   }
-  nsIntRegion& operator=(nsIntRegion&& aRegion)
+
+  static IntRegionTyped FromUntyped(const IntRegionTyped<UnknownUnits>& aRegion)
   {
-    return BaseIntRegion::operator=(mozilla::Move(aRegion));
+    return IntRegionTyped(aRegion.Impl());
   }
+private:
+  // This is deliberately private, so calling code uses FromUntyped().
+  explicit IntRegionTyped(const nsRegion& aRegion) : Super(aRegion) {}
 };
 
+} // namespace gfx
+} // namespace mozilla
+
+typedef mozilla::gfx::IntRegion nsIntRegion;
 typedef nsIntRegion::RectIterator nsIntRegionRectIterator;
 
 #endif
new file mode 100644
--- /dev/null
+++ b/gfx/src/nsRegionFwd.h
@@ -0,0 +1,26 @@
+/* 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 nsRegionFwd_h__
+#define nsRegionFwd_h__
+
+// Forward declare enough things to define the typedef |nsIntRegion|.
+
+namespace mozilla {
+namespace gfx {
+
+struct UnknownUnits;
+
+template <class units>
+class IntRegionTyped;
+
+typedef IntRegionTyped<UnknownUnits> IntRegion;
+
+} // namespace gfx
+} // namespace mozilla
+
+typedef mozilla::gfx::IntRegion nsIntRegion;
+
+#endif
--- a/gfx/thebes/gfxUtils.h
+++ b/gfx/thebes/gfxUtils.h
@@ -8,23 +8,23 @@
 
 #include "gfxTypes.h"
 #include "imgIContainer.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/UniquePtr.h"
 #include "nsColor.h"
 #include "nsPrintfCString.h"
+#include "nsRegionFwd.h"
 #include "mozilla/gfx/Rect.h"
 
 class gfxASurface;
 class gfxDrawable;
 class nsIInputStream;
 class nsIGfxInfo;
-class nsIntRegion;
 class nsIPresShell;
 
 namespace mozilla {
 namespace layers {
 struct PlanarYCbCrData;
 } // namespace layers
 namespace image {
 class ImageRegion;
--- a/layout/base/Units.h
+++ b/layout/base/Units.h
@@ -5,21 +5,21 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef MOZ_UNITS_H_
 #define MOZ_UNITS_H_
 
 #include "mozilla/gfx/Coord.h"
 #include "mozilla/gfx/Point.h"
 #include "mozilla/gfx/Rect.h"
-#include "mozilla/gfx/RegionTyped.h"
 #include "mozilla/gfx/ScaleFactor.h"
 #include "mozilla/gfx/ScaleFactors2D.h"
+#include "nsMargin.h"
 #include "nsRect.h"
-#include "nsMargin.h"
+#include "nsRegion.h"
 #include "mozilla/AppUnits.h"
 #include "mozilla/TypeTraits.h"
 
 namespace mozilla {
 
 template <typename T>
 struct IsPixel : FalseType {};
 
--- a/layout/base/nsIPresShell.h
+++ b/layout/base/nsIPresShell.h
@@ -31,16 +31,17 @@
 #include "nsISupports.h"
 #include "nsIContent.h"
 #include "nsQueryFrame.h"
 #include "nsCoord.h"
 #include "nsColor.h"
 #include "nsCompatibility.h"
 #include "nsFrameManagerBase.h"
 #include "nsRect.h"
+#include "nsRegionFwd.h"
 #include "mozFlushType.h"
 #include "nsWeakReference.h"
 #include <stdio.h> // for FILE definition
 #include "nsChangeHint.h"
 #include "nsRefPtrHashtable.h"
 #include "nsClassHashtable.h"
 #include "nsPresArena.h"
 #include "nsIImageLoadingContent.h"
@@ -64,17 +65,16 @@ class AccessibleCaretEventHub;
 class TouchCaret;
 class SelectionCarets;
 } // namespace mozilla
 class nsFrameSelection;
 class nsFrameManager;
 class nsILayoutHistoryState;
 class nsIReflowCallback;
 class nsIDOMNode;
-class nsIntRegion;
 class nsIStyleSheet;
 class nsCSSFrameConstructor;
 class nsISelection;
 template<class E> class nsCOMArray;
 class nsWeakFrame;
 class nsIScrollableFrame;
 class gfxContext;
 class nsIDOMEvent;
--- a/layout/svg/nsSVGIntegrationUtils.h
+++ b/layout/svg/nsSVGIntegrationUtils.h
@@ -4,23 +4,23 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #ifndef NSSVGINTEGRATIONUTILS_H_
 #define NSSVGINTEGRATIONUTILS_H_
 
 #include "gfxMatrix.h"
 #include "gfxRect.h"
 #include "nsAutoPtr.h"
+#include "nsRegionFwd.h"
 
 class gfxContext;
 class gfxDrawable;
 class nsDisplayList;
 class nsDisplayListBuilder;
 class nsIFrame;
-class nsIntRegion;
 
 struct nsRect;
 
 namespace mozilla {
 namespace gfx {
 class DrawTarget;
 } // namespace gfx
 namespace layers {
--- a/widget/cocoa/VibrancyManager.h
+++ b/widget/cocoa/VibrancyManager.h
@@ -12,17 +12,16 @@
 #include "nsRegion.h"
 #include "nsTArray.h"
 
 #import <Foundation/NSGeometry.h>
 
 @class NSColor;
 @class NSView;
 class nsChildView;
-class nsIntRegion;
 
 namespace mozilla {
 
 enum class VibrancyType {
   LIGHT,
   DARK,
   TOOLTIP,
   MENU,
--- a/widget/nsIWidget.h
+++ b/widget/nsIWidget.h
@@ -12,16 +12,17 @@
 #include "nsStringGlue.h"
 
 #include "nsCOMPtr.h"
 #include "nsAutoPtr.h"
 #include "nsWidgetInitData.h"
 #include "nsTArray.h"
 #include "nsITheme.h"
 #include "nsITimer.h"
+#include "nsRegionFwd.h"
 #include "nsXULAppAPI.h"
 #include "mozilla/Maybe.h"
 #include "mozilla/EventForwards.h"
 #include "mozilla/layers/LayersTypes.h"
 #include "mozilla/RefPtr.h"
 #include "mozilla/TimeStamp.h"
 #include "mozilla/gfx/Point.h"
 #include "mozilla/widget/IMEData.h"
@@ -31,17 +32,16 @@
 #include "FrameMetrics.h"
 #include "Units.h"
 
 // forward declarations
 class   nsIRollupListener;
 class   imgIContainer;
 class   nsIContent;
 class   ViewWrapper;
-class   nsIntRegion;
 class   nsIScreen;
 class   nsIRunnable;
 
 namespace mozilla {
 class CompositorVsyncDispatcher;
 namespace dom {
 class TabChild;
 } // namespace dom
--- a/widget/nsIWidgetListener.h
+++ b/widget/nsIWidgetListener.h
@@ -5,18 +5,19 @@
 #ifndef nsIWidgetListener_h__
 #define nsIWidgetListener_h__
 
 #include <stdint.h>
 
 #include "mozilla/EventForwards.h"
 #include "mozilla/TimeStamp.h"
 
+#include "nsRegionFwd.h"
+
 class nsView;
-class nsIntRegion;
 class nsIPresShell;
 class nsIWidget;
 class nsIXULWindow;
 
 /**
  * sizemode is an adjunct to widget size
  */
 enum nsSizeMode
--- a/widget/windows/nsWindow.h
+++ b/widget/windows/nsWindow.h
@@ -23,16 +23,17 @@
 #include "nsWindowDbg.h"
 #include "cairo.h"
 #include "nsITimer.h"
 #include "nsRegion.h"
 #include "mozilla/EventForwards.h"
 #include "mozilla/MouseEvents.h"
 #include "mozilla/TimeStamp.h"
 #include "nsMargin.h"
+#include "nsRegionFwd.h"
 
 #include "nsWinGesture.h"
 
 #include "WindowHook.h"
 #include "TaskbarWindowPreview.h"
 
 #ifdef ACCESSIBILITY
 #include "oleacc.h"
@@ -44,17 +45,16 @@
 #include "nsIIdleServiceInternal.h"
 
 /**
  * Forward class definitions
  */
 
 class nsNativeDragTarget;
 class nsIRollupListener;
-class nsIntRegion;
 class imgIContainer;
 
 namespace mozilla {
 namespace widget {
 class NativeKey;
 struct MSGResult;
 } // namespace widget
 } // namespacw mozilla;
--- a/xpcom/glue/nsTArray.h
+++ b/xpcom/glue/nsTArray.h
@@ -22,25 +22,25 @@
 #include <string.h>
 
 #include "nsCycleCollectionNoteChild.h"
 #include "nsAlgorithm.h"
 #include "nscore.h"
 #include "nsQuickSort.h"
 #include "nsDebug.h"
 #include "nsISupportsImpl.h"
+#include "nsRegionFwd.h"
 #include <new>
 
 namespace JS {
 template<class T>
 class Heap;
 } /* namespace JS */
 
 class nsRegion;
-class nsIntRegion;
 namespace mozilla {
 namespace layers {
 struct TileClient;
 } // namespace layers
 } // namespace mozilla
 //
 // nsTArray is a resizable array class, like std::vector.
 //