Bug 1320014 Part 1 - Move Corner's definition and NS_FOR_CSS_CORNERS to gfx/2d/Types.h.
The only change is that NS_PRECONDITION is replaced by MOZ_ASSERT to prevent
Types.h depends on nsDebug.h.
MozReview-Commit-ID: FI6LGOedKQ9
--- a/gfx/2d/Types.h
+++ b/gfx/2d/Types.h
@@ -411,11 +411,40 @@ enum SideBits {
static inline Side& operator++(Side& side) {
MOZ_ASSERT(side >= eSideTop && side <= eSideLeft,
"Out of range side");
side = Side(side + 1);
return side;
}
+namespace css {
+enum Corner {
+ // This order is important!
+ eCornerTopLeft = 0,
+ eCornerTopRight = 1,
+ eCornerBottomRight = 2,
+ eCornerBottomLeft = 3,
+ eNumCorners = 4
+};
+} // namespace css
+
+#define NS_CORNER_TOP_LEFT mozilla::css::eCornerTopLeft
+#define NS_CORNER_TOP_RIGHT mozilla::css::eCornerTopRight
+#define NS_CORNER_BOTTOM_RIGHT mozilla::css::eCornerBottomRight
+#define NS_CORNER_BOTTOM_LEFT mozilla::css::eCornerBottomLeft
+#define NS_NUM_CORNERS mozilla::css::eNumCorners
+
+#define NS_FOR_CSS_CORNERS(var_) \
+ for (mozilla::css::Corner var_ = NS_CORNER_TOP_LEFT; \
+ var_ <= NS_CORNER_BOTTOM_LEFT; \
+ var_++)
+
+static inline mozilla::css::Corner operator++(mozilla::css::Corner& corner, int) {
+ MOZ_ASSERT(corner >= NS_CORNER_TOP_LEFT &&
+ corner < NS_NUM_CORNERS, "Out of range corner");
+ corner = mozilla::css::Corner(corner + 1);
+ return corner;
+}
+
} // namespace mozilla
#endif /* MOZILLA_GFX_TYPES_H_ */
--- a/gfx/thebes/gfxRect.h
+++ b/gfx/thebes/gfxRect.h
@@ -22,46 +22,16 @@ struct gfxMargin : public mozilla::gfx::
// Constructors
gfxMargin() : Super() {}
gfxMargin(const gfxMargin& aMargin) : Super(aMargin) {}
gfxMargin(gfxFloat aTop, gfxFloat aRight, gfxFloat aBottom, gfxFloat aLeft)
: Super(aTop, aRight, aBottom, aLeft) {}
};
-namespace mozilla {
- namespace css {
- enum Corner {
- // this order is important!
- eCornerTopLeft = 0,
- eCornerTopRight = 1,
- eCornerBottomRight = 2,
- eCornerBottomLeft = 3,
- eNumCorners = 4
- };
- } // namespace css
-} // namespace mozilla
-#define NS_CORNER_TOP_LEFT mozilla::css::eCornerTopLeft
-#define NS_CORNER_TOP_RIGHT mozilla::css::eCornerTopRight
-#define NS_CORNER_BOTTOM_RIGHT mozilla::css::eCornerBottomRight
-#define NS_CORNER_BOTTOM_LEFT mozilla::css::eCornerBottomLeft
-#define NS_NUM_CORNERS mozilla::css::eNumCorners
-
-#define NS_FOR_CSS_CORNERS(var_) \
- for (mozilla::css::Corner var_ = NS_CORNER_TOP_LEFT; \
- var_ <= NS_CORNER_BOTTOM_LEFT; \
- var_++)
-
-static inline mozilla::css::Corner operator++(mozilla::css::Corner& corner, int) {
- NS_PRECONDITION(corner >= NS_CORNER_TOP_LEFT &&
- corner < NS_NUM_CORNERS, "Out of range corner");
- corner = mozilla::css::Corner(corner + 1);
- return corner;
-}
-
struct gfxRect :
public mozilla::gfx::BaseRect<gfxFloat, gfxRect, gfxPoint, gfxSize, gfxMargin> {
typedef mozilla::gfx::BaseRect<gfxFloat, gfxRect, gfxPoint, gfxSize, gfxMargin> Super;
gfxRect() : Super() {}
gfxRect(const gfxPoint& aPos, const gfxSize& aSize) :
Super(aPos, aSize) {}
gfxRect(gfxFloat aX, gfxFloat aY, gfxFloat aWidth, gfxFloat aHeight) :