mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-08 00:38:39 +09:00
Issue #1925 - Convert NS_HALF_CORNER_IS_X to a constexpr function.
This commit is contained in:
parent
1730199755
commit
f507d2cdbc
4 changed files with 12 additions and 7 deletions
|
|
@ -459,6 +459,11 @@ static inline mozilla::HalfCorner operator++(mozilla::HalfCorner& aHalfCorner) {
|
|||
return aHalfCorner;
|
||||
}
|
||||
|
||||
constexpr bool HalfCornerIsX(HalfCorner aHalfCorner)
|
||||
{
|
||||
return !(aHalfCorner % 2);
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* MOZILLA_GFX_TYPES_H_ */
|
||||
|
|
|
|||
|
|
@ -1237,7 +1237,7 @@ nsIFrame::ComputeBorderRadii(const nsStyleCorners& aBorderRadius,
|
|||
NS_FOR_CSS_HALF_CORNERS(i) {
|
||||
const nsStyleCoord c = aBorderRadius.Get(i);
|
||||
nscoord axis =
|
||||
NS_HALF_CORNER_IS_X(i) ? aFrameSize.width : aFrameSize.height;
|
||||
HalfCornerIsX(i) ? aFrameSize.width : aFrameSize.height;
|
||||
|
||||
if (c.IsCoordPercentCalcUnit()) {
|
||||
aRadii[i] = nsRuleNode::ComputeCoordPercentCalc(c, axis);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ namespace mozilla {
|
|||
// nsStyleCoord.cpp.
|
||||
// Arguments must not have side effects.
|
||||
|
||||
#define NS_HALF_CORNER_IS_X(var_) (!((var_)%2))
|
||||
#define NS_HALF_TO_FULL_CORNER(var_) ((var_)/2)
|
||||
#define NS_FULL_TO_HALF_CORNER(var_, vert_) ((var_)*2 + !!(vert_))
|
||||
|
||||
|
|
|
|||
|
|
@ -328,9 +328,9 @@ void nsStyleCorners::Reset()
|
|||
}
|
||||
}
|
||||
|
||||
// Validation of NS_SIDE_IS_VERTICAL and NS_HALF_CORNER_IS_X.
|
||||
// Validation of NS_SIDE_IS_VERTICAL.
|
||||
#define CASE(side, result) \
|
||||
static_assert(NS_SIDE_IS_VERTICAL(side) == result, \
|
||||
static_assert(NS_SIDE_IS_VERTICAL(side) == result, \
|
||||
"NS_SIDE_IS_VERTICAL is wrong")
|
||||
CASE(eSideTop, false);
|
||||
CASE(eSideRight, true);
|
||||
|
|
@ -338,9 +338,10 @@ CASE(eSideBottom, false);
|
|||
CASE(eSideLeft, true);
|
||||
#undef CASE
|
||||
|
||||
// Validation of HalfCornerIsX.
|
||||
#define CASE(corner, result) \
|
||||
static_assert(NS_HALF_CORNER_IS_X(corner) == result, \
|
||||
"NS_HALF_CORNER_IS_X is wrong")
|
||||
static_assert(HalfCornerIsX(corner) == result, \
|
||||
"HalfCornerIsX is wrong")
|
||||
CASE(eCornerTopLeftX, true);
|
||||
CASE(eCornerTopLeftY, false);
|
||||
CASE(eCornerTopRightX, true);
|
||||
|
|
@ -353,7 +354,7 @@ CASE(eCornerBottomLeftY, false);
|
|||
|
||||
// Validation of NS_HALF_TO_FULL_CORNER.
|
||||
#define CASE(corner, result) \
|
||||
static_assert(NS_HALF_TO_FULL_CORNER(corner) == result, \
|
||||
static_assert(NS_HALF_TO_FULL_CORNER(corner) == result, \
|
||||
"NS_HALF_TO_FULL_CORNER is wrong")
|
||||
CASE(eCornerTopLeftX, eCornerTopLeft);
|
||||
CASE(eCornerTopLeftY, eCornerTopLeft);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue