--- a/gfx/public/gfxCore.h
+++ b/gfx/public/gfxCore.h
@@ -36,20 +36,25 @@
* ***** END LICENSE BLOCK ***** */
#ifndef gfxCore_h__
#define gfxCore_h__
#include "nscore.h"
// Side constants for use in various places
-#define NS_SIDE_TOP 0
-#define NS_SIDE_RIGHT 1
-#define NS_SIDE_BOTTOM 2
-#define NS_SIDE_LEFT 3
+namespace mozilla {
+ namespace css {
+ enum Side {eSideTop, eSideRight, eSideBottom, eSideLeft};
+ }
+}
+#define NS_SIDE_TOP mozilla::css::eSideTop
+#define NS_SIDE_RIGHT mozilla::css::eSideRight
+#define NS_SIDE_BOTTOM mozilla::css::eSideBottom
+#define NS_SIDE_LEFT mozilla::css::eSideLeft
#if defined(MOZ_ENABLE_LIBXUL) || !defined(MOZILLA_INTERNAL_API)
# define NS_GFX
# define NS_GFX_(type) type
# define NS_GFX_STATIC_MEMBER_(type) type
#elif defined(_IMPL_NS_GFX)
# define NS_GFX NS_EXPORT
# define NS_GFX_(type) NS_EXPORT_(type)
--- a/gfx/public/nsMargin.h
+++ b/gfx/public/nsMargin.h
@@ -59,29 +59,25 @@ struct nsMargin {
nscoord aRight, nscoord aBottom) {left += aLeft; top += aTop;
right += aRight; bottom += aBottom;}
nscoord LeftRight() const { return left + right; }
nscoord TopBottom() const { return top + bottom; }
nsPoint TopLeft() const { return nsPoint(left, top); }
-#if (NS_SIDE_TOP == 0) && (NS_SIDE_RIGHT == 1) && (NS_SIDE_BOTTOM == 2) && (NS_SIDE_LEFT == 3)
- nscoord& side(PRUint8 aSide) {
+ nscoord& side(mozilla::css::Side aSide) {
NS_PRECONDITION(aSide <= NS_SIDE_LEFT, "Out of range side");
return *(&top + aSide);
}
- nscoord side(PRUint8 aSide) const {
+ nscoord side(mozilla::css::Side aSide) const {
NS_PRECONDITION(aSide <= NS_SIDE_LEFT, "Out of range side");
return *(&top + aSide);
}
-#else
-#error "Somebody changed the side constants."
-#endif
// Overloaded operators. Note that '=' isn't defined so we'll get the
// compiler generated default assignment operator
PRBool operator==(const nsMargin& aMargin) const {
return (PRBool) ((left == aMargin.left) && (top == aMargin.top) &&
(right == aMargin.right) && (bottom == aMargin.bottom));
}
PRBool operator!=(const nsMargin& aMargin) const {
@@ -123,22 +119,22 @@ struct nsIntMargin {
PRInt32 aRight, PRInt32 aBottom) {left = aLeft; top = aTop;
right = aRight; bottom = aBottom;}
PRInt32 LeftRight() const { return left + right; }
PRInt32 TopBottom() const { return top + bottom; }
nsPoint TopLeft() const { return nsPoint(left, top); }
- PRInt32& side(PRUint8 aSide) {
+ PRInt32& side(mozilla::css::Side aSide) {
NS_PRECONDITION(aSide <= NS_SIDE_LEFT, "Out of range side");
return *(&top + aSide);
}
- PRInt32 side(PRUint8 aSide) const {
+ PRInt32 side(mozilla::css::Side aSide) const {
NS_PRECONDITION(aSide <= NS_SIDE_LEFT, "Out of range side");
return *(&top + aSide);
}
PRBool operator!=(const nsIntMargin& aMargin) const {
return (PRBool) ((left != aMargin.left) || (top != aMargin.top) ||
(right != aMargin.right) || (bottom != aMargin.bottom));
}
--- a/gfx/src/nsRect.cpp
+++ b/gfx/src/nsRect.cpp
@@ -33,16 +33,20 @@
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsRect.h"
#include "nsString.h"
#include "nsIDeviceContext.h"
+#include "prlog.h"
+
+// the mozilla::css::Side sequence must match the nsMargin nscoord sequence
+PR_STATIC_ASSERT((NS_SIDE_TOP == 0) && (NS_SIDE_RIGHT == 1) && (NS_SIDE_BOTTOM == 2) && (NS_SIDE_LEFT == 3));
// Containment
PRBool nsRect::Contains(nscoord aX, nscoord aY) const
{
return (PRBool) ((aX >= x) && (aY >= y) &&
(aX < XMost()) && (aY < YMost()));
}
--- a/gfx/thebes/public/gfxRect.h
+++ b/gfx/thebes/public/gfxRect.h
@@ -35,30 +35,47 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef GFX_RECT_H
#define GFX_RECT_H
#include "gfxTypes.h"
#include "gfxPoint.h"
+#include "gfxCore.h"
#include "nsDebug.h"
-struct THEBES_API gfxCorner {
- typedef int Corner;
- enum {
- // this order is important!
- TOP_LEFT = 0,
- TOP_RIGHT = 1,
- BOTTOM_RIGHT = 2,
- BOTTOM_LEFT = 3,
- NUM_CORNERS = 4
- };
-};
+namespace mozilla {
+ namespace css {
+ enum Corner {
+ // this order is important!
+ eCornerTopLeft = 0,
+ eCornerTopRight = 1,
+ eCornerBottomRight = 2,
+ eCornerBottomLeft = 3,
+ eNumCorners = 4
+ };
+ }
+}
+#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_FOR_CSS_CORNERS(var_) \
+ for (mozilla::css::Corner var_ = NS_CORNER_TOP_LEFT; \
+ var_ <= NS_CORNER_BOTTOM_LEFT; \
+ var_++)
+
+static inline mozilla::css::Corner operator++(mozilla::css::Corner& corner, int) {
+ NS_PRECONDITION(corner < NS_CORNER_TOP_LEFT, "Out of range corner");
+ corner = mozilla::css::Corner(corner + 1);
+ return corner;
+}
struct THEBES_API gfxRect {
// pt? point?
gfxPoint pos;
gfxSize size;
gfxRect() {}
gfxRect(const gfxRect& s) : pos(s.pos), size(s.size) {}
@@ -159,29 +176,55 @@ struct THEBES_API gfxRect {
void RoundOut();
// grabbing specific points
gfxPoint TopLeft() const { return gfxPoint(pos); }
gfxPoint TopRight() const { return pos + gfxSize(size.width, 0.0); }
gfxPoint BottomLeft() const { return pos + gfxSize(0.0, size.height); }
gfxPoint BottomRight() const { return pos + size; }
- gfxPoint Corner(gfxCorner::Corner corner) const {
+ gfxPoint AtCorner(mozilla::css::Corner corner) const {
switch (corner) {
- case gfxCorner::TOP_LEFT: return TopLeft();
- case gfxCorner::TOP_RIGHT: return TopRight();
- case gfxCorner::BOTTOM_LEFT: return BottomLeft();
- case gfxCorner::BOTTOM_RIGHT: return BottomRight();
+ case NS_CORNER_TOP_LEFT: return TopLeft();
+ case NS_CORNER_TOP_RIGHT: return TopRight();
+ case NS_CORNER_BOTTOM_RIGHT: return BottomRight();
+ case NS_CORNER_BOTTOM_LEFT: return BottomLeft();
default:
NS_ERROR("Invalid corner!");
break;
}
return gfxPoint(0.0, 0.0);
}
+ gfxPoint CCWCorner(mozilla::css::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();
+ default:
+ NS_ERROR("Invalid side!");
+ break;
+ }
+ return gfxPoint(0.0, 0.0);
+ }
+
+ gfxPoint CWCorner(mozilla::css::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();
+ default:
+ NS_ERROR("Invalid side!");
+ break;
+ }
+ return gfxPoint(0.0, 0.0);
+ }
+
/* Conditions this border to Cairo's max coordinate space.
* The caller can check IsEmpty() after Condition() -- if it's TRUE,
* the caller can possibly avoid doing any extra rendering.
*/
void Condition();
void Scale(gfxFloat k) {
NS_ASSERTION(k >= 0.0, "Invalid (negative) scale factor");
@@ -205,52 +248,52 @@ struct THEBES_API gfxRect {
pos.x /= k;
pos.y /= k;
size.width /= k;
size.height /= k;
}
};
struct THEBES_API gfxCornerSizes {
- gfxSize sizes[gfxCorner::NUM_CORNERS];
+ gfxSize sizes[NS_NUM_CORNERS];
gfxCornerSizes () { }
gfxCornerSizes (gfxFloat v) {
- for (int i = 0; i < gfxCorner::NUM_CORNERS; i++)
+ for (int i = 0; i < NS_NUM_CORNERS; i++)
sizes[i].SizeTo(v, v);
}
gfxCornerSizes (gfxFloat tl, gfxFloat tr, gfxFloat br, gfxFloat bl) {
- sizes[gfxCorner::TOP_LEFT].SizeTo(tl, tl);
- sizes[gfxCorner::TOP_RIGHT].SizeTo(tr, tr);
- sizes[gfxCorner::BOTTOM_RIGHT].SizeTo(br, br);
- sizes[gfxCorner::BOTTOM_LEFT].SizeTo(bl, bl);
+ sizes[NS_CORNER_TOP_LEFT].SizeTo(tl, tl);
+ sizes[NS_CORNER_TOP_RIGHT].SizeTo(tr, tr);
+ sizes[NS_CORNER_BOTTOM_RIGHT].SizeTo(br, br);
+ sizes[NS_CORNER_BOTTOM_LEFT].SizeTo(bl, bl);
}
gfxCornerSizes (const gfxSize& tl, const gfxSize& tr, const gfxSize& br, const gfxSize& bl) {
- sizes[gfxCorner::TOP_LEFT] = tl;
- sizes[gfxCorner::TOP_RIGHT] = tr;
- sizes[gfxCorner::BOTTOM_RIGHT] = br;
- sizes[gfxCorner::BOTTOM_LEFT] = bl;
+ sizes[NS_CORNER_TOP_LEFT] = tl;
+ sizes[NS_CORNER_TOP_RIGHT] = tr;
+ sizes[NS_CORNER_BOTTOM_RIGHT] = br;
+ sizes[NS_CORNER_BOTTOM_LEFT] = bl;
}
- const gfxSize& operator[] (gfxCorner::Corner index) const {
+ const gfxSize& operator[] (mozilla::css::Corner index) const {
return sizes[index];
}
- gfxSize& operator[] (gfxCorner::Corner index) {
+ gfxSize& operator[] (mozilla::css::Corner index) {
return sizes[index];
}
- const gfxSize TopLeft() const { return sizes[gfxCorner::TOP_LEFT]; }
- gfxSize& TopLeft() { return sizes[gfxCorner::TOP_LEFT]; }
+ const gfxSize TopLeft() const { return sizes[NS_CORNER_TOP_LEFT]; }
+ gfxSize& TopLeft() { return sizes[NS_CORNER_TOP_LEFT]; }
- const gfxSize TopRight() const { return sizes[gfxCorner::TOP_RIGHT]; }
- gfxSize& TopRight() { return sizes[gfxCorner::TOP_RIGHT]; }
+ const gfxSize TopRight() const { return sizes[NS_CORNER_TOP_RIGHT]; }
+ gfxSize& TopRight() { return sizes[NS_CORNER_TOP_RIGHT]; }
- const gfxSize BottomLeft() const { return sizes[gfxCorner::BOTTOM_LEFT]; }
- gfxSize& BottomLeft() { return sizes[gfxCorner::BOTTOM_LEFT]; }
+ const gfxSize BottomLeft() const { return sizes[NS_CORNER_BOTTOM_LEFT]; }
+ gfxSize& BottomLeft() { return sizes[NS_CORNER_BOTTOM_LEFT]; }
- const gfxSize BottomRight() const { return sizes[gfxCorner::BOTTOM_RIGHT]; }
- gfxSize& BottomRight() { return sizes[gfxCorner::BOTTOM_RIGHT]; }
+ const gfxSize BottomRight() const { return sizes[NS_CORNER_BOTTOM_RIGHT]; }
+ gfxSize& BottomRight() { return sizes[NS_CORNER_BOTTOM_RIGHT]; }
};
#endif /* GFX_RECT_H */
--- a/gfx/thebes/src/gfxContext.cpp
+++ b/gfx/thebes/src/gfxContext.cpp
@@ -888,31 +888,31 @@ gfxContext::RoundedRectangle(const gfxRe
{ -1, 0 },
{ 0, +1 } };
twoFloats *cornerMults = draw_clockwise ? cwCornerMults : ccwCornerMults;
gfxPoint pc, p0, p1, p2, p3;
if (draw_clockwise)
- cairo_move_to(mCairo, rect.pos.x + corners[gfxCorner::TOP_LEFT].width, rect.pos.y);
+ cairo_move_to(mCairo, rect.pos.x + corners[NS_CORNER_TOP_LEFT].width, rect.pos.y);
else
- cairo_move_to(mCairo, rect.pos.x + rect.size.width - corners[gfxCorner::TOP_RIGHT].width, rect.pos.y);
+ cairo_move_to(mCairo, rect.pos.x + rect.size.width - corners[NS_CORNER_TOP_RIGHT].width, rect.pos.y);
- for (int i = 0; i < gfxCorner::NUM_CORNERS; i++) {
+ NS_FOR_CSS_CORNERS(i) {
// the corner index -- either 1 2 3 0 (cw) or 0 3 2 1 (ccw)
- int c = draw_clockwise ? ((i+1) % 4) : ((4-i) % 4);
+ mozilla::css::Corner c = mozilla::css::Corner(draw_clockwise ? ((i+1) % 4) : ((4-i) % 4));
// 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
// of each corner and finding a pattern in the signs and values.
int i2 = (i+2) % 4;
int i3 = (i+3) % 4;
- pc = rect.Corner(c);
+ pc = rect.AtCorner(c);
if (corners[c].width > 0.0 && corners[c].height > 0.0) {
p0.x = pc.x + cornerMults[i].a * corners[c].width;
p0.y = pc.y + cornerMults[i].b * corners[c].height;
p3.x = pc.x + cornerMults[i3].a * corners[c].width;
p3.y = pc.y + cornerMults[i3].b * corners[c].height;
--- a/layout/base/nsCSSRendering.cpp
+++ b/layout/base/nsCSSRendering.cpp
@@ -371,17 +371,17 @@ static void DrawBorderImageComponent(nsI
const nsRect& aFill,
const nsIntRect& aSrc,
PRUint8 aHFill,
PRUint8 aVFill,
const nsSize& aUnitSize,
const nsStyleBorder& aStyleBorder,
PRUint8 aIndex);
-static nscolor MakeBevelColor(PRIntn whichSide, PRUint8 style,
+static nscolor MakeBevelColor(mozilla::css::Side whichSide, PRUint8 style,
nscolor aBackgroundColor,
nscolor aBorderColor);
static InlineBackgroundData* gInlineBGData = nsnull;
// Initialize any static variables used by nsCSSRendering.
nsresult nsCSSRendering::Init()
{
@@ -399,17 +399,17 @@ void nsCSSRendering::Shutdown()
delete gInlineBGData;
gInlineBGData = nsnull;
}
/**
* Make a bevel color
*/
static nscolor
-MakeBevelColor(PRIntn whichSide, PRUint8 style,
+MakeBevelColor(mozilla::css::Side whichSide, PRUint8 style,
nscolor aBackgroundColor, nscolor aBorderColor)
{
nscolor colors[2];
nscolor theColor;
// Given a background color and a border color
// calculate the color used for the shading
@@ -1471,17 +1471,17 @@ nsCSSRendering::PaintBackground(nsPresCo
PaintBackgroundWithSC(aPresContext, aRenderingContext, aForFrame,
aDirtyRect, aBorderArea, sc,
*aForFrame->GetStyleBorder(), aFlags,
aBGClipRect);
}
static PRBool
-IsOpaqueBorderEdge(const nsStyleBorder& aBorder, PRUint32 aSide)
+IsOpaqueBorderEdge(const nsStyleBorder& aBorder, mozilla::css::Side aSide)
{
if (aBorder.GetActualBorder().side(aSide) == 0)
return PR_TRUE;
switch (aBorder.GetBorderStyle(aSide)) {
case NS_STYLE_BORDER_STYLE_SOLID:
case NS_STYLE_BORDER_STYLE_GROOVE:
case NS_STYLE_BORDER_STYLE_RIDGE:
case NS_STYLE_BORDER_STYLE_INSET:
@@ -1513,17 +1513,17 @@ IsOpaqueBorderEdge(const nsStyleBorder&
/**
* Returns true if all border edges are either missing or opaque.
*/
static PRBool
IsOpaqueBorder(const nsStyleBorder& aBorder)
{
if (aBorder.mBorderColors)
return PR_FALSE;
- for (PRUint32 i = 0; i < 4; ++i) {
+ NS_FOR_CSS_SIDES(i) {
if (!IsOpaqueBorderEdge(aBorder, i))
return PR_FALSE;
}
return PR_TRUE;
}
static inline void
SetupDirtyRects(const nsRect& aBGClipArea, const nsRect& aCallerDirtyRect,
@@ -3076,17 +3076,17 @@ nsCSSRendering::DrawTableBorderSegment(n
DrawSolidBorderSegment(aContext, aBorder, twipsPerPixel, aStartBevelSide, aStartBevelOffset,
aEndBevelSide, aEndBevelOffset);
}
else {
nscoord startBevel = (aStartBevelOffset > 0)
? RoundFloatToPixel(0.5f * (float)aStartBevelOffset, twipsPerPixel, PR_TRUE) : 0;
nscoord endBevel = (aEndBevelOffset > 0)
? RoundFloatToPixel(0.5f * (float)aEndBevelOffset, twipsPerPixel, PR_TRUE) : 0;
- PRUint8 ridgeGrooveSide = (horizontal) ? NS_SIDE_TOP : NS_SIDE_LEFT;
+ mozilla::css::Side ridgeGrooveSide = (horizontal) ? NS_SIDE_TOP : NS_SIDE_LEFT;
// FIXME: In theory, this should use the visited-dependent
// background color, but I don't care.
aContext.SetColor (
MakeBevelColor(ridgeGrooveSide, ridgeGroove, aBGColor->mBackgroundColor, aBorderColor));
nsRect rect(aBorder);
nscoord half;
if (horizontal) { // top, bottom
half = RoundFloatToPixel(0.5f * (float)aBorder.height, twipsPerPixel);
--- a/layout/base/nsCSSRenderingBorders.cpp
+++ b/layout/base/nsCSSRenderingBorders.cpp
@@ -92,18 +92,18 @@
*/
static void ComputeBorderCornerDimensions(const gfxRect& aOuterRect,
const gfxRect& aInnerRect,
const gfxCornerSizes& aRadii,
gfxCornerSizes *aDimsResult);
// given a side index, get the previous and next side index
-#define NEXT_SIDE(_s) (((_s) + 1) & 3)
-#define PREV_SIDE(_s) (((_s) + 3) & 3)
+#define NEXT_SIDE(_s) mozilla::css::Side(((_s) + 1) & 3)
+#define PREV_SIDE(_s) mozilla::css::Side(((_s) + 3) & 3)
// from the given base color and the background color, turn
// color into a color for the given border pattern style
static gfxRGBA MakeBorderColor(const gfxRGBA& aColor,
const gfxRGBA& aBackgroundColor,
BorderColorStyle aBorderColorStyle);
@@ -132,20 +132,20 @@ CheckFourFloatsEqual(const gfxFloat *val
static bool
IsZeroSize(const gfxSize& sz) {
return sz.width == 0.0 || sz.height == 0.0;
}
static bool
AllCornersZeroSize(const gfxCornerSizes& corners) {
- return IsZeroSize(corners[0]) &&
- IsZeroSize(corners[1]) &&
- IsZeroSize(corners[2]) &&
- IsZeroSize(corners[3]);
+ return IsZeroSize(corners[NS_CORNER_TOP_LEFT]) &&
+ IsZeroSize(corners[NS_CORNER_TOP_RIGHT]) &&
+ IsZeroSize(corners[NS_CORNER_BOTTOM_RIGHT]) &&
+ IsZeroSize(corners[NS_CORNER_BOTTOM_LEFT]);
}
typedef enum {
// Normal solid square corner. Will be rectangular, the size of the
// adjacent sides. If the corner has a border radius, the corner
// will always be solid, since we don't do dotted/dashed etc.
CORNER_NORMAL,
@@ -281,88 +281,88 @@ nsCSSBorderRenderer::AreBorderSideFinalS
return ((aSides & ~(SIDE_BIT_TOP | SIDE_BIT_LEFT)) == 0 ||
(aSides & ~(SIDE_BIT_BOTTOM | SIDE_BIT_RIGHT)) == 0);
}
return PR_TRUE;
}
PRBool
-nsCSSBorderRenderer::IsSolidCornerStyle(PRUint8 aStyle, gfxCorner::Corner aCorner)
+nsCSSBorderRenderer::IsSolidCornerStyle(PRUint8 aStyle, mozilla::css::Corner aCorner)
{
switch (aStyle) {
case NS_STYLE_BORDER_STYLE_DOTTED:
case NS_STYLE_BORDER_STYLE_DASHED:
case NS_STYLE_BORDER_STYLE_SOLID:
return PR_TRUE;
case NS_STYLE_BORDER_STYLE_INSET:
case NS_STYLE_BORDER_STYLE_OUTSET:
- return (aCorner == gfxCorner::TOP_LEFT || aCorner == gfxCorner::BOTTOM_RIGHT);
+ return (aCorner == NS_CORNER_TOP_LEFT || aCorner == NS_CORNER_BOTTOM_RIGHT);
case NS_STYLE_BORDER_STYLE_GROOVE:
case NS_STYLE_BORDER_STYLE_RIDGE:
- return mOneUnitBorder && (aCorner == gfxCorner::TOP_LEFT || aCorner == gfxCorner::BOTTOM_RIGHT);
+ return mOneUnitBorder && (aCorner == NS_CORNER_TOP_LEFT || aCorner == NS_CORNER_BOTTOM_RIGHT);
case NS_STYLE_BORDER_STYLE_DOUBLE:
return mOneUnitBorder;
default:
return PR_FALSE;
}
}
BorderColorStyle
-nsCSSBorderRenderer::BorderColorStyleForSolidCorner(PRUint8 aStyle, gfxCorner::Corner aCorner)
+nsCSSBorderRenderer::BorderColorStyleForSolidCorner(PRUint8 aStyle, mozilla::css::Corner aCorner)
{
// note that this function assumes that the corner is already solid,
// as per the earlier function
switch (aStyle) {
case NS_STYLE_BORDER_STYLE_DOTTED:
case NS_STYLE_BORDER_STYLE_DASHED:
case NS_STYLE_BORDER_STYLE_SOLID:
case NS_STYLE_BORDER_STYLE_DOUBLE:
return BorderColorStyleSolid;
case NS_STYLE_BORDER_STYLE_INSET:
case NS_STYLE_BORDER_STYLE_GROOVE:
- if (aCorner == gfxCorner::TOP_LEFT)
+ if (aCorner == NS_CORNER_TOP_LEFT)
return BorderColorStyleDark;
- else if (aCorner == gfxCorner::BOTTOM_RIGHT)
+ else if (aCorner == NS_CORNER_BOTTOM_RIGHT)
return BorderColorStyleLight;
break;
case NS_STYLE_BORDER_STYLE_OUTSET:
case NS_STYLE_BORDER_STYLE_RIDGE:
- if (aCorner == gfxCorner::TOP_LEFT)
+ if (aCorner == NS_CORNER_TOP_LEFT)
return BorderColorStyleLight;
- else if (aCorner == gfxCorner::BOTTOM_RIGHT)
+ else if (aCorner == NS_CORNER_BOTTOM_RIGHT)
return BorderColorStyleDark;
break;
}
return BorderColorStyleNone;
}
void
-nsCSSBorderRenderer::DoCornerSubPath(PRUint8 aCorner)
+nsCSSBorderRenderer::DoCornerSubPath(mozilla::css::Corner aCorner)
{
gfxPoint offset(0.0, 0.0);
if (aCorner == C_TR || aCorner == C_BR)
offset.x = mOuterRect.size.width - mBorderCornerDimensions[aCorner].width;
if (aCorner == C_BR || aCorner == C_BL)
offset.y = mOuterRect.size.height - mBorderCornerDimensions[aCorner].height;
mContext->Rectangle(gfxRect(mOuterRect.pos + offset,
mBorderCornerDimensions[aCorner]));
}
void
-nsCSSBorderRenderer::DoSideClipWithoutCornersSubPath(PRUint8 aSide)
+nsCSSBorderRenderer::DoSideClipWithoutCornersSubPath(mozilla::css::Side aSide)
{
gfxPoint offset(0.0, 0.0);
// The offset from the outside rect to the start of this side's
// box. For the top and bottom sides, the height of the box
// 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.
@@ -377,17 +377,18 @@ nsCSSBorderRenderer::DoSideClipWithoutCo
} else if (aSide == NS_SIDE_LEFT) {
offset.y = mBorderCornerDimensions[C_TL].height;
}
// The sum of the width & height of the corners adjacent to the
// side. This relies on the relationship between side indexing and
// corner indexing; that is, 0 == SIDE_TOP and 0 == CORNER_TOP_LEFT,
// with both proceeding clockwise.
- gfxSize sideCornerSum = mBorderCornerDimensions[aSide] + mBorderCornerDimensions[NEXT_SIDE(aSide)];
+ gfxSize sideCornerSum = mBorderCornerDimensions[mozilla::css::Corner(aSide)]
+ + mBorderCornerDimensions[mozilla::css::Corner(NEXT_SIDE(aSide))];
gfxRect rect(mOuterRect.pos + offset,
mOuterRect.size - sideCornerSum);
if (aSide == NS_SIDE_TOP || aSide == NS_SIDE_BOTTOM)
rect.size.height = mBorderWidths[aSide];
else
rect.size.width = mBorderWidths[aSide];
@@ -430,17 +431,17 @@ MaybeMoveToMidPoint(gfxPoint& aP0, gfxPo
if (ps.x != 0.0 && ps.y != 0.0) {
gfxFloat k = NS_MIN((aMidPoint.x - aP0.x) / ps.x,
(aMidPoint.y - aP1.y) / ps.y);
aP1 = aP0 + ps * k;
}
}
void
-nsCSSBorderRenderer::DoSideClipSubPath(PRUint8 aSide)
+nsCSSBorderRenderer::DoSideClipSubPath(mozilla::css::Side aSide)
{
// the clip proceeds clockwise from the top left corner;
// so "start" in each case is the start of the region from that side.
//
// the final path will be formed like:
// s0 ------- e0
// | /
// s1 ----- e1
@@ -454,50 +455,50 @@ nsCSSBorderRenderer::DoSideClipSubPath(P
PRBool isDashed = IS_DASHED_OR_DOTTED(mBorderStyles[aSide]);
PRBool startIsDashed = IS_DASHED_OR_DOTTED(mBorderStyles[PREV_SIDE(aSide)]);
PRBool endIsDashed = IS_DASHED_OR_DOTTED(mBorderStyles[NEXT_SIDE(aSide)]);
#undef IS_DASHED_OR_DOTTED
SideClipType startType = SIDE_CLIP_TRAPEZOID;
SideClipType endType = SIDE_CLIP_TRAPEZOID;
- if (!IsZeroSize(mBorderRadii[aSide]))
+ if (!IsZeroSize(mBorderRadii[mozilla::css::Corner(aSide)]))
startType = SIDE_CLIP_TRAPEZOID_FULL;
else if (startIsDashed && isDashed)
startType = SIDE_CLIP_RECTANGLE;
- if (!IsZeroSize(mBorderRadii[NEXT_SIDE(aSide)]))
+ if (!IsZeroSize(mBorderRadii[mozilla::css::Corner(NEXT_SIDE(aSide))]))
endType = SIDE_CLIP_TRAPEZOID_FULL;
else if (endIsDashed && isDashed)
endType = SIDE_CLIP_RECTANGLE;
gfxPoint midPoint = mInnerRect.pos + mInnerRect.size / 2.0;
- start[0] = mOuterRect.Corner(aSide);
- start[1] = mInnerRect.Corner(aSide);
+ start[0] = mOuterRect.CCWCorner(aSide);
+ start[1] = mInnerRect.CCWCorner(aSide);
- end[0] = mOuterRect.Corner(NEXT_SIDE(aSide));
- end[1] = mInnerRect.Corner(NEXT_SIDE(aSide));
+ end[0] = mOuterRect.CWCorner(aSide);
+ end[1] = mInnerRect.CWCorner(aSide);
if (startType == SIDE_CLIP_TRAPEZOID_FULL) {
MaybeMoveToMidPoint(start[0], start[1], midPoint);
} else if (startType == SIDE_CLIP_RECTANGLE) {
if (aSide == NS_SIDE_TOP || aSide == NS_SIDE_BOTTOM)
- start[1] = gfxPoint(mOuterRect.Corner(aSide).x, mInnerRect.Corner(aSide).y);
+ start[1] = gfxPoint(mOuterRect.CCWCorner(aSide).x, mInnerRect.CCWCorner(aSide).y);
else
- start[1] = gfxPoint(mInnerRect.Corner(aSide).x, mOuterRect.Corner(aSide).y);
+ start[1] = gfxPoint(mInnerRect.CCWCorner(aSide).x, mOuterRect.CCWCorner(aSide).y);
}
if (endType == SIDE_CLIP_TRAPEZOID_FULL) {
MaybeMoveToMidPoint(end[0], end[1], midPoint);
} else if (endType == SIDE_CLIP_RECTANGLE) {
if (aSide == NS_SIDE_TOP || aSide == NS_SIDE_BOTTOM)
- end[0] = gfxPoint(mInnerRect.Corner(NEXT_SIDE(aSide)).x, mOuterRect.Corner(NEXT_SIDE(aSide)).y);
+ end[0] = gfxPoint(mInnerRect.CWCorner(aSide).x, mOuterRect.CWCorner(aSide).y);
else
- end[0] = gfxPoint(mOuterRect.Corner(NEXT_SIDE(aSide)).x, mInnerRect.Corner(NEXT_SIDE(aSide)).y);
+ end[0] = gfxPoint(mOuterRect.CWCorner(aSide).x, mInnerRect.CWCorner(aSide).y);
}
mContext->MoveTo(start[0]);
mContext->LineTo(end[0]);
mContext->LineTo(end[1]);
mContext->LineTo(start[1]);
mContext->ClosePath();
}
@@ -904,17 +905,17 @@ nsCSSBorderRenderer::DrawBorderSides(PRI
ComputeInnerRadii(radii, borderWidths[i], &radii);
// And now soRect is the same as siRect, for the next line in.
soRect = siRect;
}
}
void
-nsCSSBorderRenderer::DrawDashedSide(PRUint8 aSide)
+nsCSSBorderRenderer::DrawDashedSide(mozilla::css::Side aSide)
{
gfxFloat dashWidth;
gfxFloat dash[2];
PRUint8 style = mBorderStyles[aSide];
gfxFloat borderWidth = mBorderWidths[aSide];
nscolor borderColor = mBorderColors[aSide];
@@ -949,18 +950,18 @@ nsCSSBorderRenderer::DrawDashedSide(PRUi
NS_ERROR("DrawDashedSide called with style other than DASHED or DOTTED; someone's not playing nice");
return;
}
SF("dash: %f %f\n", dash[0], dash[1]);
mContext->SetDash(dash, 2, 0.0);
- gfxPoint start = mOuterRect.Corner(aSide);
- gfxPoint end = mOuterRect.Corner(NEXT_SIDE(aSide));
+ gfxPoint start = mOuterRect.CCWCorner(aSide);
+ gfxPoint end = mOuterRect.CWCorner(aSide);
if (aSide == NS_SIDE_TOP) {
start.x += mBorderCornerDimensions[C_TL].width;
end.x -= mBorderCornerDimensions[C_TR].width;
start.y += borderWidth / 2.0;
end.y += borderWidth / 2.0;
} else if (aSide == NS_SIDE_RIGHT) {
@@ -1076,32 +1077,32 @@ nsCSSBorderRenderer::DrawBorders()
* If we have a 1px-wide border, the corners are going to be
* negligible, so don't bother doing anything fancy. Just extend
* the top and bottom borders to the right 1px and the left border
* to the bottom 1px. We do this by twiddling the corner dimensions,
* which causes the right to happen later on. Only do this if we have
* a 1.0 unit border all around and no border radius.
*/
- for (int corner = 0; corner < gfxCorner::NUM_CORNERS; corner++) {
- const PRIntn sides[2] = { corner, PREV_SIDE(corner) };
+ NS_FOR_CSS_CORNERS(corner) {
+ const mozilla::css::Side sides[2] = { mozilla::css::Side(corner), PREV_SIDE(corner) };
if (!IsZeroSize(mBorderRadii[corner]))
continue;
if (mBorderWidths[sides[0]] == 1.0 && mBorderWidths[sides[1]] == 1.0) {
- if (corner == gfxCorner::TOP_LEFT || corner == gfxCorner::TOP_RIGHT)
+ if (corner == NS_CORNER_TOP_LEFT || corner == NS_CORNER_TOP_RIGHT)
mBorderCornerDimensions[corner].width = 0.0;
else
mBorderCornerDimensions[corner].height = 0.0;
}
}
// First, the corners
- for (int corner = 0; corner < gfxCorner::NUM_CORNERS; corner++) {
+ NS_FOR_CSS_CORNERS(corner) {
// if there's no corner, don't do all this work for it
if (IsZeroSize(mBorderCornerDimensions[corner]))
continue;
const PRIntn sides[2] = { corner, PREV_SIDE(corner) };
PRIntn sideBits = (1 << sides[0]) | (1 << sides[1]);
PRBool simpleCornerStyle = mCompositeColors[sides[0]] == NULL &&
@@ -1145,17 +1146,17 @@ nsCSSBorderRenderer::DrawBorders()
// avoid the temporary, but that situation doesn't happen all
// that often in practice (we double buffer to no-alpha
// surfaces).
mContext->PushGroup(gfxASurface::CONTENT_COLOR_ALPHA);
mContext->SetOperator(gfxContext::OPERATOR_ADD);
for (int cornerSide = 0; cornerSide < 2; cornerSide++) {
- PRUint8 side = sides[cornerSide];
+ mozilla::css::Side side = mozilla::css::Side(sides[cornerSide]);
PRUint8 style = mBorderStyles[side];
SF("corner: %d cornerSide: %d side: %d style: %d\n", corner, cornerSide, side, style);
mContext->Save();
mContext->NewPath();
DoSideClipSubPath(side);
--- a/layout/base/nsCSSRenderingBorders.h
+++ b/layout/base/nsCSSRenderingBorders.h
@@ -54,20 +54,20 @@
//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_BITS_ALL (SIDE_BIT_TOP|SIDE_BIT_RIGHT|SIDE_BIT_BOTTOM|SIDE_BIT_LEFT)
-#define C_TL (gfxCorner::TOP_LEFT)
-#define C_TR (gfxCorner::TOP_RIGHT)
-#define C_BR (gfxCorner::BOTTOM_RIGHT)
-#define C_BL (gfxCorner::BOTTOM_LEFT)
+#define C_TL NS_CORNER_TOP_LEFT
+#define C_TR NS_CORNER_TOP_RIGHT
+#define C_BR NS_CORNER_BOTTOM_RIGHT
+#define C_BL NS_CORNER_BOTTOM_LEFT
/*
* Helper class that handles border rendering.
*
* appUnitsPerPixel -- current value of AUPP
* destContext -- the gfxContext to which the border should be rendered
* outsideRect -- the rectangle on the outer edge of the border
*
@@ -136,39 +136,39 @@ struct nsCSSBorderRenderer {
PRPackedBool mOneUnitBorder;
PRPackedBool mNoBorderRadius;
// For all the sides in the bitmask, would they be rendered
// in an identical color and style?
PRBool AreBorderSideFinalStylesSame(PRUint8 aSides);
// For the given style, is the given corner a solid color?
- PRBool IsSolidCornerStyle(PRUint8 aStyle, gfxCorner::Corner aCorner);
+ PRBool IsSolidCornerStyle(PRUint8 aStyle, mozilla::css::Corner aCorner);
// For the given solid corner, what color style should be used?
- BorderColorStyle BorderColorStyleForSolidCorner(PRUint8 aStyle, gfxCorner::Corner aCorner);
+ BorderColorStyle BorderColorStyleForSolidCorner(PRUint8 aStyle, mozilla::css::Corner aCorner);
//
// Path generation functions
//
// add the path for drawing the given corner to the context
- void DoCornerSubPath(PRUint8 aCorner);
+ void DoCornerSubPath(mozilla::css::Corner aCorner);
// add the path for drawing the given side without any adjacent corners to the context
- void DoSideClipWithoutCornersSubPath(PRUint8 aSide);
+ void DoSideClipWithoutCornersSubPath(mozilla::css::Side aSide);
// Create a clip path for the wedge that this side of
// the border should take up. This is only called
// when we're drawing separate border sides, so we know
// that ADD compositing is taking place.
//
// This code needs to make sure that the individual pieces
// don't ever (mathematically) overlap; the pixel overlap
// is taken care of by the ADD compositing.
- void DoSideClipSubPath(PRUint8 aSide);
+ void DoSideClipSubPath(mozilla::css::Side aSide);
// Given a set of sides to fill and a color, do so in the fastest way.
//
// Stroke tends to be faster for smaller borders because it doesn't go
// through the tessellator, which has initialization overhead. If
// we're rendering all sides, we can use stroke at any thickness; we
// also do TL/BR pairs at 1px thickness using stroke.
//
@@ -191,17 +191,17 @@ struct nsCSSBorderRenderer {
// draw the border for the given sides, using the style of the first side
// present in the bitmask
void DrawBorderSides (PRIntn aSides);
// function used by the above to handle -moz-border-colors
void DrawBorderSidesCompositeColors(PRIntn aSides, const nsBorderColors *compositeColors);
// draw the given dashed side
- void DrawDashedSide (PRUint8 aSide);
+ void DrawDashedSide (mozilla::css::Side aSide);
// draw the entire border
void DrawBorders ();
// utility function used for background painting as well as borders
static void ComputeInnerRadii(const gfxCornerSizes& aRadii,
const gfxFloat *aBorderSizes,
gfxCornerSizes *aInnerRadiiRet);
--- a/layout/base/nsLayoutUtils.cpp
+++ b/layout/base/nsLayoutUtils.cpp
@@ -3154,33 +3154,33 @@ nsLayoutUtils::HasNonZeroCorner(const ns
NS_FOR_CSS_HALF_CORNERS(corner) {
if (NonZeroStyleCoord(aCorners.Get(corner)))
return PR_TRUE;
}
return PR_FALSE;
}
// aCorner is a "full corner" value, i.e. NS_CORNER_TOP_LEFT etc
-static PRBool IsCornerAdjacentToSide(PRUint8 aCorner, PRUint8 aSide)
+static PRBool IsCornerAdjacentToSide(PRUint8 aCorner, mozilla::css::Side aSide)
{
- PR_STATIC_ASSERT(NS_SIDE_TOP == NS_CORNER_TOP_LEFT);
- PR_STATIC_ASSERT(NS_SIDE_RIGHT == NS_CORNER_TOP_RIGHT);
- PR_STATIC_ASSERT(NS_SIDE_BOTTOM == NS_CORNER_BOTTOM_RIGHT);
- PR_STATIC_ASSERT(NS_SIDE_LEFT == NS_CORNER_BOTTOM_LEFT);
- PR_STATIC_ASSERT(NS_SIDE_TOP == ((NS_CORNER_TOP_RIGHT - 1)&3));
- PR_STATIC_ASSERT(NS_SIDE_RIGHT == ((NS_CORNER_BOTTOM_RIGHT - 1)&3));
- PR_STATIC_ASSERT(NS_SIDE_BOTTOM == ((NS_CORNER_BOTTOM_LEFT - 1)&3));
- PR_STATIC_ASSERT(NS_SIDE_LEFT == ((NS_CORNER_TOP_LEFT - 1)&3));
+ PR_STATIC_ASSERT((int)NS_SIDE_TOP == NS_CORNER_TOP_LEFT);
+ PR_STATIC_ASSERT((int)NS_SIDE_RIGHT == NS_CORNER_TOP_RIGHT);
+ PR_STATIC_ASSERT((int)NS_SIDE_BOTTOM == NS_CORNER_BOTTOM_RIGHT);
+ PR_STATIC_ASSERT((int)NS_SIDE_LEFT == NS_CORNER_BOTTOM_LEFT);
+ PR_STATIC_ASSERT((int)NS_SIDE_TOP == ((NS_CORNER_TOP_RIGHT - 1)&3));
+ PR_STATIC_ASSERT((int)NS_SIDE_RIGHT == ((NS_CORNER_BOTTOM_RIGHT - 1)&3));
+ PR_STATIC_ASSERT((int)NS_SIDE_BOTTOM == ((NS_CORNER_BOTTOM_LEFT - 1)&3));
+ PR_STATIC_ASSERT((int)NS_SIDE_LEFT == ((NS_CORNER_TOP_LEFT - 1)&3));
return aSide == aCorner || aSide == ((aCorner - 1)&3);
}
/* static */ PRBool
nsLayoutUtils::HasNonZeroCornerOnSide(const nsStyleCorners& aCorners,
- PRUint8 aSide)
+ mozilla::css::Side aSide)
{
PR_STATIC_ASSERT(NS_CORNER_TOP_LEFT_X/2 == NS_CORNER_TOP_LEFT);
PR_STATIC_ASSERT(NS_CORNER_TOP_LEFT_Y/2 == NS_CORNER_TOP_LEFT);
PR_STATIC_ASSERT(NS_CORNER_TOP_RIGHT_X/2 == NS_CORNER_TOP_RIGHT);
PR_STATIC_ASSERT(NS_CORNER_TOP_RIGHT_Y/2 == NS_CORNER_TOP_RIGHT);
PR_STATIC_ASSERT(NS_CORNER_BOTTOM_RIGHT_X/2 == NS_CORNER_BOTTOM_RIGHT);
PR_STATIC_ASSERT(NS_CORNER_BOTTOM_RIGHT_Y/2 == NS_CORNER_BOTTOM_RIGHT);
PR_STATIC_ASSERT(NS_CORNER_BOTTOM_LEFT_X/2 == NS_CORNER_BOTTOM_LEFT);
--- a/layout/base/nsLayoutUtils.h
+++ b/layout/base/nsLayoutUtils.h
@@ -1028,17 +1028,17 @@ public:
*/
static PRBool HasNonZeroCorner(const nsStyleCorners& aCorners);
/**
* Determine if there is any corner radius on corners adjacent to the
* given side.
*/
static PRBool HasNonZeroCornerOnSide(const nsStyleCorners& aCorners,
- PRUint8 aSide);
+ mozilla::css::Side aSide);
/**
* Determine if a widget is likely to require transparency or translucency.
* @param aBackgroundFrame The frame that the background is set on. For
* <window>s, this will be the canvas frame.
* @param aCSSRootFrame The frame that holds CSS properties affecting
* the widget's transparency. For menupopups,
* aBackgroundFrame and aCSSRootFrame will be the
--- a/layout/base/nsStyleConsts.h
+++ b/layout/base/nsStyleConsts.h
@@ -37,36 +37,36 @@
*
* ***** END LICENSE BLOCK ***** */
/* constants used in the style struct data provided by nsStyleContext */
#ifndef nsStyleConsts_h___
#define nsStyleConsts_h___
+#include "gfxRect.h"
#include "nsFont.h"
// cairo doesn't support invert
// #define GFX_HAS_INVERT
// XXX fold this into nsStyleContext and group by nsStyleXXX struct
// Indices into border/padding/margin arrays
-#define NS_SIDE_TOP 0
-#define NS_SIDE_RIGHT 1
-#define NS_SIDE_BOTTOM 2
-#define NS_SIDE_LEFT 3
+#define NS_SIDE_TOP mozilla::css::eSideTop
+#define NS_SIDE_RIGHT mozilla::css::eSideRight
+#define NS_SIDE_BOTTOM mozilla::css::eSideBottom
+#define NS_SIDE_LEFT mozilla::css::eSideLeft
-#define NS_FOR_CSS_SIDES(var_) for (PRInt32 var_ = 0; var_ < 4; ++var_)
-
-// Indices into "full corner" arrays (nsCSSCornerSizes e.g.)
-#define NS_CORNER_TOP_LEFT 0
-#define NS_CORNER_TOP_RIGHT 1
-#define NS_CORNER_BOTTOM_RIGHT 2
-#define NS_CORNER_BOTTOM_LEFT 3
+#define NS_FOR_CSS_SIDES(var_) for (mozilla::css::Side var_ = NS_SIDE_TOP; var_ <= NS_SIDE_LEFT; var_++)
+static inline mozilla::css::Side operator++(mozilla::css::Side& side, int) {
+ NS_PRECONDITION(side < NS_SIDE_LEFT, "Out of range side");
+ side = mozilla::css::Side(side + 1);
+ return side;
+}
#define NS_FOR_CSS_FULL_CORNERS(var_) for (PRInt32 var_ = 0; var_ < 4; ++var_)
// Indices into "half corner" arrays (nsStyleCorners e.g.)
#define NS_CORNER_TOP_LEFT_X 0
#define NS_CORNER_TOP_LEFT_Y 1
#define NS_CORNER_TOP_RIGHT_X 2
#define NS_CORNER_TOP_RIGHT_Y 3
--- a/layout/generic/nsContainerFrame.cpp
+++ b/layout/generic/nsContainerFrame.cpp
@@ -599,17 +599,17 @@ nsContainerFrame::DoInlineIntrinsicWidth
nsLayoutUtils::IntrinsicWidthType aType)
{
if (GetPrevInFlow())
return; // Already added.
NS_PRECONDITION(aType == nsLayoutUtils::MIN_WIDTH ||
aType == nsLayoutUtils::PREF_WIDTH, "bad type");
- PRUint8 startSide, endSide;
+ mozilla::css::Side startSide, endSide;
if (GetStyleVisibility()->mDirection == NS_STYLE_DIRECTION_LTR) {
startSide = NS_SIDE_LEFT;
endSide = NS_SIDE_RIGHT;
} else {
startSide = NS_SIDE_RIGHT;
endSide = NS_SIDE_LEFT;
}
--- a/layout/style/nsCSSStruct.cpp
+++ b/layout/style/nsCSSStruct.cpp
@@ -52,16 +52,17 @@
#include "nsCSSProps.h"
#include "nsFont.h"
#include "nsStyleConsts.h"
#include "nsCOMPtr.h"
#include "nsReadableUtils.h"
#include "nsPrintfCString.h"
+#include "prlog.h"
// --- nsCSSFont -----------------
nsCSSFont::nsCSSFont(void)
{
MOZ_COUNT_CTOR(nsCSSFont);
}
@@ -168,19 +169,17 @@ nsCSSRect::~nsCSSRect()
void nsCSSRect::SetAllSidesTo(const nsCSSValue& aValue)
{
mTop = aValue;
mRight = aValue;
mBottom = aValue;
mLeft = aValue;
}
-#if (NS_SIDE_TOP != 0) || (NS_SIDE_RIGHT != 1) || (NS_SIDE_BOTTOM != 2) || (NS_SIDE_LEFT != 3)
-#error "Somebody changed the side constants."
-#endif
+PR_STATIC_ASSERT((NS_SIDE_TOP == 0) && (NS_SIDE_RIGHT == 1) && (NS_SIDE_BOTTOM == 2) && (NS_SIDE_LEFT == 3));
/* static */ const nsCSSRect::side_type nsCSSRect::sides[4] = {
&nsCSSRect::mTop,
&nsCSSRect::mRight,
&nsCSSRect::mBottom,
&nsCSSRect::mLeft,
};
@@ -208,20 +207,18 @@ nsCSSCornerSizes::~nsCSSCornerSizes()
void
nsCSSCornerSizes::Reset()
{
NS_FOR_CSS_FULL_CORNERS(corner) {
this->GetFullCorner(corner).Reset();
}
}
-#if NS_CORNER_TOP_LEFT != 0 || NS_CORNER_TOP_RIGHT != 1 || \
- NS_CORNER_BOTTOM_RIGHT != 2 || NS_CORNER_BOTTOM_LEFT != 3
-#error "Somebody changed the corner constants."
-#endif
+PR_STATIC_ASSERT(NS_CORNER_TOP_LEFT == 0 && NS_CORNER_TOP_RIGHT == 1 && \
+ NS_CORNER_BOTTOM_RIGHT == 2 && NS_CORNER_BOTTOM_LEFT == 3);
/* static */ const nsCSSCornerSizes::corner_type
nsCSSCornerSizes::corners[4] = {
&nsCSSCornerSizes::mTopLeft,
&nsCSSCornerSizes::mTopRight,
&nsCSSCornerSizes::mBottomRight,
&nsCSSCornerSizes::mBottomLeft,
};
--- a/layout/style/nsComputedDOMStyle.cpp
+++ b/layout/style/nsComputedDOMStyle.cpp
@@ -3303,17 +3303,17 @@ nsComputedDOMStyle::GetROCSSValueList(PR
nsDOMCSSValueList *valueList = new nsDOMCSSValueList(aCommaDelimited,
PR_TRUE);
NS_ASSERTION(valueList != 0, "ran out of memory");
return valueList;
}
nsresult
-nsComputedDOMStyle::GetOffsetWidthFor(PRUint8 aSide, nsIDOMCSSValue** aValue)
+nsComputedDOMStyle::GetOffsetWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue)
{
const nsStyleDisplay* display = GetStyleDisplay();
AssertFlushedPendingReflows();
nsresult rv = NS_OK;
switch (display->mPosition) {
case NS_STYLE_POSITION_STATIC:
@@ -3330,17 +3330,17 @@ nsComputedDOMStyle::GetOffsetWidthFor(PR
NS_ERROR("Invalid position");
break;
}
return rv;
}
nsresult
-nsComputedDOMStyle::GetAbsoluteOffset(PRUint8 aSide, nsIDOMCSSValue** aValue)
+nsComputedDOMStyle::GetAbsoluteOffset(mozilla::css::Side aSide, nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
nsIFrame* container = GetContainingBlockFor(mOuterFrame);
if (container) {
nsMargin margin = mOuterFrame->GetUsedMargin();
nsMargin border = container->GetUsedBorder();
@@ -3390,25 +3390,21 @@ nsComputedDOMStyle::GetAbsoluteOffset(PR
} else {
// XXX no frame. This property makes no sense
val->SetAppUnits(0);
}
return CallQueryInterface(val, aValue);
}
-
-#if (NS_SIDE_TOP == 0) && (NS_SIDE_RIGHT == 1) && (NS_SIDE_BOTTOM == 2) && (NS_SIDE_LEFT == 3)
-#define NS_OPPOSITE_SIDE(s_) (((s_) + 2) & 3)
-#else
-#error "Somebody changed the side constants."
-#endif
+PR_STATIC_ASSERT((NS_SIDE_TOP == 0) && (NS_SIDE_RIGHT == 1) && (NS_SIDE_BOTTOM == 2) && (NS_SIDE_LEFT == 3));
+#define NS_OPPOSITE_SIDE(s_) mozilla::css::Side(((s_) + 2) & 3)
nsresult
-nsComputedDOMStyle::GetRelativeOffset(PRUint8 aSide, nsIDOMCSSValue** aValue)
+nsComputedDOMStyle::GetRelativeOffset(mozilla::css::Side aSide, nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
const nsStylePosition* positionData = GetStylePosition();
PRInt32 sign = 1;
nsStyleCoord coord = positionData->mOffset.Get(aSide);
@@ -3429,29 +3425,29 @@ nsComputedDOMStyle::GetRelativeOffset(PR
}
val->SetAppUnits(sign * StyleCoordToNSCoord(coord, baseGetter, 0));
return CallQueryInterface(val, aValue);
}
nsresult
-nsComputedDOMStyle::GetStaticOffset(PRUint8 aSide, nsIDOMCSSValue** aValue)
+nsComputedDOMStyle::GetStaticOffset(mozilla::css::Side aSide, nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue *val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
SetValueToCoord(val, GetStylePosition()->mOffset.Get(aSide));
return CallQueryInterface(val, aValue);
}
nsresult
-nsComputedDOMStyle::GetPaddingWidthFor(PRUint8 aSide, nsIDOMCSSValue** aValue)
+nsComputedDOMStyle::GetPaddingWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
if (!mInnerFrame) {
SetValueToCoord(val, GetStylePadding()->mPadding.Get(aSide));
} else {
AssertFlushedPendingReflows();
@@ -3489,17 +3485,17 @@ nsComputedDOMStyle::GetLineHeightCoord(n
aCoord = NSToCoordRound((float(aCoord) *
(float(font->mSize) / float(font->mFont.size))) /
mPresShell->GetPresContext()->TextZoom());
return PR_TRUE;
}
nsresult
-nsComputedDOMStyle::GetBorderColorsFor(PRUint8 aSide, nsIDOMCSSValue** aValue)
+nsComputedDOMStyle::GetBorderColorsFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue)
{
const nsStyleBorder *border = GetStyleBorder();
if (border->mBorderColors) {
nsBorderColors* borderColors = border->mBorderColors[aSide];
if (borderColors) {
nsDOMCSSValueList *valueList = GetROCSSValueList(PR_FALSE);
NS_ENSURE_TRUE(valueList, NS_ERROR_OUT_OF_MEMORY);
@@ -3536,17 +3532,17 @@ nsComputedDOMStyle::GetBorderColorsFor(P
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
val->SetIdent(eCSSKeyword_none);
return CallQueryInterface(val, aValue);
}
nsresult
-nsComputedDOMStyle::GetBorderWidthFor(PRUint8 aSide, nsIDOMCSSValue** aValue)
+nsComputedDOMStyle::GetBorderWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
nscoord width;
if (mInnerFrame) {
AssertFlushedPendingReflows();
width = mInnerFrame->GetUsedBorder().side(aSide);
@@ -3554,17 +3550,17 @@ nsComputedDOMStyle::GetBorderWidthFor(PR
width = GetStyleBorder()->GetActualBorderWidth(aSide);
}
val->SetAppUnits(width);
return CallQueryInterface(val, aValue);
}
nsresult
-nsComputedDOMStyle::GetBorderColorFor(PRUint8 aSide, nsIDOMCSSValue** aValue)
+nsComputedDOMStyle::GetBorderColorFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
nscolor color;
PRBool foreground;
GetStyleBorder()->GetBorderColor(aSide, color, foreground);
if (foreground) {
@@ -3576,34 +3572,34 @@ nsComputedDOMStyle::GetBorderColorFor(PR
delete val;
return rv;
}
return CallQueryInterface(val, aValue);
}
nsresult
-nsComputedDOMStyle::GetMarginWidthFor(PRUint8 aSide, nsIDOMCSSValue** aValue)
+nsComputedDOMStyle::GetMarginWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
if (!mInnerFrame) {
SetValueToCoord(val, GetStyleMargin()->mMargin.Get(aSide));
} else {
AssertFlushedPendingReflows();
val->SetAppUnits(mInnerFrame->GetUsedMargin().side(aSide));
}
return CallQueryInterface(val, aValue);
}
nsresult
-nsComputedDOMStyle::GetBorderStyleFor(PRUint8 aSide, nsIDOMCSSValue** aValue)
+nsComputedDOMStyle::GetBorderStyleFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue)
{
nsROCSSPrimitiveValue* val = GetROCSSPrimitiveValue();
NS_ENSURE_TRUE(val, NS_ERROR_OUT_OF_MEMORY);
val->SetIdent(
nsCSSProps::ValueToKeywordEnum(GetStyleBorder()->GetBorderStyle(aSide),
nsCSSProps::kBorderStyleKTable));
--- a/layout/style/nsComputedDOMStyle.h
+++ b/layout/style/nsComputedDOMStyle.h
@@ -111,35 +111,35 @@ private:
}
#include "nsStyleStructList.h"
#undef STYLE_STRUCT
nsresult GetEllipseRadii(const nsStyleCorners& aRadius,
PRUint8 aFullCorner,
nsIDOMCSSValue** aValue);
- nsresult GetOffsetWidthFor(PRUint8 aSide, nsIDOMCSSValue** aValue);
+ nsresult GetOffsetWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue);
- nsresult GetAbsoluteOffset(PRUint8 aSide, nsIDOMCSSValue** aValue);
+ nsresult GetAbsoluteOffset(mozilla::css::Side aSide, nsIDOMCSSValue** aValue);
- nsresult GetRelativeOffset(PRUint8 aSide, nsIDOMCSSValue** aValue);
+ nsresult GetRelativeOffset(mozilla::css::Side aSide, nsIDOMCSSValue** aValue);
- nsresult GetStaticOffset(PRUint8 aSide, nsIDOMCSSValue** aValue);
+ nsresult GetStaticOffset(mozilla::css::Side aSide, nsIDOMCSSValue** aValue);
- nsresult GetPaddingWidthFor(PRUint8 aSide, nsIDOMCSSValue** aValue);
+ nsresult GetPaddingWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue);
- nsresult GetBorderColorsFor(PRUint8 aSide, nsIDOMCSSValue** aValue);
+ nsresult GetBorderColorsFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue);
- nsresult GetBorderStyleFor(PRUint8 aSide, nsIDOMCSSValue** aValue);
+ nsresult GetBorderStyleFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue);
- nsresult GetBorderWidthFor(PRUint8 aSide, nsIDOMCSSValue** aValue);
+ nsresult GetBorderWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue);
- nsresult GetBorderColorFor(PRUint8 aSide, nsIDOMCSSValue** aValue);
+ nsresult GetBorderColorFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue);
- nsresult GetMarginWidthFor(PRUint8 aSide, nsIDOMCSSValue** aValue);
+ nsresult GetMarginWidthFor(mozilla::css::Side aSide, nsIDOMCSSValue** aValue);
PRBool GetLineHeightCoord(nscoord& aCoord);
nsresult GetCSSShadowArray(nsCSSShadowArray* aArray,
const nscolor& aDefaultColor,
PRBool aIsBoxShadow,
nsIDOMCSSValue** aValue);
--- a/layout/style/nsRuleNode.cpp
+++ b/layout/style/nsRuleNode.cpp
@@ -2304,17 +2304,17 @@ nsRuleNode::SetDefaultOnRoot(const nsSty
* input).
*/
void
nsRuleNode::AdjustLogicalBoxProp(nsStyleContext* aContext,
const nsCSSValue& aLTRSource,
const nsCSSValue& aRTLSource,
const nsCSSValue& aLTRLogicalValue,
const nsCSSValue& aRTLLogicalValue,
- PRUint8 aSide,
+ mozilla::css::Side aSide,
nsCSSRect& aValueRect,
PRBool& aCanStoreInRuleTree)
{
PRBool LTRlogical = aLTRSource.GetUnit() == eCSSUnit_Enumerated &&
aLTRSource.GetIntValue() == NS_BOXPROP_SOURCE_LOGICAL;
PRBool RTLlogical = aRTLSource.GetUnit() == eCSSUnit_Enumerated &&
aRTLSource.GetIntValue() == NS_BOXPROP_SOURCE_LOGICAL;
if (LTRlogical || RTLlogical) {
--- a/layout/style/nsRuleNode.h
+++ b/layout/style/nsRuleNode.h
@@ -644,17 +644,17 @@ protected:
nscoord aMinFontSize,
nsStyleFont* aFont);
void AdjustLogicalBoxProp(nsStyleContext* aContext,
const nsCSSValue& aLTRSource,
const nsCSSValue& aRTLSource,
const nsCSSValue& aLTRLogicalValue,
const nsCSSValue& aRTLLogicalValue,
- PRUint8 aSide,
+ mozilla::css::Side aSide,
nsCSSRect& aValueRect,
PRBool& aCanStoreInRuleTree);
inline RuleDetail CheckSpecifiedProperties(const nsStyleStructID aSID, const nsRuleDataStruct& aRuleDataStruct);
const void* GetParentData(const nsStyleStructID aSID);
#define STYLE_STRUCT(name_, checkdata_cb_, ctor_args_) \
const nsStyle##name_* GetParent##name_();
--- a/layout/style/nsStyleAnimation.cpp
+++ b/layout/style/nsStyleAnimation.cpp
@@ -1231,17 +1231,17 @@ StyleDataAtOffset(const void* aStyleStru
inline void*
StyleDataAtOffset(void* aStyleStruct, ptrdiff_t aOffset)
{
return reinterpret_cast<char*>(aStyleStruct) + aOffset;
}
static void
ExtractBorderColor(nsStyleContext* aStyleContext, const void* aStyleBorder,
- PRUint8 aSide, nsStyleAnimation::Value& aComputedValue)
+ mozilla::css::Side aSide, nsStyleAnimation::Value& aComputedValue)
{
nscolor color;
PRBool foreground;
static_cast<const nsStyleBorder*>(aStyleBorder)->
GetBorderColor(aSide, color, foreground);
if (foreground) {
// FIXME: should add test for this
color = aStyleContext->GetStyleColor()->mColor;
@@ -1663,17 +1663,17 @@ nsStyleAnimation::ExtractComputedValue(n
PR_STATIC_ASSERT(eStyleAnimType_Sides_Right - eStyleAnimType_Sides_Top
== NS_SIDE_RIGHT);
PR_STATIC_ASSERT(eStyleAnimType_Sides_Bottom - eStyleAnimType_Sides_Top
== NS_SIDE_BOTTOM);
PR_STATIC_ASSERT(eStyleAnimType_Sides_Left - eStyleAnimType_Sides_Top
== NS_SIDE_LEFT);
const nsStyleCoord &coord = static_cast<const nsStyleSides*>(
StyleDataAtOffset(styleStruct, ssOffset))->
- Get(animType - eStyleAnimType_Sides_Top);
+ Get(mozilla::css::Side(animType - eStyleAnimType_Sides_Top));
return StyleCoordToValue(coord, aComputedValue);
}
case eStyleAnimType_Corner_TopLeft:
case eStyleAnimType_Corner_TopRight:
case eStyleAnimType_Corner_BottomRight:
case eStyleAnimType_Corner_BottomLeft: {
PR_STATIC_ASSERT(0 == NS_CORNER_TOP_LEFT);
PR_STATIC_ASSERT(eStyleAnimType_Corner_TopRight -
--- a/layout/style/nsStyleCoord.h
+++ b/layout/style/nsStyleCoord.h
@@ -129,33 +129,31 @@ public:
class nsStyleSides {
public:
nsStyleSides(void);
// nsStyleSides& operator=(const nsStyleSides& aCopy); // use compiler's version
PRBool operator==(const nsStyleSides& aOther) const;
PRBool operator!=(const nsStyleSides& aOther) const;
- // aSide is always one of NS_SIDE_* defined in nsStyleConsts.h
-
- inline nsStyleUnit GetUnit(PRUint8 aSide) const;
+ inline nsStyleUnit GetUnit(mozilla::css::Side aSide) const;
inline nsStyleUnit GetLeftUnit(void) const;
inline nsStyleUnit GetTopUnit(void) const;
inline nsStyleUnit GetRightUnit(void) const;
inline nsStyleUnit GetBottomUnit(void) const;
- inline nsStyleCoord Get(PRUint8 aSide) const;
+ inline nsStyleCoord Get(mozilla::css::Side aSide) const;
inline nsStyleCoord GetLeft() const;
inline nsStyleCoord GetTop() const;
inline nsStyleCoord GetRight() const;
inline nsStyleCoord GetBottom() const;
void Reset(void);
- inline void Set(PRUint8 aSide, const nsStyleCoord& aCoord);
+ inline void Set(mozilla::css::Side aSide, const nsStyleCoord& aCoord);
inline void SetLeft(const nsStyleCoord& aCoord);
inline void SetTop(const nsStyleCoord& aCoord);
inline void SetRight(const nsStyleCoord& aCoord);
inline void SetBottom(const nsStyleCoord& aCoord);
protected:
PRUint8 mUnits[4];
nsStyleUnion mValues[4];
@@ -281,17 +279,17 @@ inline void nsStyleCoord::GetUnionValue(
// -------------------------
// nsStyleSides inlines
//
inline PRBool nsStyleSides::operator!=(const nsStyleSides& aOther) const
{
return !((*this) == aOther);
}
-inline nsStyleUnit nsStyleSides::GetUnit(PRUint8 aSide) const
+inline nsStyleUnit nsStyleSides::GetUnit(mozilla::css::Side aSide) const
{
return (nsStyleUnit)mUnits[aSide];
}
inline nsStyleUnit nsStyleSides::GetLeftUnit(void) const
{
return GetUnit(NS_SIDE_LEFT);
}
@@ -306,17 +304,17 @@ inline nsStyleUnit nsStyleSides::GetRigh
return GetUnit(NS_SIDE_RIGHT);
}
inline nsStyleUnit nsStyleSides::GetBottomUnit(void) const
{
return GetUnit(NS_SIDE_BOTTOM);
}
-inline nsStyleCoord nsStyleSides::Get(PRUint8 aSide) const
+inline nsStyleCoord nsStyleSides::Get(mozilla::css::Side aSide) const
{
return nsStyleCoord(mValues[aSide], nsStyleUnit(mUnits[aSide]));
}
inline nsStyleCoord nsStyleSides::GetLeft() const
{
return Get(NS_SIDE_LEFT);
}
@@ -331,17 +329,17 @@ inline nsStyleCoord nsStyleSides::GetRig
return Get(NS_SIDE_RIGHT);
}
inline nsStyleCoord nsStyleSides::GetBottom() const
{
return Get(NS_SIDE_BOTTOM);
}
-inline void nsStyleSides::Set(PRUint8 aSide, const nsStyleCoord& aCoord)
+inline void nsStyleSides::Set(mozilla::css::Side aSide, const nsStyleCoord& aCoord)
{
mUnits[aSide] = aCoord.GetUnit();
aCoord.GetUnionValue(mValues[aSide]);
}
inline void nsStyleSides::SetLeft(const nsStyleCoord& aCoord)
{
Set(NS_SIDE_LEFT, aCoord);
--- a/layout/style/nsStyleStruct.h
+++ b/layout/style/nsStyleStruct.h
@@ -61,16 +61,17 @@
#include "nsCOMArray.h"
#include "nsTArray.h"
#include "nsIAtom.h"
#include "nsIURI.h"
#include "nsCSSValue.h"
#include "nsStyleTransformMatrix.h"
#include "nsAlgorithm.h"
#include "imgIRequest.h"
+#include "gfxRect.h"
class nsIFrame;
class imgIRequest;
class imgIContainer;
// Includes nsStyleStructID.
#include "nsStyleStructFwd.h"
@@ -732,44 +733,44 @@ struct nsStyleBorder {
if (!mBorderColors) {
mBorderColors = new nsBorderColors*[4];
if (mBorderColors)
for (PRInt32 i = 0; i < 4; i++)
mBorderColors[i] = nsnull;
}
}
- void ClearBorderColors(PRUint8 aSide) {
+ void ClearBorderColors(mozilla::css::Side aSide) {
if (mBorderColors && mBorderColors[aSide]) {
delete mBorderColors[aSide];
mBorderColors[aSide] = nsnull;
}
}
// Return whether aStyle is a visible style. Invisible styles cause
// the relevant computed border width to be 0.
// Note that this does *not* consider the effects of 'border-image':
// if border-style is none, but there is a loaded border image,
// HasVisibleStyle will be false even though there *is* a border.
- PRBool HasVisibleStyle(PRUint8 aSide)
+ PRBool HasVisibleStyle(mozilla::css::Side aSide)
{
return IsVisibleBorderStyle(GetBorderStyle(aSide));
}
// aBorderWidth is in twips
- void SetBorderWidth(PRUint8 aSide, nscoord aBorderWidth)
+ void SetBorderWidth(mozilla::css::Side aSide, nscoord aBorderWidth)
{
nscoord roundedWidth =
NS_ROUND_BORDER_TO_PIXELS(aBorderWidth, mTwipsPerPixel);
mBorder.side(aSide) = roundedWidth;
if (HasVisibleStyle(aSide))
mComputedBorder.side(aSide) = roundedWidth;
}
- void SetBorderImageWidthOverride(PRUint8 aSide, nscoord aBorderWidth)
+ void SetBorderImageWidthOverride(mozilla::css::Side aSide, nscoord aBorderWidth)
{
mBorderImageWidth.side(aSide) =
NS_ROUND_BORDER_TO_PIXELS(aBorderWidth, mTwipsPerPixel);
}
// Get the actual border, in twips. (If there is no border-image
// loaded, this is the same as GetComputedBorder. If there is a
// border-image loaded, it uses the border-image width overrides if
@@ -784,54 +785,54 @@ struct nsStyleBorder {
{
return mComputedBorder;
}
// Get the actual border width for a particular side, in appunits. Note that
// this is zero if and only if there is no border to be painted for this
// side. That is, this value takes into account the border style and the
// value is rounded to the nearest device pixel by NS_ROUND_BORDER_TO_PIXELS.
- nscoord GetActualBorderWidth(PRUint8 aSide) const
+ nscoord GetActualBorderWidth(mozilla::css::Side aSide) const
{
return GetActualBorder().side(aSide);
}
- PRUint8 GetBorderStyle(PRUint8 aSide) const
+ PRUint8 GetBorderStyle(mozilla::css::Side aSide) const
{
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
return (mBorderStyle[aSide] & BORDER_STYLE_MASK);
}
- void SetBorderStyle(PRUint8 aSide, PRUint8 aStyle)
+ void SetBorderStyle(mozilla::css::Side aSide, PRUint8 aStyle)
{
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
mBorderStyle[aSide] &= ~BORDER_STYLE_MASK;
mBorderStyle[aSide] |= (aStyle & BORDER_STYLE_MASK);
mComputedBorder.side(aSide) =
(HasVisibleStyle(aSide) ? mBorder.side(aSide) : 0);
}
// Defined in nsStyleStructInlines.h
inline PRBool IsBorderImageLoaded() const;
inline nsresult RequestDecode();
- void GetBorderColor(PRUint8 aSide, nscolor& aColor,
+ void GetBorderColor(mozilla::css::Side aSide, nscolor& aColor,
PRBool& aForeground) const
{
aForeground = PR_FALSE;
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
if ((mBorderStyle[aSide] & BORDER_COLOR_SPECIAL) == 0)
aColor = mBorderColor[aSide];
else if (mBorderStyle[aSide] & BORDER_COLOR_FOREGROUND)
aForeground = PR_TRUE;
else
NS_NOTREACHED("OUTLINE_COLOR_INITIAL should not be set here");
}
- void SetBorderColor(PRUint8 aSide, nscolor aColor)
+ void SetBorderColor(mozilla::css::Side aSide, nscolor aColor)
{
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
mBorderColor[aSide] = aColor;
mBorderStyle[aSide] &= ~BORDER_COLOR_SPECIAL;
}
// These are defined in nsStyleStructInlines.h
inline void SetBorderImage(imgIRequest* aImage);
@@ -860,17 +861,17 @@ struct nsStyleBorder {
nsBorderColors* last = mBorderColors[aIndex];
while (last->mNext)
last = last->mNext;
last->mNext = colorEntry;
}
mBorderStyle[aIndex] &= ~BORDER_COLOR_SPECIAL;
}
- void SetBorderToForeground(PRUint8 aSide)
+ void SetBorderToForeground(mozilla::css::Side aSide)
{
NS_ASSERTION(aSide <= NS_SIDE_LEFT, "bad side");
mBorderStyle[aSide] &= ~BORDER_COLOR_SPECIAL;
mBorderStyle[aSide] |= BORDER_COLOR_FOREGROUND;
}
protected:
// mComputedBorder holds the CSS2.1 computed border-width values. In
--- a/layout/tables/celldata.h
+++ b/layout/tables/celldata.h
@@ -34,16 +34,17 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef CellData_h__
#define CellData_h__
#include "nsISupports.h"
#include "nsCoord.h"
+#include "gfxCore.h"
class nsTableCellFrame;
class nsCellMap;
class BCCellData;
#define MAX_ROWSPAN 8190 // the cellmap can not handle more
#define MAX_COLSPAN 1000 // limit as IE and opera do
@@ -222,21 +223,21 @@ public:
nscoord GetTopEdge(BCBorderOwner& aOwner,
PRBool& aStart) const;
void SetTopEdge(BCBorderOwner aOwner,
nscoord aSize,
PRBool aStart);
- BCPixelSize GetCorner(PRUint8& aCornerOwner,
+ BCPixelSize GetCorner(mozilla::css::Side& aCornerOwner,
PRPackedBool& aBevel) const;
void SetCorner(BCPixelSize aSubSize,
- PRUint8 aOwner,
+ mozilla::css::Side aOwner,
PRBool aBevel);
PRBool IsLeftStart() const;
void SetLeftStart(PRBool aValue);
PRBool IsTopStart() const;
@@ -250,17 +251,17 @@ protected:
// dominant plane (for example, if corner is
// owned by the segment to its top or bottom,
// then the size is the max of the border
// sizes of the segments to its left or right.
unsigned mLeftOwner: 4; // owner of left border
unsigned mTopOwner: 4; // owner of top border
unsigned mLeftStart: 1; // set if this is the start of a vertical border segment
unsigned mTopStart: 1; // set if this is the start of a horizontal border segment
- unsigned mCornerSide: 2; // side of the owner of the upper left corner relative to the corner
+ mozilla::css::Side mCornerSide: 2; // side of the owner of the upper left corner relative to the corner
unsigned mCornerBevel: 1; // is the corner beveled (only two segments, perpendicular, not dashed or dotted).
};
// BCCellData entries replace CellData entries in the cell map if the border collapsing model is in
// effect. BCData for a row and col entry contains the left and top borders of cell at that row and
// col and the corner connecting the two. The right borders of the cells in the last col and the bottom
// borders of the last row are stored in separate BCData entries in the cell map.
class BCCellData : public CellData
@@ -411,17 +412,18 @@ inline void CellData::SetOverlap(PRBool
}
}
}
inline BCData::BCData()
{
mLeftOwner = mTopOwner = eCellOwner;
mLeftStart = mTopStart = 1;
- mLeftSize = mCornerSide = mCornerSubSize = mTopSize = 0;
+ mLeftSize = mCornerSubSize = mTopSize = 0;
+ mCornerSide = NS_SIDE_TOP;
mCornerBevel = PR_FALSE;
}
inline BCData::~BCData()
{
}
inline nscoord BCData::GetLeftEdge(BCBorderOwner& aOwner,
@@ -455,26 +457,26 @@ inline void BCData::SetTopEdge(BCBorderO
nscoord aSize,
PRBool aStart)
{
mTopOwner = aOwner;
mTopSize = (aSize > MAX_BORDER_WIDTH) ? MAX_BORDER_WIDTH : aSize;
mTopStart = aStart;
}
-inline BCPixelSize BCData::GetCorner(PRUint8& aOwnerSide,
+inline BCPixelSize BCData::GetCorner(mozilla::css::Side& aOwnerSide,
PRPackedBool& aBevel) const
{
aOwnerSide = mCornerSide;
aBevel = (PRBool)mCornerBevel;
return mCornerSubSize;
}
inline void BCData::SetCorner(BCPixelSize aSubSize,
- PRUint8 aOwnerSide,
+ mozilla::css::Side aOwnerSide,
PRBool aBevel)
{
mCornerSubSize = aSubSize;
mCornerSide = aOwnerSide;
mCornerBevel = aBevel;
}
inline PRBool BCData::IsLeftStart() const
--- a/layout/tables/nsCellMap.cpp
+++ b/layout/tables/nsCellMap.cpp
@@ -737,17 +737,17 @@ nsTableCellMap::Dump(char* aString) cons
while (cellMap) {
cellMap->Dump(nsnull != mBCInfo);
cellMap = cellMap->GetNextSibling();
}
if (nsnull != mBCInfo) {
printf("***** bottom borders *****\n");
nscoord size;
BCBorderOwner owner;
- PRUint8 side;
+ mozilla::css::Side side;
PRBool segStart;
PRPackedBool bevel;
PRInt32 colIndex;
PRInt32 numCols = mBCInfo->mBottomBorders.Length();
for (PRInt32 i = 0; i <= 2; i++) {
printf("\n ");
for (colIndex = 0; colIndex < numCols; colIndex++) {
@@ -977,17 +977,17 @@ nsTableCellMap::SetNotTopStart(PRUint8
}
}
// store the aSide border segment at coord = (aRowIndex, aColIndex). For top/left, store
// the info at coord. For bottom/left store it at the adjacent location so that it is
// top/left at that location. If the new location is at the right or bottom edge of the
// table, then store it one of the special arrays (right most borders, bottom most borders).
void
-nsTableCellMap::SetBCBorderEdge(PRUint8 aSide,
+nsTableCellMap::SetBCBorderEdge(mozilla::css::Side aSide,
nsCellMap& aCellMap,
PRUint32 aCellMapStart,
PRUint32 aRowIndex,
PRUint32 aColIndex,
PRUint32 aLength,
BCBorderOwner aOwner,
nscoord aSize,
PRBool aChanged)
@@ -1073,17 +1073,17 @@ nsTableCellMap::SetBCBorderEdge(PRUint8
// (aRowIndex, aColIndex). For eTopRight, store it in the entry to the right where
// it would be top left. For eBottomRight, store it in the entry to the bottom. etc.
void
nsTableCellMap::SetBCBorderCorner(Corner aCorner,
nsCellMap& aCellMap,
PRUint32 aCellMapStart,
PRUint32 aRowIndex,
PRUint32 aColIndex,
- PRUint8 aOwner,
+ mozilla::css::Side aOwner,
nscoord aSubSize,
PRBool aBevel,
PRBool aIsBottomRight)
{
if (!mBCInfo) ABORT0();
if (aIsBottomRight) {
mBCInfo->mLowerRightCorner.SetCorner(aSubSize, aOwner, aBevel);
@@ -2563,17 +2563,17 @@ void nsCellMap::Dump(PRBool aIsBorderCol
}
} else {
printf("---- ");
}
}
if (aIsBorderCollapse) {
nscoord size;
BCBorderOwner owner;
- PRUint8 side;
+ mozilla::css::Side side;
PRBool segStart;
PRPackedBool bevel;
for (PRInt32 i = 0; i <= 2; i++) {
printf("\n ");
for (colIndex = 0; colIndex < colCount; colIndex++) {
BCCellData* cd = (BCCellData *)row[colIndex];
if (cd) {
if (0 == i) {
--- a/layout/tables/nsCellMap.h
+++ b/layout/tables/nsCellMap.h
@@ -230,32 +230,32 @@ public:
void ExpandZeroColSpans();
void SetNotTopStart(PRUint8 aSide,
nsCellMap& aCellMap,
PRUint32 aYPos,
PRUint32 aXPos,
PRBool aIsLowerRight = PR_FALSE);
- void SetBCBorderEdge(PRUint8 aEdge,
+ void SetBCBorderEdge(mozilla::css::Side aEdge,
nsCellMap& aCellMap,
PRUint32 aCellMapStart,
PRUint32 aYPos,
PRUint32 aXPos,
PRUint32 aLength,
BCBorderOwner aOwner,
nscoord aSize,
PRBool aChanged);
void SetBCBorderCorner(Corner aCorner,
nsCellMap& aCellMap,
PRUint32 aCellMapStart,
PRUint32 aYPos,
PRUint32 aXPos,
- PRUint8 aOwner,
+ mozilla::css::Side aOwner,
nscoord aSubSize,
PRBool aBevel,
PRBool aIsBottomRight = PR_FALSE);
/** dump a representation of the cell map to stdout for debugging */
#ifdef NS_DEBUG
void Dump(char* aString = nsnull) const;
#endif
--- a/layout/tables/nsTableCellFrame.cpp
+++ b/layout/tables/nsTableCellFrame.cpp
@@ -1107,32 +1107,32 @@ nsBCTableCellFrame::GetBorderWidth(nsMar
aBorder.top = BC_BORDER_BOTTOM_HALF_COORD(aPixelsToTwips, mTopBorder);
aBorder.right = BC_BORDER_LEFT_HALF_COORD(aPixelsToTwips, mRightBorder);
aBorder.bottom = BC_BORDER_TOP_HALF_COORD(aPixelsToTwips, mBottomBorder);
aBorder.left = BC_BORDER_RIGHT_HALF_COORD(aPixelsToTwips, mLeftBorder);
return &aBorder;
}
BCPixelSize
-nsBCTableCellFrame::GetBorderWidth(PRUint8 aSide) const
+nsBCTableCellFrame::GetBorderWidth(mozilla::css::Side aSide) const
{
switch(aSide) {
case NS_SIDE_TOP:
return BC_BORDER_BOTTOM_HALF(mTopBorder);
case NS_SIDE_RIGHT:
return BC_BORDER_LEFT_HALF(mRightBorder);
case NS_SIDE_BOTTOM:
return BC_BORDER_TOP_HALF(mBottomBorder);
default:
return BC_BORDER_RIGHT_HALF(mLeftBorder);
}
}
void
-nsBCTableCellFrame::SetBorderWidth(PRUint8 aSide,
+nsBCTableCellFrame::SetBorderWidth(mozilla::css::Side aSide,
BCPixelSize aValue)
{
switch(aSide) {
case NS_SIDE_TOP:
mTopBorder = aValue;
break;
case NS_SIDE_RIGHT:
mRightBorder = aValue;
--- a/layout/tables/nsTableCellFrame.h
+++ b/layout/tables/nsTableCellFrame.h
@@ -313,20 +313,20 @@ public:
virtual nsIAtom* GetType() const;
virtual nsMargin GetUsedBorder() const;
// Get the *inner half of the border only*, in twips.
virtual nsMargin* GetBorderWidth(nsMargin& aBorder) const;
// Get the *inner half of the border only*, in pixels.
- BCPixelSize GetBorderWidth(PRUint8 aSide) const;
+ BCPixelSize GetBorderWidth(mozilla::css::Side aSide) const;
// Set the full (both halves) width of the border
- void SetBorderWidth(PRUint8 aSide, BCPixelSize aPixelValue);
+ void SetBorderWidth(mozilla::css::Side aSide, BCPixelSize aPixelValue);
virtual void GetSelfOverflow(nsRect& aOverflowArea);
#ifdef DEBUG
NS_IMETHOD GetFrameName(nsAString& aResult) const;
#endif
virtual void PaintBackground(nsIRenderingContext& aRenderingContext,
--- a/layout/tables/nsTableFrame.cpp
+++ b/layout/tables/nsTableFrame.cpp
@@ -3893,18 +3893,18 @@ struct BCMapCellInfo
nsTableFrame* mTableFrame;
PRInt32 mNumTableRows;
PRInt32 mNumTableCols;
BCPropertyData* mTableBCData;
// storage of table ltr information, the border collapse code swaps the sides
// to account for rtl tables, this is done through mStartSide and mEndSide
PRPackedBool mTableIsLTR;
- PRUint8 mStartSide;
- PRUint8 mEndSide;
+ mozilla::css::Side mStartSide;
+ mozilla::css::Side mEndSide;
// a cell can only belong to one rowgroup
nsTableRowGroupFrame* mRowGroup;
// a cell with a rowspan has a top and a bottom row, and rows in between
nsTableRowFrame* mTopRow;
nsTableRowFrame* mBottomRow;
nsTableRowFrame* mCurrentRowFrame;
@@ -4395,17 +4395,17 @@ static PRUint8 styleToPriority[13] = { 0
* @param aFrame - query the info for this frame
* @param aSide - the side of the frame
* @param aStyle - the border style
* @param aColor - the border color
* @param aTableIsLTR - table direction is LTR
*/
static void
GetColorAndStyle(const nsIFrame* aFrame,
- PRUint8 aSide,
+ mozilla::css::Side aSide,
PRUint8& aStyle,
nscolor& aColor,
PRBool aTableIsLTR)
{
NS_PRECONDITION(aFrame, "null frame");
// initialize out arg
aColor = 0;
const nsStyleBorder* styleData = aFrame->GetStyleBorder();
@@ -4431,17 +4431,17 @@ GetColorAndStyle(const nsIFrame* aFrame
* @param aFrame - query the info for this frame
* @param aSide - the side of the frame
* @param aStyle - the border style
* @param aColor - the border color
* @param aTableIsLTR - table direction is LTR
*/
static void
GetPaintStyleInfo(const nsIFrame* aFrame,
- PRUint8 aSide,
+ mozilla::css::Side aSide,
PRUint8& aStyle,
nscolor& aColor,
PRBool aTableIsLTR)
{
GetColorAndStyle(aFrame, aSide, aStyle, aColor, aTableIsLTR);
if (NS_STYLE_BORDER_STYLE_INSET == aStyle) {
aStyle = NS_STYLE_BORDER_STYLE_RIDGE;
}
@@ -4457,17 +4457,17 @@ GetPaintStyleInfo(const nsIFrame* aFram
* @param aStyle - the border style
* @param aColor - the border color
* @param aTableIsLTR - table direction is LTR
* @param aWidth - the border width in px.
* @param aTwipsToPixels - conversion factor from twips to pixel
*/
static void
GetColorAndStyle(const nsIFrame* aFrame,
- PRUint8 aSide,
+ mozilla::css::Side aSide,
PRUint8& aStyle,
nscolor& aColor,
PRBool aTableIsLTR,
BCPixelSize& aWidth)
{
GetColorAndStyle(aFrame, aSide, aStyle, aColor, aTableIsLTR);
if ((NS_STYLE_BORDER_STYLE_NONE == aStyle) ||
(NS_STYLE_BORDER_STYLE_HIDDEN == aStyle)) {
@@ -4605,17 +4605,17 @@ CompareBorders(PRBool aIsCo
static BCCellBorder
CompareBorders(const nsIFrame* aTableFrame,
const nsIFrame* aColGroupFrame,
const nsIFrame* aColFrame,
const nsIFrame* aRowGroupFrame,
const nsIFrame* aRowFrame,
const nsIFrame* aCellFrame,
PRBool aTableIsLTR,
- PRUint8 aSide,
+ mozilla::css::Side aSide,
PRBool aAja)
{
BCCellBorder border, tempBorder;
PRBool horizontal = (NS_SIDE_TOP == aSide) || (NS_SIDE_BOTTOM == aSide);
// start with the table as dominant if present
if (aTableFrame) {
GetColorAndStyle(aTableFrame, aSide, border.style, border.color, aTableIsLTR, border.width);
@@ -4666,62 +4666,62 @@ CompareBorders(const nsIFrame* aTableFr
GetColorAndStyle(aCellFrame, aSide, tempBorder.style, tempBorder.color, aTableIsLTR, tempBorder.width);
tempBorder.owner = (aAja) ? eAjaCellOwner : eCellOwner;
border = CompareBorders(!CELL_CORNER, border, tempBorder, PR_FALSE);
}
return border;
}
static PRBool
-Perpendicular(PRUint8 aSide1,
- PRUint8 aSide2)
+Perpendicular(mozilla::css::Side aSide1,
+ mozilla::css::Side aSide2)
{
switch (aSide1) {
case NS_SIDE_TOP:
return (NS_SIDE_BOTTOM != aSide2);
case NS_SIDE_RIGHT:
return (NS_SIDE_LEFT != aSide2);
case NS_SIDE_BOTTOM:
return (NS_SIDE_TOP != aSide2);
default: // NS_SIDE_LEFT
return (NS_SIDE_RIGHT != aSide2);
}
}
// XXX allocate this as number-of-cols+1 instead of number-of-cols+1 * number-of-rows+1
struct BCCornerInfo
{
- BCCornerInfo() { ownerColor = 0; ownerWidth = subWidth = ownerSide = ownerElem = subSide =
- subElem = hasDashDot = numSegs = bevel = 0;
+ BCCornerInfo() { ownerColor = 0; ownerWidth = subWidth = ownerElem = subSide =
+ subElem = hasDashDot = numSegs = bevel = 0; ownerSide = NS_SIDE_TOP;
ownerStyle = 0xFF; subStyle = NS_STYLE_BORDER_STYLE_SOLID; }
- void Set(PRUint8 aSide,
+ void Set(mozilla::css::Side aSide,
BCCellBorder border);
- void Update(PRUint8 aSide,
+ void Update(mozilla::css::Side aSide,
BCCellBorder border);
nscolor ownerColor; // color of borderOwner
PRUint16 ownerWidth; // pixel width of borderOwner
PRUint16 subWidth; // pixel width of the largest border intersecting the border perpendicular
// to ownerSide
- PRUint32 ownerSide:2; // side (e.g NS_SIDE_TOP, NS_SIDE_RIGHT, etc) of the border owning
+ mozilla::css::Side ownerSide:2; // side (e.g NS_SIDE_TOP, NS_SIDE_RIGHT, etc) of the border owning
// the corner relative to the corner
PRUint32 ownerElem:3; // elem type (e.g. eTable, eGroup, etc) owning the corner
PRUint32 ownerStyle:8; // border style of ownerElem
PRUint32 subSide:2; // side of border with subWidth relative to the corner
PRUint32 subElem:3; // elem type (e.g. eTable, eGroup, etc) of sub owner
PRUint32 subStyle:8; // border style of subElem
PRUint32 hasDashDot:1; // does a dashed, dotted segment enter the corner, they cannot be beveled
PRUint32 numSegs:3; // number of segments entering corner
PRUint32 bevel:1; // is the corner beveled (uses the above two fields together with subWidth)
PRUint32 unused:1;
};
void
-BCCornerInfo::Set(PRUint8 aSide,
+BCCornerInfo::Set(mozilla::css::Side aSide,
BCCellBorder aBorder)
{
ownerElem = aBorder.owner;
ownerStyle = aBorder.style;
ownerWidth = aBorder.width;
ownerColor = aBorder.color;
ownerSide = aSide;
hasDashDot = 0;
@@ -4735,32 +4735,32 @@ BCCornerInfo::Set(PRUint8 aSide,
subWidth = 0;
// the following will get set later
subSide = ((aSide == NS_SIDE_LEFT) || (aSide == NS_SIDE_RIGHT)) ? NS_SIDE_TOP : NS_SIDE_LEFT;
subElem = eTableOwner;
subStyle = NS_STYLE_BORDER_STYLE_SOLID;
}
void
-BCCornerInfo::Update(PRUint8 aSide,
+BCCornerInfo::Update(mozilla::css::Side aSide,
BCCellBorder aBorder)
{
PRBool existingWins = PR_FALSE;
if (0xFF == ownerStyle) { // initial value indiating that it hasn't been set yet
Set(aSide, aBorder);
}
else {
PRBool horizontal = (NS_SIDE_LEFT == aSide) || (NS_SIDE_RIGHT == aSide); // relative to the corner
BCCellBorder oldBorder, tempBorder;
oldBorder.owner = (BCBorderOwner) ownerElem;
oldBorder.style = ownerStyle;
oldBorder.width = ownerWidth;
oldBorder.color = ownerColor;
- PRUint8 oldSide = ownerSide;
+ mozilla::css::Side oldSide = ownerSide;
tempBorder = CompareBorders(CELL_CORNER, oldBorder, aBorder, horizontal, &existingWins);
ownerElem = tempBorder.owner;
ownerStyle = tempBorder.style;
ownerWidth = tempBorder.width;
ownerColor = tempBorder.color;
if (existingWins) { // existing corner is dominant
@@ -5524,17 +5524,17 @@ nsTableFrame::CalcBCBorders()
info.SetTableTopLeftContBCBorder();
}
else {
// see if the top border needs to be the start of a segment due to a
// vertical border owning the corner
if (info.mColIndex > 0) {
BCData& data = info.mCellData->mData;
if (!data.IsTopStart()) {
- PRUint8 cornerSide;
+ mozilla::css::Side cornerSide;
PRPackedBool bevel;
data.GetCorner(cornerSide, bevel);
if ((NS_SIDE_TOP == cornerSide) || (NS_SIDE_BOTTOM == cornerSide)) {
data.SetTopStart(PR_TRUE);
}
}
}
}
@@ -5926,17 +5926,17 @@ struct BCVerticalSeg
nsTableRowGroupFrame* mFirstRowGroup; // row group at the start of the segment
nsTableRowFrame* mFirstRow; // row at the start of the segment
nsTableCellFrame* mLastCell; // cell at the current end of the
// segment
PRUint8 mOwner; // owner of the border, defines the
// style
- PRUint8 mTopBevelSide; // direction to bevel at the top
+ mozilla::css::Side mTopBevelSide; // direction to bevel at the top
nscoord mTopBevelOffset; // how much to bevel at the top
BCPixelSize mBottomHorSegHeight; // height of the crossing
//horizontal border
nscoord mBottomOffset; // how much longer is the segment due
// to the horizontal border, by this
// amount the next segment needs to be
// shifted.
PRBool mIsBottomBevel; // should we bevel at the bottom
@@ -5957,20 +5957,20 @@ struct BCHorizontalSeg
void Paint(BCPaintBorderIterator& aIter,
nsIRenderingContext& aRenderingContext);
nscoord mOffsetX; // x-offset with respect to the table edge
nscoord mOffsetY; // y-offset with respect to the table edge
nscoord mLength; // horizontal length including corners
BCPixelSize mWidth; // border width in pixels
nscoord mLeftBevelOffset; // how much to bevel at the left
- PRUint8 mLeftBevelSide; // direction to bevel at the left
- PRBool mIsRightBevel; // should we bevel at the right end
+ mozilla::css::Side mLeftBevelSide; // direction to bevel at the left
+ PRBool mIsRightBevel; // should we bevel at the right end
nscoord mRightBevelOffset; // how much to bevel at the right
- PRUint8 mRightBevelSide; // direction to bevel at the right
+ mozilla::css::Side mRightBevelSide; // direction to bevel at the right
nscoord mEndOffset; // how much longer is the segment due
// to the vertical border, by this
// amount the next segment needs to be
// shifted.
PRUint8 mOwner; // owner of the border, defines the
// style
nsTableCellFrame* mFirstCell; // cell at the start of the segment
nsTableCellFrame* mAjaCell; // neighboring cell to the first cell
@@ -6462,17 +6462,17 @@ BCPaintBorderIterator::Next()
* @param aCornerOwnerSide - which side owns the corner
* @param aCornerSubWidth - how wide is the nonwinning side of the corner
* @param aHorWidth - how wide is the horizontal edge of the corner
* @param aIsStartOfSeg - does this corner start a new segment
* @param aIsBevel - is this corner beveled
* @return - offset in twips
*/
static nscoord
-CalcVerCornerOffset(PRUint8 aCornerOwnerSide,
+CalcVerCornerOffset(mozilla::css::Side aCornerOwnerSide,
BCPixelSize aCornerSubWidth,
BCPixelSize aHorWidth,
PRBool aIsStartOfSeg,
PRBool aIsBevel)
{
nscoord offset = 0;
// XXX These should be replaced with appropriate side-specific macros (which?)
BCPixelSize smallHalf, largeHalf;
@@ -6503,17 +6503,17 @@ CalcVerCornerOffset(PRUint8 aCornerO
* @param aCornerSubWidth - how wide is the nonwinning side of the corner
* @param aVerWidth - how wide is the vertical edge of the corner
* @param aIsStartOfSeg - does this corner start a new segment
* @param aIsBevel - is this corner beveled
* @param aTableIsLTR - direction, the computation depends on ltr or rtl
* @return - offset in twips
*/
static nscoord
-CalcHorCornerOffset(PRUint8 aCornerOwnerSide,
+CalcHorCornerOffset(mozilla::css::Side aCornerOwnerSide,
BCPixelSize aCornerSubWidth,
BCPixelSize aVerWidth,
PRBool aIsStartOfSeg,
PRBool aIsBevel,
PRBool aTableIsLTR)
{
nscoord offset = 0;
// XXX These should be replaced with appropriate side-specific macros (which?)
@@ -6549,17 +6549,18 @@ CalcHorCornerOffset(PRUint8 aCornerO
}
return nsPresContext::CSSPixelsToAppUnits(offset);
}
BCVerticalSeg::BCVerticalSeg()
{
mCol = nsnull;
mFirstCell = mLastCell = mAjaCell = nsnull;
- mOffsetX = mOffsetY = mLength = mWidth = mTopBevelOffset = mTopBevelSide = 0;
+ mOffsetX = mOffsetY = mLength = mWidth = mTopBevelOffset = 0;
+ mTopBevelSide = NS_SIDE_TOP;
mOwner = eCellOwner;
}
/**
* Start a new vertical segment
* @param aIter - iterator containing the structural information
* @param aBorderOwner - determines the border style
* @param aVerSegWidth - the width of segment in pixel
@@ -6567,17 +6568,17 @@ BCVerticalSeg::BCVerticalSeg()
* at the start
*/
void
BCVerticalSeg::Start(BCPaintBorderIterator& aIter,
BCBorderOwner aBorderOwner,
BCPixelSize aVerSegWidth,
BCPixelSize aHorSegHeight)
{
- PRUint8 ownerSide = 0;
+ mozilla::css::Side ownerSide = NS_SIDE_TOP;
PRPackedBool bevel = PR_FALSE;
nscoord cornerSubWidth = (aIter.mBCData) ?
aIter.mBCData->GetCorner(ownerSide, bevel) : 0;
PRBool topBevel = (aVerSegWidth > 0) ? bevel : PR_FALSE;
BCPixelSize maxHorSegHeight = PR_MAX(aIter.mPrevHorSegHeight, aHorSegHeight);
@@ -6630,17 +6631,17 @@ BCVerticalSeg::Initialize(BCPaintBorderI
* @param aIter - iterator containing the structural information
* @param aHorSegHeight - the width of the horizontal segment joining the corner
* at the start
*/
void
BCVerticalSeg::GetBottomCorner(BCPaintBorderIterator& aIter,
BCPixelSize aHorSegHeight)
{
- PRUint8 ownerSide = 0;
+ mozilla::css::Side ownerSide = NS_SIDE_TOP;
nscoord cornerSubWidth = 0;
PRPackedBool bevel = PR_FALSE;
if (aIter.mBCData) {
cornerSubWidth = aIter.mBCData->GetCorner(ownerSide, bevel);
}
mIsBottomBevel = (mWidth > 0) ? bevel : PR_FALSE;
mBottomHorSegHeight = PR_MAX(aIter.mPrevHorSegHeight, aHorSegHeight);
mBottomOffset = CalcVerCornerOffset(ownerSide, cornerSubWidth,
@@ -6657,17 +6658,17 @@ BCVerticalSeg::GetBottomCorner(BCPaintBo
* at the start
*/
void
BCVerticalSeg::Paint(BCPaintBorderIterator& aIter,
nsIRenderingContext& aRenderingContext,
BCPixelSize aHorSegHeight)
{
// get the border style, color and paint the segment
- PRUint8 side = (aIter.IsDamageAreaRightMost()) ? NS_SIDE_RIGHT :
+ mozilla::css::Side side = (aIter.IsDamageAreaRightMost()) ? NS_SIDE_RIGHT :
NS_SIDE_LEFT;
PRInt32 relColIndex = aIter.GetRelativeColIndex();
nsTableColFrame* col = mCol; if (!col) ABORT0();
nsTableCellFrame* cell = mFirstCell; // ???
nsIFrame* owner = nsnull;
PRUint8 style = NS_STYLE_BORDER_STYLE_SOLID;
nscolor color = 0xFFFFFFFF;
@@ -6720,19 +6721,19 @@ BCVerticalSeg::Paint(BCPaintBorderIterat
}
BCPixelSize smallHalf, largeHalf;
DivideBCBorderSize(mWidth, smallHalf, largeHalf);
nsRect segRect(mOffsetX - nsPresContext::CSSPixelsToAppUnits(largeHalf),
mOffsetY,
nsPresContext::CSSPixelsToAppUnits(mWidth), mLength);
nscoord bottomBevelOffset = (mIsBottomBevel) ?
nsPresContext::CSSPixelsToAppUnits(mBottomHorSegHeight) : 0;
- PRUint8 bottomBevelSide = ((aHorSegHeight > 0) ^ !aIter.mTableIsLTR) ?
+ mozilla::css::Side bottomBevelSide = ((aHorSegHeight > 0) ^ !aIter.mTableIsLTR) ?
NS_SIDE_RIGHT : NS_SIDE_LEFT;
- PRUint8 topBevelSide = ((mTopBevelSide == NS_SIDE_RIGHT) ^ !aIter.mTableIsLTR)?
+ mozilla::css::Side topBevelSide = ((mTopBevelSide == NS_SIDE_RIGHT) ^ !aIter.mTableIsLTR)?
NS_SIDE_RIGHT : NS_SIDE_LEFT;
nsCSSRendering::DrawTableBorderSegment(aRenderingContext, style, color,
aIter.mTableBgColor, segRect,
nsPresContext::AppUnitsPerCSSPixel(),
topBevelSide, mTopBevelOffset,
bottomBevelSide, bottomBevelOffset);
}
@@ -6753,33 +6754,33 @@ BCVerticalSeg::IncludeCurrentBorder(BCPa
{
mLastCell = aIter.mCell;
mLength += aIter.mRow->GetRect().height;
}
BCHorizontalSeg::BCHorizontalSeg()
{
mOffsetX = mOffsetY = mLength = mWidth = mLeftBevelOffset = 0;
- mLeftBevelSide = 0;
+ mLeftBevelSide = NS_SIDE_TOP;
mFirstCell = mAjaCell = nsnull;
}
/** Initialize a horizontal border segment for painting
* @param aIter - iterator storing the current and adjacent frames
* @param aBorderOwner - which frame owns the border
* @param aBottomVerSegWidth - vertical segment width coming from up
* @param aHorSegHeight - the height of the segment
+ */
void
BCHorizontalSeg::Start(BCPaintBorderIterator& aIter,
BCBorderOwner aBorderOwner,
BCPixelSize aBottomVerSegWidth,
BCPixelSize aHorSegHeight)
{
- PRUint8 cornerOwnerSide = 0;
+ mozilla::css::Side cornerOwnerSide = NS_SIDE_TOP;
PRPackedBool bevel = PR_FALSE;
mOwner = aBorderOwner;
nscoord cornerSubWidth = (aIter.mBCData) ?
aIter.mBCData->GetCorner(cornerOwnerSide,
bevel) : 0;
PRBool leftBevel = (aHorSegHeight > 0) ? bevel : PR_FALSE;
@@ -6810,17 +6811,17 @@ BCHorizontalSeg::Start(BCPaintBorderIter
* @param aIter - iterator containing the structural information
* @param aLeftSegWidth - the width of the vertical segment joining the corner
* at the start
*/
void
BCHorizontalSeg::GetRightCorner(BCPaintBorderIterator& aIter,
BCPixelSize aLeftSegWidth)
{
- PRUint8 ownerSide = 0;
+ mozilla::css::Side ownerSide = NS_SIDE_TOP;
nscoord cornerSubWidth = 0;
PRPackedBool bevel = PR_FALSE;
if (aIter.mBCData) {
cornerSubWidth = aIter.mBCData->GetCorner(ownerSide, bevel);
}
mIsRightBevel = (mWidth > 0) ? bevel : 0;
PRInt32 relColIndex = aIter.GetRelativeColIndex();
@@ -6838,17 +6839,17 @@ BCHorizontalSeg::GetRightCorner(BCPaintB
* @param aIter - iterator containing the structural information
* @param aRenderingContext - the rendering context
*/
void
BCHorizontalSeg::Paint(BCPaintBorderIterator& aIter,
nsIRenderingContext& aRenderingContext)
{
// get the border style, color and paint the segment
- PRUint8 side = (aIter.IsDamageAreaBottomMost()) ? NS_SIDE_BOTTOM :
+ mozilla::css::Side side = (aIter.IsDamageAreaBottomMost()) ? NS_SIDE_BOTTOM :
NS_SIDE_TOP;
nsIFrame* rg = aIter.mRg; if (!rg) ABORT0();
nsIFrame* row = aIter.mRow; if (!row) ABORT0();
nsIFrame* cell = mFirstCell;
nsIFrame* col;
nsIFrame* owner = nsnull;
PRUint8 style = NS_STYLE_BORDER_STYLE_SOLID;
@@ -6963,17 +6964,17 @@ BCPaintBorderIterator::StoreColumnWidth(
}
}
/**
* Determine if a vertical segment owns the corder
*/
PRBool
BCPaintBorderIterator::VerticalSegmentOwnsCorner()
{
- PRUint8 cornerOwnerSide = 0;
+ mozilla::css::Side cornerOwnerSide = NS_SIDE_TOP;
PRPackedBool bevel = PR_FALSE;
nscoord cornerSubWidth;
cornerSubWidth = (mBCData) ? mBCData->GetCorner(cornerOwnerSide, bevel) : 0;
// unitialized ownerside, bevel
return (NS_SIDE_TOP == cornerOwnerSide) ||
(NS_SIDE_BOTTOM == cornerOwnerSide);
}