115804 - nsStyleBorder::CalcDifference not accounting for mBorderColors, r=ben, sr=hyatt

This commit is contained in:
hewitt%netscape.com 2001-12-19 11:59:31 +00:00
Родитель 251414564d
Коммит af7305af17
4 изменённых файлов: 62 добавлений и 0 удалений

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

@ -318,6 +318,19 @@ struct nsBorderColors {
~nsBorderColors() {
delete mNext;
}
PRBool Equals(nsBorderColors* aOther) {
nsBorderColors* c1 = this;
nsBorderColors* c2 = aOther;
while (c1 && c2) {
if (c1->mColor != c2->mColor ||
c1->mTransparent != c2->mTransparent)
return PR_FALSE;
c1 = c1->mNext;
c2 = c2->mNext;
}
return !c1 && !c2;
}
};
struct nsStyleBorder: public nsStyleStruct {

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

@ -572,6 +572,24 @@ PRInt32 nsStyleBorder::CalcDifference(const nsStyleBorder& aOther) const
if (mBorderRadius != aOther.mBorderRadius) {
return NS_STYLE_HINT_VISUAL;
}
if (mBorderColors && !aOther.mBorderColors ||
!mBorderColors && aOther.mBorderColors) {
return NS_STYLE_HINT_VISUAL;
}
if (mBorderColors && aOther.mBorderColors) {
for (ix = 0; ix < 4; ix++) {
if (mBorderColors[ix] && !aOther.mBorderColors[ix] ||
!mBorderColors[ix] && aOther.mBorderColors[ix]) {
return NS_STYLE_HINT_VISUAL;
} else if (mBorderColors[ix] && aOther.mBorderColors[ix]) {
if (!mBorderColors[ix]->Equals(aOther.mBorderColors[ix]))
return NS_STYLE_HINT_VISUAL;
}
}
}
return NS_STYLE_HINT_NONE;
}
return NS_STYLE_HINT_REFLOW;

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

@ -572,6 +572,24 @@ PRInt32 nsStyleBorder::CalcDifference(const nsStyleBorder& aOther) const
if (mBorderRadius != aOther.mBorderRadius) {
return NS_STYLE_HINT_VISUAL;
}
if (mBorderColors && !aOther.mBorderColors ||
!mBorderColors && aOther.mBorderColors) {
return NS_STYLE_HINT_VISUAL;
}
if (mBorderColors && aOther.mBorderColors) {
for (ix = 0; ix < 4; ix++) {
if (mBorderColors[ix] && !aOther.mBorderColors[ix] ||
!mBorderColors[ix] && aOther.mBorderColors[ix]) {
return NS_STYLE_HINT_VISUAL;
} else if (mBorderColors[ix] && aOther.mBorderColors[ix]) {
if (!mBorderColors[ix]->Equals(aOther.mBorderColors[ix]))
return NS_STYLE_HINT_VISUAL;
}
}
}
return NS_STYLE_HINT_NONE;
}
return NS_STYLE_HINT_REFLOW;

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

@ -318,6 +318,19 @@ struct nsBorderColors {
~nsBorderColors() {
delete mNext;
}
PRBool Equals(nsBorderColors* aOther) {
nsBorderColors* c1 = this;
nsBorderColors* c2 = aOther;
while (c1 && c2) {
if (c1->mColor != c2->mColor ||
c1->mTransparent != c2->mTransparent)
return PR_FALSE;
c1 = c1->mNext;
c2 = c2->mNext;
}
return !c1 && !c2;
}
};
struct nsStyleBorder: public nsStyleStruct {