Bug 1220923 - Make nsIntRegion a typedef for IntRegionTyped<UnknownUnits>. r=nical

This commit is contained in:
Botond Ballo 2015-11-04 11:49:49 -05:00
parent 31dad746c2
commit b4f149d49f
20 changed files with 67 additions and 93 deletions

View File

@ -9,8 +9,7 @@
#include "GLDefs.h"
#include "mozilla/gfx/Types.h"
#include "nsPoint.h"
class nsIntRegion;
#include "nsRegionFwd.h"
namespace mozilla {

View File

@ -106,7 +106,6 @@
*/
class nsIWidget;
class nsIntRegion;
namespace mozilla {
namespace gfx {

View File

@ -8,9 +8,8 @@
#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 {

View File

@ -17,8 +17,6 @@
#include "nsPrintfCString.h" // for nsPrintfCString
#include "nsString.h" // for nsAutoCString
class nsIntRegion;
#define BIAS_TIME_MS 1.0
namespace mozilla {

View File

@ -20,10 +20,9 @@
#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;

View File

@ -29,10 +29,9 @@
#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;

View File

@ -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 */

View File

@ -32,6 +32,7 @@ EXPORTS += [
'nsPoint.h',
'nsRect.h',
'nsRegion.h',
'nsRegionFwd.h',
'nsRenderingContext.h',
'nsSize.h',
'nsThemeConstants.h',
@ -42,10 +43,6 @@ EXPORTS.mozilla += [
'AppUnits.h',
]
EXPORTS.mozilla.gfx += [
'RegionTyped.h',
]
if CONFIG['MOZ_X11']:
EXPORTS.mozilla += ['X11Util.h']
SOURCES += [

View File

@ -7,7 +7,7 @@
#include "nsISupports.idl"
%{C++
class nsIntRegion;
#include "nsRegionFwd.h"
%}
native nsIntRegion(nsIntRegion);

View File

@ -15,11 +15,11 @@
#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;
@ -821,30 +821,42 @@ private:
}
};
} // 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);
}
nsIntRegion& operator=(nsIntRegion&& aRegion)
IntRegionTyped& operator=(IntRegionTyped&& aRegion)
{
return BaseIntRegion::operator=(mozilla::Move(aRegion));
return Super::operator=(mozilla::Move(aRegion));
}
static IntRegionTyped FromUntyped(const IntRegionTyped<UnknownUnits>& 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

26
gfx/src/nsRegionFwd.h Normal file
View File

@ -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

View File

@ -13,13 +13,13 @@
#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 {

View File

@ -10,11 +10,11 @@
#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 "nsRect.h"
#include "nsMargin.h"
#include "nsRect.h"
#include "nsRegion.h"
#include "mozilla/AppUnits.h"
#include "mozilla/TypeTraits.h"

View File

@ -36,6 +36,7 @@
#include "nsCompatibility.h"
#include "nsFrameManagerBase.h"
#include "nsRect.h"
#include "nsRegionFwd.h"
#include "mozFlushType.h"
#include "nsWeakReference.h"
#include <stdio.h> // for FILE definition
@ -69,7 +70,6 @@ class nsFrameManager;
class nsILayoutHistoryState;
class nsIReflowCallback;
class nsIDOMNode;
class nsIntRegion;
class nsIStyleSheet;
class nsCSSFrameConstructor;
class nsISelection;

View File

@ -9,13 +9,13 @@
#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;

View File

@ -17,7 +17,6 @@
@class NSColor;
@class NSView;
class nsChildView;
class nsIntRegion;
namespace mozilla {

View File

@ -17,6 +17,7 @@
#include "nsTArray.h"
#include "nsITheme.h"
#include "nsITimer.h"
#include "nsRegionFwd.h"
#include "nsXULAppAPI.h"
#include "mozilla/Maybe.h"
#include "mozilla/EventForwards.h"
@ -36,7 +37,6 @@ class nsIRollupListener;
class imgIContainer;
class nsIContent;
class ViewWrapper;
class nsIntRegion;
class nsIScreen;
class nsIRunnable;

View File

@ -10,8 +10,9 @@
#include "mozilla/EventForwards.h"
#include "mozilla/TimeStamp.h"
#include "nsRegionFwd.h"
class nsView;
class nsIntRegion;
class nsIPresShell;
class nsIWidget;
class nsIXULWindow;

View File

@ -28,6 +28,7 @@
#include "mozilla/MouseEvents.h"
#include "mozilla/TimeStamp.h"
#include "nsMargin.h"
#include "nsRegionFwd.h"
#include "nsWinGesture.h"
@ -49,7 +50,6 @@
class nsNativeDragTarget;
class nsIRollupListener;
class nsIntRegion;
class imgIContainer;
namespace mozilla {

View File

@ -27,6 +27,7 @@
#include "nsQuickSort.h"
#include "nsDebug.h"
#include "nsISupportsImpl.h"
#include "nsRegionFwd.h"
#include <new>
namespace JS {
@ -35,7 +36,6 @@ class Heap;
} /* namespace JS */
class nsRegion;
class nsIntRegion;
namespace mozilla {
namespace layers {
struct TileClient;