mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-24 16:17:29 +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;
|
return aHalfCorner;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constexpr bool HalfCornerIsX(HalfCorner aHalfCorner)
|
||||||
|
{
|
||||||
|
return !(aHalfCorner % 2);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace mozilla
|
} // namespace mozilla
|
||||||
|
|
||||||
#endif /* MOZILLA_GFX_TYPES_H_ */
|
#endif /* MOZILLA_GFX_TYPES_H_ */
|
||||||
|
|
|
||||||
|
|
@ -1237,7 +1237,7 @@ nsIFrame::ComputeBorderRadii(const nsStyleCorners& aBorderRadius,
|
||||||
NS_FOR_CSS_HALF_CORNERS(i) {
|
NS_FOR_CSS_HALF_CORNERS(i) {
|
||||||
const nsStyleCoord c = aBorderRadius.Get(i);
|
const nsStyleCoord c = aBorderRadius.Get(i);
|
||||||
nscoord axis =
|
nscoord axis =
|
||||||
NS_HALF_CORNER_IS_X(i) ? aFrameSize.width : aFrameSize.height;
|
HalfCornerIsX(i) ? aFrameSize.width : aFrameSize.height;
|
||||||
|
|
||||||
if (c.IsCoordPercentCalcUnit()) {
|
if (c.IsCoordPercentCalcUnit()) {
|
||||||
aRadii[i] = nsRuleNode::ComputeCoordPercentCalc(c, axis);
|
aRadii[i] = nsRuleNode::ComputeCoordPercentCalc(c, axis);
|
||||||
|
|
|
||||||
|
|
@ -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_CORNER_IS_X(var_) (!((var_)%2))
|
|
||||||
#define NS_HALF_TO_FULL_CORNER(var_) ((var_)/2)
|
#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_))
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -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) \
|
#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")
|
"NS_SIDE_IS_VERTICAL is wrong")
|
||||||
CASE(eSideTop, false);
|
CASE(eSideTop, false);
|
||||||
CASE(eSideRight, true);
|
CASE(eSideRight, true);
|
||||||
|
|
@ -338,9 +338,10 @@ CASE(eSideBottom, false);
|
||||||
CASE(eSideLeft, true);
|
CASE(eSideLeft, true);
|
||||||
#undef CASE
|
#undef CASE
|
||||||
|
|
||||||
|
// Validation of HalfCornerIsX.
|
||||||
#define CASE(corner, result) \
|
#define CASE(corner, result) \
|
||||||
static_assert(NS_HALF_CORNER_IS_X(corner) == result, \
|
static_assert(HalfCornerIsX(corner) == result, \
|
||||||
"NS_HALF_CORNER_IS_X is wrong")
|
"HalfCornerIsX is wrong")
|
||||||
CASE(eCornerTopLeftX, true);
|
CASE(eCornerTopLeftX, true);
|
||||||
CASE(eCornerTopLeftY, false);
|
CASE(eCornerTopLeftY, false);
|
||||||
CASE(eCornerTopRightX, true);
|
CASE(eCornerTopRightX, true);
|
||||||
|
|
@ -353,7 +354,7 @@ CASE(eCornerBottomLeftY, false);
|
||||||
|
|
||||||
// Validation of NS_HALF_TO_FULL_CORNER.
|
// Validation of NS_HALF_TO_FULL_CORNER.
|
||||||
#define CASE(corner, result) \
|
#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")
|
"NS_HALF_TO_FULL_CORNER is wrong")
|
||||||
CASE(eCornerTopLeftX, eCornerTopLeft);
|
CASE(eCornerTopLeftX, eCornerTopLeft);
|
||||||
CASE(eCornerTopLeftY, eCornerTopLeft);
|
CASE(eCornerTopLeftY, eCornerTopLeft);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue