Fix bug 311710, r=neil, sr=roc

This commit is contained in:
bzbarsky%mit.edu 2005-10-14 21:26:38 +00:00
Родитель be63c93879
Коммит 3c06eb9daf
1 изменённых файлов: 8 добавлений и 4 удалений

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

@ -220,13 +220,17 @@ nsGrid::RebuildIfNeeded()
// So in this case we need to make 1 extra column. // So in this case we need to make 1 extra column.
// //
if (computedColumnCount > columnCount) { // Make sure to update mExtraColumnCount no matter what, since it might
// happen that we now have as many columns as are defined, and we wouldn't
// want to have a positive mExtraColumnCount hanging about in that case!
mExtraColumnCount = computedColumnCount - columnCount; mExtraColumnCount = computedColumnCount - columnCount;
if (computedColumnCount > columnCount) {
columnCount = computedColumnCount; columnCount = computedColumnCount;
} }
if (computedRowCount > rowCount) { // Same for rows.
mExtraRowCount = computedRowCount - rowCount; mExtraRowCount = computedRowCount - rowCount;
if (computedRowCount > rowCount) {
rowCount = computedRowCount; rowCount = computedRowCount;
} }
@ -536,10 +540,10 @@ nsGrid::GetRowAt(PRInt32 aIndex, PRBool aIsHorizontal)
RebuildIfNeeded(); RebuildIfNeeded();
if (aIsHorizontal) { if (aIsHorizontal) {
NS_ASSERTION(aIndex < mRowCount || aIndex >= 0, "Index out of range"); NS_ASSERTION(aIndex < mRowCount && aIndex >= 0, "Index out of range");
return &mRows[aIndex]; return &mRows[aIndex];
} else { } else {
NS_ASSERTION(aIndex < mColumnCount || aIndex >= 0, "Index out of range"); NS_ASSERTION(aIndex < mColumnCount && aIndex >= 0, "Index out of range");
return &mColumns[aIndex]; return &mColumns[aIndex];
} }
} }