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

git-svn-id: svn://10.0.0.236/trunk@98727 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
cmanske%netscape.com
2001-07-05 22:35:22 +00:00
parent b7dcadfafa
commit ec0bd39530
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;
}