Issue #1925 - Remove mozilla::css::Side typedef.

This commit is contained in:
Moonchild 2024-08-01 16:46:27 +02:00 committed by roytam1
commit e6e2796541
18 changed files with 108 additions and 112 deletions

View file

@ -394,25 +394,21 @@ enum SideBits {
#define NS_SIDE_BOTTOM mozilla::eSideBottom
#define NS_SIDE_LEFT mozilla::eSideLeft
namespace css {
typedef mozilla::Side Side;
} // namespace css
// Creates a for loop that walks over the four mozilla::css::Side values.
// Creates a for loop that walks over the four mozilla::Side values.
// We use an int32_t helper variable (instead of a Side) for our loop counter,
// to avoid triggering undefined behavior just before we exit the loop (at
// which point the counter is incremented beyond the largest valid Side value).
#define NS_FOR_CSS_SIDES(var_) \
int32_t MOZ_CONCAT(var_,__LINE__) = NS_SIDE_TOP; \
for (mozilla::css::Side var_; \
for (mozilla::Side var_; \
MOZ_CONCAT(var_,__LINE__) <= NS_SIDE_LEFT && \
((var_ = mozilla::css::Side(MOZ_CONCAT(var_,__LINE__))), true); \
((var_ = mozilla::Side(MOZ_CONCAT(var_,__LINE__))), true); \
MOZ_CONCAT(var_,__LINE__)++)
static inline css::Side operator++(css::Side& side, int) {
static inline Side operator++(Side& side, int) {
NS_PRECONDITION(side >= NS_SIDE_TOP &&
side <= NS_SIDE_LEFT, "Out of range side");
side = css::Side(side + 1);
side = Side(side + 1);
return side;
}