Rename FOR_CSS_SIDES to NS_FOR_CSS_SIDES, move it, and use it more. b=233795 r+sr=bzbarsky

This commit is contained in:
dbaron%dbaron.org 2004-04-12 21:54:45 +00:00
Родитель b2e0bd26a0
Коммит 21a5e14d4e
10 изменённых файлов: 104 добавлений и 162 удалений

Просмотреть файл

@ -3102,7 +3102,7 @@ nsRuleNode::ComputeMarginData(nsStyleStruct* aStartStruct,
// margin: length, percent, auto, inherit
nsStyleCoord coord;
nsStyleCoord parentCoord;
FOR_CSS_SIDES(side) {
NS_FOR_CSS_SIDES(side) {
parentMargin->mMargin.Get(side, parentCoord);
if (SetCoord(marginData.mMargin.*(nsCSSRect::sides[side]),
coord, parentCoord, SETCOORD_LPAH,
@ -3171,7 +3171,7 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct,
nsStyleCoord coord;
nsStyleCoord parentCoord;
{ // scope for compilers with broken |for| loop scoping
FOR_CSS_SIDES(side) {
NS_FOR_CSS_SIDES(side) {
const nsCSSValue &value = marginData.mBorderWidth.*(nsCSSRect::sides[side]);
if (SetCoord(value, coord, parentCoord, SETCOORD_LE, aContext,
mPresContext, inherited))
@ -3186,7 +3186,7 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct,
// border-style: enum, none, inhert
const nsCSSRect& ourStyle = marginData.mBorderStyle;
{ // scope for compilers with broken |for| loop scoping
FOR_CSS_SIDES(side) {
NS_FOR_CSS_SIDES(side) {
const nsCSSValue &value = ourStyle.*(nsCSSRect::sides[side]);
nsCSSUnit unit = value.GetUnit();
if (eCSSUnit_Enumerated == unit) {
@ -3207,7 +3207,7 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct,
nscolor unused = NS_RGB(0,0,0);
{ // scope for compilers with broken |for| loop scoping
FOR_CSS_SIDES(side) {
NS_FOR_CSS_SIDES(side) {
nsCSSValueList* list =
marginData.mBorderColors.*(nsCSSValueListRect::sides[side]);
if (list) {
@ -3233,7 +3233,7 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct,
PRBool foreground;
{ // scope for compilers with broken |for| loop scoping
FOR_CSS_SIDES(side) {
NS_FOR_CSS_SIDES(side) {
const nsCSSValue &value = ourBorderColor.*(nsCSSRect::sides[side]);
if (eCSSUnit_Inherit == value.GetUnit()) {
if (parentContext) {
@ -3274,7 +3274,7 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct,
// -moz-border-radius: length, percent, inherit
{ // scope for compilers with broken |for| loop scoping
FOR_CSS_SIDES(side) {
NS_FOR_CSS_SIDES(side) {
parentBorder->mBorderRadius.Get(side, parentCoord);
if (SetCoord(marginData.mBorderRadius.*(nsCSSRect::sides[side]), coord,
parentCoord, SETCOORD_LPH, aContext, mPresContext,
@ -3337,7 +3337,7 @@ nsRuleNode::ComputePaddingData(nsStyleStruct* aStartStruct,
// padding: length, percent, inherit
nsStyleCoord coord;
nsStyleCoord parentCoord;
FOR_CSS_SIDES(side) {
NS_FOR_CSS_SIDES(side) {
parentPadding->mPadding.Get(side, parentCoord);
if (SetCoord(marginData.mPadding.*(nsCSSRect::sides[side]),
coord, parentCoord, SETCOORD_LPH,
@ -3591,7 +3591,7 @@ nsRuleNode::ComputePositionData(nsStyleStruct* aStartStruct,
// box offsets: length, percent, auto, inherit
nsStyleCoord coord;
nsStyleCoord parentCoord;
FOR_CSS_SIDES(side) {
NS_FOR_CSS_SIDES(side) {
parentPos->mOffset.Get(side, parentCoord);
if (SetCoord(posData.mOffset.*(nsCSSRect::sides[side]),
coord, parentCoord, SETCOORD_LPAH,

Просмотреть файл

@ -4908,7 +4908,7 @@ CSSParserImpl::DoParseRect(nsCSSRect& aRect, nsresult& aErrorCode)
if (!ExpectSymbol(aErrorCode, '(', PR_TRUE)) {
return PR_FALSE;
}
FOR_CSS_SIDES(side) {
NS_FOR_CSS_SIDES(side) {
if (! ParseVariant(aErrorCode, aRect.*(nsCSSRect::sides[side]),
VARIANT_AL, nsnull)) {
return PR_FALSE;

Просмотреть файл

@ -150,8 +150,6 @@ struct nsCSSText : public nsCSSStruct {
struct nsRuleDataText : public nsCSSText {
};
#define FOR_CSS_SIDES(var_) for (PRInt32 var_ = 0; var_ < 4; ++var_)
struct nsCSSRect {
nsCSSRect(void);
nsCSSRect(const nsCSSRect& aCopy);

Просмотреть файл

@ -20,7 +20,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* David Hyatt (hyatt@netscape.com
* David Hyatt (hyatt@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
@ -270,12 +270,17 @@ nsChangeHint nsStyleFont::CalcFontDifference(const nsFont& aFont1, const nsFont&
return NS_STYLE_HINT_REFLOW;
}
static nscoord nsMargin::* const gMarginSides[4] = {
&nsMargin::top, &nsMargin::right, &nsMargin::bottom, &nsMargin::left
};
static PRBool IsFixedData(const nsStyleSides& aSides, PRBool aEnumOK)
{
return PRBool(IsFixedUnit(aSides.GetLeftUnit(), aEnumOK) &&
IsFixedUnit(aSides.GetTopUnit(), aEnumOK) &&
IsFixedUnit(aSides.GetRightUnit(), aEnumOK) &&
IsFixedUnit(aSides.GetBottomUnit(), aEnumOK));
NS_FOR_CSS_SIDES(side) {
if (!IsFixedUnit(aSides.GetUnit(side), aEnumOK))
return PR_FALSE;
}
return PR_TRUE;
}
static nscoord CalcCoord(const nsStyleCoord& aCoord,
@ -331,12 +336,11 @@ nsStyleMargin::Destroy(nsIPresContext* aContext) {
void nsStyleMargin::RecalcData()
{
if (IsFixedData(mMargin, PR_FALSE)) {
nsStyleCoord coord;
mCachedMargin.left = CalcCoord(mMargin.GetLeft(coord), nsnull, 0);
mCachedMargin.top = CalcCoord(mMargin.GetTop(coord), nsnull, 0);
mCachedMargin.right = CalcCoord(mMargin.GetRight(coord), nsnull, 0);
mCachedMargin.bottom = CalcCoord(mMargin.GetBottom(coord), nsnull, 0);
nsStyleCoord coord;
NS_FOR_CSS_SIDES(side) {
mCachedMargin.*(gMarginSides[side]) =
CalcCoord(mMargin.Get(side, coord), nsnull, 0);
}
mHasCachedMargin = PR_TRUE;
}
else
@ -389,12 +393,11 @@ nsStylePadding::Destroy(nsIPresContext* aContext) {
void nsStylePadding::RecalcData()
{
if (IsFixedData(mPadding, PR_FALSE)) {
nsStyleCoord coord;
mCachedPadding.left = CalcCoord(mPadding.GetLeft(coord), nsnull, 0);
mCachedPadding.top = CalcCoord(mPadding.GetTop(coord), nsnull, 0);
mCachedPadding.right = CalcCoord(mPadding.GetRight(coord), nsnull, 0);
mCachedPadding.bottom = CalcCoord(mPadding.GetBottom(coord), nsnull, 0);
nsStyleCoord coord;
NS_FOR_CSS_SIDES(side) {
mCachedPadding.*(gMarginSides[side]) =
CalcCoord(mPadding.Get(side, coord), nsnull, 0);
}
mHasCachedPadding = PR_TRUE;
}
else
@ -496,38 +499,20 @@ PRBool nsStyleBorder::IsBorderSideVisible(PRUint8 aSide) const
void nsStyleBorder::RecalcData()
{
if (((!IsBorderSideVisible(NS_SIDE_LEFT))||
IsFixedUnit(mBorder.GetLeftUnit(), PR_TRUE)) &&
((!IsBorderSideVisible(NS_SIDE_TOP)) ||
IsFixedUnit(mBorder.GetTopUnit(), PR_TRUE)) &&
((!IsBorderSideVisible(NS_SIDE_RIGHT)) ||
IsFixedUnit(mBorder.GetRightUnit(), PR_TRUE)) &&
((!IsBorderSideVisible(NS_SIDE_BOTTOM)) ||
IsFixedUnit(mBorder.GetBottomUnit(), PR_TRUE))) {
nsStyleCoord coord;
if (!IsBorderSideVisible(NS_SIDE_LEFT)) {
mCachedBorder.left = 0;
PRBool allFixed = PR_TRUE;
{NS_FOR_CSS_SIDES(side) {
if (IsBorderSideVisible(side) &&
!IsFixedUnit(mBorder.GetUnit(side), PR_TRUE)) {
allFixed = PR_FALSE;
break;
}
else {
mCachedBorder.left = CalcCoord(mBorder.GetLeft(coord), mBorderWidths, 3);
}
if (!IsBorderSideVisible(NS_SIDE_TOP)) {
mCachedBorder.top = 0;
}
else {
mCachedBorder.top = CalcCoord(mBorder.GetTop(coord), mBorderWidths, 3);
}
if (!IsBorderSideVisible(NS_SIDE_RIGHT)) {
mCachedBorder.right = 0;
}
else {
mCachedBorder.right = CalcCoord(mBorder.GetRight(coord), mBorderWidths, 3);
}
if (!IsBorderSideVisible(NS_SIDE_BOTTOM)) {
mCachedBorder.bottom = 0;
}
else {
mCachedBorder.bottom = CalcCoord(mBorder.GetBottom(coord), mBorderWidths, 3);
}}
if (allFixed) {
nsStyleCoord coord;
NS_FOR_CSS_SIDES(side) {
mCachedBorder.*(gMarginSides[side]) = IsBorderSideVisible(side)
? CalcCoord(mBorder.Get(side, coord), mBorderWidths, 3)
: 0;
}
mHasCachedBorder = PR_TRUE;
}
@ -535,25 +520,12 @@ void nsStyleBorder::RecalcData()
mHasCachedBorder = PR_FALSE;
}
if ((mBorderStyle[NS_SIDE_TOP] & BORDER_COLOR_DEFINED) == 0) {
NS_ASSERTION(!(mBorderStyle[NS_SIDE_TOP] & BORDER_COLOR_SPECIAL),
"Clearing special border because BORDER_COLOR_DEFINED is not set");
SetBorderToForeground(NS_SIDE_TOP);
}
if ((mBorderStyle[NS_SIDE_BOTTOM] & BORDER_COLOR_DEFINED) == 0) {
NS_ASSERTION(!(mBorderStyle[NS_SIDE_BOTTOM] & BORDER_COLOR_SPECIAL),
"Clearing special border because BORDER_COLOR_DEFINED is not set");
SetBorderToForeground(NS_SIDE_BOTTOM);
}
if ((mBorderStyle[NS_SIDE_LEFT] & BORDER_COLOR_DEFINED) == 0) {
NS_ASSERTION(!(mBorderStyle[NS_SIDE_LEFT] & BORDER_COLOR_SPECIAL),
"Clearing special border because BORDER_COLOR_DEFINED is not set");
SetBorderToForeground(NS_SIDE_LEFT);
}
if ((mBorderStyle[NS_SIDE_RIGHT] & BORDER_COLOR_DEFINED) == 0) {
NS_ASSERTION(!(mBorderStyle[NS_SIDE_RIGHT] & BORDER_COLOR_SPECIAL),
"Clearing special border because BORDER_COLOR_DEFINED is not set");
SetBorderToForeground(NS_SIDE_RIGHT);
NS_FOR_CSS_SIDES(side) {
if ((mBorderStyle[side] & BORDER_COLOR_DEFINED) == 0) {
NS_ASSERTION(!(mBorderStyle[side] & BORDER_COLOR_SPECIAL),
"Clearing special border because BORDER_COLOR_DEFINED is not set");
SetBorderToForeground(side);
}
}
}
@ -561,8 +533,7 @@ nsChangeHint nsStyleBorder::CalcDifference(const nsStyleBorder& aOther) const
{
if ((mBorder == aOther.mBorder) &&
(mFloatEdge == aOther.mFloatEdge)) {
PRInt32 ix;
for (ix = 0; ix < 4; ix++) {
NS_FOR_CSS_SIDES(ix) {
if ((mBorderStyle[ix] != aOther.mBorderStyle[ix]) ||
(mBorderColor[ix] != aOther.mBorderColor[ix])) {
if ((mBorderStyle[ix] != aOther.mBorderStyle[ix]) &&
@ -584,7 +555,7 @@ nsChangeHint nsStyleBorder::CalcDifference(const nsStyleBorder& aOther) const
}
if (mBorderColors && aOther.mBorderColors) {
for (ix = 0; ix < 4; ix++) {
NS_FOR_CSS_SIDES(ix) {
if (mBorderColors[ix] && !aOther.mBorderColors[ix] ||
!mBorderColors[ix] && aOther.mBorderColors[ix]) {
return NS_STYLE_HINT_VISUAL;

Просмотреть файл

@ -47,6 +47,8 @@
#define NS_SIDE_BOTTOM 2
#define NS_SIDE_LEFT 3
#define NS_FOR_CSS_SIDES(var_) for (PRInt32 var_ = 0; var_ < 4; ++var_)
// {margin,padding}-{left,right}-{ltr,rtl}-source
#define NS_BOXPROP_SOURCE_PHYSICAL 0
#define NS_BOXPROP_SOURCE_LOGICAL 1

Просмотреть файл

@ -47,6 +47,8 @@
#define NS_SIDE_BOTTOM 2
#define NS_SIDE_LEFT 3
#define NS_FOR_CSS_SIDES(var_) for (PRInt32 var_ = 0; var_ < 4; ++var_)
// {margin,padding}-{left,right}-{ltr,rtl}-source
#define NS_BOXPROP_SOURCE_PHYSICAL 0
#define NS_BOXPROP_SOURCE_LOGICAL 1

Просмотреть файл

@ -4908,7 +4908,7 @@ CSSParserImpl::DoParseRect(nsCSSRect& aRect, nsresult& aErrorCode)
if (!ExpectSymbol(aErrorCode, '(', PR_TRUE)) {
return PR_FALSE;
}
FOR_CSS_SIDES(side) {
NS_FOR_CSS_SIDES(side) {
if (! ParseVariant(aErrorCode, aRect.*(nsCSSRect::sides[side]),
VARIANT_AL, nsnull)) {
return PR_FALSE;

Просмотреть файл

@ -150,8 +150,6 @@ struct nsCSSText : public nsCSSStruct {
struct nsRuleDataText : public nsCSSText {
};
#define FOR_CSS_SIDES(var_) for (PRInt32 var_ = 0; var_ < 4; ++var_)
struct nsCSSRect {
nsCSSRect(void);
nsCSSRect(const nsCSSRect& aCopy);

Просмотреть файл

@ -3102,7 +3102,7 @@ nsRuleNode::ComputeMarginData(nsStyleStruct* aStartStruct,
// margin: length, percent, auto, inherit
nsStyleCoord coord;
nsStyleCoord parentCoord;
FOR_CSS_SIDES(side) {
NS_FOR_CSS_SIDES(side) {
parentMargin->mMargin.Get(side, parentCoord);
if (SetCoord(marginData.mMargin.*(nsCSSRect::sides[side]),
coord, parentCoord, SETCOORD_LPAH,
@ -3171,7 +3171,7 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct,
nsStyleCoord coord;
nsStyleCoord parentCoord;
{ // scope for compilers with broken |for| loop scoping
FOR_CSS_SIDES(side) {
NS_FOR_CSS_SIDES(side) {
const nsCSSValue &value = marginData.mBorderWidth.*(nsCSSRect::sides[side]);
if (SetCoord(value, coord, parentCoord, SETCOORD_LE, aContext,
mPresContext, inherited))
@ -3186,7 +3186,7 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct,
// border-style: enum, none, inhert
const nsCSSRect& ourStyle = marginData.mBorderStyle;
{ // scope for compilers with broken |for| loop scoping
FOR_CSS_SIDES(side) {
NS_FOR_CSS_SIDES(side) {
const nsCSSValue &value = ourStyle.*(nsCSSRect::sides[side]);
nsCSSUnit unit = value.GetUnit();
if (eCSSUnit_Enumerated == unit) {
@ -3207,7 +3207,7 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct,
nscolor unused = NS_RGB(0,0,0);
{ // scope for compilers with broken |for| loop scoping
FOR_CSS_SIDES(side) {
NS_FOR_CSS_SIDES(side) {
nsCSSValueList* list =
marginData.mBorderColors.*(nsCSSValueListRect::sides[side]);
if (list) {
@ -3233,7 +3233,7 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct,
PRBool foreground;
{ // scope for compilers with broken |for| loop scoping
FOR_CSS_SIDES(side) {
NS_FOR_CSS_SIDES(side) {
const nsCSSValue &value = ourBorderColor.*(nsCSSRect::sides[side]);
if (eCSSUnit_Inherit == value.GetUnit()) {
if (parentContext) {
@ -3274,7 +3274,7 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct,
// -moz-border-radius: length, percent, inherit
{ // scope for compilers with broken |for| loop scoping
FOR_CSS_SIDES(side) {
NS_FOR_CSS_SIDES(side) {
parentBorder->mBorderRadius.Get(side, parentCoord);
if (SetCoord(marginData.mBorderRadius.*(nsCSSRect::sides[side]), coord,
parentCoord, SETCOORD_LPH, aContext, mPresContext,
@ -3337,7 +3337,7 @@ nsRuleNode::ComputePaddingData(nsStyleStruct* aStartStruct,
// padding: length, percent, inherit
nsStyleCoord coord;
nsStyleCoord parentCoord;
FOR_CSS_SIDES(side) {
NS_FOR_CSS_SIDES(side) {
parentPadding->mPadding.Get(side, parentCoord);
if (SetCoord(marginData.mPadding.*(nsCSSRect::sides[side]),
coord, parentCoord, SETCOORD_LPH,
@ -3591,7 +3591,7 @@ nsRuleNode::ComputePositionData(nsStyleStruct* aStartStruct,
// box offsets: length, percent, auto, inherit
nsStyleCoord coord;
nsStyleCoord parentCoord;
FOR_CSS_SIDES(side) {
NS_FOR_CSS_SIDES(side) {
parentPos->mOffset.Get(side, parentCoord);
if (SetCoord(posData.mOffset.*(nsCSSRect::sides[side]),
coord, parentCoord, SETCOORD_LPAH,

Просмотреть файл

@ -20,7 +20,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* David Hyatt (hyatt@netscape.com
* David Hyatt (hyatt@netscape.com)
*
*
* Alternatively, the contents of this file may be used under the terms of
@ -270,12 +270,17 @@ nsChangeHint nsStyleFont::CalcFontDifference(const nsFont& aFont1, const nsFont&
return NS_STYLE_HINT_REFLOW;
}
static nscoord nsMargin::* const gMarginSides[4] = {
&nsMargin::top, &nsMargin::right, &nsMargin::bottom, &nsMargin::left
};
static PRBool IsFixedData(const nsStyleSides& aSides, PRBool aEnumOK)
{
return PRBool(IsFixedUnit(aSides.GetLeftUnit(), aEnumOK) &&
IsFixedUnit(aSides.GetTopUnit(), aEnumOK) &&
IsFixedUnit(aSides.GetRightUnit(), aEnumOK) &&
IsFixedUnit(aSides.GetBottomUnit(), aEnumOK));
NS_FOR_CSS_SIDES(side) {
if (!IsFixedUnit(aSides.GetUnit(side), aEnumOK))
return PR_FALSE;
}
return PR_TRUE;
}
static nscoord CalcCoord(const nsStyleCoord& aCoord,
@ -331,12 +336,11 @@ nsStyleMargin::Destroy(nsIPresContext* aContext) {
void nsStyleMargin::RecalcData()
{
if (IsFixedData(mMargin, PR_FALSE)) {
nsStyleCoord coord;
mCachedMargin.left = CalcCoord(mMargin.GetLeft(coord), nsnull, 0);
mCachedMargin.top = CalcCoord(mMargin.GetTop(coord), nsnull, 0);
mCachedMargin.right = CalcCoord(mMargin.GetRight(coord), nsnull, 0);
mCachedMargin.bottom = CalcCoord(mMargin.GetBottom(coord), nsnull, 0);
nsStyleCoord coord;
NS_FOR_CSS_SIDES(side) {
mCachedMargin.*(gMarginSides[side]) =
CalcCoord(mMargin.Get(side, coord), nsnull, 0);
}
mHasCachedMargin = PR_TRUE;
}
else
@ -389,12 +393,11 @@ nsStylePadding::Destroy(nsIPresContext* aContext) {
void nsStylePadding::RecalcData()
{
if (IsFixedData(mPadding, PR_FALSE)) {
nsStyleCoord coord;
mCachedPadding.left = CalcCoord(mPadding.GetLeft(coord), nsnull, 0);
mCachedPadding.top = CalcCoord(mPadding.GetTop(coord), nsnull, 0);
mCachedPadding.right = CalcCoord(mPadding.GetRight(coord), nsnull, 0);
mCachedPadding.bottom = CalcCoord(mPadding.GetBottom(coord), nsnull, 0);
nsStyleCoord coord;
NS_FOR_CSS_SIDES(side) {
mCachedPadding.*(gMarginSides[side]) =
CalcCoord(mPadding.Get(side, coord), nsnull, 0);
}
mHasCachedPadding = PR_TRUE;
}
else
@ -496,38 +499,20 @@ PRBool nsStyleBorder::IsBorderSideVisible(PRUint8 aSide) const
void nsStyleBorder::RecalcData()
{
if (((!IsBorderSideVisible(NS_SIDE_LEFT))||
IsFixedUnit(mBorder.GetLeftUnit(), PR_TRUE)) &&
((!IsBorderSideVisible(NS_SIDE_TOP)) ||
IsFixedUnit(mBorder.GetTopUnit(), PR_TRUE)) &&
((!IsBorderSideVisible(NS_SIDE_RIGHT)) ||
IsFixedUnit(mBorder.GetRightUnit(), PR_TRUE)) &&
((!IsBorderSideVisible(NS_SIDE_BOTTOM)) ||
IsFixedUnit(mBorder.GetBottomUnit(), PR_TRUE))) {
nsStyleCoord coord;
if (!IsBorderSideVisible(NS_SIDE_LEFT)) {
mCachedBorder.left = 0;
PRBool allFixed = PR_TRUE;
{NS_FOR_CSS_SIDES(side) {
if (IsBorderSideVisible(side) &&
!IsFixedUnit(mBorder.GetUnit(side), PR_TRUE)) {
allFixed = PR_FALSE;
break;
}
else {
mCachedBorder.left = CalcCoord(mBorder.GetLeft(coord), mBorderWidths, 3);
}
if (!IsBorderSideVisible(NS_SIDE_TOP)) {
mCachedBorder.top = 0;
}
else {
mCachedBorder.top = CalcCoord(mBorder.GetTop(coord), mBorderWidths, 3);
}
if (!IsBorderSideVisible(NS_SIDE_RIGHT)) {
mCachedBorder.right = 0;
}
else {
mCachedBorder.right = CalcCoord(mBorder.GetRight(coord), mBorderWidths, 3);
}
if (!IsBorderSideVisible(NS_SIDE_BOTTOM)) {
mCachedBorder.bottom = 0;
}
else {
mCachedBorder.bottom = CalcCoord(mBorder.GetBottom(coord), mBorderWidths, 3);
}}
if (allFixed) {
nsStyleCoord coord;
NS_FOR_CSS_SIDES(side) {
mCachedBorder.*(gMarginSides[side]) = IsBorderSideVisible(side)
? CalcCoord(mBorder.Get(side, coord), mBorderWidths, 3)
: 0;
}
mHasCachedBorder = PR_TRUE;
}
@ -535,25 +520,12 @@ void nsStyleBorder::RecalcData()
mHasCachedBorder = PR_FALSE;
}
if ((mBorderStyle[NS_SIDE_TOP] & BORDER_COLOR_DEFINED) == 0) {
NS_ASSERTION(!(mBorderStyle[NS_SIDE_TOP] & BORDER_COLOR_SPECIAL),
"Clearing special border because BORDER_COLOR_DEFINED is not set");
SetBorderToForeground(NS_SIDE_TOP);
}
if ((mBorderStyle[NS_SIDE_BOTTOM] & BORDER_COLOR_DEFINED) == 0) {
NS_ASSERTION(!(mBorderStyle[NS_SIDE_BOTTOM] & BORDER_COLOR_SPECIAL),
"Clearing special border because BORDER_COLOR_DEFINED is not set");
SetBorderToForeground(NS_SIDE_BOTTOM);
}
if ((mBorderStyle[NS_SIDE_LEFT] & BORDER_COLOR_DEFINED) == 0) {
NS_ASSERTION(!(mBorderStyle[NS_SIDE_LEFT] & BORDER_COLOR_SPECIAL),
"Clearing special border because BORDER_COLOR_DEFINED is not set");
SetBorderToForeground(NS_SIDE_LEFT);
}
if ((mBorderStyle[NS_SIDE_RIGHT] & BORDER_COLOR_DEFINED) == 0) {
NS_ASSERTION(!(mBorderStyle[NS_SIDE_RIGHT] & BORDER_COLOR_SPECIAL),
"Clearing special border because BORDER_COLOR_DEFINED is not set");
SetBorderToForeground(NS_SIDE_RIGHT);
NS_FOR_CSS_SIDES(side) {
if ((mBorderStyle[side] & BORDER_COLOR_DEFINED) == 0) {
NS_ASSERTION(!(mBorderStyle[side] & BORDER_COLOR_SPECIAL),
"Clearing special border because BORDER_COLOR_DEFINED is not set");
SetBorderToForeground(side);
}
}
}
@ -561,8 +533,7 @@ nsChangeHint nsStyleBorder::CalcDifference(const nsStyleBorder& aOther) const
{
if ((mBorder == aOther.mBorder) &&
(mFloatEdge == aOther.mFloatEdge)) {
PRInt32 ix;
for (ix = 0; ix < 4; ix++) {
NS_FOR_CSS_SIDES(ix) {
if ((mBorderStyle[ix] != aOther.mBorderStyle[ix]) ||
(mBorderColor[ix] != aOther.mBorderColor[ix])) {
if ((mBorderStyle[ix] != aOther.mBorderStyle[ix]) &&
@ -584,7 +555,7 @@ nsChangeHint nsStyleBorder::CalcDifference(const nsStyleBorder& aOther) const
}
if (mBorderColors && aOther.mBorderColors) {
for (ix = 0; ix < 4; ix++) {
NS_FOR_CSS_SIDES(ix) {
if (mBorderColors[ix] && !aOther.mBorderColors[ix] ||
!mBorderColors[ix] && aOther.mBorderColors[ix]) {
return NS_STYLE_HINT_VISUAL;