Made direction inheritable by tables in nav-quirks mode; cleaned up some linux specific compiler warning noise

This commit is contained in:
kipp%netscape.com 1999-07-05 18:43:38 +00:00
Родитель f967462f7d
Коммит 7128c4ecd7
3 изменённых файлов: 105 добавлений и 99 удалений

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

@ -649,12 +649,12 @@ PRInt32 StyleSpacingImpl::CalcDifference(const StyleSpacingImpl& aOther) const
if ((mMargin == aOther.mMargin) && if ((mMargin == aOther.mMargin) &&
(mPadding == aOther.mPadding) && (mPadding == aOther.mPadding) &&
(mBorder == aOther.mBorder)) { (mBorder == aOther.mBorder)) {
PRInt32 index; PRInt32 ix;
for (index = 0; index < 4; index++) { for (ix = 0; ix < 4; ix++) {
if ((mBorderStyle[index] != aOther.mBorderStyle[index]) || if ((mBorderStyle[ix] != aOther.mBorderStyle[ix]) ||
(mBorderColor[index] != aOther.mBorderColor[index])) { (mBorderColor[ix] != aOther.mBorderColor[ix])) {
if ((NS_STYLE_BORDER_STYLE_NONE == mBorderStyle[index]) || if ((NS_STYLE_BORDER_STYLE_NONE == mBorderStyle[ix]) ||
(NS_STYLE_BORDER_STYLE_NONE == aOther.mBorderStyle[index])) { (NS_STYLE_BORDER_STYLE_NONE == aOther.mBorderStyle[ix])) {
return NS_STYLE_HINT_REFLOW; // border on or off return NS_STYLE_HINT_REFLOW; // border on or off
} }
return NS_STYLE_HINT_VISUAL; return NS_STYLE_HINT_VISUAL;
@ -1153,9 +1153,9 @@ StyleContentImpl::ResetFrom(const StyleContentImpl* aParent, nsIPresContext* aPr
// inherited data // inherited data
if (aParent) { if (aParent) {
if (NS_SUCCEEDED(AllocateQuotes(aParent->mQuotesCount))) { if (NS_SUCCEEDED(AllocateQuotes(aParent->mQuotesCount))) {
PRUint32 index = (mQuotesCount * 2); PRUint32 ix = (mQuotesCount * 2);
while (0 < index--) { while (0 < ix--) {
mQuotes[index] = aParent->mQuotes[index]; mQuotes[ix] = aParent->mQuotes[ix];
} }
} }
} }
@ -1173,30 +1173,30 @@ StyleContentImpl::CalcDifference(const StyleContentImpl& aOther) const
(mIncrementCount == aOther.mIncrementCount) && (mIncrementCount == aOther.mIncrementCount) &&
(mResetCount == aOther.mResetCount) && (mResetCount == aOther.mResetCount) &&
(mQuotesCount == aOther.mQuotesCount)) { (mQuotesCount == aOther.mQuotesCount)) {
PRUint32 index = mContentCount; PRUint32 ix = mContentCount;
while (0 < index--) { while (0 < ix--) {
if ((mContents[index].mType != aOther.mContents[index].mType) || if ((mContents[ix].mType != aOther.mContents[ix].mType) ||
(mContents[index].mContent != aOther.mContents[index].mContent)) { (mContents[ix].mContent != aOther.mContents[ix].mContent)) {
return NS_STYLE_HINT_REFLOW; return NS_STYLE_HINT_REFLOW;
} }
} }
index = mIncrementCount; ix = mIncrementCount;
while (0 < index--) { while (0 < ix--) {
if ((mIncrements[index].mValue != aOther.mIncrements[index].mValue) || if ((mIncrements[ix].mValue != aOther.mIncrements[ix].mValue) ||
(mIncrements[index].mCounter != aOther.mIncrements[index].mCounter)) { (mIncrements[ix].mCounter != aOther.mIncrements[ix].mCounter)) {
return NS_STYLE_HINT_REFLOW; return NS_STYLE_HINT_REFLOW;
} }
} }
index = mResetCount; ix = mResetCount;
while (0 < index--) { while (0 < ix--) {
if ((mResets[index].mValue != aOther.mResets[index].mValue) || if ((mResets[ix].mValue != aOther.mResets[ix].mValue) ||
(mResets[index].mCounter != aOther.mResets[index].mCounter)) { (mResets[ix].mCounter != aOther.mResets[ix].mCounter)) {
return NS_STYLE_HINT_REFLOW; return NS_STYLE_HINT_REFLOW;
} }
} }
index = (mQuotesCount * 2); ix = (mQuotesCount * 2);
while (0 < index--) { while (0 < ix--) {
if (mQuotes[index] != aOther.mQuotes[index]) { if (mQuotes[ix] != aOther.mQuotes[ix]) {
return NS_STYLE_HINT_REFLOW; return NS_STYLE_HINT_REFLOW;
} }
} }
@ -1825,8 +1825,9 @@ StyleContextImpl::RemapStyle(nsIPresContext* aPresContext)
StyleContextImpl* holdParent = mParent; StyleContextImpl* holdParent = mParent;
mParent = nsnull; // cut off all inheritance. this really blows mParent = nsnull; // cut off all inheritance. this really blows
// XXX the one piece of style we do preserve is visibility // XXX the style we do preserve is visibility, direction
PRUint8 visible = mDisplay.mVisible; PRUint8 visible = mDisplay.mVisible;
PRUint8 direction = mDisplay.mDirection;
// time to emulate a sub-document // time to emulate a sub-document
// This is ugly, but we need to map style once to determine display type // This is ugly, but we need to map style once to determine display type
@ -1841,13 +1842,14 @@ StyleContextImpl::RemapStyle(nsIPresContext* aPresContext)
mPosition.ResetFrom(nsnull, aPresContext); mPosition.ResetFrom(nsnull, aPresContext);
mDisplay.ResetFrom(nsnull, aPresContext); mDisplay.ResetFrom(nsnull, aPresContext);
mDisplay.mVisible = visible; mDisplay.mVisible = visible;
mDisplay.mDirection = direction;
PRUint32 cnt = 0; PRUint32 numRules = 0;
if (mRules) { if (mRules) {
nsresult rv = mRules->Count(&cnt); nsresult rv = mRules->Count(&numRules);
NS_ASSERTION(NS_SUCCEEDED(rv), "Count failed"); NS_ASSERTION(NS_SUCCEEDED(rv), "Count failed");
} }
if (0 < cnt) { if (0 < numRules) {
MapStyleData data(this, aPresContext); MapStyleData data(this, aPresContext);
mRules->EnumerateForwards(MapStyleRuleFont, &data); mRules->EnumerateForwards(MapStyleRuleFont, &data);
mRules->EnumerateForwards(MapStyleRule, &data); mRules->EnumerateForwards(MapStyleRule, &data);
@ -1998,8 +2000,8 @@ StyleContextImpl::CalcStyleDifference(nsIStyleContext* aOther, PRInt32& aHint) c
void StyleContextImpl::List(FILE* out, PRInt32 aIndent) void StyleContextImpl::List(FILE* out, PRInt32 aIndent)
{ {
// Indent // Indent
PRInt32 index; PRInt32 ix;
for (index = aIndent; --index >= 0; ) fputs(" ", out); for (ix = aIndent; --ix >= 0; ) fputs(" ", out);
fprintf(out, "%p(%d) ", this, mRefCnt); fprintf(out, "%p(%d) ", this, mRefCnt);
if (nsnull != mPseudoTag) { if (nsnull != mPseudoTag) {
nsAutoString buffer; nsAutoString buffer;
@ -2011,13 +2013,13 @@ void StyleContextImpl::List(FILE* out, PRInt32 aIndent)
if (0 < count) { if (0 < count) {
fputs("{\n", out); fputs("{\n", out);
for (index = 0; index < count; index++) { for (ix = 0; ix < count; ix++) {
nsIStyleRule* rule = (nsIStyleRule*)mRules->ElementAt(index); nsIStyleRule* rule = (nsIStyleRule*)mRules->ElementAt(ix);
rule->List(out, aIndent + 1); rule->List(out, aIndent + 1);
NS_RELEASE(rule); NS_RELEASE(rule);
} }
for (index = aIndent; --index >= 0; ) fputs(" ", out); for (ix = aIndent; --ix >= 0; ) fputs(" ", out);
fputs("}\n", out); fputs("}\n", out);
} }
else { else {

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

@ -649,12 +649,12 @@ PRInt32 StyleSpacingImpl::CalcDifference(const StyleSpacingImpl& aOther) const
if ((mMargin == aOther.mMargin) && if ((mMargin == aOther.mMargin) &&
(mPadding == aOther.mPadding) && (mPadding == aOther.mPadding) &&
(mBorder == aOther.mBorder)) { (mBorder == aOther.mBorder)) {
PRInt32 index; PRInt32 ix;
for (index = 0; index < 4; index++) { for (ix = 0; ix < 4; ix++) {
if ((mBorderStyle[index] != aOther.mBorderStyle[index]) || if ((mBorderStyle[ix] != aOther.mBorderStyle[ix]) ||
(mBorderColor[index] != aOther.mBorderColor[index])) { (mBorderColor[ix] != aOther.mBorderColor[ix])) {
if ((NS_STYLE_BORDER_STYLE_NONE == mBorderStyle[index]) || if ((NS_STYLE_BORDER_STYLE_NONE == mBorderStyle[ix]) ||
(NS_STYLE_BORDER_STYLE_NONE == aOther.mBorderStyle[index])) { (NS_STYLE_BORDER_STYLE_NONE == aOther.mBorderStyle[ix])) {
return NS_STYLE_HINT_REFLOW; // border on or off return NS_STYLE_HINT_REFLOW; // border on or off
} }
return NS_STYLE_HINT_VISUAL; return NS_STYLE_HINT_VISUAL;
@ -1153,9 +1153,9 @@ StyleContentImpl::ResetFrom(const StyleContentImpl* aParent, nsIPresContext* aPr
// inherited data // inherited data
if (aParent) { if (aParent) {
if (NS_SUCCEEDED(AllocateQuotes(aParent->mQuotesCount))) { if (NS_SUCCEEDED(AllocateQuotes(aParent->mQuotesCount))) {
PRUint32 index = (mQuotesCount * 2); PRUint32 ix = (mQuotesCount * 2);
while (0 < index--) { while (0 < ix--) {
mQuotes[index] = aParent->mQuotes[index]; mQuotes[ix] = aParent->mQuotes[ix];
} }
} }
} }
@ -1173,30 +1173,30 @@ StyleContentImpl::CalcDifference(const StyleContentImpl& aOther) const
(mIncrementCount == aOther.mIncrementCount) && (mIncrementCount == aOther.mIncrementCount) &&
(mResetCount == aOther.mResetCount) && (mResetCount == aOther.mResetCount) &&
(mQuotesCount == aOther.mQuotesCount)) { (mQuotesCount == aOther.mQuotesCount)) {
PRUint32 index = mContentCount; PRUint32 ix = mContentCount;
while (0 < index--) { while (0 < ix--) {
if ((mContents[index].mType != aOther.mContents[index].mType) || if ((mContents[ix].mType != aOther.mContents[ix].mType) ||
(mContents[index].mContent != aOther.mContents[index].mContent)) { (mContents[ix].mContent != aOther.mContents[ix].mContent)) {
return NS_STYLE_HINT_REFLOW; return NS_STYLE_HINT_REFLOW;
} }
} }
index = mIncrementCount; ix = mIncrementCount;
while (0 < index--) { while (0 < ix--) {
if ((mIncrements[index].mValue != aOther.mIncrements[index].mValue) || if ((mIncrements[ix].mValue != aOther.mIncrements[ix].mValue) ||
(mIncrements[index].mCounter != aOther.mIncrements[index].mCounter)) { (mIncrements[ix].mCounter != aOther.mIncrements[ix].mCounter)) {
return NS_STYLE_HINT_REFLOW; return NS_STYLE_HINT_REFLOW;
} }
} }
index = mResetCount; ix = mResetCount;
while (0 < index--) { while (0 < ix--) {
if ((mResets[index].mValue != aOther.mResets[index].mValue) || if ((mResets[ix].mValue != aOther.mResets[ix].mValue) ||
(mResets[index].mCounter != aOther.mResets[index].mCounter)) { (mResets[ix].mCounter != aOther.mResets[ix].mCounter)) {
return NS_STYLE_HINT_REFLOW; return NS_STYLE_HINT_REFLOW;
} }
} }
index = (mQuotesCount * 2); ix = (mQuotesCount * 2);
while (0 < index--) { while (0 < ix--) {
if (mQuotes[index] != aOther.mQuotes[index]) { if (mQuotes[ix] != aOther.mQuotes[ix]) {
return NS_STYLE_HINT_REFLOW; return NS_STYLE_HINT_REFLOW;
} }
} }
@ -1825,8 +1825,9 @@ StyleContextImpl::RemapStyle(nsIPresContext* aPresContext)
StyleContextImpl* holdParent = mParent; StyleContextImpl* holdParent = mParent;
mParent = nsnull; // cut off all inheritance. this really blows mParent = nsnull; // cut off all inheritance. this really blows
// XXX the one piece of style we do preserve is visibility // XXX the style we do preserve is visibility, direction
PRUint8 visible = mDisplay.mVisible; PRUint8 visible = mDisplay.mVisible;
PRUint8 direction = mDisplay.mDirection;
// time to emulate a sub-document // time to emulate a sub-document
// This is ugly, but we need to map style once to determine display type // This is ugly, but we need to map style once to determine display type
@ -1841,13 +1842,14 @@ StyleContextImpl::RemapStyle(nsIPresContext* aPresContext)
mPosition.ResetFrom(nsnull, aPresContext); mPosition.ResetFrom(nsnull, aPresContext);
mDisplay.ResetFrom(nsnull, aPresContext); mDisplay.ResetFrom(nsnull, aPresContext);
mDisplay.mVisible = visible; mDisplay.mVisible = visible;
mDisplay.mDirection = direction;
PRUint32 cnt = 0; PRUint32 numRules = 0;
if (mRules) { if (mRules) {
nsresult rv = mRules->Count(&cnt); nsresult rv = mRules->Count(&numRules);
NS_ASSERTION(NS_SUCCEEDED(rv), "Count failed"); NS_ASSERTION(NS_SUCCEEDED(rv), "Count failed");
} }
if (0 < cnt) { if (0 < numRules) {
MapStyleData data(this, aPresContext); MapStyleData data(this, aPresContext);
mRules->EnumerateForwards(MapStyleRuleFont, &data); mRules->EnumerateForwards(MapStyleRuleFont, &data);
mRules->EnumerateForwards(MapStyleRule, &data); mRules->EnumerateForwards(MapStyleRule, &data);
@ -1998,8 +2000,8 @@ StyleContextImpl::CalcStyleDifference(nsIStyleContext* aOther, PRInt32& aHint) c
void StyleContextImpl::List(FILE* out, PRInt32 aIndent) void StyleContextImpl::List(FILE* out, PRInt32 aIndent)
{ {
// Indent // Indent
PRInt32 index; PRInt32 ix;
for (index = aIndent; --index >= 0; ) fputs(" ", out); for (ix = aIndent; --ix >= 0; ) fputs(" ", out);
fprintf(out, "%p(%d) ", this, mRefCnt); fprintf(out, "%p(%d) ", this, mRefCnt);
if (nsnull != mPseudoTag) { if (nsnull != mPseudoTag) {
nsAutoString buffer; nsAutoString buffer;
@ -2011,13 +2013,13 @@ void StyleContextImpl::List(FILE* out, PRInt32 aIndent)
if (0 < count) { if (0 < count) {
fputs("{\n", out); fputs("{\n", out);
for (index = 0; index < count; index++) { for (ix = 0; ix < count; ix++) {
nsIStyleRule* rule = (nsIStyleRule*)mRules->ElementAt(index); nsIStyleRule* rule = (nsIStyleRule*)mRules->ElementAt(ix);
rule->List(out, aIndent + 1); rule->List(out, aIndent + 1);
NS_RELEASE(rule); NS_RELEASE(rule);
} }
for (index = aIndent; --index >= 0; ) fputs(" ", out); for (ix = aIndent; --ix >= 0; ) fputs(" ", out);
fputs("}\n", out); fputs("}\n", out);
} }
else { else {

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

@ -649,12 +649,12 @@ PRInt32 StyleSpacingImpl::CalcDifference(const StyleSpacingImpl& aOther) const
if ((mMargin == aOther.mMargin) && if ((mMargin == aOther.mMargin) &&
(mPadding == aOther.mPadding) && (mPadding == aOther.mPadding) &&
(mBorder == aOther.mBorder)) { (mBorder == aOther.mBorder)) {
PRInt32 index; PRInt32 ix;
for (index = 0; index < 4; index++) { for (ix = 0; ix < 4; ix++) {
if ((mBorderStyle[index] != aOther.mBorderStyle[index]) || if ((mBorderStyle[ix] != aOther.mBorderStyle[ix]) ||
(mBorderColor[index] != aOther.mBorderColor[index])) { (mBorderColor[ix] != aOther.mBorderColor[ix])) {
if ((NS_STYLE_BORDER_STYLE_NONE == mBorderStyle[index]) || if ((NS_STYLE_BORDER_STYLE_NONE == mBorderStyle[ix]) ||
(NS_STYLE_BORDER_STYLE_NONE == aOther.mBorderStyle[index])) { (NS_STYLE_BORDER_STYLE_NONE == aOther.mBorderStyle[ix])) {
return NS_STYLE_HINT_REFLOW; // border on or off return NS_STYLE_HINT_REFLOW; // border on or off
} }
return NS_STYLE_HINT_VISUAL; return NS_STYLE_HINT_VISUAL;
@ -1153,9 +1153,9 @@ StyleContentImpl::ResetFrom(const StyleContentImpl* aParent, nsIPresContext* aPr
// inherited data // inherited data
if (aParent) { if (aParent) {
if (NS_SUCCEEDED(AllocateQuotes(aParent->mQuotesCount))) { if (NS_SUCCEEDED(AllocateQuotes(aParent->mQuotesCount))) {
PRUint32 index = (mQuotesCount * 2); PRUint32 ix = (mQuotesCount * 2);
while (0 < index--) { while (0 < ix--) {
mQuotes[index] = aParent->mQuotes[index]; mQuotes[ix] = aParent->mQuotes[ix];
} }
} }
} }
@ -1173,30 +1173,30 @@ StyleContentImpl::CalcDifference(const StyleContentImpl& aOther) const
(mIncrementCount == aOther.mIncrementCount) && (mIncrementCount == aOther.mIncrementCount) &&
(mResetCount == aOther.mResetCount) && (mResetCount == aOther.mResetCount) &&
(mQuotesCount == aOther.mQuotesCount)) { (mQuotesCount == aOther.mQuotesCount)) {
PRUint32 index = mContentCount; PRUint32 ix = mContentCount;
while (0 < index--) { while (0 < ix--) {
if ((mContents[index].mType != aOther.mContents[index].mType) || if ((mContents[ix].mType != aOther.mContents[ix].mType) ||
(mContents[index].mContent != aOther.mContents[index].mContent)) { (mContents[ix].mContent != aOther.mContents[ix].mContent)) {
return NS_STYLE_HINT_REFLOW; return NS_STYLE_HINT_REFLOW;
} }
} }
index = mIncrementCount; ix = mIncrementCount;
while (0 < index--) { while (0 < ix--) {
if ((mIncrements[index].mValue != aOther.mIncrements[index].mValue) || if ((mIncrements[ix].mValue != aOther.mIncrements[ix].mValue) ||
(mIncrements[index].mCounter != aOther.mIncrements[index].mCounter)) { (mIncrements[ix].mCounter != aOther.mIncrements[ix].mCounter)) {
return NS_STYLE_HINT_REFLOW; return NS_STYLE_HINT_REFLOW;
} }
} }
index = mResetCount; ix = mResetCount;
while (0 < index--) { while (0 < ix--) {
if ((mResets[index].mValue != aOther.mResets[index].mValue) || if ((mResets[ix].mValue != aOther.mResets[ix].mValue) ||
(mResets[index].mCounter != aOther.mResets[index].mCounter)) { (mResets[ix].mCounter != aOther.mResets[ix].mCounter)) {
return NS_STYLE_HINT_REFLOW; return NS_STYLE_HINT_REFLOW;
} }
} }
index = (mQuotesCount * 2); ix = (mQuotesCount * 2);
while (0 < index--) { while (0 < ix--) {
if (mQuotes[index] != aOther.mQuotes[index]) { if (mQuotes[ix] != aOther.mQuotes[ix]) {
return NS_STYLE_HINT_REFLOW; return NS_STYLE_HINT_REFLOW;
} }
} }
@ -1825,8 +1825,9 @@ StyleContextImpl::RemapStyle(nsIPresContext* aPresContext)
StyleContextImpl* holdParent = mParent; StyleContextImpl* holdParent = mParent;
mParent = nsnull; // cut off all inheritance. this really blows mParent = nsnull; // cut off all inheritance. this really blows
// XXX the one piece of style we do preserve is visibility // XXX the style we do preserve is visibility, direction
PRUint8 visible = mDisplay.mVisible; PRUint8 visible = mDisplay.mVisible;
PRUint8 direction = mDisplay.mDirection;
// time to emulate a sub-document // time to emulate a sub-document
// This is ugly, but we need to map style once to determine display type // This is ugly, but we need to map style once to determine display type
@ -1841,13 +1842,14 @@ StyleContextImpl::RemapStyle(nsIPresContext* aPresContext)
mPosition.ResetFrom(nsnull, aPresContext); mPosition.ResetFrom(nsnull, aPresContext);
mDisplay.ResetFrom(nsnull, aPresContext); mDisplay.ResetFrom(nsnull, aPresContext);
mDisplay.mVisible = visible; mDisplay.mVisible = visible;
mDisplay.mDirection = direction;
PRUint32 cnt = 0; PRUint32 numRules = 0;
if (mRules) { if (mRules) {
nsresult rv = mRules->Count(&cnt); nsresult rv = mRules->Count(&numRules);
NS_ASSERTION(NS_SUCCEEDED(rv), "Count failed"); NS_ASSERTION(NS_SUCCEEDED(rv), "Count failed");
} }
if (0 < cnt) { if (0 < numRules) {
MapStyleData data(this, aPresContext); MapStyleData data(this, aPresContext);
mRules->EnumerateForwards(MapStyleRuleFont, &data); mRules->EnumerateForwards(MapStyleRuleFont, &data);
mRules->EnumerateForwards(MapStyleRule, &data); mRules->EnumerateForwards(MapStyleRule, &data);
@ -1998,8 +2000,8 @@ StyleContextImpl::CalcStyleDifference(nsIStyleContext* aOther, PRInt32& aHint) c
void StyleContextImpl::List(FILE* out, PRInt32 aIndent) void StyleContextImpl::List(FILE* out, PRInt32 aIndent)
{ {
// Indent // Indent
PRInt32 index; PRInt32 ix;
for (index = aIndent; --index >= 0; ) fputs(" ", out); for (ix = aIndent; --ix >= 0; ) fputs(" ", out);
fprintf(out, "%p(%d) ", this, mRefCnt); fprintf(out, "%p(%d) ", this, mRefCnt);
if (nsnull != mPseudoTag) { if (nsnull != mPseudoTag) {
nsAutoString buffer; nsAutoString buffer;
@ -2011,13 +2013,13 @@ void StyleContextImpl::List(FILE* out, PRInt32 aIndent)
if (0 < count) { if (0 < count) {
fputs("{\n", out); fputs("{\n", out);
for (index = 0; index < count; index++) { for (ix = 0; ix < count; ix++) {
nsIStyleRule* rule = (nsIStyleRule*)mRules->ElementAt(index); nsIStyleRule* rule = (nsIStyleRule*)mRules->ElementAt(ix);
rule->List(out, aIndent + 1); rule->List(out, aIndent + 1);
NS_RELEASE(rule); NS_RELEASE(rule);
} }
for (index = aIndent; --index >= 0; ) fputs(" ", out); for (ix = aIndent; --ix >= 0; ) fputs(" ", out);
fputs("}\n", out); fputs("}\n", out);
} }
else { else {