mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 765371 - decomtaminate GetSelected-RowCount / ColumnCount / CellCount on accessible tables, r=tbsaunde
This commit is contained in:
parent
8a08fcb9d6
commit
aa746fa127
@ -219,24 +219,17 @@ ARIAGridAccessible::IsCellSelected(PRUint32 aRowIdx, PRUint32 aColIdx)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
PRUint32
|
||||||
ARIAGridAccessible::GetSelectedCellCount(PRUint32* aCount)
|
ARIAGridAccessible::SelectedCellCount()
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aCount);
|
PRUint32 count = 0, colCount = ColCount();
|
||||||
*aCount = 0;
|
|
||||||
|
|
||||||
if (IsDefunct())
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
PRInt32 colCount = 0;
|
|
||||||
GetColumnCount(&colCount);
|
|
||||||
|
|
||||||
AccIterator rowIter(this, filters::GetRow);
|
AccIterator rowIter(this, filters::GetRow);
|
||||||
|
|
||||||
Accessible* row = nsnull;
|
Accessible* row = nsnull;
|
||||||
|
|
||||||
while ((row = rowIter.Next())) {
|
while ((row = rowIter.Next())) {
|
||||||
if (nsAccUtils::IsARIASelected(row)) {
|
if (nsAccUtils::IsARIASelected(row)) {
|
||||||
(*aCount) += colCount;
|
count += colCount;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -245,34 +238,32 @@ ARIAGridAccessible::GetSelectedCellCount(PRUint32* aCount)
|
|||||||
|
|
||||||
while ((cell = cellIter.Next())) {
|
while ((cell = cellIter.Next())) {
|
||||||
if (nsAccUtils::IsARIASelected(cell))
|
if (nsAccUtils::IsARIASelected(cell))
|
||||||
(*aCount)++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
PRUint32
|
||||||
ARIAGridAccessible::GetSelectedColumnCount(PRUint32* aCount)
|
ARIAGridAccessible::SelectedColCount()
|
||||||
{
|
{
|
||||||
return GetSelectedColumnsArray(aCount);
|
PRUint32 colCount = 0;
|
||||||
|
GetSelectedColumnsArray(&colCount);
|
||||||
|
return colCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
PRUint32
|
||||||
ARIAGridAccessible::GetSelectedRowCount(PRUint32* aCount)
|
ARIAGridAccessible::SelectedRowCount()
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aCount);
|
PRUint32 count = 0;
|
||||||
*aCount = 0;
|
|
||||||
|
|
||||||
if (IsDefunct())
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
AccIterator rowIter(this, filters::GetRow);
|
AccIterator rowIter(this, filters::GetRow);
|
||||||
|
|
||||||
Accessible* row = nsnull;
|
Accessible* row = nsnull;
|
||||||
|
|
||||||
while ((row = rowIter.Next())) {
|
while ((row = rowIter.Next())) {
|
||||||
if (nsAccUtils::IsARIASelected(row)) {
|
if (nsAccUtils::IsARIASelected(row)) {
|
||||||
(*aCount)++;
|
count++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,10 +281,10 @@ ARIAGridAccessible::GetSelectedRowCount(PRUint32* aCount)
|
|||||||
} while ((cell = cellIter.Next()));
|
} while ((cell = cellIter.Next()));
|
||||||
|
|
||||||
if (isRowSelected)
|
if (isRowSelected)
|
||||||
(*aCount)++;
|
count++;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -45,6 +45,9 @@ public:
|
|||||||
virtual bool IsColSelected(PRUint32 aColIdx);
|
virtual bool IsColSelected(PRUint32 aColIdx);
|
||||||
virtual bool IsRowSelected(PRUint32 aRowIdx);
|
virtual bool IsRowSelected(PRUint32 aRowIdx);
|
||||||
virtual bool IsCellSelected(PRUint32 aRowIdx, PRUint32 aColIdx);
|
virtual bool IsCellSelected(PRUint32 aRowIdx, PRUint32 aColIdx);
|
||||||
|
virtual PRUint32 SelectedCellCount();
|
||||||
|
virtual PRUint32 SelectedColCount();
|
||||||
|
virtual PRUint32 SelectedRowCount();
|
||||||
virtual void SelectCol(PRUint32 aColIdx);
|
virtual void SelectCol(PRUint32 aColIdx);
|
||||||
virtual void SelectRow(PRUint32 aRowIdx);
|
virtual void SelectRow(PRUint32 aRowIdx);
|
||||||
virtual void UnselectCol(PRUint32 aColIdx);
|
virtual void UnselectCol(PRUint32 aColIdx);
|
||||||
|
@ -554,93 +554,60 @@ HTMLTableAccessible::RowCount()
|
|||||||
return rowCount;
|
return rowCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
PRUint32
|
||||||
HTMLTableAccessible::GetSelectedCellCount(PRUint32* aCount)
|
HTMLTableAccessible::SelectedCellCount()
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aCount);
|
|
||||||
*aCount = 0;
|
|
||||||
|
|
||||||
PRInt32 rowCount = 0;
|
|
||||||
nsresult rv = GetRowCount(&rowCount);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
PRInt32 columnCount = 0;
|
|
||||||
rv = GetColumnCount(&columnCount);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
nsITableLayout *tableLayout = GetTableLayout();
|
nsITableLayout *tableLayout = GetTableLayout();
|
||||||
NS_ENSURE_STATE(tableLayout);
|
if (!tableLayout)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
PRUint32 count = 0, rowCount = RowCount(), colCount = ColCount();
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMElement> domElement;
|
nsCOMPtr<nsIDOMElement> domElement;
|
||||||
PRInt32 startRowIndex = 0, startColIndex = 0,
|
PRInt32 startRowIndex = 0, startColIndex = 0,
|
||||||
rowSpan, colSpan, actualRowSpan, actualColSpan;
|
rowSpan, colSpan, actualRowSpan, actualColSpan;
|
||||||
bool isSelected = false;
|
bool isSelected = false;
|
||||||
|
|
||||||
PRInt32 rowIndex;
|
for (PRUint32 rowIdx = 0; rowIdx < rowCount; rowIdx++) {
|
||||||
for (rowIndex = 0; rowIndex < rowCount; rowIndex++) {
|
for (PRUint32 colIdx = 0; colIdx < colCount; colIdx++) {
|
||||||
PRInt32 columnIndex;
|
nsresult rv = tableLayout->GetCellDataAt(rowIdx, colIdx,
|
||||||
for (columnIndex = 0; columnIndex < columnCount; columnIndex++) {
|
|
||||||
rv = tableLayout->GetCellDataAt(rowIndex, columnIndex,
|
|
||||||
*getter_AddRefs(domElement),
|
*getter_AddRefs(domElement),
|
||||||
startRowIndex, startColIndex,
|
startRowIndex, startColIndex,
|
||||||
rowSpan, colSpan,
|
rowSpan, colSpan,
|
||||||
actualRowSpan, actualColSpan,
|
actualRowSpan, actualColSpan,
|
||||||
isSelected);
|
isSelected);
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv) && startRowIndex == rowIndex &&
|
if (NS_SUCCEEDED(rv) && startRowIndex == rowIdx &&
|
||||||
startColIndex == columnIndex && isSelected) {
|
startColIndex == colIdx && isSelected)
|
||||||
(*aCount)++;
|
count++;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
PRUint32
|
||||||
HTMLTableAccessible::GetSelectedColumnCount(PRUint32* aCount)
|
HTMLTableAccessible::SelectedColCount()
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aCount);
|
PRUint32 count = 0, colCount = ColCount();
|
||||||
*aCount = 0;
|
|
||||||
|
|
||||||
PRInt32 count = 0;
|
for (PRUint32 colIdx = 0; colIdx < colCount; colIdx++)
|
||||||
nsresult rv = GetColumnCount(&count);
|
if (IsColSelected(colIdx))
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
count++;
|
||||||
|
|
||||||
PRInt32 index;
|
return count;
|
||||||
for (index = 0; index < count; index++) {
|
|
||||||
bool state = false;
|
|
||||||
rv = IsColumnSelected(index, &state);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
if (state)
|
|
||||||
(*aCount)++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
PRUint32
|
||||||
HTMLTableAccessible::GetSelectedRowCount(PRUint32* aCount)
|
HTMLTableAccessible::SelectedRowCount()
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aCount);
|
PRUint32 count = 0, rowCount = RowCount();
|
||||||
*aCount = 0;
|
|
||||||
|
|
||||||
PRInt32 count = 0;
|
for (PRUint32 rowIdx = 0; rowIdx < rowCount; rowIdx++)
|
||||||
nsresult rv = GetRowCount(&count);
|
if (IsRowSelected(rowIdx))
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
count++;
|
||||||
|
|
||||||
PRInt32 index;
|
return count;
|
||||||
for (index = 0; index < count; index++) {
|
|
||||||
bool state = false;
|
|
||||||
rv = IsRowSelected(index, &state);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
if (state)
|
|
||||||
(*aCount)++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -109,6 +109,9 @@ public:
|
|||||||
virtual bool IsColSelected(PRUint32 aColIdx);
|
virtual bool IsColSelected(PRUint32 aColIdx);
|
||||||
virtual bool IsRowSelected(PRUint32 aRowIdx);
|
virtual bool IsRowSelected(PRUint32 aRowIdx);
|
||||||
virtual bool IsCellSelected(PRUint32 aRowIdx, PRUint32 aColIdx);
|
virtual bool IsCellSelected(PRUint32 aRowIdx, PRUint32 aColIdx);
|
||||||
|
virtual PRUint32 SelectedCellCount();
|
||||||
|
virtual PRUint32 SelectedColCount();
|
||||||
|
virtual PRUint32 SelectedRowCount();
|
||||||
virtual void SelectCol(PRUint32 aColIdx);
|
virtual void SelectCol(PRUint32 aColIdx);
|
||||||
virtual void SelectRow(PRUint32 aRowIdx);
|
virtual void SelectRow(PRUint32 aRowIdx);
|
||||||
virtual void UnselectCol(PRUint32 aColIdx);
|
virtual void UnselectCol(PRUint32 aColIdx);
|
||||||
|
@ -202,6 +202,45 @@ xpcAccessibleTable::IsCellSelected(PRInt32 aRowIdx, PRInt32 aColIdx,
|
|||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
xpcAccessibleTable::GetSelectedCellCount(PRUint32* aSelectedCellCount)
|
||||||
|
{
|
||||||
|
NS_ENSURE_ARG_POINTER(aSelectedCellCount);
|
||||||
|
*aSelectedCellCount = 0;
|
||||||
|
|
||||||
|
if (!mTable)
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
*aSelectedCellCount = mTable->SelectedCellCount();
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
xpcAccessibleTable::GetSelectedColumnCount(PRUint32* aSelectedColumnCount)
|
||||||
|
{
|
||||||
|
NS_ENSURE_ARG_POINTER(aSelectedColumnCount);
|
||||||
|
*aSelectedColumnCount = 0;
|
||||||
|
|
||||||
|
if (!mTable)
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
*aSelectedColumnCount = mTable->SelectedColCount();
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
xpcAccessibleTable::GetSelectedRowCount(PRUint32* aSelectedRowCount)
|
||||||
|
{
|
||||||
|
NS_ENSURE_ARG_POINTER(aSelectedRowCount);
|
||||||
|
*aSelectedRowCount = 0;
|
||||||
|
|
||||||
|
if (!mTable)
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
|
*aSelectedRowCount = mTable->SelectedRowCount();
|
||||||
|
return NS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
xpcAccessibleTable::GetSummary(nsAString& aSummary)
|
xpcAccessibleTable::GetSummary(nsAString& aSummary)
|
||||||
{
|
{
|
||||||
|
@ -39,6 +39,9 @@ public:
|
|||||||
nsresult IsColumnSelected(PRInt32 aColIdx, bool* _retval);
|
nsresult IsColumnSelected(PRInt32 aColIdx, bool* _retval);
|
||||||
nsresult IsRowSelected(PRInt32 aRowIdx, bool* _retval);
|
nsresult IsRowSelected(PRInt32 aRowIdx, bool* _retval);
|
||||||
nsresult IsCellSelected(PRInt32 aRowIdx, PRInt32 aColIdx, bool* _retval);
|
nsresult IsCellSelected(PRInt32 aRowIdx, PRInt32 aColIdx, bool* _retval);
|
||||||
|
nsresult GetSelectedCellCount(PRUint32* aSelectedCellCount);
|
||||||
|
nsresult GetSelectedColumnCount(PRUint32* aSelectedColumnCount);
|
||||||
|
nsresult GetSelectedRowCount(PRUint32* aSelectedRowCount);
|
||||||
nsresult SelectColumn(PRInt32 aColIdx);
|
nsresult SelectColumn(PRInt32 aColIdx);
|
||||||
nsresult SelectRow(PRInt32 aRowIdx);
|
nsresult SelectRow(PRInt32 aRowIdx);
|
||||||
nsresult UnselectColumn(PRInt32 aColIdx);
|
nsresult UnselectColumn(PRInt32 aColIdx);
|
||||||
@ -79,9 +82,12 @@ protected:
|
|||||||
{ return xpcAccessibleTable::IsRowSelected(rowIdx, _retval); } \
|
{ return xpcAccessibleTable::IsRowSelected(rowIdx, _retval); } \
|
||||||
NS_SCRIPTABLE NS_IMETHOD IsCellSelected(PRInt32 rowIdx, PRInt32 colIdx, bool* _retval NS_OUTPARAM) \
|
NS_SCRIPTABLE NS_IMETHOD IsCellSelected(PRInt32 rowIdx, PRInt32 colIdx, bool* _retval NS_OUTPARAM) \
|
||||||
{ return xpcAccessibleTable::IsCellSelected(rowIdx, colIdx, _retval); } \
|
{ return xpcAccessibleTable::IsCellSelected(rowIdx, colIdx, _retval); } \
|
||||||
NS_SCRIPTABLE NS_IMETHOD GetSelectedCellCount(PRUint32 *aSelectedCellCount); \
|
NS_SCRIPTABLE NS_IMETHOD GetSelectedCellCount(PRUint32* aSelectedCellCount) \
|
||||||
NS_SCRIPTABLE NS_IMETHOD GetSelectedColumnCount(PRUint32 *aSelectedColumnCount); \
|
{ return xpcAccessibleTable::GetSelectedCellCount(aSelectedCellCount); } \
|
||||||
NS_SCRIPTABLE NS_IMETHOD GetSelectedRowCount(PRUint32 *aSelectedRowCount); \
|
NS_SCRIPTABLE NS_IMETHOD GetSelectedColumnCount(PRUint32* aSelectedColumnCount) \
|
||||||
|
{ return xpcAccessibleTable::GetSelectedColumnCount(aSelectedColumnCount); } \
|
||||||
|
NS_SCRIPTABLE NS_IMETHOD GetSelectedRowCount(PRUint32* aSelectedRowCount) \
|
||||||
|
{ return xpcAccessibleTable::GetSelectedRowCount(aSelectedRowCount); } \
|
||||||
NS_SCRIPTABLE NS_IMETHOD GetSelectedCells(nsIArray * *aSelectedCells); \
|
NS_SCRIPTABLE NS_IMETHOD GetSelectedCells(nsIArray * *aSelectedCells); \
|
||||||
NS_SCRIPTABLE NS_IMETHOD GetSelectedCellIndices(PRUint32 *cellsArraySize NS_OUTPARAM, PRInt32 **cellsArray NS_OUTPARAM); \
|
NS_SCRIPTABLE NS_IMETHOD GetSelectedCellIndices(PRUint32 *cellsArraySize NS_OUTPARAM, PRInt32 **cellsArray NS_OUTPARAM); \
|
||||||
NS_SCRIPTABLE NS_IMETHOD GetSelectedColumnIndices(PRUint32 *rowsArraySize NS_OUTPARAM, PRInt32 **rowsArray NS_OUTPARAM); \
|
NS_SCRIPTABLE NS_IMETHOD GetSelectedColumnIndices(PRUint32 *rowsArraySize NS_OUTPARAM, PRInt32 **rowsArray NS_OUTPARAM); \
|
||||||
|
@ -354,12 +354,9 @@ XULListboxAccessible::IsCellSelected(PRUint32 aRowIdx, PRUint32 aColIdx)
|
|||||||
return IsRowSelected(aRowIdx);
|
return IsRowSelected(aRowIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
PRUint32
|
||||||
XULListboxAccessible::GetSelectedCellCount(PRUint32* aCount)
|
XULListboxAccessible::SelectedCellCount()
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aCount);
|
|
||||||
*aCount = 0;
|
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMXULMultiSelectControlElement> control =
|
nsCOMPtr<nsIDOMXULMultiSelectControlElement> control =
|
||||||
do_QueryInterface(mContent);
|
do_QueryInterface(mContent);
|
||||||
NS_ASSERTION(control,
|
NS_ASSERTION(control,
|
||||||
@ -368,76 +365,43 @@ XULListboxAccessible::GetSelectedCellCount(PRUint32* aCount)
|
|||||||
nsCOMPtr<nsIDOMNodeList> selectedItems;
|
nsCOMPtr<nsIDOMNodeList> selectedItems;
|
||||||
control->GetSelectedItems(getter_AddRefs(selectedItems));
|
control->GetSelectedItems(getter_AddRefs(selectedItems));
|
||||||
if (!selectedItems)
|
if (!selectedItems)
|
||||||
return NS_OK;
|
return 0;
|
||||||
|
|
||||||
PRUint32 selectedItemsCount = 0;
|
PRUint32 selectedItemsCount = 0;
|
||||||
nsresult rv = selectedItems->GetLength(&selectedItemsCount);
|
nsresult rv = selectedItems->GetLength(&selectedItemsCount);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, 0);
|
||||||
|
|
||||||
if (!selectedItemsCount)
|
return selectedItemsCount * ColCount();
|
||||||
return NS_OK;
|
|
||||||
|
|
||||||
PRInt32 columnCount = 0;
|
|
||||||
rv = GetColumnCount(&columnCount);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
*aCount = selectedItemsCount * columnCount;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
PRUint32
|
||||||
XULListboxAccessible::GetSelectedColumnCount(PRUint32* aCount)
|
XULListboxAccessible::SelectedColCount()
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aCount);
|
|
||||||
*aCount = 0;
|
|
||||||
|
|
||||||
if (IsDefunct())
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMXULMultiSelectControlElement> control =
|
nsCOMPtr<nsIDOMXULMultiSelectControlElement> control =
|
||||||
do_QueryInterface(mContent);
|
do_QueryInterface(mContent);
|
||||||
NS_ASSERTION(control,
|
NS_ASSERTION(control,
|
||||||
"Doesn't implement nsIDOMXULMultiSelectControlElement.");
|
"Doesn't implement nsIDOMXULMultiSelectControlElement.");
|
||||||
|
|
||||||
PRInt32 selectedrowCount = 0;
|
PRInt32 selectedRowCount = 0;
|
||||||
nsresult rv = control->GetSelectedCount(&selectedrowCount);
|
nsresult rv = control->GetSelectedCount(&selectedRowCount);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, 0);
|
||||||
|
|
||||||
PRInt32 rowCount = 0;
|
return selectedRowCount > 0 && selectedRowCount == RowCount() ? ColCount() : 0;
|
||||||
rv = GetRowCount(&rowCount);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
if (selectedrowCount != rowCount)
|
|
||||||
return NS_OK;
|
|
||||||
|
|
||||||
PRInt32 columnCount = 0;
|
|
||||||
rv = GetColumnCount(&columnCount);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
*aCount = columnCount;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
PRUint32
|
||||||
XULListboxAccessible::GetSelectedRowCount(PRUint32* aCount)
|
XULListboxAccessible::SelectedRowCount()
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aCount);
|
|
||||||
*aCount = 0;
|
|
||||||
|
|
||||||
if (IsDefunct())
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
nsCOMPtr<nsIDOMXULMultiSelectControlElement> control =
|
nsCOMPtr<nsIDOMXULMultiSelectControlElement> control =
|
||||||
do_QueryInterface(mContent);
|
do_QueryInterface(mContent);
|
||||||
NS_ASSERTION(control,
|
NS_ASSERTION(control,
|
||||||
"Doesn't implement nsIDOMXULMultiSelectControlElement.");
|
"Doesn't implement nsIDOMXULMultiSelectControlElement.");
|
||||||
|
|
||||||
PRInt32 selectedrowCount = 0;
|
PRInt32 selectedRowCount = 0;
|
||||||
nsresult rv = control->GetSelectedCount(&selectedrowCount);
|
nsresult rv = control->GetSelectedCount(&selectedRowCount);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, 0);
|
||||||
|
|
||||||
*aCount = selectedrowCount;
|
return selectedRowCount >= 0 ? selectedRowCount : 0;
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -79,6 +79,9 @@ public:
|
|||||||
virtual bool IsColSelected(PRUint32 aColIdx);
|
virtual bool IsColSelected(PRUint32 aColIdx);
|
||||||
virtual bool IsRowSelected(PRUint32 aRowIdx);
|
virtual bool IsRowSelected(PRUint32 aRowIdx);
|
||||||
virtual bool IsCellSelected(PRUint32 aRowIdx, PRUint32 aColIdx);
|
virtual bool IsCellSelected(PRUint32 aRowIdx, PRUint32 aColIdx);
|
||||||
|
virtual PRUint32 SelectedCellCount();
|
||||||
|
virtual PRUint32 SelectedColCount();
|
||||||
|
virtual PRUint32 SelectedRowCount();
|
||||||
virtual void SelectRow(PRUint32 aRowIdx);
|
virtual void SelectRow(PRUint32 aRowIdx);
|
||||||
virtual void UnselectRow(PRUint32 aRowIdx);
|
virtual void UnselectRow(PRUint32 aRowIdx);
|
||||||
|
|
||||||
|
@ -56,70 +56,33 @@ XULTreeGridAccessible::RowCount()
|
|||||||
return rowCount >= 0 ? rowCount : 0;
|
return rowCount >= 0 ? rowCount : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
PRUint32
|
||||||
XULTreeGridAccessible::GetSelectedCellCount(PRUint32* aCount)
|
XULTreeGridAccessible::SelectedCellCount()
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aCount);
|
return SelectedRowCount() * ColCount();
|
||||||
*aCount = 0;
|
|
||||||
|
|
||||||
PRUint32 selectedrowCount = 0;
|
|
||||||
nsresult rv = GetSelectedRowCount(&selectedrowCount);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
PRInt32 columnCount = 0;
|
|
||||||
rv = GetColumnCount(&columnCount);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
*aCount = selectedrowCount * columnCount;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
PRUint32
|
||||||
XULTreeGridAccessible::GetSelectedColumnCount(PRUint32* aCount)
|
XULTreeGridAccessible::SelectedColCount()
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aCount);
|
|
||||||
*aCount = 0;
|
|
||||||
|
|
||||||
if (IsDefunct())
|
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
// If all the row has been selected, then all the columns are selected,
|
// If all the row has been selected, then all the columns are selected,
|
||||||
// because we can't select a column alone.
|
// because we can't select a column alone.
|
||||||
|
|
||||||
PRInt32 rowCount = 0;
|
PRInt32 selectedRowCount = 0;
|
||||||
nsresult rv = GetRowCount(&rowCount);
|
nsresult rv = GetSelectionCount(&selectedRowCount);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, 0);
|
||||||
|
|
||||||
PRInt32 selectedrowCount = 0;
|
return selectedRowCount > 0 && selectedRowCount == RowCount() ? ColCount() : 0;
|
||||||
rv = GetSelectionCount(&selectedrowCount);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
if (rowCount == selectedrowCount) {
|
|
||||||
PRInt32 columnCount = 0;
|
|
||||||
rv = GetColumnCount(&columnCount);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
*aCount = columnCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
PRUint32
|
||||||
XULTreeGridAccessible::GetSelectedRowCount(PRUint32* aCount)
|
XULTreeGridAccessible::SelectedRowCount()
|
||||||
{
|
{
|
||||||
NS_ENSURE_ARG_POINTER(aCount);
|
PRInt32 selectedRowCount = 0;
|
||||||
*aCount = 0;
|
nsresult rv = GetSelectionCount(&selectedRowCount);
|
||||||
|
NS_ENSURE_SUCCESS(rv, 0);
|
||||||
|
|
||||||
if (IsDefunct())
|
return selectedRowCount >= 0 ? selectedRowCount : 0;
|
||||||
return NS_ERROR_FAILURE;
|
|
||||||
|
|
||||||
PRInt32 selectedrowCount = 0;
|
|
||||||
nsresult rv = GetSelectionCount(&selectedrowCount);
|
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
|
||||||
|
|
||||||
*aCount = selectedrowCount;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -38,6 +38,9 @@ public:
|
|||||||
virtual bool IsColSelected(PRUint32 aColIdx);
|
virtual bool IsColSelected(PRUint32 aColIdx);
|
||||||
virtual bool IsRowSelected(PRUint32 aRowIdx);
|
virtual bool IsRowSelected(PRUint32 aRowIdx);
|
||||||
virtual bool IsCellSelected(PRUint32 aRowIdx, PRUint32 aColIdx);
|
virtual bool IsCellSelected(PRUint32 aRowIdx, PRUint32 aColIdx);
|
||||||
|
virtual PRUint32 SelectedCellCount();
|
||||||
|
virtual PRUint32 SelectedColCount();
|
||||||
|
virtual PRUint32 SelectedRowCount();
|
||||||
virtual void SelectRow(PRUint32 aRowIdx);
|
virtual void SelectRow(PRUint32 aRowIdx);
|
||||||
virtual void UnselectRow(PRUint32 aRowIdx);
|
virtual void UnselectRow(PRUint32 aRowIdx);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user