result = tableLayout->GetCellDataAt(rowIndex, colIndex, *getter_AddRefs(cellElement), curRowIndex, curColIndex, rowSpan, colSpan, actualRowSpan, actualColSpan, isSelected);
result = tableLayout->GetCellDataAt(rowIndex, colIndex, getter_AddRefs(cellElement), curRowIndex, curColIndex, rowSpan, colSpan, actualRowSpan, actualColSpan, isSelected);
nsSelection::SelectRowOrColumn(nsIContent *aCellContent, PRUint32 aTarget){  if (!aCellContent) return NS_ERROR_NULL_POINTER;  nsCOMPtr<nsIContent> table;  nsresult result = GetParentTable(aCellContent, getter_AddRefs(table));  if (NS_FAILED(result)) return PR_FALSE;  if (!table) return NS_ERROR_NULL_POINTER;  // Get table and cell layout interfaces to access   //   cell data based on cellmap location  // Frames are not ref counted, so don't use an nsCOMPtr  nsITableLayout *tableLayout = GetTableLayout(table);  if (!tableLayout) return NS_ERROR_FAILURE;  nsITableCellLayout *cellLayout = GetCellLayout(aCellContent);  if (!cellLayout) return NS_ERROR_FAILURE;  // Get location of target cell:        PRInt32 rowIndex, colIndex, curRowIndex, curColIndex;  result = cellLayout->GetCellIndexes(rowIndex, colIndex);  if (NS_FAILED(result)) return result;  // Be sure we start at proper beginning  // (This allows us to select row or col given ANY cell!)  if (aTarget == nsISelectionPrivate::TABLESELECTION_ROW)    colIndex = 0;  if (aTarget == nsISelectionPrivate::TABLESELECTION_COLUMN)    rowIndex = 0;  nsCOMPtr<nsIDOMElement> cellElement;  nsCOMPtr<nsIDOMElement> firstCell;  nsCOMPtr<nsIDOMElement> lastCell;  PRInt32 rowSpan, colSpan, actualRowSpan, actualColSpan;  PRBool isSelected;  do {    // Loop through all cells in column or row to find first and last    result = tableLayout->GetCellDataAt(rowIndex, colIndex, *getter_AddRefs(cellElement),                                        curRowIndex, curColIndex, rowSpan, colSpan,                                         actualRowSpan, actualColSpan, isSelected);    if (NS_FAILED(result)) return result;    if (cellElement)    {      NS_ASSERTION(actualRowSpan > 0 && actualColSpan> 0, "SelectRowOrColumn: Bad rowspan or colspan\n");      if (!firstCell)        firstCell = cellElement;      lastCell = cellElement;      // Move to next cell in cellmap, skipping spanned locations      if (aTarget == nsISelectionPrivate::TABLESELECTION_ROW)        colIndex += actualColSpan;      else        rowIndex += actualRowSpan;    }  }  while (cellElement);  // Use SelectBlockOfCells:  // This will replace existing selection,  //  but allow unselecting by dragging out of selected region  if (firstCell && lastCell)  {    if (!mStartSelectedCell)    {      // We are starting a new block, so select the first cell      result = SelectCellElement(firstCell);      if (NS_FAILED(result)) return result;      mStartSelectedCell = do_QueryInterface(firstCell);    }    nsCOMPtr<nsIContent> lastCellContent = do_QueryInterface(lastCell);    result = SelectBlockOfCells(mStartSelectedCell, lastCellContent);    // This gets set to the cell at end of row/col,     //   but we need it to be the cell under cursor    mEndSelectedCell = aCellContent;    return result;  }#if 0// This is a more efficient strategy that appends row to current selection,//  but doesn't allow dragging OFF of an existing selection to unselect!  do {    // Loop through all cells in column or row    result = tableLayout->GetCellDataAt(rowIndex, colIndex, *getter_AddRefs(cellElement),                                        curRowIndex, curColIndex, rowSpan, colSpan,                                         actualRowSpan, actualColSpan, isSelected);    if (NS_FAILED(result)) return result;    // We're done when cell is not found    if (!cellElement) break;    // Check spans else we infinitely loop    NS_ASSERTION(actualColSpan, "actualColSpan is 0!");    NS_ASSERTION(actualRowSpan, "actualRowSpan is 0!");        // Skip cells that are already selected or span from outside our region    if (!isSelected && rowIndex == curRowIndex && colIndex == curColIndex)    {      result = SelectCellElement(cellElement);      if (NS_FAILED(result)) return result;    }    // Move to next row or column in cellmap, skipping spanned locations    if (aTarget == nsISelectionPrivate::TABLESELECTION_ROW)      colIndex += actualColSpan;    else      rowIndex += actualRowSpan;  }  while (cellElement);#endif  return NS_OK;}