Bug 1320014 Part 1 - Move Corner's definition and NS_FOR_CSS_CORNERS to gfx/2d/Types.h. r=mats

The only change is that NS_PRECONDITION is replaced by MOZ_ASSERT to prevent
Types.h depends on nsDebug.h.

MozReview-Commit-ID: FI6LGOedKQ9

--HG--
extra : rebase_source : c31bdd527635e2abc306ddd5bd249e9ca2e81c0b
This commit is contained in:
Ting-Yu Lin 2017-01-04 16:19:20 +08:00
Родитель d0e4cec2ba
Коммит 8871f2bf54
2 изменённых файлов: 29 добавлений и 30 удалений

Просмотреть файл

@ -416,6 +416,35 @@ static inline Side& operator++(Side& side) {
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_ */

Просмотреть файл

@ -27,36 +27,6 @@ struct gfxMargin : public mozilla::gfx::BaseMargin<gfxFloat, gfxMargin> {
: 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;