Fixed Join Table Cells bug 86009, r=mjudge, sr=sfraser

This commit is contained in:
cmanske%netscape.com 2001-07-05 22:35:22 +00:00
parent 21bbde052f
commit 6820c1ef7d
2 changed files with 22 additions and 70 deletions

View File

@ -3120,47 +3120,23 @@ nsHTMLEditor::GetFirstSelectedCellInTable(nsIDOMElement **aCell, PRInt32 *aRowIn
if (NS_FAILED(res)) return res;
if (!cell) return NS_EDITOR_ELEMENT_NOT_FOUND;
PRInt32 startRowIndex, startColIndex;
res = GetCellIndexes(cell, startRowIndex, startColIndex);
if(NS_FAILED(res)) return res;
*aCell = cell.get();
NS_ADDREF(*aCell);
// Start with first cell selected
nsCOMPtr<nsIDOMElement> firstCell = cell;
PRInt32 firstRowIndex = startRowIndex;
PRInt32 firstColIndex = startColIndex;
while (cell)
// Also return the row and/or column if requested
if (aRowIndex || aColIndex)
{
res = GetNextSelectedCell(getter_AddRefs(cell), nsnull);
if (NS_FAILED(res)) return res;
if (cell)
{
res = GetCellIndexes(cell, startRowIndex, startColIndex);
if(NS_FAILED(res)) return res;
// Find the topmost row
if (startRowIndex <= firstRowIndex)
{
// Then save the left-most cell in that row
if (startRowIndex < firstRowIndex ||
startColIndex < firstColIndex)
{
firstCell = cell;
firstRowIndex = startRowIndex;
firstColIndex = startColIndex;
}
}
}
}
if (NS_SUCCEEDED(res))
{
*aCell = firstCell.get();
NS_ADDREF(*aCell);
PRInt32 startRowIndex, startColIndex;
res = GetCellIndexes(cell, startRowIndex, startColIndex);
if(NS_FAILED(res)) return res;
if (aRowIndex)
*aRowIndex = firstRowIndex;
*aRowIndex = startRowIndex;
if (aColIndex)
*aColIndex = firstColIndex;
*aColIndex = startColIndex;
}
return res;
}

View File

@ -3120,47 +3120,23 @@ nsHTMLEditor::GetFirstSelectedCellInTable(nsIDOMElement **aCell, PRInt32 *aRowIn
if (NS_FAILED(res)) return res;
if (!cell) return NS_EDITOR_ELEMENT_NOT_FOUND;
PRInt32 startRowIndex, startColIndex;
res = GetCellIndexes(cell, startRowIndex, startColIndex);
if(NS_FAILED(res)) return res;
*aCell = cell.get();
NS_ADDREF(*aCell);
// Start with first cell selected
nsCOMPtr<nsIDOMElement> firstCell = cell;
PRInt32 firstRowIndex = startRowIndex;
PRInt32 firstColIndex = startColIndex;
while (cell)
// Also return the row and/or column if requested
if (aRowIndex || aColIndex)
{
res = GetNextSelectedCell(getter_AddRefs(cell), nsnull);
if (NS_FAILED(res)) return res;
if (cell)
{
res = GetCellIndexes(cell, startRowIndex, startColIndex);
if(NS_FAILED(res)) return res;
// Find the topmost row
if (startRowIndex <= firstRowIndex)
{
// Then save the left-most cell in that row
if (startRowIndex < firstRowIndex ||
startColIndex < firstColIndex)
{
firstCell = cell;
firstRowIndex = startRowIndex;
firstColIndex = startColIndex;
}
}
}
}
if (NS_SUCCEEDED(res))
{
*aCell = firstCell.get();
NS_ADDREF(*aCell);
PRInt32 startRowIndex, startColIndex;
res = GetCellIndexes(cell, startRowIndex, startColIndex);
if(NS_FAILED(res)) return res;
if (aRowIndex)
*aRowIndex = firstRowIndex;
*aRowIndex = startRowIndex;
if (aColIndex)
*aColIndex = firstColIndex;
*aColIndex = startColIndex;
}
return res;
}