Added support for Ctrl+Shift+mouseclick to select block of cells. Rewrote nsITableLayout::nsGetCellData() to be much more efficient, eliminating a method in the process. Implemented nsTableCellFrame::Get[Previous|Next]CellInColumn for cursor key navigation in tables. r=mjudge,karnaze.
This commit is contained in:
@@ -1057,6 +1057,54 @@ nsTableCellFrame::GetCellIndexes(PRInt32 &aRowIndex, PRInt32 &aColIndex)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTableCellFrame::GetPreviousCellInColumn(nsITableCellLayout **aCellLayout)
|
||||
{
|
||||
if (!aCellLayout) return NS_ERROR_NULL_POINTER;
|
||||
*aCellLayout = nsnull;
|
||||
|
||||
nsTableFrame* tableFrame = nsnull;
|
||||
nsresult rv = nsTableFrame::GetTableFrame(this, tableFrame);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!tableFrame) return NS_ERROR_FAILURE;
|
||||
|
||||
// Get current cell location
|
||||
PRInt32 rowIndex, colIndex;
|
||||
GetCellIndexes(rowIndex, colIndex);
|
||||
if (colIndex > 0)
|
||||
{
|
||||
// Get the cellframe at previous colIndex
|
||||
nsTableCellFrame *cellFrame = tableFrame->GetCellFrameAt(rowIndex, colIndex-1);
|
||||
if (cellFrame)
|
||||
cellFrame->QueryInterface(NS_GET_IID(nsITableCellLayout), (void **)aCellLayout);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsTableCellFrame::GetNextCellInColumn(nsITableCellLayout **aCellLayout)
|
||||
{
|
||||
if (!aCellLayout) return NS_ERROR_NULL_POINTER;
|
||||
*aCellLayout = nsnull;
|
||||
|
||||
nsTableFrame* tableFrame = nsnull;
|
||||
nsresult rv = nsTableFrame::GetTableFrame(this, tableFrame);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
if (!tableFrame) return NS_ERROR_FAILURE;
|
||||
|
||||
// Get current cell location
|
||||
PRInt32 rowIndex, colIndex;
|
||||
GetCellIndexes(rowIndex, colIndex);
|
||||
|
||||
// Get the cellframe at next colIndex
|
||||
nsTableCellFrame *cellFrame = tableFrame->GetCellFrameAt(rowIndex, colIndex+1);
|
||||
if (cellFrame)
|
||||
cellFrame->QueryInterface(NS_GET_IID(nsITableCellLayout), (void **)aCellLayout);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_NewTableCellFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user