Issue #1925 - Move Corner enum from mozilla::css to mozilla namespace.

This commit is contained in:
Moonchild 2024-08-01 20:28:28 +02:00 committed by roytam1
commit b3a51c2711
8 changed files with 45 additions and 47 deletions

View file

@ -241,7 +241,7 @@ FindBezierNearestPoint(const Bezier& aBezier, const Point& aTarget,
}
void
GetBezierPointsForCorner(Bezier* aBezier, mozilla::css::Corner aCorner,
GetBezierPointsForCorner(Bezier* aBezier, mozilla::Corner aCorner,
const Point& aCornerPoint, const Size& aCornerSize)
{
// Calculate bezier control points for elliptic arc.

View file

@ -127,7 +127,7 @@ Point FindBezierNearestPoint(const Bezier& aBezier, const Point& aTarget,
// | |
// v mPoints[0] |
// -------------+
void GetBezierPointsForCorner(Bezier* aBezier, mozilla::css::Corner aCorner,
void GetBezierPointsForCorner(Bezier* aBezier, mozilla::Corner aCorner,
const Point& aCornerPoint,
const Size& aCornerSize);

View file

@ -406,7 +406,6 @@ static inline Side& operator++(Side& side) {
return side;
}
namespace css {
enum Corner {
// This order is important!
eCornerTopLeft = 0,
@ -415,23 +414,22 @@ enum Corner {
eCornerBottomLeft = 3,
eNumCorners = 4
};
} // namespace css
#define NS_CORNER_TOP_LEFT mozilla::css::eCornerTopLeft
#define NS_CORNER_TOP_RIGHT mozilla::css::eCornerTopRight
#define NS_CORNER_BOTTOM_RIGHT mozilla::css::eCornerBottomRight
#define NS_CORNER_BOTTOM_LEFT mozilla::css::eCornerBottomLeft
#define NS_NUM_CORNERS mozilla::css::eNumCorners
#define NS_CORNER_TOP_LEFT mozilla::eCornerTopLeft
#define NS_CORNER_TOP_RIGHT mozilla::eCornerTopRight
#define NS_CORNER_BOTTOM_RIGHT mozilla::eCornerBottomRight
#define NS_CORNER_BOTTOM_LEFT mozilla::eCornerBottomLeft
#define NS_NUM_CORNERS mozilla::eNumCorners
#define NS_FOR_CSS_CORNERS(var_) \
for (mozilla::css::Corner var_ = NS_CORNER_TOP_LEFT; \
for (mozilla::Corner var_ = NS_CORNER_TOP_LEFT; \
var_ <= NS_CORNER_BOTTOM_LEFT; \
var_++)
static inline mozilla::css::Corner operator++(mozilla::css::Corner& corner, int) {
static inline mozilla::Corner operator++(mozilla::Corner& corner, int) {
MOZ_ASSERT(corner >= NS_CORNER_TOP_LEFT &&
corner < NS_NUM_CORNERS, "Out of range corner");
corner = mozilla::css::Corner(corner + 1);
corner = mozilla::Corner(corner + 1);
return corner;
}

View file

@ -45,7 +45,7 @@ struct gfxRect :
*/
bool WithinEpsilonOfIntegerPixels(gfxFloat aEpsilon) const;
gfxPoint AtCorner(mozilla::css::Corner corner) const {
gfxPoint AtCorner(mozilla::Corner corner) const {
switch (corner) {
case NS_CORNER_TOP_LEFT: return TopLeft();
case NS_CORNER_TOP_RIGHT: return TopRight();

View file

@ -44,7 +44,7 @@ nsDataHashtable<FourFloatsHashKey, BestOverlap> DottedCornerCache;
DottedCornerFinder::DottedCornerFinder(const Bezier& aOuterBezier,
const Bezier& aInnerBezier,
mozilla::css::Corner aCorner,
mozilla::Corner aCorner,
Float aBorderRadiusX,
Float aBorderRadiusY,
const Point& aC0, Float aR0,

View file

@ -116,7 +116,7 @@ public:
// |<------->|
// aRn
DottedCornerFinder(const Bezier& aOuterBezier, const Bezier& aInnerBezier,
mozilla::css::Corner aCorner,
mozilla::Corner aCorner,
Float aBorderRadiusX, Float aBorderRadiusY,
const Point& aC0, Float aR0, const Point& aCn, Float aRn,
const Size& aCornerDim);
@ -150,7 +150,7 @@ private:
Bezier mInnerBezier;
Bezier mCenterBezier;
mozilla::css::Corner mCorner;
mozilla::Corner mCorner;
// Sign of the normal vector used in radius calculation, flipped depends on
// corner and start and end radii.

View file

@ -67,8 +67,8 @@ static void ComputeBorderCornerDimensions(const Float* aBorderWidths,
#define PREV_SIDE(_s) mozilla::Side(((_s) + 3) & 3)
// given a corner index, get the previous and next corner index
#define NEXT_CORNER(_s) mozilla::css::Corner(((_s) + 1) & 3)
#define PREV_CORNER(_s) mozilla::css::Corner(((_s) + 3) & 3)
#define NEXT_CORNER(_s) mozilla::Corner(((_s) + 1) & 3)
#define PREV_CORNER(_s) mozilla::Corner(((_s) + 3) & 3)
// from the given base color and the background color, turn
// color into a color for the given border pattern style
@ -114,27 +114,27 @@ AllCornersZeroSize(const RectCornerRadii& corners) {
}
static mozilla::Side
GetHorizontalSide(mozilla::css::Corner aCorner)
GetHorizontalSide(mozilla::Corner aCorner)
{
return (aCorner == C_TL || aCorner == C_TR) ? eSideTop : eSideBottom;
}
static mozilla::Side
GetVerticalSide(mozilla::css::Corner aCorner)
GetVerticalSide(mozilla::Corner aCorner)
{
return (aCorner == C_TL || aCorner == C_BL) ? eSideLeft : eSideRight;
}
static mozilla::css::Corner
static mozilla::Corner
GetCWCorner(mozilla::Side aSide)
{
return mozilla::css::Corner(NEXT_SIDE(aSide));
return mozilla::Corner(NEXT_SIDE(aSide));
}
static mozilla::css::Corner
static mozilla::Corner
GetCCWCorner(mozilla::Side aSide)
{
return mozilla::css::Corner(aSide);
return mozilla::Corner(aSide);
}
static bool
@ -332,7 +332,7 @@ nsCSSBorderRenderer::AreBorderSideFinalStylesSame(uint8_t aSides)
}
bool
nsCSSBorderRenderer::IsSolidCornerStyle(uint8_t aStyle, mozilla::css::Corner aCorner)
nsCSSBorderRenderer::IsSolidCornerStyle(uint8_t aStyle, mozilla::Corner aCorner)
{
switch (aStyle) {
case NS_STYLE_BORDER_STYLE_SOLID:
@ -355,7 +355,7 @@ nsCSSBorderRenderer::IsSolidCornerStyle(uint8_t aStyle, mozilla::css::Corner aCo
}
bool
nsCSSBorderRenderer::IsCornerMergeable(mozilla::css::Corner aCorner)
nsCSSBorderRenderer::IsCornerMergeable(mozilla::Corner aCorner)
{
// Corner between dotted borders with same width and small radii is
// merged into single dot.
@ -405,7 +405,7 @@ nsCSSBorderRenderer::IsCornerMergeable(mozilla::css::Corner aCorner)
}
BorderColorStyle
nsCSSBorderRenderer::BorderColorStyleForSolidCorner(uint8_t aStyle, mozilla::css::Corner aCorner)
nsCSSBorderRenderer::BorderColorStyleForSolidCorner(uint8_t aStyle, mozilla::Corner aCorner)
{
// note that this function assumes that the corner is already solid,
// as per the earlier function
@ -435,7 +435,7 @@ nsCSSBorderRenderer::BorderColorStyleForSolidCorner(uint8_t aStyle, mozilla::css
}
Rect
nsCSSBorderRenderer::GetCornerRect(mozilla::css::Corner aCorner)
nsCSSBorderRenderer::GetCornerRect(mozilla::Corner aCorner)
{
Point offset(0.f, 0.f);
@ -674,7 +674,7 @@ nsCSSBorderRenderer::GetSideClipSubPath(mozilla::Side aSide)
Point
nsCSSBorderRenderer::GetStraightBorderPoint(mozilla::Side aSide,
mozilla::css::Corner aCorner,
mozilla::Corner aCorner,
bool* aIsUnfilled,
Float aDotOffset)
@ -1070,7 +1070,7 @@ nsCSSBorderRenderer::GetStraightBorderPoint(mozilla::Side aSide,
void
nsCSSBorderRenderer::GetOuterAndInnerBezier(Bezier* aOuterBezier,
Bezier* aInnerBezier,
mozilla::css::Corner aCorner)
mozilla::Corner aCorner)
{
// Return bezier control points for outer and inner curve for given corner.
//
@ -2308,7 +2308,7 @@ nsCSSBorderRenderer::DrawDottedSideSlow(mozilla::Side aSide)
void
nsCSSBorderRenderer::DrawDashedOrDottedCorner(mozilla::Side aSide,
mozilla::css::Corner aCorner)
mozilla::Corner aCorner)
{
// Draw dashed/dotted corner with following approach.
//
@ -2417,7 +2417,7 @@ nsCSSBorderRenderer::DrawDashedOrDottedCorner(mozilla::Side aSide,
void
nsCSSBorderRenderer::DrawDottedCornerSlow(mozilla::Side aSide,
mozilla::css::Corner aCorner)
mozilla::Corner aCorner)
{
NS_ASSERTION(mBorderStyles[aSide] == NS_STYLE_BORDER_STYLE_DOTTED,
"Style should be dotted.");
@ -2494,7 +2494,7 @@ DashedPathOverlapsRect(Rect& pathRect,
void
nsCSSBorderRenderer::DrawDashedCornerSlow(mozilla::Side aSide,
mozilla::css::Corner aCorner)
mozilla::Corner aCorner)
{
NS_ASSERTION(mBorderStyles[aSide] == NS_STYLE_BORDER_STYLE_DASHED,
"Style should be dashed.");
@ -2610,7 +2610,7 @@ nsCSSBorderRenderer::DrawDashedCornerSlow(mozilla::Side aSide,
void
nsCSSBorderRenderer::DrawFallbackSolidCorner(mozilla::Side aSide,
mozilla::css::Corner aCorner)
mozilla::Corner aCorner)
{
// Render too large dashed or dotted corner with solid style, to avoid hangup
// inside DashedCornerFinder and DottedCornerFinder.
@ -2839,7 +2839,7 @@ ComputeCornerSkirtSize(Float aAlpha1, Float aAlpha2,
// seams when anti-aliased drawing is used.
static void
DrawBorderRadius(DrawTarget* aDrawTarget,
mozilla::css::Corner c,
mozilla::Corner c,
const Point& aOuterCorner, const Point& aInnerCorner,
const twoFloats& aCornerMultPrev, const twoFloats& aCornerMultNext,
const Size& aCornerDims,
@ -3046,8 +3046,8 @@ nsCSSBorderRenderer::DrawNoCompositeColorSolidBorder()
// Thus, the CCW corner of the next side will end up drawn here.
// the corner index -- either 1 2 3 0 (cw) or 0 3 2 1 (ccw)
mozilla::css::Corner c = mozilla::css::Corner((i+1) % 4);
mozilla::css::Corner prevCorner = mozilla::css::Corner(i);
mozilla::Corner c = mozilla::Corner((i+1) % 4);
mozilla::Corner prevCorner = mozilla::Corner(i);
// i+2 and i+3 respectively. These are used to index into the corner
// multiplier table, and were deduced by calculating out the long form

View file

@ -142,20 +142,20 @@ private:
bool AreBorderSideFinalStylesSame(uint8_t aSides);
// For the given style, is the given corner a solid color?
bool IsSolidCornerStyle(uint8_t aStyle, mozilla::css::Corner aCorner);
bool IsSolidCornerStyle(uint8_t aStyle, mozilla::Corner aCorner);
// For the given corner, is the given corner mergeable into one dot?
bool IsCornerMergeable(mozilla::css::Corner aCorner);
bool IsCornerMergeable(mozilla::Corner aCorner);
// For the given solid corner, what color style should be used?
BorderColorStyle BorderColorStyleForSolidCorner(uint8_t aStyle, mozilla::css::Corner aCorner);
BorderColorStyle BorderColorStyleForSolidCorner(uint8_t aStyle, mozilla::Corner aCorner);
//
// Path generation functions
//
// Get the Rect for drawing the given corner
Rect GetCornerRect(mozilla::css::Corner aCorner);
Rect GetCornerRect(mozilla::Corner aCorner);
// add the path for drawing the given side without any adjacent corners to the context
Rect GetSideClipWithoutCornersRect(mozilla::Side aSide);
@ -171,7 +171,7 @@ private:
// Return start or end point for dashed/dotted side
Point GetStraightBorderPoint(mozilla::Side aSide,
mozilla::css::Corner aCorner,
mozilla::Corner aCorner,
bool* aIsUnfilled,
Float aDotOffset = 0.0f);
@ -179,7 +179,7 @@ private:
// corner
void GetOuterAndInnerBezier(Bezier* aOuterBezier,
Bezier* aInnerBezier,
mozilla::css::Corner aCorner);
mozilla::Corner aCorner);
// Given a set of sides to fill and a color, do so in the fastest way.
//
@ -224,19 +224,19 @@ private:
// Draw the given dashed/dotted corner
void DrawDashedOrDottedCorner(mozilla::Side aSide,
mozilla::css::Corner aCorner);
mozilla::Corner aCorner);
// Draw the given dotted corner, each segment separately
void DrawDottedCornerSlow(mozilla::Side aSide,
mozilla::css::Corner aCorner);
mozilla::Corner aCorner);
// Draw the given dashed corner, each dot separately
void DrawDashedCornerSlow(mozilla::Side aSide,
mozilla::css::Corner aCorner);
mozilla::Corner aCorner);
// Draw the given dashed/dotted corner with solid style
void DrawFallbackSolidCorner(mozilla::Side aSide,
mozilla::css::Corner aCorner);
mozilla::Corner aCorner);
// Analyze if all border sides have the same width.
bool AllBordersSameWidth();