mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-27 01:27:30 +09:00
Issue #1925 - Convert NS_HALF_TO_FULL_CORNER to a constexpr function.
This commit is contained in:
parent
f507d2cdbc
commit
31badb0f2e
3 changed files with 8 additions and 4 deletions
|
|
@ -464,6 +464,11 @@ constexpr bool HalfCornerIsX(HalfCorner aHalfCorner)
|
||||||
return !(aHalfCorner % 2);
|
return !(aHalfCorner % 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr Corner HalfToFullCorner(HalfCorner aHalfCorner)
|
||||||
|
{
|
||||||
|
return Corner(aHalfCorner / 2);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
#endif /* MOZILLA_GFX_TYPES_H_ */
|
#endif /* MOZILLA_GFX_TYPES_H_ */
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,6 @@ namespace mozilla {
|
||||||
// nsStyleCoord.cpp.
|
// nsStyleCoord.cpp.
|
||||||
// Arguments must not have side effects.
|
// Arguments must not have side effects.
|
||||||
|
|
||||||
#define NS_HALF_TO_FULL_CORNER(var_) ((var_)/2)
|
|
||||||
#define NS_FULL_TO_HALF_CORNER(var_, vert_) ((var_)*2 + !!(vert_))
|
#define NS_FULL_TO_HALF_CORNER(var_, vert_) ((var_)*2 + !!(vert_))
|
||||||
|
|
||||||
#define NS_SIDE_IS_VERTICAL(side_) ((side_) % 2)
|
#define NS_SIDE_IS_VERTICAL(side_) ((side_) % 2)
|
||||||
|
|
|
||||||
|
|
@ -352,10 +352,10 @@ CASE(eCornerBottomLeftX, true);
|
||||||
CASE(eCornerBottomLeftY, false);
|
CASE(eCornerBottomLeftY, false);
|
||||||
#undef CASE
|
#undef CASE
|
||||||
|
|
||||||
// Validation of NS_HALF_TO_FULL_CORNER.
|
// Validation of HalfToFullCorner.
|
||||||
#define CASE(corner, result) \
|
#define CASE(corner, result) \
|
||||||
static_assert(NS_HALF_TO_FULL_CORNER(corner) == result, \
|
static_assert(HalfToFullCorner(corner) == result, \
|
||||||
"NS_HALF_TO_FULL_CORNER is wrong")
|
"HalfToFullCorner is wrong")
|
||||||
CASE(eCornerTopLeftX, eCornerTopLeft);
|
CASE(eCornerTopLeftX, eCornerTopLeft);
|
||||||
CASE(eCornerTopLeftY, eCornerTopLeft);
|
CASE(eCornerTopLeftY, eCornerTopLeft);
|
||||||
CASE(eCornerTopRightX, eCornerTopRight);
|
CASE(eCornerTopRightX, eCornerTopRight);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue