Bug 1320014 Part 8 - Move NS_FOR_CSS_HALF_CORNERS to Types.h and rewrite it. r=mats

MozReview-Commit-ID: 5UkZUSe5stP

--HG--
extra : rebase_source : e8c33473a39088d9bd807920630500b31ac6228f
This commit is contained in:
Ting-Yu Lin 2017-01-05 12:03:23 +08:00
parent 797609894a
commit df030594f6
2 changed files with 16 additions and 2 deletions

View File

@ -453,6 +453,22 @@ enum HalfCorner {
eCornerBottomLeftY = 7
};
// Creates a for loop that walks over the eight mozilla::HalfCorner values.
// This implementation uses the same technique as NS_FOR_CSS_SIDES.
#define NS_FOR_CSS_HALF_CORNERS(var_) \
int32_t MOZ_CONCAT(var_,__LINE__) = mozilla::eCornerTopLeftX; \
for (mozilla::HalfCorner var_; \
MOZ_CONCAT(var_,__LINE__) <= mozilla::eCornerBottomLeftY && \
(var_ = mozilla::HalfCorner(MOZ_CONCAT(var_,__LINE__)), true); \
++MOZ_CONCAT(var_,__LINE__))
static inline HalfCorner operator++(HalfCorner& aHalfCorner) {
MOZ_ASSERT(aHalfCorner >= eCornerTopLeftX && aHalfCorner <= eCornerBottomLeftY,
"Out of range half corner!");
aHalfCorner = HalfCorner(aHalfCorner + 1);
return aHalfCorner;
}
} // namespace mozilla
#endif /* MOZILLA_GFX_TYPES_H_ */

View File

@ -16,8 +16,6 @@
namespace mozilla {
#define NS_FOR_CSS_HALF_CORNERS(var_) for (int32_t var_ = 0; var_ < 8; ++var_)
// The results of these conversion macros are exhaustively checked in
// nsStyleCoord.cpp.
// Arguments must not have side effects.