mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-09 17:31:47 +09:00
Issue #1925 - Convert NS_SIDE_IS_VERTICAL to a constexpr function.
This commit is contained in:
parent
8a2bc8ef4d
commit
b0b13b8719
5 changed files with 11 additions and 9 deletions
|
|
@ -474,6 +474,11 @@ constexpr HalfCorner FullToHalfCorner(Corner aCorner, bool aIsVertical)
|
|||
return HalfCorner(aCorner * 2 + aIsVertical);
|
||||
}
|
||||
|
||||
constexpr bool SideIsVertical(Side aSide)
|
||||
{
|
||||
return aSide % 2;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif /* MOZILLA_GFX_TYPES_H_ */
|
||||
|
|
|
|||
|
|
@ -3920,10 +3920,8 @@ DrawBorderImage(nsPresContext* aPresContext,
|
|||
nsMargin border;
|
||||
NS_FOR_CSS_SIDES(s) {
|
||||
nsStyleCoord coord = aStyleBorder.mBorderImageSlice.Get(s);
|
||||
int32_t imgDimension = NS_SIDE_IS_VERTICAL(s)
|
||||
? imageSize.width : imageSize.height;
|
||||
nscoord borderDimension = NS_SIDE_IS_VERTICAL(s)
|
||||
? borderImgArea.width : borderImgArea.height;
|
||||
int32_t imgDimension = SideIsVertical(s) ? imageSize.width : imageSize.height;
|
||||
nscoord borderDimension = SideIsVertical(s) ? borderImgArea.width : borderImgArea.height;
|
||||
double value;
|
||||
switch (coord.GetUnit()) {
|
||||
case eStyleUnit_Percent:
|
||||
|
|
|
|||
|
|
@ -1287,7 +1287,7 @@ nsIFrame::ComputeBorderRadii(const nsStyleCorners& aBorderRadius,
|
|||
uint32_t hc1 = NS_SIDE_TO_HALF_CORNER(side, false, true);
|
||||
uint32_t hc2 = NS_SIDE_TO_HALF_CORNER(side, true, true);
|
||||
nscoord length =
|
||||
NS_SIDE_IS_VERTICAL(side) ? aBorderArea.height : aBorderArea.width;
|
||||
SideIsVertical(side) ? aBorderArea.height : aBorderArea.width;
|
||||
nscoord sum = aRadii[hc1] + aRadii[hc2];
|
||||
if (sum)
|
||||
haveRadius = true;
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@ namespace mozilla {
|
|||
// nsStyleCoord.cpp.
|
||||
// Arguments must not have side effects.
|
||||
|
||||
#define NS_SIDE_IS_VERTICAL(side_) ((side_) % 2)
|
||||
#define NS_SIDE_TO_FULL_CORNER(side_, second_) \
|
||||
(((side_) + !!(second_)) % 4)
|
||||
#define NS_SIDE_TO_HALF_CORNER(side_, second_, parallel_) \
|
||||
|
|
|
|||
|
|
@ -328,10 +328,10 @@ void nsStyleCorners::Reset()
|
|||
}
|
||||
}
|
||||
|
||||
// Validation of NS_SIDE_IS_VERTICAL.
|
||||
// Validation of SideIsVertical.
|
||||
#define CASE(side, result) \
|
||||
static_assert(NS_SIDE_IS_VERTICAL(side) == result, \
|
||||
"NS_SIDE_IS_VERTICAL is wrong")
|
||||
static_assert(SideIsVertical(side) == result, \
|
||||
"SideIsVertical is wrong")
|
||||
CASE(eSideTop, false);
|
||||
CASE(eSideRight, true);
|
||||
CASE(eSideBottom, false);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue