From 3c06eb9daf88d84368f444632227b76aececffa5 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Fri, 14 Oct 2005 21:26:38 +0000 Subject: [PATCH] Fix bug 311710, r=neil, sr=roc --- layout/xul/base/src/grid/nsGrid.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/layout/xul/base/src/grid/nsGrid.cpp b/layout/xul/base/src/grid/nsGrid.cpp index 0ada9083c028..bef674bb8be1 100644 --- a/layout/xul/base/src/grid/nsGrid.cpp +++ b/layout/xul/base/src/grid/nsGrid.cpp @@ -220,13 +220,17 @@ nsGrid::RebuildIfNeeded() // So in this case we need to make 1 extra column. // + // 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; if (computedColumnCount > columnCount) { - mExtraColumnCount = computedColumnCount - columnCount; columnCount = computedColumnCount; } + // Same for rows. + mExtraRowCount = computedRowCount - rowCount; if (computedRowCount > rowCount) { - mExtraRowCount = computedRowCount - rowCount; rowCount = computedRowCount; } @@ -536,10 +540,10 @@ nsGrid::GetRowAt(PRInt32 aIndex, PRBool aIsHorizontal) RebuildIfNeeded(); 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]; } else { - NS_ASSERTION(aIndex < mColumnCount || aIndex >= 0, "Index out of range"); + NS_ASSERTION(aIndex < mColumnCount && aIndex >= 0, "Index out of range"); return &mColumns[aIndex]; } }