Issue #1925 - Remove use of NS_SIDE_* macros.

This commit is contained in:
Moonchild 2024-08-01 17:28:01 +02:00 committed by roytam1
commit ec7351a5d4
30 changed files with 322 additions and 328 deletions

View file

@ -340,7 +340,7 @@ DOMIntersectionObserver::Update(nsIDocument* aDocument, DOMHighResTimeStamp time
nsMargin rootMargin;
NS_FOR_CSS_SIDES(side) {
nscoord basis = side == NS_SIDE_TOP || side == NS_SIDE_BOTTOM ?
nscoord basis = side == eSideTop || side == eSideBottom ?
rootRect.height : rootRect.width;
nsCSSValue value = mRootMargin.*nsCSSRect::sides[side];
nsStyleCoord coord;

View file

@ -340,8 +340,8 @@ nsGenericHTMLElement::GetOffsetRect(CSSIntRect& aRect)
if (parent &&
parent->StylePosition()->mBoxSizing != StyleBoxSizing::Border) {
const nsStyleBorder* border = parent->StyleBorder();
origin.x -= border->GetComputedBorderWidth(NS_SIDE_LEFT);
origin.y -= border->GetComputedBorderWidth(NS_SIDE_TOP);
origin.x -= border->GetComputedBorderWidth(eSideLeft);
origin.y -= border->GetComputedBorderWidth(eSideTop);
}
// XXX We should really consider subtracting out padding for

View file

@ -389,19 +389,19 @@ struct BaseRect {
}
Point CCWCorner(mozilla::Side side) const {
switch (side) {
case NS_SIDE_TOP: return TopLeft();
case NS_SIDE_RIGHT: return TopRight();
case NS_SIDE_BOTTOM: return BottomRight();
case NS_SIDE_LEFT: return BottomLeft();
case eSideTop: return TopLeft();
case eSideRight: return TopRight();
case eSideBottom: return BottomRight();
case eSideLeft: return BottomLeft();
}
MOZ_CRASH("GFX: Incomplete switch");
}
Point CWCorner(mozilla::Side side) const {
switch (side) {
case NS_SIDE_TOP: return TopRight();
case NS_SIDE_RIGHT: return BottomRight();
case NS_SIDE_BOTTOM: return BottomLeft();
case NS_SIDE_LEFT: return TopLeft();
case eSideTop: return TopRight();
case eSideRight: return BottomRight();
case eSideBottom: return BottomLeft();
case eSideLeft: return TopLeft();
}
MOZ_CRASH("GFX: Incomplete switch");
}
@ -422,10 +422,10 @@ struct BaseRect {
T Edge(mozilla::Side aSide) const
{
switch (aSide) {
case NS_SIDE_TOP: return Y();
case NS_SIDE_RIGHT: return XMost();
case NS_SIDE_BOTTOM: return YMost();
case NS_SIDE_LEFT: return X();
case eSideTop: return Y();
case eSideRight: return XMost();
case eSideBottom: return YMost();
case eSideLeft: return X();
}
MOZ_CRASH("GFX: Incomplete switch");
}

View file

@ -8,7 +8,6 @@
#include "mozilla/EndianUtils.h"
#include "mozilla/MacroArgs.h" // for MOZ_CONCAT
#include "nsDebug.h"
#include <stddef.h>
#include <stdint.h>
@ -389,27 +388,22 @@ enum SideBits {
eSideBitsAll = eSideBitsTopBottom | eSideBitsLeftRight
};
#define NS_SIDE_TOP mozilla::eSideTop
#define NS_SIDE_RIGHT mozilla::eSideRight
#define NS_SIDE_BOTTOM mozilla::eSideBottom
#define NS_SIDE_LEFT mozilla::eSideLeft
// Creates a for loop that walks over the four mozilla::Side values.
// We use an int32_t helper variable (instead of a Side) for our loop counter,
// to avoid triggering undefined behavior just before we exit the loop (at
// which point the counter is incremented beyond the largest valid Side value).
#define NS_FOR_CSS_SIDES(var_) \
int32_t MOZ_CONCAT(var_,__LINE__) = NS_SIDE_TOP; \
#define NS_FOR_CSS_SIDES(var_) \
int32_t MOZ_CONCAT(var_,__LINE__) = mozilla::eSideTop; \
for (mozilla::Side var_; \
MOZ_CONCAT(var_,__LINE__) <= NS_SIDE_LEFT && \
MOZ_CONCAT(var_,__LINE__) <= mozilla::eSideLeft && \
((var_ = mozilla::Side(MOZ_CONCAT(var_,__LINE__))), true); \
MOZ_CONCAT(var_,__LINE__)++)
static inline Side operator++(Side& side, int) {
NS_PRECONDITION(side >= NS_SIDE_TOP &&
side <= NS_SIDE_LEFT, "Out of range side");
side = Side(side + 1);
return side;
MOZ_ASSERT(side >= eSideTop && side <= eSideLeft,
"Out of range side");
side = Side(side + 1);
return side;
}
} // namespace mozilla

View file

@ -4,16 +4,16 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "nsRect.h"
#include "mozilla/gfx/Types.h" // for NS_SIDE_BOTTOM, etc
#include "mozilla/gfx/Types.h" // for eSideBottom, etc
#include "mozilla/CheckedInt.h" // for CheckedInt
#include "nsDeviceContext.h" // for nsDeviceContext
#include "nsString.h" // for nsAutoString, etc
#include "nsMargin.h" // for nsMargin
static_assert((int(NS_SIDE_TOP) == 0) &&
(int(NS_SIDE_RIGHT) == 1) &&
(int(NS_SIDE_BOTTOM) == 2) &&
(int(NS_SIDE_LEFT) == 3),
static_assert((int(eSideTop) == 0) &&
(int(eSideRight) == 1) &&
(int(eSideBottom) == 2) &&
(int(eSideLeft) == 3),
"The mozilla::Side sequence must match the nsMargin nscoord sequence");
const mozilla::gfx::IntRect& GetMaxSizedIntRect() {

View file

@ -90,20 +90,20 @@ struct gfxRect :
gfxPoint CCWCorner(mozilla::Side side) const {
switch (side) {
case NS_SIDE_TOP: return TopLeft();
case NS_SIDE_RIGHT: return TopRight();
case NS_SIDE_BOTTOM: return BottomRight();
case NS_SIDE_LEFT: return BottomLeft();
case mozilla::eSideTop: return TopLeft();
case mozilla::eSideRight: return TopRight();
case mozilla::eSideBottom: return BottomRight();
case mozilla::eSideLeft: return BottomLeft();
}
MOZ_CRASH("Incomplete switch");
}
gfxPoint CWCorner(mozilla::Side side) const {
switch (side) {
case NS_SIDE_TOP: return TopRight();
case NS_SIDE_RIGHT: return BottomRight();
case NS_SIDE_BOTTOM: return BottomLeft();
case NS_SIDE_LEFT: return TopLeft();
case mozilla::eSideTop: return TopRight();
case mozilla::eSideRight: return BottomRight();
case mozilla::eSideBottom: return BottomLeft();
case mozilla::eSideLeft: return TopLeft();
}
MOZ_CRASH("Incomplete switch");
}

View file

@ -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

View file

@ -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,

View file

@ -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,

View file

@ -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);
}

View file

@ -325,10 +325,10 @@ public:
// bit 0 = the eOrientationMask value
// bit 1 = the eBlockFlowMask value
static const mozilla::Side kLogicalBlockSides[][2] = {
{ NS_SIDE_TOP, NS_SIDE_BOTTOM }, // horizontal-tb
{ NS_SIDE_RIGHT, NS_SIDE_LEFT }, // vertical-rl
{ NS_SIDE_BOTTOM, NS_SIDE_TOP }, // (horizontal-bt)
{ NS_SIDE_LEFT, NS_SIDE_RIGHT }, // vertical-lr
{ eSideTop, eSideBottom }, // horizontal-tb
{ eSideRight, eSideLeft }, // vertical-rl
{ eSideBottom, eSideTop }, // (horizontal-bt)
{ eSideLeft, eSideRight }, // vertical-lr
};
// Ignore the SIDEWAYS_MASK bit of the writing-mode value, as this has no
@ -353,22 +353,22 @@ public:
// produces "inverted" text. (The former 'sideways-left' value, no longer
// in the spec, would have produced this in vertical-rl mode.)
static const mozilla::Side kLogicalInlineSides[][2] = {
{ NS_SIDE_LEFT, NS_SIDE_RIGHT }, // horizontal-tb ltr
{ NS_SIDE_TOP, NS_SIDE_BOTTOM }, // vertical-rl ltr
{ NS_SIDE_RIGHT, NS_SIDE_LEFT }, // horizontal-tb rtl
{ NS_SIDE_BOTTOM, NS_SIDE_TOP }, // vertical-rl rtl
{ NS_SIDE_RIGHT, NS_SIDE_LEFT }, // (horizontal-bt) (inverted) ltr
{ NS_SIDE_TOP, NS_SIDE_BOTTOM }, // sideways-lr rtl
{ NS_SIDE_LEFT, NS_SIDE_RIGHT }, // (horizontal-bt) (inverted) rtl
{ NS_SIDE_BOTTOM, NS_SIDE_TOP }, // sideways-lr ltr
{ NS_SIDE_LEFT, NS_SIDE_RIGHT }, // horizontal-tb (inverted) rtl
{ NS_SIDE_TOP, NS_SIDE_BOTTOM }, // vertical-rl (inverted) rtl
{ NS_SIDE_RIGHT, NS_SIDE_LEFT }, // horizontal-tb (inverted) ltr
{ NS_SIDE_BOTTOM, NS_SIDE_TOP }, // vertical-rl (inverted) ltr
{ NS_SIDE_LEFT, NS_SIDE_RIGHT }, // (horizontal-bt) ltr
{ NS_SIDE_TOP, NS_SIDE_BOTTOM }, // vertical-lr ltr
{ NS_SIDE_RIGHT, NS_SIDE_LEFT }, // (horizontal-bt) rtl
{ NS_SIDE_BOTTOM, NS_SIDE_TOP }, // vertical-lr rtl
{ eSideLeft, eSideRight }, // horizontal-tb ltr
{ eSideTop, eSideBottom }, // vertical-rl ltr
{ eSideRight, eSideLeft }, // horizontal-tb rtl
{ eSideBottom, eSideTop }, // vertical-rl rtl
{ eSideRight, eSideLeft }, // (horizontal-bt) (inverted) ltr
{ eSideTop, eSideBottom }, // sideways-lr rtl
{ eSideLeft, eSideRight }, // (horizontal-bt) (inverted) rtl
{ eSideBottom, eSideTop }, // sideways-lr ltr
{ eSideLeft, eSideRight }, // horizontal-tb (inverted) rtl
{ eSideTop, eSideBottom }, // vertical-rl (inverted) rtl
{ eSideRight, eSideLeft }, // horizontal-tb (inverted) ltr
{ eSideBottom, eSideTop }, // vertical-rl (inverted) ltr
{ eSideLeft, eSideRight }, // (horizontal-bt) ltr
{ eSideTop, eSideBottom }, // vertical-lr ltr
{ eSideRight, eSideLeft }, // (horizontal-bt) rtl
{ eSideBottom, eSideTop }, // vertical-lr rtl
};
// Inline axis sides depend on all three of writing-mode, text-orientation

View file

@ -93,14 +93,14 @@ nsColumnSetFrame::PaintColumnRule(nsRenderingContext* aCtx,
nsStyleBorder border(presContext);
Sides skipSides;
if (isVertical) {
border.SetBorderWidth(NS_SIDE_TOP, ruleWidth);
border.SetBorderStyle(NS_SIDE_TOP, ruleStyle);
border.SetBorderWidth(eSideTop, ruleWidth);
border.SetBorderStyle(eSideTop, ruleStyle);
border.mBorderTopColor = StyleComplexColor::FromColor(ruleColor);
skipSides |= mozilla::eSideBitsLeftRight;
skipSides |= mozilla::eSideBitsBottom;
} else {
border.SetBorderWidth(NS_SIDE_LEFT, ruleWidth);
border.SetBorderStyle(NS_SIDE_LEFT, ruleStyle);
border.SetBorderWidth(eSideLeft, ruleWidth);
border.SetBorderStyle(eSideLeft, ruleStyle);
border.mBorderLeftColor = StyleComplexColor::FromColor(ruleColor);
skipSides |= mozilla::eSideBitsTopBottom;
skipSides |= mozilla::eSideBitsRight;

View file

@ -4579,11 +4579,11 @@ IntrinsicSizeOffsets(nsIFrame* aFrame, nscoord aPercentageBasis, bool aForISize)
const nsStyleBorder* styleBorder = aFrame->StyleBorder();
if (verticalAxis) {
result.hBorder += styleBorder->GetComputedBorderWidth(NS_SIDE_TOP);
result.hBorder += styleBorder->GetComputedBorderWidth(NS_SIDE_BOTTOM);
result.hBorder += styleBorder->GetComputedBorderWidth(eSideTop);
result.hBorder += styleBorder->GetComputedBorderWidth(eSideBottom);
} else {
result.hBorder += styleBorder->GetComputedBorderWidth(NS_SIDE_LEFT);
result.hBorder += styleBorder->GetComputedBorderWidth(NS_SIDE_RIGHT);
result.hBorder += styleBorder->GetComputedBorderWidth(eSideLeft);
result.hBorder += styleBorder->GetComputedBorderWidth(eSideRight);
}
const nsStyleDisplay* disp = aFrame->StyleDisplay();

View file

@ -114,20 +114,20 @@ nsInlineFrame::IsSelfEmpty()
// get logical start and end flags.
if (wm.IsVertical()) {
haveStart =
border->GetComputedBorderWidth(NS_SIDE_TOP) != 0 ||
border->GetComputedBorderWidth(eSideTop) != 0 ||
!nsLayoutUtils::IsPaddingZero(padding->mPadding.GetTop()) ||
!IsMarginZero(margin->mMargin.GetTop());
haveEnd =
border->GetComputedBorderWidth(NS_SIDE_BOTTOM) != 0 ||
border->GetComputedBorderWidth(eSideBottom) != 0 ||
!nsLayoutUtils::IsPaddingZero(padding->mPadding.GetBottom()) ||
!IsMarginZero(margin->mMargin.GetBottom());
} else {
haveStart =
border->GetComputedBorderWidth(NS_SIDE_LEFT) != 0 ||
border->GetComputedBorderWidth(eSideLeft) != 0 ||
!nsLayoutUtils::IsPaddingZero(padding->mPadding.GetLeft()) ||
!IsMarginZero(margin->mMargin.GetLeft());
haveEnd =
border->GetComputedBorderWidth(NS_SIDE_RIGHT) != 0 ||
border->GetComputedBorderWidth(eSideRight) != 0 ||
!nsLayoutUtils::IsPaddingZero(padding->mPadding.GetRight()) ||
!IsMarginZero(margin->mMargin.GetRight());
}

View file

@ -760,8 +760,8 @@ IsPercentageAware(const nsIFrame* aFrame)
pos->mWidth.GetUnit() != eStyleUnit_Auto) ||
pos->MaxWidthDependsOnContainer() ||
pos->MinWidthDependsOnContainer() ||
pos->OffsetHasPercent(NS_SIDE_RIGHT) ||
pos->OffsetHasPercent(NS_SIDE_LEFT)) {
pos->OffsetHasPercent(eSideRight) ||
pos->OffsetHasPercent(eSideLeft)) {
return true;
}

View file

@ -80,7 +80,7 @@ nsPageContentFrame::Reflow(nsPresContext* aPresContext,
nscoord xmost = aDesiredSize.ScrollableOverflow().XMost();
if (xmost > aDesiredSize.Width()) {
nscoord widthToFit = xmost + padding.right +
kidReflowInput.mStyleBorder->GetComputedBorderWidth(NS_SIDE_RIGHT);
kidReflowInput.mStyleBorder->GetComputedBorderWidth(eSideRight);
float ratio = float(maxSize.width) / widthToFit;
NS_ASSERTION(ratio >= 0.0 && ratio < 1.0, "invalid shrink-to-fit ratio");
mPD->mShrinkToFitRatio = std::min(mPD->mShrinkToFitRatio, ratio);

View file

@ -200,13 +200,13 @@ ApplyBorderToStyle(const nsMathMLmtdFrame* aFrame,
// values, we simply repeat the last value.
uint32_t listLength = rowLinesList->Length();
if (rowIndex < listLength) {
aStyleBorder.SetBorderStyle(NS_SIDE_TOP,
aStyleBorder.SetBorderStyle(eSideTop,
rowLinesList->ElementAt(rowIndex - 1));
} else {
aStyleBorder.SetBorderStyle(NS_SIDE_TOP,
aStyleBorder.SetBorderStyle(eSideTop,
rowLinesList->ElementAt(listLength - 1));
}
aStyleBorder.SetBorderWidth(NS_SIDE_TOP, borderWidth);
aStyleBorder.SetBorderWidth(eSideTop, borderWidth);
}
// We don't place a column line on the left of the first column.
@ -215,13 +215,13 @@ ApplyBorderToStyle(const nsMathMLmtdFrame* aFrame,
// values, we simply repeat the last value.
uint32_t listLength = columnLinesList->Length();
if (columnIndex < listLength) {
aStyleBorder.SetBorderStyle(NS_SIDE_LEFT,
aStyleBorder.SetBorderStyle(eSideLeft,
columnLinesList->ElementAt(columnIndex - 1));
} else {
aStyleBorder.SetBorderStyle(NS_SIDE_LEFT,
aStyleBorder.SetBorderStyle(eSideLeft,
columnLinesList->ElementAt(listLength - 1));
}
aStyleBorder.SetBorderWidth(NS_SIDE_LEFT, borderWidth);
aStyleBorder.SetBorderWidth(eSideLeft, borderWidth);
}
}

View file

@ -4373,10 +4373,10 @@ StyleAnimationValue::ExtractComputedValue(nsCSSPropertyID aProperty,
case eStyleAnimType_Sides_Bottom:
case eStyleAnimType_Sides_Left: {
static_assert(
NS_SIDE_TOP == eStyleAnimType_Sides_Top -eStyleAnimType_Sides_Top &&
NS_SIDE_RIGHT == eStyleAnimType_Sides_Right -eStyleAnimType_Sides_Top &&
NS_SIDE_BOTTOM == eStyleAnimType_Sides_Bottom-eStyleAnimType_Sides_Top &&
NS_SIDE_LEFT == eStyleAnimType_Sides_Left -eStyleAnimType_Sides_Top,
eSideTop == eStyleAnimType_Sides_Top -eStyleAnimType_Sides_Top &&
eSideRight == eStyleAnimType_Sides_Right -eStyleAnimType_Sides_Top &&
eSideBottom == eStyleAnimType_Sides_Bottom-eStyleAnimType_Sides_Top &&
eSideLeft == eStyleAnimType_Sides_Left -eStyleAnimType_Sides_Top,
"box side constants out of sync with animation side constants");
const nsStyleCoord &coord =

View file

@ -249,8 +249,8 @@ EnsurePhysicalProperty(nsCSSPropertyID& aProperty, nsRuleData* aRuleData)
// We rely on the physical side constant values matching the order of
// the physical properties in the logical group array.
static_assert(NS_SIDE_TOP == 0 && NS_SIDE_RIGHT == 1 &&
NS_SIDE_BOTTOM == 2 && NS_SIDE_LEFT == 3,
static_assert(eSideTop == 0 && eSideRight == 1 &&
eSideBottom == 2 && eSideLeft == 3,
"unexpected side constant values");
index = side;
}

View file

@ -2794,8 +2794,8 @@ static const nsCSSPropertyID gBorderBottomSubpropTable[] = {
eCSSProperty_UNKNOWN
};
static_assert(NS_SIDE_TOP == 0 && NS_SIDE_RIGHT == 1 &&
NS_SIDE_BOTTOM == 2 && NS_SIDE_LEFT == 3,
static_assert(eSideTop == 0 && eSideRight == 1 &&
eSideBottom == 2 && eSideLeft == 3,
"box side constants not top/right/bottom/left == 0/1/2/3");
static const nsCSSPropertyID gBorderColorSubpropTable[] = {
// Code relies on these being in top-right-bottom-left order.

View file

@ -2565,8 +2565,8 @@ nsCSSRect_heap::SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const
return n;
}
static_assert(NS_SIDE_TOP == 0 && NS_SIDE_RIGHT == 1 &&
NS_SIDE_BOTTOM == 2 && NS_SIDE_LEFT == 3,
static_assert(eSideTop == 0 && eSideRight == 1 &&
eSideBottom == 2 && eSideLeft == 3,
"box side constants not top/right/bottom/left == 0/1/2/3");
/* static */ const nsCSSRect::side_type nsCSSRect::sides[4] = {

View file

@ -985,7 +985,7 @@ nsComputedDOMStyle::DoGetFloat()
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBottom()
{
return GetOffsetWidthFor(NS_SIDE_BOTTOM);
return GetOffsetWidthFor(eSideBottom);
}
already_AddRefed<CSSValue>
@ -3013,25 +3013,25 @@ nsComputedDOMStyle::DoGetRowGap()
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetPaddingTop()
{
return GetPaddingWidthFor(NS_SIDE_TOP);
return GetPaddingWidthFor(eSideTop);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetPaddingBottom()
{
return GetPaddingWidthFor(NS_SIDE_BOTTOM);
return GetPaddingWidthFor(eSideBottom);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetPaddingLeft()
{
return GetPaddingWidthFor(NS_SIDE_LEFT);
return GetPaddingWidthFor(eSideLeft);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetPaddingRight()
{
return GetPaddingWidthFor(NS_SIDE_RIGHT);
return GetPaddingWidthFor(eSideRight);
}
already_AddRefed<CSSValue>
@ -3095,50 +3095,50 @@ nsComputedDOMStyle::DoGetTableLayout()
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderTopStyle()
{
return GetBorderStyleFor(NS_SIDE_TOP);
return GetBorderStyleFor(eSideTop);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderBottomStyle()
{
return GetBorderStyleFor(NS_SIDE_BOTTOM);
return GetBorderStyleFor(eSideBottom);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderLeftStyle()
{
return GetBorderStyleFor(NS_SIDE_LEFT);
return GetBorderStyleFor(eSideLeft);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderRightStyle()
{
return GetBorderStyleFor(NS_SIDE_RIGHT);
return GetBorderStyleFor(eSideRight);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderBottomColors()
{
return GetBorderColorsFor(NS_SIDE_BOTTOM);
return GetBorderColorsFor(eSideBottom);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderLeftColors()
{
return GetBorderColorsFor(NS_SIDE_LEFT);
return GetBorderColorsFor(eSideLeft);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderRightColors()
{
return GetBorderColorsFor(NS_SIDE_RIGHT);
return GetBorderColorsFor(eSideRight);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderTopColors()
{
return GetBorderColorsFor(NS_SIDE_TOP);
return GetBorderColorsFor(eSideTop);
}
already_AddRefed<CSSValue>
@ -3172,73 +3172,73 @@ nsComputedDOMStyle::DoGetBorderTopRightRadius()
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderTopWidth()
{
return GetBorderWidthFor(NS_SIDE_TOP);
return GetBorderWidthFor(eSideTop);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderBottomWidth()
{
return GetBorderWidthFor(NS_SIDE_BOTTOM);
return GetBorderWidthFor(eSideBottom);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderLeftWidth()
{
return GetBorderWidthFor(NS_SIDE_LEFT);
return GetBorderWidthFor(eSideLeft);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderRightWidth()
{
return GetBorderWidthFor(NS_SIDE_RIGHT);
return GetBorderWidthFor(eSideRight);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderTopColor()
{
return GetBorderColorFor(NS_SIDE_TOP);
return GetBorderColorFor(eSideTop);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderBottomColor()
{
return GetBorderColorFor(NS_SIDE_BOTTOM);
return GetBorderColorFor(eSideBottom);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderLeftColor()
{
return GetBorderColorFor(NS_SIDE_LEFT);
return GetBorderColorFor(eSideLeft);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetBorderRightColor()
{
return GetBorderColorFor(NS_SIDE_RIGHT);
return GetBorderColorFor(eSideRight);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetMarginTopWidth()
{
return GetMarginWidthFor(NS_SIDE_TOP);
return GetMarginWidthFor(eSideTop);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetMarginBottomWidth()
{
return GetMarginWidthFor(NS_SIDE_BOTTOM);
return GetMarginWidthFor(eSideBottom);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetMarginLeftWidth()
{
return GetMarginWidthFor(NS_SIDE_LEFT);
return GetMarginWidthFor(eSideLeft);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetMarginRightWidth()
{
return GetMarginWidthFor(NS_SIDE_RIGHT);
return GetMarginWidthFor(eSideRight);
}
already_AddRefed<CSSValue>
@ -5069,19 +5069,19 @@ nsComputedDOMStyle::DoGetObjectPosition()
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetLeft()
{
return GetOffsetWidthFor(NS_SIDE_LEFT);
return GetOffsetWidthFor(eSideLeft);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetRight()
{
return GetOffsetWidthFor(NS_SIDE_RIGHT);
return GetOffsetWidthFor(eSideRight);
}
already_AddRefed<CSSValue>
nsComputedDOMStyle::DoGetTop()
{
return GetOffsetWidthFor(NS_SIDE_TOP);
return GetOffsetWidthFor(eSideTop);
}
already_AddRefed<CSSValue>
@ -5143,21 +5143,21 @@ nsComputedDOMStyle::GetAbsoluteOffset(mozilla::Side aSide)
nscoord offset = 0;
switch (aSide) {
case NS_SIDE_TOP:
case eSideTop:
offset = rect.y - margin.top - border.top - scrollbarSizes.top;
break;
case NS_SIDE_RIGHT:
case eSideRight:
offset = containerRect.width - rect.width -
rect.x - margin.right - border.right - scrollbarSizes.right;
break;
case NS_SIDE_BOTTOM:
case eSideBottom:
offset = containerRect.height - rect.height -
rect.y - margin.bottom - border.bottom - scrollbarSizes.bottom;
break;
case NS_SIDE_LEFT:
case eSideLeft:
offset = rect.x - margin.left - border.left - scrollbarSizes.left;
break;
@ -5171,8 +5171,8 @@ nsComputedDOMStyle::GetAbsoluteOffset(mozilla::Side aSide)
return val.forget();
}
static_assert(NS_SIDE_TOP == 0 && NS_SIDE_RIGHT == 1 &&
NS_SIDE_BOTTOM == 2 && NS_SIDE_LEFT == 3,
static_assert(eSideTop == 0 && eSideRight == 1 &&
eSideBottom == 2 && eSideLeft == 3,
"box side constants not as expected for NS_OPPOSITE_SIDE");
#define NS_OPPOSITE_SIDE(s_) mozilla::Side(((s_) + 2) & 3)
@ -5196,7 +5196,7 @@ nsComputedDOMStyle::GetRelativeOffset(mozilla::Side aSide)
sign = -1;
}
PercentageBaseGetter baseGetter;
if (aSide == NS_SIDE_LEFT || aSide == NS_SIDE_RIGHT) {
if (aSide == eSideLeft || aSide == eSideRight) {
baseGetter = &nsComputedDOMStyle::GetCBContentWidth;
} else {
baseGetter = &nsComputedDOMStyle::GetCBContentHeight;
@ -5225,7 +5225,7 @@ nsComputedDOMStyle::GetStickyOffset(mozilla::Side aSide)
return val.forget();
}
PercentageBaseGetter baseGetter;
if (aSide == NS_SIDE_LEFT || aSide == NS_SIDE_RIGHT) {
if (aSide == eSideLeft || aSide == eSideRight) {
baseGetter = &nsComputedDOMStyle::GetScrollFrameContentWidth;
} else {
baseGetter = &nsComputedDOMStyle::GetScrollFrameContentHeight;

View file

@ -332,10 +332,10 @@ void nsStyleCorners::Reset()
#define CASE(side, result) \
static_assert(NS_SIDE_IS_VERTICAL(side) == result, \
"NS_SIDE_IS_VERTICAL is wrong")
CASE(NS_SIDE_TOP, false);
CASE(NS_SIDE_RIGHT, true);
CASE(NS_SIDE_BOTTOM, false);
CASE(NS_SIDE_LEFT, true);
CASE(eSideTop, false);
CASE(eSideRight, true);
CASE(eSideBottom, false);
CASE(eSideLeft, true);
#undef CASE
#define CASE(corner, result) \
@ -383,39 +383,39 @@ CASE(NS_CORNER_BOTTOM_LEFT, true, NS_CORNER_BOTTOM_LEFT_Y);
#define CASE(side, second, result) \
static_assert(NS_SIDE_TO_FULL_CORNER(side, second) == result, \
"NS_SIDE_TO_FULL_CORNER is wrong")
CASE(NS_SIDE_TOP, false, NS_CORNER_TOP_LEFT);
CASE(NS_SIDE_TOP, true, NS_CORNER_TOP_RIGHT);
CASE(eSideTop, false, NS_CORNER_TOP_LEFT);
CASE(eSideTop, true, NS_CORNER_TOP_RIGHT);
CASE(NS_SIDE_RIGHT, false, NS_CORNER_TOP_RIGHT);
CASE(NS_SIDE_RIGHT, true, NS_CORNER_BOTTOM_RIGHT);
CASE(eSideRight, false, NS_CORNER_TOP_RIGHT);
CASE(eSideRight, true, NS_CORNER_BOTTOM_RIGHT);
CASE(NS_SIDE_BOTTOM, false, NS_CORNER_BOTTOM_RIGHT);
CASE(NS_SIDE_BOTTOM, true, NS_CORNER_BOTTOM_LEFT);
CASE(eSideBottom, false, NS_CORNER_BOTTOM_RIGHT);
CASE(eSideBottom, true, NS_CORNER_BOTTOM_LEFT);
CASE(NS_SIDE_LEFT, false, NS_CORNER_BOTTOM_LEFT);
CASE(NS_SIDE_LEFT, true, NS_CORNER_TOP_LEFT);
CASE(eSideLeft, false, NS_CORNER_BOTTOM_LEFT);
CASE(eSideLeft, true, NS_CORNER_TOP_LEFT);
#undef CASE
#define CASE(side, second, parallel, result) \
static_assert(NS_SIDE_TO_HALF_CORNER(side, second, parallel) == result, \
"NS_SIDE_TO_HALF_CORNER is wrong")
CASE(NS_SIDE_TOP, false, true, NS_CORNER_TOP_LEFT_X);
CASE(NS_SIDE_TOP, false, false, NS_CORNER_TOP_LEFT_Y);
CASE(NS_SIDE_TOP, true, true, NS_CORNER_TOP_RIGHT_X);
CASE(NS_SIDE_TOP, true, false, NS_CORNER_TOP_RIGHT_Y);
CASE(eSideTop, false, true, NS_CORNER_TOP_LEFT_X);
CASE(eSideTop, false, false, NS_CORNER_TOP_LEFT_Y);
CASE(eSideTop, true, true, NS_CORNER_TOP_RIGHT_X);
CASE(eSideTop, true, false, NS_CORNER_TOP_RIGHT_Y);
CASE(NS_SIDE_RIGHT, false, false, NS_CORNER_TOP_RIGHT_X);
CASE(NS_SIDE_RIGHT, false, true, NS_CORNER_TOP_RIGHT_Y);
CASE(NS_SIDE_RIGHT, true, false, NS_CORNER_BOTTOM_RIGHT_X);
CASE(NS_SIDE_RIGHT, true, true, NS_CORNER_BOTTOM_RIGHT_Y);
CASE(eSideRight, false, false, NS_CORNER_TOP_RIGHT_X);
CASE(eSideRight, false, true, NS_CORNER_TOP_RIGHT_Y);
CASE(eSideRight, true, false, NS_CORNER_BOTTOM_RIGHT_X);
CASE(eSideRight, true, true, NS_CORNER_BOTTOM_RIGHT_Y);
CASE(NS_SIDE_BOTTOM, false, true, NS_CORNER_BOTTOM_RIGHT_X);
CASE(NS_SIDE_BOTTOM, false, false, NS_CORNER_BOTTOM_RIGHT_Y);
CASE(NS_SIDE_BOTTOM, true, true, NS_CORNER_BOTTOM_LEFT_X);
CASE(NS_SIDE_BOTTOM, true, false, NS_CORNER_BOTTOM_LEFT_Y);
CASE(eSideBottom, false, true, NS_CORNER_BOTTOM_RIGHT_X);
CASE(eSideBottom, false, false, NS_CORNER_BOTTOM_RIGHT_Y);
CASE(eSideBottom, true, true, NS_CORNER_BOTTOM_LEFT_X);
CASE(eSideBottom, true, false, NS_CORNER_BOTTOM_LEFT_Y);
CASE(NS_SIDE_LEFT, false, false, NS_CORNER_BOTTOM_LEFT_X);
CASE(NS_SIDE_LEFT, false, true, NS_CORNER_BOTTOM_LEFT_Y);
CASE(NS_SIDE_LEFT, true, false, NS_CORNER_TOP_LEFT_X);
CASE(NS_SIDE_LEFT, true, true, NS_CORNER_TOP_LEFT_Y);
CASE(eSideLeft, false, false, NS_CORNER_BOTTOM_LEFT_X);
CASE(eSideLeft, false, true, NS_CORNER_BOTTOM_LEFT_Y);
CASE(eSideLeft, true, false, NS_CORNER_TOP_LEFT_X);
CASE(eSideLeft, true, true, NS_CORNER_TOP_LEFT_Y);
#undef CASE

View file

@ -552,22 +552,22 @@ inline nsStyleUnit nsStyleSides::GetUnit(mozilla::Side aSide) const
inline nsStyleUnit nsStyleSides::GetLeftUnit() const
{
return GetUnit(NS_SIDE_LEFT);
return GetUnit(mozilla::eSideLeft);
}
inline nsStyleUnit nsStyleSides::GetTopUnit() const
{
return GetUnit(NS_SIDE_TOP);
return GetUnit(mozilla::eSideTop);
}
inline nsStyleUnit nsStyleSides::GetRightUnit() const
{
return GetUnit(NS_SIDE_RIGHT);
return GetUnit(mozilla::eSideRight);
}
inline nsStyleUnit nsStyleSides::GetBottomUnit() const
{
return GetUnit(NS_SIDE_BOTTOM);
return GetUnit(mozilla::eSideBottom);
}
inline nsStyleCoord nsStyleSides::Get(mozilla::Side aSide) const
@ -577,22 +577,22 @@ inline nsStyleCoord nsStyleSides::Get(mozilla::Side aSide) const
inline nsStyleCoord nsStyleSides::GetLeft() const
{
return Get(NS_SIDE_LEFT);
return Get(mozilla::eSideLeft);
}
inline nsStyleCoord nsStyleSides::GetTop() const
{
return Get(NS_SIDE_TOP);
return Get(mozilla::eSideTop);
}
inline nsStyleCoord nsStyleSides::GetRight() const
{
return Get(NS_SIDE_RIGHT);
return Get(mozilla::eSideRight);
}
inline nsStyleCoord nsStyleSides::GetBottom() const
{
return Get(NS_SIDE_BOTTOM);
return Get(mozilla::eSideBottom);
}
inline void nsStyleSides::Set(mozilla::Side aSide, const nsStyleCoord& aCoord)
@ -602,22 +602,22 @@ inline void nsStyleSides::Set(mozilla::Side aSide, const nsStyleCoord& aCoord)
inline void nsStyleSides::SetLeft(const nsStyleCoord& aCoord)
{
Set(NS_SIDE_LEFT, aCoord);
Set(mozilla::eSideLeft, aCoord);
}
inline void nsStyleSides::SetTop(const nsStyleCoord& aCoord)
{
Set(NS_SIDE_TOP, aCoord);
Set(mozilla::eSideTop, aCoord);
}
inline void nsStyleSides::SetRight(const nsStyleCoord& aCoord)
{
Set(NS_SIDE_RIGHT, aCoord);
Set(mozilla::eSideRight, aCoord);
}
inline void nsStyleSides::SetBottom(const nsStyleCoord& aCoord)
{
Set(NS_SIDE_BOTTOM, aCoord);
Set(mozilla::eSideBottom, aCoord);
}
// -------------------------

View file

@ -1259,13 +1259,13 @@ struct MOZ_NEEDS_MEMMOVABLE_MEMBERS nsStyleBorder
uint8_t GetBorderStyle(mozilla::Side aSide) const
{
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
NS_ASSERTION(aSide <= eSideLeft, "bad side");
return mBorderStyle[aSide];
}
void SetBorderStyle(mozilla::Side aSide, uint8_t aStyle)
{
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
NS_ASSERTION(aSide <= eSideLeft, "bad side");
mBorderStyle[aSide] = aStyle;
mComputedBorder.Side(aSide) =
(HasVisibleStyle(aSide) ? mBorder.Side(aSide) : 0);

View file

@ -183,13 +183,13 @@ BoxObject::GetOffsetRect(nsIntRect& aRect)
// For the origin, add in the border for the frame
const nsStyleBorder* border = frame->StyleBorder();
origin.x += border->GetComputedBorderWidth(NS_SIDE_LEFT);
origin.y += border->GetComputedBorderWidth(NS_SIDE_TOP);
origin.x += border->GetComputedBorderWidth(eSideLeft);
origin.y += border->GetComputedBorderWidth(eSideTop);
// And subtract out the border for the parent
const nsStyleBorder* parentBorder = parent->StyleBorder();
origin.x -= parentBorder->GetComputedBorderWidth(NS_SIDE_LEFT);
origin.y -= parentBorder->GetComputedBorderWidth(NS_SIDE_TOP);
origin.x -= parentBorder->GetComputedBorderWidth(eSideLeft);
origin.y -= parentBorder->GetComputedBorderWidth(eSideTop);
aRect.x = nsPresContext::AppUnitsToIntCSSPixels(origin.x);
aRect.y = nsPresContext::AppUnitsToIntCSSPixels(origin.y);

View file

@ -1707,23 +1707,23 @@ void nsMenuPopupFrame::CanAdjustEdges(int8_t aHorizontalSide,
popupAlign = -popupAlign;
}
if (aHorizontalSide == (mHFlip ? NS_SIDE_RIGHT : NS_SIDE_LEFT)) {
if (aHorizontalSide == (mHFlip ? eSideRight : eSideLeft)) {
if (popupAlign == POPUPALIGNMENT_TOPLEFT || popupAlign == POPUPALIGNMENT_BOTTOMLEFT) {
aChange.x = 0;
}
}
else if (aHorizontalSide == (mHFlip ? NS_SIDE_LEFT : NS_SIDE_RIGHT)) {
else if (aHorizontalSide == (mHFlip ? eSideLeft : eSideRight)) {
if (popupAlign == POPUPALIGNMENT_TOPRIGHT || popupAlign == POPUPALIGNMENT_BOTTOMRIGHT) {
aChange.x = 0;
}
}
if (aVerticalSide == (mVFlip ? NS_SIDE_BOTTOM : NS_SIDE_TOP)) {
if (aVerticalSide == (mVFlip ? eSideBottom : eSideTop)) {
if (popupAlign == POPUPALIGNMENT_TOPLEFT || popupAlign == POPUPALIGNMENT_TOPRIGHT) {
aChange.y = 0;
}
}
else if (aVerticalSide == (mVFlip ? NS_SIDE_TOP : NS_SIDE_BOTTOM)) {
else if (aVerticalSide == (mVFlip ? eSideTop : eSideBottom)) {
if (popupAlign == POPUPALIGNMENT_BOTTOMLEFT || popupAlign == POPUPALIGNMENT_BOTTOMRIGHT) {
aChange.y = 0;
}

View file

@ -173,8 +173,8 @@ nsResizerFrame::HandleEvent(nsPresContext* aPresContext,
if (window || menuPopupFrame) {
if (menuPopupFrame) {
menuPopupFrame->CanAdjustEdges(
(direction.mHorizontal == -1) ? NS_SIDE_LEFT : NS_SIDE_RIGHT,
(direction.mVertical == -1) ? NS_SIDE_TOP : NS_SIDE_BOTTOM, mouseMove);
(direction.mHorizontal == -1) ? eSideLeft : eSideRight,
(direction.mVertical == -1) ? eSideTop : eSideBottom, mouseMove);
}
}
else if (!contentToResize) {

View file

@ -23,10 +23,10 @@ using namespace mozilla;
nsBoxLayout* nsStackLayout::gInstance = nullptr;
#define SPECIFIED_LEFT (1 << NS_SIDE_LEFT)
#define SPECIFIED_RIGHT (1 << NS_SIDE_RIGHT)
#define SPECIFIED_TOP (1 << NS_SIDE_TOP)
#define SPECIFIED_BOTTOM (1 << NS_SIDE_BOTTOM)
#define SPECIFIED_LEFT (1 << eSideLeft)
#define SPECIFIED_RIGHT (1 << eSideRight)
#define SPECIFIED_TOP (1 << eSideTop)
#define SPECIFIED_BOTTOM (1 << eSideBottom)
nsresult
NS_NewStackLayout(nsCOMPtr<nsBoxLayout>& aNewLayout)

View file

@ -3322,7 +3322,7 @@ nsTreeBodyFrame::PaintCell(int32_t aRowIndex,
CalcComplexColor(borderStyle->mBorderLeftColor);
ColorPattern colorPatt(ToDeviceColor(color));
uint8_t style = borderStyle->GetBorderStyle(NS_SIDE_LEFT);
uint8_t style = borderStyle->GetBorderStyle(eSideLeft);
StrokeOptions strokeOptions;
nsLayoutUtils::InitDashPattern(strokeOptions, style);