mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-21 07:47:32 +09:00
Issue #1925 - Remove use of NS_SIDE_* macros.
This commit is contained in:
parent
e6e2796541
commit
ec7351a5d4
30 changed files with 322 additions and 328 deletions
|
|
@ -389,19 +389,19 @@ struct BaseRect {
|
|||
}
|
||||
Point CCWCorner(mozilla::Side side) const {
|
||||
switch (side) {
|
||||
case NS_SIDE_TOP: return TopLeft();
|
||||
case NS_SIDE_RIGHT: return TopRight();
|
||||
case NS_SIDE_BOTTOM: return BottomRight();
|
||||
case NS_SIDE_LEFT: return BottomLeft();
|
||||
case eSideTop: return TopLeft();
|
||||
case eSideRight: return TopRight();
|
||||
case eSideBottom: return BottomRight();
|
||||
case eSideLeft: return BottomLeft();
|
||||
}
|
||||
MOZ_CRASH("GFX: Incomplete switch");
|
||||
}
|
||||
Point CWCorner(mozilla::Side side) const {
|
||||
switch (side) {
|
||||
case NS_SIDE_TOP: return TopRight();
|
||||
case NS_SIDE_RIGHT: return BottomRight();
|
||||
case NS_SIDE_BOTTOM: return BottomLeft();
|
||||
case NS_SIDE_LEFT: return TopLeft();
|
||||
case eSideTop: return TopRight();
|
||||
case eSideRight: return BottomRight();
|
||||
case eSideBottom: return BottomLeft();
|
||||
case eSideLeft: return TopLeft();
|
||||
}
|
||||
MOZ_CRASH("GFX: Incomplete switch");
|
||||
}
|
||||
|
|
@ -422,10 +422,10 @@ struct BaseRect {
|
|||
T Edge(mozilla::Side aSide) const
|
||||
{
|
||||
switch (aSide) {
|
||||
case NS_SIDE_TOP: return Y();
|
||||
case NS_SIDE_RIGHT: return XMost();
|
||||
case NS_SIDE_BOTTOM: return YMost();
|
||||
case NS_SIDE_LEFT: return X();
|
||||
case eSideTop: return Y();
|
||||
case eSideRight: return XMost();
|
||||
case eSideBottom: return YMost();
|
||||
case eSideLeft: return X();
|
||||
}
|
||||
MOZ_CRASH("GFX: Incomplete switch");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@
|
|||
|
||||
#include "mozilla/EndianUtils.h"
|
||||
#include "mozilla/MacroArgs.h" // for MOZ_CONCAT
|
||||
#include "nsDebug.h"
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
|
@ -389,27 +388,22 @@ enum SideBits {
|
|||
eSideBitsAll = eSideBitsTopBottom | eSideBitsLeftRight
|
||||
};
|
||||
|
||||
#define NS_SIDE_TOP mozilla::eSideTop
|
||||
#define NS_SIDE_RIGHT mozilla::eSideRight
|
||||
#define NS_SIDE_BOTTOM mozilla::eSideBottom
|
||||
#define NS_SIDE_LEFT mozilla::eSideLeft
|
||||
|
||||
// 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; \
|
||||
#define NS_FOR_CSS_SIDES(var_) \
|
||||
int32_t MOZ_CONCAT(var_,__LINE__) = mozilla::eSideTop; \
|
||||
for (mozilla::Side var_; \
|
||||
MOZ_CONCAT(var_,__LINE__) <= NS_SIDE_LEFT && \
|
||||
MOZ_CONCAT(var_,__LINE__) <= mozilla::eSideLeft && \
|
||||
((var_ = mozilla::Side(MOZ_CONCAT(var_,__LINE__))), true); \
|
||||
MOZ_CONCAT(var_,__LINE__)++)
|
||||
|
||||
static inline Side operator++(Side& side, int) {
|
||||
NS_PRECONDITION(side >= NS_SIDE_TOP &&
|
||||
side <= NS_SIDE_LEFT, "Out of range side");
|
||||
side = Side(side + 1);
|
||||
return side;
|
||||
MOZ_ASSERT(side >= eSideTop && side <= eSideLeft,
|
||||
"Out of range side");
|
||||
side = Side(side + 1);
|
||||
return side;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue