mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-29 20:07:30 +09:00
Issue #1925 - Remove use of NS_SIDE_* macros.
This commit is contained in:
parent
e6e2796541
commit
ec7351a5d4
30 changed files with 322 additions and 328 deletions
|
|
@ -11,10 +11,10 @@
|
|||
#define DASH_LENGTH 3 // 3 times longer than dot
|
||||
|
||||
// some shorthand for side bits
|
||||
#define SIDE_BIT_TOP (1 << NS_SIDE_TOP)
|
||||
#define SIDE_BIT_RIGHT (1 << NS_SIDE_RIGHT)
|
||||
#define SIDE_BIT_BOTTOM (1 << NS_SIDE_BOTTOM)
|
||||
#define SIDE_BIT_LEFT (1 << NS_SIDE_LEFT)
|
||||
#define SIDE_BIT_TOP (1 << eSideTop)
|
||||
#define SIDE_BIT_RIGHT (1 << eSideRight)
|
||||
#define SIDE_BIT_BOTTOM (1 << eSideBottom)
|
||||
#define SIDE_BIT_LEFT (1 << eSideLeft)
|
||||
#define SIDE_BITS_ALL (SIDE_BIT_TOP|SIDE_BIT_RIGHT|SIDE_BIT_BOTTOM|SIDE_BIT_LEFT)
|
||||
|
||||
#define C_TL NS_CORNER_TOP_LEFT
|
||||
|
|
|
|||
|
|
@ -475,24 +475,24 @@ MakeBevelColor(mozilla::Side whichSide, uint8_t style,
|
|||
(style == NS_STYLE_BORDER_STYLE_RIDGE)) {
|
||||
// Flip colors for these two border styles
|
||||
switch (whichSide) {
|
||||
case NS_SIDE_BOTTOM: whichSide = NS_SIDE_TOP; break;
|
||||
case NS_SIDE_RIGHT: whichSide = NS_SIDE_LEFT; break;
|
||||
case NS_SIDE_TOP: whichSide = NS_SIDE_BOTTOM; break;
|
||||
case NS_SIDE_LEFT: whichSide = NS_SIDE_RIGHT; break;
|
||||
case eSideBottom: whichSide = eSideTop; break;
|
||||
case eSideRight: whichSide = eSideLeft; break;
|
||||
case eSideTop: whichSide = eSideBottom; break;
|
||||
case eSideLeft: whichSide = eSideRight; break;
|
||||
}
|
||||
}
|
||||
|
||||
switch (whichSide) {
|
||||
case NS_SIDE_BOTTOM:
|
||||
case eSideBottom:
|
||||
theColor = colors[1];
|
||||
break;
|
||||
case NS_SIDE_RIGHT:
|
||||
case eSideRight:
|
||||
theColor = colors[1];
|
||||
break;
|
||||
case NS_SIDE_TOP:
|
||||
case eSideTop:
|
||||
theColor = colors[0];
|
||||
break;
|
||||
case NS_SIDE_LEFT:
|
||||
case eSideLeft:
|
||||
default:
|
||||
theColor = colors[0];
|
||||
break;
|
||||
|
|
@ -1483,10 +1483,10 @@ nsCSSRendering::PaintBoxShadowOuter(nsPresContext* aPresContext,
|
|||
|
||||
Float borderSizes[4];
|
||||
|
||||
borderSizes[NS_SIDE_LEFT] = spreadDistance;
|
||||
borderSizes[NS_SIDE_TOP] = spreadDistance;
|
||||
borderSizes[NS_SIDE_RIGHT] = spreadDistance;
|
||||
borderSizes[NS_SIDE_BOTTOM] = spreadDistance;
|
||||
borderSizes[eSideLeft] = spreadDistance;
|
||||
borderSizes[eSideTop] = spreadDistance;
|
||||
borderSizes[eSideRight] = spreadDistance;
|
||||
borderSizes[eSideBottom] = spreadDistance;
|
||||
|
||||
nsCSSBorderRenderer::ComputeOuterRadii(borderRadii, borderSizes,
|
||||
&clipRectRadii);
|
||||
|
|
@ -1595,19 +1595,19 @@ nsCSSRendering::PaintBoxShadowInner(nsPresContext* aPresContext,
|
|||
|
||||
// See PaintBoxShadowOuter and bug 514670
|
||||
if (innerRadii[C_TL].width > 0 || innerRadii[C_BL].width > 0) {
|
||||
borderSizes[NS_SIDE_LEFT] = spreadDistance;
|
||||
borderSizes[eSideLeft] = spreadDistance;
|
||||
}
|
||||
|
||||
if (innerRadii[C_TL].height > 0 || innerRadii[C_TR].height > 0) {
|
||||
borderSizes[NS_SIDE_TOP] = spreadDistance;
|
||||
borderSizes[eSideTop] = spreadDistance;
|
||||
}
|
||||
|
||||
if (innerRadii[C_TR].width > 0 || innerRadii[C_BR].width > 0) {
|
||||
borderSizes[NS_SIDE_RIGHT] = spreadDistance;
|
||||
borderSizes[eSideRight] = spreadDistance;
|
||||
}
|
||||
|
||||
if (innerRadii[C_BL].height > 0 || innerRadii[C_BR].height > 0) {
|
||||
borderSizes[NS_SIDE_BOTTOM] = spreadDistance;
|
||||
borderSizes[eSideBottom] = spreadDistance;
|
||||
}
|
||||
|
||||
nsCSSBorderRenderer::ComputeInnerRadii(innerRadii, borderSizes,
|
||||
|
|
@ -4264,32 +4264,32 @@ DrawSolidBorderSegment(DrawTarget& aDrawTarget,
|
|||
Float startBevelOffset =
|
||||
NSAppUnitsToFloatPixels(aStartBevelOffset, aAppUnitsPerDevPixel);
|
||||
switch(aStartBevelSide) {
|
||||
case NS_SIDE_TOP:
|
||||
case eSideTop:
|
||||
poly[0].x += startBevelOffset;
|
||||
break;
|
||||
case NS_SIDE_BOTTOM:
|
||||
case eSideBottom:
|
||||
poly[3].x += startBevelOffset;
|
||||
break;
|
||||
case NS_SIDE_RIGHT:
|
||||
case eSideRight:
|
||||
poly[1].y += startBevelOffset;
|
||||
break;
|
||||
case NS_SIDE_LEFT:
|
||||
case eSideLeft:
|
||||
poly[0].y += startBevelOffset;
|
||||
}
|
||||
|
||||
Float endBevelOffset =
|
||||
NSAppUnitsToFloatPixels(aEndBevelOffset, aAppUnitsPerDevPixel);
|
||||
switch(aEndBevelSide) {
|
||||
case NS_SIDE_TOP:
|
||||
case eSideTop:
|
||||
poly[1].x -= endBevelOffset;
|
||||
break;
|
||||
case NS_SIDE_BOTTOM:
|
||||
case eSideBottom:
|
||||
poly[2].x -= endBevelOffset;
|
||||
break;
|
||||
case NS_SIDE_RIGHT:
|
||||
case eSideRight:
|
||||
poly[2].y -= endBevelOffset;
|
||||
break;
|
||||
case NS_SIDE_LEFT:
|
||||
case eSideLeft:
|
||||
poly[3].y -= endBevelOffset;
|
||||
}
|
||||
|
||||
|
|
@ -4341,7 +4341,7 @@ nsCSSRendering::DrawTableBorderSegment(DrawTarget& aDrawTarget,
|
|||
uint8_t aEndBevelSide,
|
||||
nscoord aEndBevelOffset)
|
||||
{
|
||||
bool horizontal = ((NS_SIDE_TOP == aStartBevelSide) || (NS_SIDE_BOTTOM == aStartBevelSide));
|
||||
bool horizontal = ((eSideTop == aStartBevelSide) || (eSideBottom == aStartBevelSide));
|
||||
nscoord twipsPerPixel = NSIntPixelsToAppUnits(1, aAppUnitsPerCSSPixel);
|
||||
uint8_t ridgeGroove = NS_STYLE_BORDER_STYLE_RIDGE;
|
||||
|
||||
|
|
@ -4425,7 +4425,7 @@ nsCSSRendering::DrawTableBorderSegment(DrawTarget& aDrawTarget,
|
|||
? RoundFloatToPixel(0.5f * (float)aStartBevelOffset, twipsPerPixel, true) : 0;
|
||||
nscoord endBevel = (aEndBevelOffset > 0)
|
||||
? RoundFloatToPixel(0.5f * (float)aEndBevelOffset, twipsPerPixel, true) : 0;
|
||||
mozilla::Side ridgeGrooveSide = (horizontal) ? NS_SIDE_TOP : NS_SIDE_LEFT;
|
||||
mozilla::Side ridgeGrooveSide = (horizontal) ? eSideTop : eSideLeft;
|
||||
// FIXME: In theory, this should use the visited-dependent
|
||||
// background color, but I don't care.
|
||||
nscolor bevelColor = MakeBevelColor(ridgeGrooveSide, ridgeGroove,
|
||||
|
|
@ -4436,11 +4436,11 @@ nsCSSRendering::DrawTableBorderSegment(DrawTarget& aDrawTarget,
|
|||
if (horizontal) { // top, bottom
|
||||
half = RoundFloatToPixel(0.5f * (float)aBorder.height, twipsPerPixel);
|
||||
rect.height = half;
|
||||
if (NS_SIDE_TOP == aStartBevelSide) {
|
||||
if (eSideTop == aStartBevelSide) {
|
||||
rect.x += startBevel;
|
||||
rect.width -= startBevel;
|
||||
}
|
||||
if (NS_SIDE_TOP == aEndBevelSide) {
|
||||
if (eSideTop == aEndBevelSide) {
|
||||
rect.width -= endBevel;
|
||||
}
|
||||
DrawSolidBorderSegment(aDrawTarget, rect, bevelColor,
|
||||
|
|
@ -4451,11 +4451,11 @@ nsCSSRendering::DrawTableBorderSegment(DrawTarget& aDrawTarget,
|
|||
else { // left, right
|
||||
half = RoundFloatToPixel(0.5f * (float)aBorder.width, twipsPerPixel);
|
||||
rect.width = half;
|
||||
if (NS_SIDE_LEFT == aStartBevelSide) {
|
||||
if (eSideLeft == aStartBevelSide) {
|
||||
rect.y += startBevel;
|
||||
rect.height -= startBevel;
|
||||
}
|
||||
if (NS_SIDE_LEFT == aEndBevelSide) {
|
||||
if (eSideLeft == aEndBevelSide) {
|
||||
rect.height -= endBevel;
|
||||
}
|
||||
DrawSolidBorderSegment(aDrawTarget, rect, bevelColor,
|
||||
|
|
@ -4465,7 +4465,7 @@ nsCSSRendering::DrawTableBorderSegment(DrawTarget& aDrawTarget,
|
|||
}
|
||||
|
||||
rect = aBorder;
|
||||
ridgeGrooveSide = (NS_SIDE_TOP == ridgeGrooveSide) ? NS_SIDE_BOTTOM : NS_SIDE_RIGHT;
|
||||
ridgeGrooveSide = (eSideTop == ridgeGrooveSide) ? eSideBottom : eSideRight;
|
||||
// FIXME: In theory, this should use the visited-dependent
|
||||
// background color, but I don't care.
|
||||
bevelColor = MakeBevelColor(ridgeGrooveSide, ridgeGroove,
|
||||
|
|
@ -4473,11 +4473,11 @@ nsCSSRendering::DrawTableBorderSegment(DrawTarget& aDrawTarget,
|
|||
if (horizontal) {
|
||||
rect.y = rect.y + half;
|
||||
rect.height = aBorder.height - half;
|
||||
if (NS_SIDE_BOTTOM == aStartBevelSide) {
|
||||
if (eSideBottom == aStartBevelSide) {
|
||||
rect.x += startBevel;
|
||||
rect.width -= startBevel;
|
||||
}
|
||||
if (NS_SIDE_BOTTOM == aEndBevelSide) {
|
||||
if (eSideBottom == aEndBevelSide) {
|
||||
rect.width -= endBevel;
|
||||
}
|
||||
DrawSolidBorderSegment(aDrawTarget, rect, bevelColor,
|
||||
|
|
@ -4488,11 +4488,11 @@ nsCSSRendering::DrawTableBorderSegment(DrawTarget& aDrawTarget,
|
|||
else {
|
||||
rect.x = rect.x + half;
|
||||
rect.width = aBorder.width - half;
|
||||
if (NS_SIDE_RIGHT == aStartBevelSide) {
|
||||
if (eSideRight == aStartBevelSide) {
|
||||
rect.y += aStartBevelOffset - startBevel;
|
||||
rect.height -= startBevel;
|
||||
}
|
||||
if (NS_SIDE_RIGHT == aEndBevelSide) {
|
||||
if (eSideRight == aEndBevelSide) {
|
||||
rect.height -= endBevel;
|
||||
}
|
||||
DrawSolidBorderSegment(aDrawTarget, rect, bevelColor,
|
||||
|
|
@ -4517,11 +4517,11 @@ nsCSSRendering::DrawTableBorderSegment(DrawTarget& aDrawTarget,
|
|||
|
||||
// draw the top line or rect
|
||||
nsRect topRect(aBorder.x, aBorder.y, aBorder.width, thirdHeight);
|
||||
if (NS_SIDE_TOP == aStartBevelSide) {
|
||||
if (eSideTop == aStartBevelSide) {
|
||||
topRect.x += aStartBevelOffset - startBevel;
|
||||
topRect.width -= aStartBevelOffset - startBevel;
|
||||
}
|
||||
if (NS_SIDE_TOP == aEndBevelSide) {
|
||||
if (eSideTop == aEndBevelSide) {
|
||||
topRect.width -= aEndBevelOffset - endBevel;
|
||||
}
|
||||
DrawSolidBorderSegment(aDrawTarget, topRect, aBorderColor,
|
||||
|
|
@ -4532,11 +4532,11 @@ nsCSSRendering::DrawTableBorderSegment(DrawTarget& aDrawTarget,
|
|||
// draw the botom line or rect
|
||||
nscoord heightOffset = aBorder.height - thirdHeight;
|
||||
nsRect bottomRect(aBorder.x, aBorder.y + heightOffset, aBorder.width, aBorder.height - heightOffset);
|
||||
if (NS_SIDE_BOTTOM == aStartBevelSide) {
|
||||
if (eSideBottom == aStartBevelSide) {
|
||||
bottomRect.x += aStartBevelOffset - startBevel;
|
||||
bottomRect.width -= aStartBevelOffset - startBevel;
|
||||
}
|
||||
if (NS_SIDE_BOTTOM == aEndBevelSide) {
|
||||
if (eSideBottom == aEndBevelSide) {
|
||||
bottomRect.width -= aEndBevelOffset - endBevel;
|
||||
}
|
||||
DrawSolidBorderSegment(aDrawTarget, bottomRect, aBorderColor,
|
||||
|
|
@ -4548,11 +4548,11 @@ nsCSSRendering::DrawTableBorderSegment(DrawTarget& aDrawTarget,
|
|||
nscoord thirdWidth = RoundFloatToPixel(0.333333f * (float)aBorder.width, twipsPerPixel);
|
||||
|
||||
nsRect leftRect(aBorder.x, aBorder.y, thirdWidth, aBorder.height);
|
||||
if (NS_SIDE_LEFT == aStartBevelSide) {
|
||||
if (eSideLeft == aStartBevelSide) {
|
||||
leftRect.y += aStartBevelOffset - startBevel;
|
||||
leftRect.height -= aStartBevelOffset - startBevel;
|
||||
}
|
||||
if (NS_SIDE_LEFT == aEndBevelSide) {
|
||||
if (eSideLeft == aEndBevelSide) {
|
||||
leftRect.height -= aEndBevelOffset - endBevel;
|
||||
}
|
||||
DrawSolidBorderSegment(aDrawTarget, leftRect, aBorderColor,
|
||||
|
|
@ -4562,11 +4562,11 @@ nsCSSRendering::DrawTableBorderSegment(DrawTarget& aDrawTarget,
|
|||
|
||||
nscoord widthOffset = aBorder.width - thirdWidth;
|
||||
nsRect rightRect(aBorder.x + widthOffset, aBorder.y, aBorder.width - widthOffset, aBorder.height);
|
||||
if (NS_SIDE_RIGHT == aStartBevelSide) {
|
||||
if (eSideRight == aStartBevelSide) {
|
||||
rightRect.y += aStartBevelOffset - startBevel;
|
||||
rightRect.height -= aStartBevelOffset - startBevel;
|
||||
}
|
||||
if (NS_SIDE_RIGHT == aEndBevelSide) {
|
||||
if (eSideRight == aEndBevelSide) {
|
||||
rightRect.height -= aEndBevelOffset - endBevel;
|
||||
}
|
||||
DrawSolidBorderSegment(aDrawTarget, rightRect, aBorderColor,
|
||||
|
|
|
|||
|
|
@ -116,13 +116,13 @@ AllCornersZeroSize(const RectCornerRadii& corners) {
|
|||
static mozilla::Side
|
||||
GetHorizontalSide(mozilla::css::Corner aCorner)
|
||||
{
|
||||
return (aCorner == C_TL || aCorner == C_TR) ? NS_SIDE_TOP : NS_SIDE_BOTTOM;
|
||||
return (aCorner == C_TL || aCorner == C_TR) ? eSideTop : eSideBottom;
|
||||
}
|
||||
|
||||
static mozilla::Side
|
||||
GetVerticalSide(mozilla::css::Corner aCorner)
|
||||
{
|
||||
return (aCorner == C_TL || aCorner == C_BL) ? NS_SIDE_LEFT : NS_SIDE_RIGHT;
|
||||
return (aCorner == C_TL || aCorner == C_BL) ? eSideLeft : eSideRight;
|
||||
}
|
||||
|
||||
static mozilla::css::Corner
|
||||
|
|
@ -147,7 +147,7 @@ IsSingleSide(int aSides)
|
|||
static bool
|
||||
IsHorizontalSide(mozilla::Side aSide)
|
||||
{
|
||||
return aSide == NS_SIDE_TOP || aSide == NS_SIDE_BOTTOM;
|
||||
return aSide == eSideTop || aSide == eSideBottom;
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
|
|
@ -215,17 +215,17 @@ nsCSSBorderRenderer::ComputeInnerRadii(const RectCornerRadii& aRadii,
|
|||
{
|
||||
RectCornerRadii& iRadii = *aInnerRadiiRet;
|
||||
|
||||
iRadii[C_TL].width = std::max(0.f, aRadii[C_TL].width - aBorderSizes[NS_SIDE_LEFT]);
|
||||
iRadii[C_TL].height = std::max(0.f, aRadii[C_TL].height - aBorderSizes[NS_SIDE_TOP]);
|
||||
iRadii[C_TL].width = std::max(0.f, aRadii[C_TL].width - aBorderSizes[eSideLeft]);
|
||||
iRadii[C_TL].height = std::max(0.f, aRadii[C_TL].height - aBorderSizes[eSideTop]);
|
||||
|
||||
iRadii[C_TR].width = std::max(0.f, aRadii[C_TR].width - aBorderSizes[NS_SIDE_RIGHT]);
|
||||
iRadii[C_TR].height = std::max(0.f, aRadii[C_TR].height - aBorderSizes[NS_SIDE_TOP]);
|
||||
iRadii[C_TR].width = std::max(0.f, aRadii[C_TR].width - aBorderSizes[eSideRight]);
|
||||
iRadii[C_TR].height = std::max(0.f, aRadii[C_TR].height - aBorderSizes[eSideTop]);
|
||||
|
||||
iRadii[C_BR].width = std::max(0.f, aRadii[C_BR].width - aBorderSizes[NS_SIDE_RIGHT]);
|
||||
iRadii[C_BR].height = std::max(0.f, aRadii[C_BR].height - aBorderSizes[NS_SIDE_BOTTOM]);
|
||||
iRadii[C_BR].width = std::max(0.f, aRadii[C_BR].width - aBorderSizes[eSideRight]);
|
||||
iRadii[C_BR].height = std::max(0.f, aRadii[C_BR].height - aBorderSizes[eSideBottom]);
|
||||
|
||||
iRadii[C_BL].width = std::max(0.f, aRadii[C_BL].width - aBorderSizes[NS_SIDE_LEFT]);
|
||||
iRadii[C_BL].height = std::max(0.f, aRadii[C_BL].height - aBorderSizes[NS_SIDE_BOTTOM]);
|
||||
iRadii[C_BL].width = std::max(0.f, aRadii[C_BL].width - aBorderSizes[eSideLeft]);
|
||||
iRadii[C_BL].height = std::max(0.f, aRadii[C_BL].height - aBorderSizes[eSideBottom]);
|
||||
}
|
||||
|
||||
/* static */ void
|
||||
|
|
@ -240,23 +240,23 @@ nsCSSBorderRenderer::ComputeOuterRadii(const RectCornerRadii& aRadii,
|
|||
|
||||
// round the edges that have radii > 0.0 to start with
|
||||
if (aRadii[C_TL].width > 0.f && aRadii[C_TL].height > 0.f) {
|
||||
oRadii[C_TL].width = std::max(0.f, aRadii[C_TL].width + aBorderSizes[NS_SIDE_LEFT]);
|
||||
oRadii[C_TL].height = std::max(0.f, aRadii[C_TL].height + aBorderSizes[NS_SIDE_TOP]);
|
||||
oRadii[C_TL].width = std::max(0.f, aRadii[C_TL].width + aBorderSizes[eSideLeft]);
|
||||
oRadii[C_TL].height = std::max(0.f, aRadii[C_TL].height + aBorderSizes[eSideTop]);
|
||||
}
|
||||
|
||||
if (aRadii[C_TR].width > 0.f && aRadii[C_TR].height > 0.f) {
|
||||
oRadii[C_TR].width = std::max(0.f, aRadii[C_TR].width + aBorderSizes[NS_SIDE_RIGHT]);
|
||||
oRadii[C_TR].height = std::max(0.f, aRadii[C_TR].height + aBorderSizes[NS_SIDE_TOP]);
|
||||
oRadii[C_TR].width = std::max(0.f, aRadii[C_TR].width + aBorderSizes[eSideRight]);
|
||||
oRadii[C_TR].height = std::max(0.f, aRadii[C_TR].height + aBorderSizes[eSideTop]);
|
||||
}
|
||||
|
||||
if (aRadii[C_BR].width > 0.f && aRadii[C_BR].height > 0.f) {
|
||||
oRadii[C_BR].width = std::max(0.f, aRadii[C_BR].width + aBorderSizes[NS_SIDE_RIGHT]);
|
||||
oRadii[C_BR].height = std::max(0.f, aRadii[C_BR].height + aBorderSizes[NS_SIDE_BOTTOM]);
|
||||
oRadii[C_BR].width = std::max(0.f, aRadii[C_BR].width + aBorderSizes[eSideRight]);
|
||||
oRadii[C_BR].height = std::max(0.f, aRadii[C_BR].height + aBorderSizes[eSideBottom]);
|
||||
}
|
||||
|
||||
if (aRadii[C_BL].width > 0.f && aRadii[C_BL].height > 0.f) {
|
||||
oRadii[C_BL].width = std::max(0.f, aRadii[C_BL].width + aBorderSizes[NS_SIDE_LEFT]);
|
||||
oRadii[C_BL].height = std::max(0.f, aRadii[C_BL].height + aBorderSizes[NS_SIDE_BOTTOM]);
|
||||
oRadii[C_BL].width = std::max(0.f, aRadii[C_BL].width + aBorderSizes[eSideLeft]);
|
||||
oRadii[C_BL].height = std::max(0.f, aRadii[C_BL].height + aBorderSizes[eSideBottom]);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -265,10 +265,10 @@ ComputeBorderCornerDimensions(const Float* aBorderWidths,
|
|||
const RectCornerRadii& aRadii,
|
||||
RectCornerRadii* aDimsRet)
|
||||
{
|
||||
Float leftWidth = aBorderWidths[NS_SIDE_LEFT];
|
||||
Float topWidth = aBorderWidths[NS_SIDE_TOP];
|
||||
Float rightWidth = aBorderWidths[NS_SIDE_RIGHT];
|
||||
Float bottomWidth = aBorderWidths[NS_SIDE_BOTTOM];
|
||||
Float leftWidth = aBorderWidths[eSideLeft];
|
||||
Float topWidth = aBorderWidths[eSideTop];
|
||||
Float rightWidth = aBorderWidths[eSideRight];
|
||||
Float bottomWidth = aBorderWidths[eSideBottom];
|
||||
|
||||
if (AllCornersZeroSize(aRadii)) {
|
||||
// These will always be in pixel units from CSS
|
||||
|
|
@ -458,15 +458,15 @@ nsCSSBorderRenderer::GetSideClipWithoutCornersRect(mozilla::Side aSide)
|
|||
// must be the border height; the x start must take into account
|
||||
// the corner size (which may be bigger than the right or left
|
||||
// side's width). The same applies to the right and left sides.
|
||||
if (aSide == NS_SIDE_TOP) {
|
||||
if (aSide == eSideTop) {
|
||||
offset.x = mBorderCornerDimensions[C_TL].width;
|
||||
} else if (aSide == NS_SIDE_RIGHT) {
|
||||
offset.x = mOuterRect.Width() - mBorderWidths[NS_SIDE_RIGHT];
|
||||
} else if (aSide == eSideRight) {
|
||||
offset.x = mOuterRect.Width() - mBorderWidths[eSideRight];
|
||||
offset.y = mBorderCornerDimensions[C_TR].height;
|
||||
} else if (aSide == NS_SIDE_BOTTOM) {
|
||||
} else if (aSide == eSideBottom) {
|
||||
offset.x = mBorderCornerDimensions[C_BL].width;
|
||||
offset.y = mOuterRect.Height() - mBorderWidths[NS_SIDE_BOTTOM];
|
||||
} else if (aSide == NS_SIDE_LEFT) {
|
||||
offset.y = mOuterRect.Height() - mBorderWidths[eSideBottom];
|
||||
} else if (aSide == eSideLeft) {
|
||||
offset.y = mBorderCornerDimensions[C_TL].height;
|
||||
}
|
||||
|
||||
|
|
@ -681,7 +681,7 @@ nsCSSBorderRenderer::GetStraightBorderPoint(mozilla::Side aSide,
|
|||
{
|
||||
// Calculate the end point of the side for dashed/dotted border, that is also
|
||||
// the end point of the corner curve. The point is specified by aSide and
|
||||
// aCorner. (e.g. NS_SIDE_TOP and C_TL means the left end of border-top)
|
||||
// aCorner. (e.g. eSideTop and C_TL means the left end of border-top)
|
||||
//
|
||||
//
|
||||
// aCorner aSide
|
||||
|
|
@ -1163,27 +1163,27 @@ nsCSSBorderRenderer::FillSolidBorder(const Rect& aOuterRect,
|
|||
|
||||
// compute base rects for each side
|
||||
if (aSides & SIDE_BIT_TOP) {
|
||||
r[NS_SIDE_TOP] =
|
||||
r[eSideTop] =
|
||||
Rect(aOuterRect.X(), aOuterRect.Y(),
|
||||
aOuterRect.Width(), aBorderSizes[NS_SIDE_TOP]);
|
||||
aOuterRect.Width(), aBorderSizes[eSideTop]);
|
||||
}
|
||||
|
||||
if (aSides & SIDE_BIT_BOTTOM) {
|
||||
r[NS_SIDE_BOTTOM] =
|
||||
Rect(aOuterRect.X(), aOuterRect.YMost() - aBorderSizes[NS_SIDE_BOTTOM],
|
||||
aOuterRect.Width(), aBorderSizes[NS_SIDE_BOTTOM]);
|
||||
r[eSideBottom] =
|
||||
Rect(aOuterRect.X(), aOuterRect.YMost() - aBorderSizes[eSideBottom],
|
||||
aOuterRect.Width(), aBorderSizes[eSideBottom]);
|
||||
}
|
||||
|
||||
if (aSides & SIDE_BIT_LEFT) {
|
||||
r[NS_SIDE_LEFT] =
|
||||
r[eSideLeft] =
|
||||
Rect(aOuterRect.X(), aOuterRect.Y(),
|
||||
aBorderSizes[NS_SIDE_LEFT], aOuterRect.Height());
|
||||
aBorderSizes[eSideLeft], aOuterRect.Height());
|
||||
}
|
||||
|
||||
if (aSides & SIDE_BIT_RIGHT) {
|
||||
r[NS_SIDE_RIGHT] =
|
||||
Rect(aOuterRect.XMost() - aBorderSizes[NS_SIDE_RIGHT], aOuterRect.Y(),
|
||||
aBorderSizes[NS_SIDE_RIGHT], aOuterRect.Height());
|
||||
r[eSideRight] =
|
||||
Rect(aOuterRect.XMost() - aBorderSizes[eSideRight], aOuterRect.Y(),
|
||||
aBorderSizes[eSideRight], aOuterRect.Height());
|
||||
}
|
||||
|
||||
// If two sides meet at a corner that we're rendering, then
|
||||
|
|
@ -1193,24 +1193,24 @@ nsCSSBorderRenderer::FillSolidBorder(const Rect& aOuterRect,
|
|||
|
||||
if ((aSides & (SIDE_BIT_TOP | SIDE_BIT_LEFT)) == (SIDE_BIT_TOP | SIDE_BIT_LEFT)) {
|
||||
// adjust the left's top down a bit
|
||||
r[NS_SIDE_LEFT].y += aBorderSizes[NS_SIDE_TOP];
|
||||
r[NS_SIDE_LEFT].height -= aBorderSizes[NS_SIDE_TOP];
|
||||
r[eSideLeft].y += aBorderSizes[eSideTop];
|
||||
r[eSideLeft].height -= aBorderSizes[eSideTop];
|
||||
}
|
||||
|
||||
if ((aSides & (SIDE_BIT_TOP | SIDE_BIT_RIGHT)) == (SIDE_BIT_TOP | SIDE_BIT_RIGHT)) {
|
||||
// adjust the top's left a bit
|
||||
r[NS_SIDE_TOP].width -= aBorderSizes[NS_SIDE_RIGHT];
|
||||
r[eSideTop].width -= aBorderSizes[eSideRight];
|
||||
}
|
||||
|
||||
if ((aSides & (SIDE_BIT_BOTTOM | SIDE_BIT_RIGHT)) == (SIDE_BIT_BOTTOM | SIDE_BIT_RIGHT)) {
|
||||
// adjust the right's bottom a bit
|
||||
r[NS_SIDE_RIGHT].height -= aBorderSizes[NS_SIDE_BOTTOM];
|
||||
r[eSideRight].height -= aBorderSizes[eSideBottom];
|
||||
}
|
||||
|
||||
if ((aSides & (SIDE_BIT_BOTTOM | SIDE_BIT_LEFT)) == (SIDE_BIT_BOTTOM | SIDE_BIT_LEFT)) {
|
||||
// adjust the bottom's left a bit
|
||||
r[NS_SIDE_BOTTOM].x += aBorderSizes[NS_SIDE_LEFT];
|
||||
r[NS_SIDE_BOTTOM].width -= aBorderSizes[NS_SIDE_LEFT];
|
||||
r[eSideBottom].x += aBorderSizes[eSideLeft];
|
||||
r[eSideBottom].width -= aBorderSizes[eSideLeft];
|
||||
}
|
||||
|
||||
// Filling these one by one is faster than filling them all at once.
|
||||
|
|
@ -1305,10 +1305,10 @@ nsCSSBorderRenderer::DrawBorderSidesCompositeColors(int aSides, const nsBorderCo
|
|||
|
||||
siRect = Rect(tl.x, tl.y, br.x - tl.x , br.y - tl.y);
|
||||
|
||||
fakeBorderSizes[NS_SIDE_TOP] = siRect.TopLeft().y - soRect.TopLeft().y;
|
||||
fakeBorderSizes[NS_SIDE_RIGHT] = soRect.TopRight().x - siRect.TopRight().x;
|
||||
fakeBorderSizes[NS_SIDE_BOTTOM] = soRect.BottomRight().y - siRect.BottomRight().y;
|
||||
fakeBorderSizes[NS_SIDE_LEFT] = siRect.BottomLeft().x - soRect.BottomLeft().x;
|
||||
fakeBorderSizes[eSideTop] = siRect.TopLeft().y - soRect.TopLeft().y;
|
||||
fakeBorderSizes[eSideRight] = soRect.TopRight().x - siRect.TopRight().x;
|
||||
fakeBorderSizes[eSideBottom] = soRect.BottomRight().y - siRect.BottomRight().y;
|
||||
fakeBorderSizes[eSideLeft] = siRect.BottomLeft().x - soRect.BottomLeft().x;
|
||||
|
||||
FillSolidBorder(soRect, siRect, radii, fakeBorderSizes, aSides, color);
|
||||
|
||||
|
|
@ -1351,27 +1351,27 @@ nsCSSBorderRenderer::DrawBorderSides(int aSides)
|
|||
borderRenderStyle == NS_STYLE_BORDER_STYLE_DOTTED) {
|
||||
// Draw each corner separately, with the given side's color.
|
||||
if (aSides & SIDE_BIT_TOP) {
|
||||
DrawDashedOrDottedCorner(NS_SIDE_TOP, C_TL);
|
||||
DrawDashedOrDottedCorner(eSideTop, C_TL);
|
||||
} else if (aSides & SIDE_BIT_LEFT) {
|
||||
DrawDashedOrDottedCorner(NS_SIDE_LEFT, C_TL);
|
||||
DrawDashedOrDottedCorner(eSideLeft, C_TL);
|
||||
}
|
||||
|
||||
if (aSides & SIDE_BIT_TOP) {
|
||||
DrawDashedOrDottedCorner(NS_SIDE_TOP, C_TR);
|
||||
DrawDashedOrDottedCorner(eSideTop, C_TR);
|
||||
} else if (aSides & SIDE_BIT_RIGHT) {
|
||||
DrawDashedOrDottedCorner(NS_SIDE_RIGHT, C_TR);
|
||||
DrawDashedOrDottedCorner(eSideRight, C_TR);
|
||||
}
|
||||
|
||||
if (aSides & SIDE_BIT_BOTTOM) {
|
||||
DrawDashedOrDottedCorner(NS_SIDE_BOTTOM, C_BL);
|
||||
DrawDashedOrDottedCorner(eSideBottom, C_BL);
|
||||
} else if (aSides & SIDE_BIT_LEFT) {
|
||||
DrawDashedOrDottedCorner(NS_SIDE_LEFT, C_BL);
|
||||
DrawDashedOrDottedCorner(eSideLeft, C_BL);
|
||||
}
|
||||
|
||||
if (aSides & SIDE_BIT_BOTTOM) {
|
||||
DrawDashedOrDottedCorner(NS_SIDE_BOTTOM, C_BR);
|
||||
DrawDashedOrDottedCorner(eSideBottom, C_BR);
|
||||
} else if (aSides & SIDE_BIT_RIGHT) {
|
||||
DrawDashedOrDottedCorner(NS_SIDE_RIGHT, C_BR);
|
||||
DrawDashedOrDottedCorner(eSideRight, C_BR);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
|
@ -1545,38 +1545,38 @@ nsCSSBorderRenderer::DrawBorderSides(int aSides)
|
|||
// If there is at least one dotted side, every side is rendered separately.
|
||||
if (IsSingleSide(aSides)) {
|
||||
if (aSides == SIDE_BIT_TOP) {
|
||||
if (mBorderStyles[NS_SIDE_RIGHT] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
if (mBorderStyles[eSideRight] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
IsZeroSize(mBorderRadii[C_TR])) {
|
||||
noMarginRight = true;
|
||||
}
|
||||
if (mBorderStyles[NS_SIDE_LEFT] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
if (mBorderStyles[eSideLeft] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
IsZeroSize(mBorderRadii[C_TL])) {
|
||||
noMarginLeft = true;
|
||||
}
|
||||
} else if (aSides == SIDE_BIT_RIGHT) {
|
||||
if (mBorderStyles[NS_SIDE_TOP] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
if (mBorderStyles[eSideTop] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
IsZeroSize(mBorderRadii[C_TR])) {
|
||||
noMarginTop = true;
|
||||
}
|
||||
if (mBorderStyles[NS_SIDE_BOTTOM] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
if (mBorderStyles[eSideBottom] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
IsZeroSize(mBorderRadii[C_BR])) {
|
||||
noMarginBottom = true;
|
||||
}
|
||||
} else if (aSides == SIDE_BIT_BOTTOM) {
|
||||
if (mBorderStyles[NS_SIDE_RIGHT] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
if (mBorderStyles[eSideRight] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
IsZeroSize(mBorderRadii[C_BR])) {
|
||||
noMarginRight = true;
|
||||
}
|
||||
if (mBorderStyles[NS_SIDE_LEFT] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
if (mBorderStyles[eSideLeft] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
IsZeroSize(mBorderRadii[C_BL])) {
|
||||
noMarginLeft = true;
|
||||
}
|
||||
} else {
|
||||
if (mBorderStyles[NS_SIDE_TOP] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
if (mBorderStyles[eSideTop] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
IsZeroSize(mBorderRadii[C_TL])) {
|
||||
noMarginTop = true;
|
||||
}
|
||||
if (mBorderStyles[NS_SIDE_BOTTOM] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
if (mBorderStyles[eSideBottom] == NS_STYLE_BORDER_STYLE_DOTTED &&
|
||||
IsZeroSize(mBorderRadii[C_BL])) {
|
||||
noMarginBottom = true;
|
||||
}
|
||||
|
|
@ -1806,13 +1806,13 @@ static Float
|
|||
GetBorderLength(mozilla::Side aSide,
|
||||
const Point& aStart, const Point& aEnd)
|
||||
{
|
||||
if (aSide == NS_SIDE_TOP) {
|
||||
if (aSide == eSideTop) {
|
||||
return aEnd.x - aStart.x;
|
||||
}
|
||||
if (aSide == NS_SIDE_RIGHT) {
|
||||
if (aSide == eSideRight) {
|
||||
return aEnd.y - aStart.y;
|
||||
}
|
||||
if (aSide == NS_SIDE_BOTTOM) {
|
||||
if (aSide == eSideBottom) {
|
||||
return aStart.x - aEnd.x;
|
||||
}
|
||||
return aStart.y - aEnd.y;
|
||||
|
|
@ -2081,16 +2081,16 @@ nsCSSBorderRenderer::DrawDottedSideSlow(mozilla::Side aSide)
|
|||
// Ei
|
||||
|
||||
Point I(0.0f, 0.0f), J(0.0f, 0.0f);
|
||||
if (aSide == NS_SIDE_TOP) {
|
||||
if (aSide == eSideTop) {
|
||||
I.x = 1.0f;
|
||||
J.y = 1.0f;
|
||||
} else if (aSide == NS_SIDE_RIGHT) {
|
||||
} else if (aSide == eSideRight) {
|
||||
I.y = 1.0f;
|
||||
J.x = -1.0f;
|
||||
} else if (aSide == NS_SIDE_BOTTOM) {
|
||||
} else if (aSide == eSideBottom) {
|
||||
I.x = -1.0f;
|
||||
J.y = -1.0f;
|
||||
} else if (aSide == NS_SIDE_LEFT) {
|
||||
} else if (aSide == eSideLeft) {
|
||||
I.y = -1.0f;
|
||||
J.x = 1.0f;
|
||||
}
|
||||
|
|
@ -2167,7 +2167,7 @@ nsCSSBorderRenderer::DrawDottedSideSlow(mozilla::Side aSide)
|
|||
// Extend dirty rect to avoid clipping pixel for anti-aliasing.
|
||||
const Float AA_MARGIN = 2.0f;
|
||||
|
||||
if (aSide == NS_SIDE_TOP) {
|
||||
if (aSide == eSideTop) {
|
||||
// Tweak |from| and |to| to fit into |mDirtyRect + radius margin|,
|
||||
// to render only paths that may overlap mDirtyRect.
|
||||
//
|
||||
|
|
@ -2212,7 +2212,7 @@ nsCSSBorderRenderer::DrawDottedSideSlow(mozilla::Side aSide)
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (aSide == NS_SIDE_RIGHT) {
|
||||
} else if (aSide == eSideRight) {
|
||||
Float top = mDirtyRect.y - radius - AA_MARGIN;
|
||||
if (fromP.y < top) {
|
||||
size_t tmp = ceil(count * (top - start.y) / (end.y - start.y));
|
||||
|
|
@ -2235,7 +2235,7 @@ nsCSSBorderRenderer::DrawDottedSideSlow(mozilla::Side aSide)
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (aSide == NS_SIDE_BOTTOM) {
|
||||
} else if (aSide == eSideBottom) {
|
||||
Float right = mDirtyRect.x + mDirtyRect.width + radius + AA_MARGIN;
|
||||
if (fromP.x > right) {
|
||||
size_t tmp = ceil(count * (right - start.x) / (end.x - start.x));
|
||||
|
|
@ -2258,7 +2258,7 @@ nsCSSBorderRenderer::DrawDottedSideSlow(mozilla::Side aSide)
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (aSide == NS_SIDE_LEFT) {
|
||||
} else if (aSide == eSideLeft) {
|
||||
Float bottom = mDirtyRect.y + mDirtyRect.height + radius + AA_MARGIN;
|
||||
if (fromP.y > bottom) {
|
||||
size_t tmp = ceil(count * (bottom - start.y) / (end.y - start.y));
|
||||
|
|
@ -3240,8 +3240,8 @@ nsCSSBorderRenderer::DrawBorders()
|
|||
}
|
||||
|
||||
// Initial values only used when the border colors/widths are all the same:
|
||||
ColorPattern color(ToDeviceColor(mBorderColors[NS_SIDE_TOP]));
|
||||
StrokeOptions strokeOptions(mBorderWidths[NS_SIDE_TOP]); // stroke width
|
||||
ColorPattern color(ToDeviceColor(mBorderColors[eSideTop]));
|
||||
StrokeOptions strokeOptions(mBorderWidths[eSideTop]); // stroke width
|
||||
|
||||
bool allBordersSolid;
|
||||
|
||||
|
|
@ -3271,10 +3271,10 @@ nsCSSBorderRenderer::DrawBorders()
|
|||
// Relatively simple case.
|
||||
gfxRect outerRect = ThebesRect(mOuterRect);
|
||||
RoundedRect borderInnerRect(outerRect, mBorderRadii);
|
||||
borderInnerRect.Deflate(mBorderWidths[NS_SIDE_TOP],
|
||||
mBorderWidths[NS_SIDE_BOTTOM],
|
||||
mBorderWidths[NS_SIDE_LEFT],
|
||||
mBorderWidths[NS_SIDE_RIGHT]);
|
||||
borderInnerRect.Deflate(mBorderWidths[eSideTop],
|
||||
mBorderWidths[eSideBottom],
|
||||
mBorderWidths[eSideLeft],
|
||||
mBorderWidths[eSideRight]);
|
||||
|
||||
// Instead of stroking we just use two paths: an inner and an outer.
|
||||
// This allows us to draw borders that we couldn't when stroking. For example,
|
||||
|
|
|
|||
|
|
@ -4655,9 +4655,9 @@ GetBSizeTakenByBoxSizing(StyleBoxSizing aBoxSizing,
|
|||
const nsStyleSides& stylePadding =
|
||||
aFrame->StylePadding()->mPadding;
|
||||
const nsStyleCoord& paddingStart =
|
||||
stylePadding.Get(aHorizontalAxis ? NS_SIDE_TOP : NS_SIDE_LEFT);
|
||||
stylePadding.Get(aHorizontalAxis ? eSideTop : eSideLeft);
|
||||
const nsStyleCoord& paddingEnd =
|
||||
stylePadding.Get(aHorizontalAxis ? NS_SIDE_BOTTOM : NS_SIDE_RIGHT);
|
||||
stylePadding.Get(aHorizontalAxis ? eSideBottom : eSideRight);
|
||||
nscoord pad;
|
||||
// XXXbz Calling GetPercentBSize on padding values looks bogus, since
|
||||
// percent padding is always a percentage of the inline-size of the
|
||||
|
|
@ -6789,14 +6789,14 @@ nsLayoutUtils::HasNonZeroCorner(const nsStyleCorners& aCorners)
|
|||
// aCorner is a "full corner" value, i.e. NS_CORNER_TOP_LEFT etc
|
||||
static bool IsCornerAdjacentToSide(uint8_t aCorner, Side aSide)
|
||||
{
|
||||
static_assert((int)NS_SIDE_TOP == NS_CORNER_TOP_LEFT, "Check for Full Corner");
|
||||
static_assert((int)NS_SIDE_RIGHT == NS_CORNER_TOP_RIGHT, "Check for Full Corner");
|
||||
static_assert((int)NS_SIDE_BOTTOM == NS_CORNER_BOTTOM_RIGHT, "Check for Full Corner");
|
||||
static_assert((int)NS_SIDE_LEFT == NS_CORNER_BOTTOM_LEFT, "Check for Full Corner");
|
||||
static_assert((int)NS_SIDE_TOP == ((NS_CORNER_TOP_RIGHT - 1)&3), "Check for Full Corner");
|
||||
static_assert((int)NS_SIDE_RIGHT == ((NS_CORNER_BOTTOM_RIGHT - 1)&3), "Check for Full Corner");
|
||||
static_assert((int)NS_SIDE_BOTTOM == ((NS_CORNER_BOTTOM_LEFT - 1)&3), "Check for Full Corner");
|
||||
static_assert((int)NS_SIDE_LEFT == ((NS_CORNER_TOP_LEFT - 1)&3), "Check for Full Corner");
|
||||
static_assert((int)eSideTop == NS_CORNER_TOP_LEFT, "Check for Full Corner");
|
||||
static_assert((int)eSideRight == NS_CORNER_TOP_RIGHT, "Check for Full Corner");
|
||||
static_assert((int)eSideBottom == NS_CORNER_BOTTOM_RIGHT, "Check for Full Corner");
|
||||
static_assert((int)eSideLeft == NS_CORNER_BOTTOM_LEFT, "Check for Full Corner");
|
||||
static_assert((int)eSideTop == ((NS_CORNER_TOP_RIGHT - 1)&3), "Check for Full Corner");
|
||||
static_assert((int)eSideRight == ((NS_CORNER_BOTTOM_RIGHT - 1)&3), "Check for Full Corner");
|
||||
static_assert((int)eSideBottom == ((NS_CORNER_BOTTOM_LEFT - 1)&3), "Check for Full Corner");
|
||||
static_assert((int)eSideLeft == ((NS_CORNER_TOP_LEFT - 1)&3), "Check for Full Corner");
|
||||
|
||||
return aSide == aCorner || aSide == ((aCorner - 1)&3);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue