2009-05-18 01:35:21 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
2011-03-01 21:16:20 -08:00
|
|
|
* Mozilla Foundation.
|
2009-05-18 01:35:21 -07:00
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2009
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Alexander Surkov <surkov.alexander@gmail.com> (original author)
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
2012-04-09 03:18:03 -07:00
|
|
|
#include "ARIAGridAccessible.h"
|
2009-05-18 01:35:21 -07:00
|
|
|
|
2012-04-13 07:17:03 -07:00
|
|
|
#include "Accessible-inl.h"
|
2010-06-21 06:08:27 -07:00
|
|
|
#include "AccIterator.h"
|
|
|
|
#include "nsAccUtils.h"
|
2012-01-11 19:07:35 -08:00
|
|
|
#include "Role.h"
|
2011-04-09 16:38:06 -07:00
|
|
|
#include "States.h"
|
2010-04-26 23:52:03 -07:00
|
|
|
|
|
|
|
#include "nsIMutableArray.h"
|
2009-09-10 18:07:56 -07:00
|
|
|
#include "nsComponentManagerUtils.h"
|
2009-05-18 01:35:21 -07:00
|
|
|
|
2012-04-09 03:18:03 -07:00
|
|
|
using namespace mozilla;
|
2011-07-27 05:43:01 -07:00
|
|
|
using namespace mozilla::a11y;
|
|
|
|
|
2009-05-18 01:35:21 -07:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2012-04-09 03:18:03 -07:00
|
|
|
// ARIAGridAccessible
|
2009-05-18 01:35:21 -07:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Constructor
|
|
|
|
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::
|
|
|
|
ARIAGridAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
|
2012-03-27 17:53:58 -07:00
|
|
|
nsAccessibleWrap(aContent, aDoc), xpcAccessibleTable(this)
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// nsISupports
|
|
|
|
|
2012-04-09 03:18:03 -07:00
|
|
|
NS_IMPL_ISUPPORTS_INHERITED1(ARIAGridAccessible,
|
2009-05-18 01:35:21 -07:00
|
|
|
nsAccessible,
|
|
|
|
nsIAccessibleTable)
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2012-03-27 17:53:58 -07:00
|
|
|
//nsAccessNode
|
2009-05-18 01:35:21 -07:00
|
|
|
|
2012-03-27 17:53:58 -07:00
|
|
|
void
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::Shutdown()
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
2012-03-27 17:53:58 -07:00
|
|
|
mTable = nsnull;
|
|
|
|
nsAccessibleWrap::Shutdown();
|
2012-03-27 17:32:49 -07:00
|
|
|
}
|
2012-03-27 15:23:29 -07:00
|
|
|
|
2012-03-27 17:53:58 -07:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// nsIAccessibleTable
|
|
|
|
|
2012-04-19 14:32:11 -07:00
|
|
|
PRUint32
|
|
|
|
ARIAGridAccessible::ColCount()
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
2010-06-21 06:08:27 -07:00
|
|
|
AccIterator rowIter(this, filters::GetRow);
|
2011-08-09 18:44:00 -07:00
|
|
|
nsAccessible* row = rowIter.Next();
|
2011-08-05 01:10:41 -07:00
|
|
|
if (!row)
|
2012-04-19 14:32:11 -07:00
|
|
|
return 0;
|
2010-05-20 00:40:25 -07:00
|
|
|
|
2010-06-21 06:08:27 -07:00
|
|
|
AccIterator cellIter(row, filters::GetCell);
|
2012-04-19 14:32:11 -07:00
|
|
|
nsAccessible* cell = nsnull;
|
2010-05-20 00:40:25 -07:00
|
|
|
|
2012-04-19 14:32:11 -07:00
|
|
|
PRUint32 colCount = 0;
|
2011-08-09 18:44:00 -07:00
|
|
|
while ((cell = cellIter.Next()))
|
2012-04-19 14:32:11 -07:00
|
|
|
colCount++;
|
2009-05-18 01:35:21 -07:00
|
|
|
|
2012-04-19 14:32:11 -07:00
|
|
|
return colCount;
|
2009-05-18 01:35:21 -07:00
|
|
|
}
|
|
|
|
|
2012-04-19 14:32:11 -07:00
|
|
|
PRUint32
|
|
|
|
ARIAGridAccessible::RowCount()
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
2012-04-19 14:32:11 -07:00
|
|
|
PRUint32 rowCount = 0;
|
2010-06-21 06:08:27 -07:00
|
|
|
AccIterator rowIter(this, filters::GetRow);
|
2011-08-09 18:44:00 -07:00
|
|
|
while (rowIter.Next())
|
2012-04-19 14:32:11 -07:00
|
|
|
rowCount++;
|
2009-05-18 01:35:21 -07:00
|
|
|
|
2012-04-19 14:32:11 -07:00
|
|
|
return rowCount;
|
2009-05-18 01:35:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::GetCellAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
|
|
|
|
nsIAccessible** aCell)
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
2012-04-09 03:18:03 -07:00
|
|
|
NS_ENSURE_ARG_POINTER(aCell);
|
|
|
|
*aCell = nsnull;
|
2009-05-18 01:35:21 -07:00
|
|
|
|
|
|
|
if (IsDefunct())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
2010-05-20 00:40:25 -07:00
|
|
|
nsAccessible *row = GetRowAt(aRowIndex);
|
2009-06-12 05:52:29 -07:00
|
|
|
NS_ENSURE_ARG(row);
|
2009-05-18 01:35:21 -07:00
|
|
|
|
2010-05-20 00:40:25 -07:00
|
|
|
nsAccessible *cell = GetCellInRowAt(row, aColumnIndex);
|
2009-06-12 05:52:29 -07:00
|
|
|
NS_ENSURE_ARG(cell);
|
2009-05-18 01:35:21 -07:00
|
|
|
|
2012-04-09 03:18:03 -07:00
|
|
|
NS_ADDREF(*aCell = cell);
|
2009-05-18 01:35:21 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::GetColumnIndexAt(PRInt32 aCellIndex,
|
|
|
|
PRInt32* aColumnIndex)
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
2009-09-10 18:07:56 -07:00
|
|
|
NS_ENSURE_ARG_POINTER(aColumnIndex);
|
|
|
|
*aColumnIndex = -1;
|
2009-05-18 01:35:21 -07:00
|
|
|
|
|
|
|
if (IsDefunct())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
2009-09-10 18:07:56 -07:00
|
|
|
NS_ENSURE_ARG(aCellIndex >= 0);
|
2009-05-18 01:35:21 -07:00
|
|
|
|
|
|
|
PRInt32 rowCount = 0;
|
2009-09-10 18:07:56 -07:00
|
|
|
GetRowCount(&rowCount);
|
2009-05-18 01:35:21 -07:00
|
|
|
|
2009-09-10 18:07:56 -07:00
|
|
|
PRInt32 colsCount = 0;
|
|
|
|
GetColumnCount(&colsCount);
|
2009-05-18 01:35:21 -07:00
|
|
|
|
2009-09-10 18:07:56 -07:00
|
|
|
NS_ENSURE_ARG(aCellIndex < rowCount * colsCount);
|
|
|
|
|
|
|
|
*aColumnIndex = aCellIndex % colsCount;
|
2009-05-18 01:35:21 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::GetRowIndexAt(PRInt32 aCellIndex, PRInt32* aRowIndex)
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
2009-09-10 18:07:56 -07:00
|
|
|
NS_ENSURE_ARG_POINTER(aRowIndex);
|
|
|
|
*aRowIndex = -1;
|
2009-05-18 01:35:21 -07:00
|
|
|
|
|
|
|
if (IsDefunct())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
2009-09-10 18:07:56 -07:00
|
|
|
NS_ENSURE_ARG(aCellIndex >= 0);
|
2009-05-18 01:35:21 -07:00
|
|
|
|
|
|
|
PRInt32 rowCount = 0;
|
2009-09-10 18:07:56 -07:00
|
|
|
GetRowCount(&rowCount);
|
2009-05-18 01:35:21 -07:00
|
|
|
|
2009-09-10 18:07:56 -07:00
|
|
|
PRInt32 colsCount = 0;
|
|
|
|
GetColumnCount(&colsCount);
|
2009-05-18 01:35:21 -07:00
|
|
|
|
2009-09-10 18:07:56 -07:00
|
|
|
NS_ENSURE_ARG(aCellIndex < rowCount * colsCount);
|
2009-05-18 01:35:21 -07:00
|
|
|
|
2009-09-10 18:07:56 -07:00
|
|
|
*aRowIndex = aCellIndex / colsCount;
|
2009-05-18 01:35:21 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2010-07-02 20:16:52 -07:00
|
|
|
NS_IMETHODIMP
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::GetRowAndColumnIndicesAt(PRInt32 aCellIndex,
|
|
|
|
PRInt32* aRowIndex,
|
|
|
|
PRInt32* aColumnIndex)
|
2010-07-02 20:16:52 -07:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aRowIndex);
|
|
|
|
*aRowIndex = -1;
|
|
|
|
NS_ENSURE_ARG_POINTER(aColumnIndex);
|
|
|
|
*aColumnIndex = -1;
|
|
|
|
|
|
|
|
if (IsDefunct())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
NS_ENSURE_ARG(aCellIndex >= 0);
|
|
|
|
|
|
|
|
PRInt32 rowCount = 0;
|
|
|
|
GetRowCount(&rowCount);
|
|
|
|
|
|
|
|
PRInt32 colsCount = 0;
|
|
|
|
GetColumnCount(&colsCount);
|
|
|
|
|
|
|
|
NS_ENSURE_ARG(aCellIndex < rowCount * colsCount);
|
|
|
|
|
|
|
|
*aColumnIndex = aCellIndex % colsCount;
|
|
|
|
*aRowIndex = aCellIndex / colsCount;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2009-05-18 01:35:21 -07:00
|
|
|
NS_IMETHODIMP
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::GetRowExtentAt(PRInt32 aRow, PRInt32 aColumn,
|
|
|
|
PRInt32* aExtentCount)
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aExtentCount);
|
|
|
|
*aExtentCount = 0;
|
|
|
|
|
|
|
|
if (IsDefunct())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
NS_ENSURE_ARG(IsValidRowNColumn(aRow, aColumn));
|
|
|
|
|
|
|
|
*aExtentCount = 1;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::GetColumnExtentAt(PRInt32 aRow, PRInt32 aColumn,
|
|
|
|
PRInt32* aExtentCount)
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aExtentCount);
|
|
|
|
*aExtentCount = 0;
|
|
|
|
|
|
|
|
if (IsDefunct())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
NS_ENSURE_ARG(IsValidRowNColumn(aRow, aColumn));
|
|
|
|
|
|
|
|
*aExtentCount = 1;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::GetColumnDescription(PRInt32 aColumn,
|
|
|
|
nsAString& aDescription)
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
|
|
|
aDescription.Truncate();
|
|
|
|
|
|
|
|
if (IsDefunct())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
NS_ENSURE_ARG(IsValidColumn(aColumn));
|
|
|
|
|
|
|
|
// XXX: not implemented
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::GetRowDescription(PRInt32 aRow, nsAString& aDescription)
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
|
|
|
aDescription.Truncate();
|
|
|
|
|
|
|
|
if (IsDefunct())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
NS_ENSURE_ARG(IsValidRow(aRow));
|
|
|
|
|
|
|
|
// XXX: not implemented
|
|
|
|
return NS_ERROR_NOT_IMPLEMENTED;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::IsColumnSelected(PRInt32 aColumn, bool* aIsSelected)
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aIsSelected);
|
2011-10-17 07:59:28 -07:00
|
|
|
*aIsSelected = false;
|
2009-05-18 01:35:21 -07:00
|
|
|
|
|
|
|
if (IsDefunct())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
NS_ENSURE_ARG(IsValidColumn(aColumn));
|
|
|
|
|
2010-06-21 06:08:27 -07:00
|
|
|
AccIterator rowIter(this, filters::GetRow);
|
2011-08-09 18:44:00 -07:00
|
|
|
nsAccessible *row = rowIter.Next();
|
2009-06-12 05:52:29 -07:00
|
|
|
if (!row)
|
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
do {
|
2009-09-10 18:07:56 -07:00
|
|
|
if (!nsAccUtils::IsARIASelected(row)) {
|
2010-05-20 00:40:25 -07:00
|
|
|
nsAccessible *cell = GetCellInRowAt(row, aColumn);
|
2009-06-12 05:52:29 -07:00
|
|
|
if (!cell) // Do not fail due to wrong markup
|
|
|
|
return NS_OK;
|
|
|
|
|
2009-09-10 18:07:56 -07:00
|
|
|
if (!nsAccUtils::IsARIASelected(cell))
|
2009-06-12 05:52:29 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2011-08-09 18:44:00 -07:00
|
|
|
} while ((row = rowIter.Next()));
|
2009-06-12 05:52:29 -07:00
|
|
|
|
2011-10-17 07:59:28 -07:00
|
|
|
*aIsSelected = true;
|
2009-06-12 05:52:29 -07:00
|
|
|
return NS_OK;
|
2009-05-18 01:35:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::IsRowSelected(PRInt32 aRow, bool* aIsSelected)
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aIsSelected);
|
2011-10-17 07:59:28 -07:00
|
|
|
*aIsSelected = false;
|
2009-05-18 01:35:21 -07:00
|
|
|
|
|
|
|
if (IsDefunct())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
2010-05-20 00:40:25 -07:00
|
|
|
nsAccessible *row = GetRowAt(aRow);
|
2009-06-12 05:52:29 -07:00
|
|
|
NS_ENSURE_ARG(row);
|
2009-05-18 01:35:21 -07:00
|
|
|
|
2009-09-10 18:07:56 -07:00
|
|
|
if (!nsAccUtils::IsARIASelected(row)) {
|
2010-06-21 06:08:27 -07:00
|
|
|
AccIterator cellIter(row, filters::GetCell);
|
2010-05-20 00:40:25 -07:00
|
|
|
nsAccessible *cell = nsnull;
|
2011-08-09 18:44:00 -07:00
|
|
|
while ((cell = cellIter.Next())) {
|
2009-09-10 18:07:56 -07:00
|
|
|
if (!nsAccUtils::IsARIASelected(cell))
|
2009-06-12 05:52:29 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2011-10-17 07:59:28 -07:00
|
|
|
*aIsSelected = true;
|
2009-06-12 05:52:29 -07:00
|
|
|
return NS_OK;
|
2009-05-18 01:35:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::IsCellSelected(PRInt32 aRow, PRInt32 aColumn,
|
|
|
|
bool* aIsSelected)
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aIsSelected);
|
2011-10-17 07:59:28 -07:00
|
|
|
*aIsSelected = false;
|
2009-05-18 01:35:21 -07:00
|
|
|
|
|
|
|
if (IsDefunct())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
2010-05-20 00:40:25 -07:00
|
|
|
nsAccessible *row = GetRowAt(aRow);
|
2009-06-12 05:52:29 -07:00
|
|
|
NS_ENSURE_ARG(row);
|
2009-05-18 01:35:21 -07:00
|
|
|
|
2009-09-10 18:07:56 -07:00
|
|
|
if (!nsAccUtils::IsARIASelected(row)) {
|
2010-05-20 00:40:25 -07:00
|
|
|
nsAccessible *cell = GetCellInRowAt(row, aColumn);
|
2009-06-12 05:52:29 -07:00
|
|
|
NS_ENSURE_ARG(cell);
|
|
|
|
|
2009-09-10 18:07:56 -07:00
|
|
|
if (!nsAccUtils::IsARIASelected(cell))
|
2009-06-12 05:52:29 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2011-10-17 07:59:28 -07:00
|
|
|
*aIsSelected = true;
|
2009-06-12 05:52:29 -07:00
|
|
|
return NS_OK;
|
2009-05-18 01:35:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::GetSelectedCellCount(PRUint32* aCount)
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aCount);
|
|
|
|
*aCount = 0;
|
|
|
|
|
|
|
|
if (IsDefunct())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
2009-06-12 05:52:29 -07:00
|
|
|
PRInt32 colCount = 0;
|
2009-09-10 18:07:56 -07:00
|
|
|
GetColumnCount(&colCount);
|
2010-05-20 00:40:25 -07:00
|
|
|
|
2010-06-21 06:08:27 -07:00
|
|
|
AccIterator rowIter(this, filters::GetRow);
|
2010-05-20 00:40:25 -07:00
|
|
|
|
|
|
|
nsAccessible *row = nsnull;
|
2011-08-09 18:44:00 -07:00
|
|
|
while ((row = rowIter.Next())) {
|
2009-09-10 18:07:56 -07:00
|
|
|
if (nsAccUtils::IsARIASelected(row)) {
|
2009-06-12 05:52:29 -07:00
|
|
|
(*aCount) += colCount;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2010-06-21 06:08:27 -07:00
|
|
|
AccIterator cellIter(row, filters::GetCell);
|
2010-05-20 00:40:25 -07:00
|
|
|
nsAccessible *cell = nsnull;
|
|
|
|
|
2011-08-09 18:44:00 -07:00
|
|
|
while ((cell = cellIter.Next())) {
|
2009-09-10 18:07:56 -07:00
|
|
|
if (nsAccUtils::IsARIASelected(cell))
|
2009-06-12 05:52:29 -07:00
|
|
|
(*aCount)++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
2009-05-18 01:35:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::GetSelectedColumnCount(PRUint32* aCount)
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
2009-06-12 05:52:29 -07:00
|
|
|
return GetSelectedColumnsArray(aCount);
|
2009-05-18 01:35:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::GetSelectedRowCount(PRUint32* aCount)
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aCount);
|
|
|
|
*aCount = 0;
|
|
|
|
|
|
|
|
if (IsDefunct())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
2010-06-21 06:08:27 -07:00
|
|
|
AccIterator rowIter(this, filters::GetRow);
|
2010-05-20 00:40:25 -07:00
|
|
|
|
|
|
|
nsAccessible *row = nsnull;
|
2011-08-09 18:44:00 -07:00
|
|
|
while ((row = rowIter.Next())) {
|
2009-09-10 18:07:56 -07:00
|
|
|
if (nsAccUtils::IsARIASelected(row)) {
|
2009-06-12 05:52:29 -07:00
|
|
|
(*aCount)++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2010-06-21 06:08:27 -07:00
|
|
|
AccIterator cellIter(row, filters::GetCell);
|
2011-08-09 18:44:00 -07:00
|
|
|
nsAccessible *cell = cellIter.Next();
|
2009-06-12 05:52:29 -07:00
|
|
|
if (!cell)
|
|
|
|
continue;
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool isRowSelected = true;
|
2009-06-12 05:52:29 -07:00
|
|
|
do {
|
2009-09-10 18:07:56 -07:00
|
|
|
if (!nsAccUtils::IsARIASelected(cell)) {
|
2011-10-17 07:59:28 -07:00
|
|
|
isRowSelected = false;
|
2009-06-12 05:52:29 -07:00
|
|
|
break;
|
|
|
|
}
|
2011-08-09 18:44:00 -07:00
|
|
|
} while ((cell = cellIter.Next()));
|
2009-06-12 05:52:29 -07:00
|
|
|
|
|
|
|
if (isRowSelected)
|
|
|
|
(*aCount)++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
2009-05-18 01:35:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::GetSelectedCells(nsIArray** aCells)
|
2009-09-10 18:07:56 -07:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aCells);
|
|
|
|
*aCells = nsnull;
|
|
|
|
|
|
|
|
if (IsDefunct())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
nsCOMPtr<nsIMutableArray> selCells =
|
|
|
|
do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
2010-06-21 06:08:27 -07:00
|
|
|
AccIterator rowIter(this, filters::GetRow);
|
2010-05-20 00:40:25 -07:00
|
|
|
|
|
|
|
nsAccessible *row = nsnull;
|
2011-08-09 18:44:00 -07:00
|
|
|
while ((row = rowIter.Next())) {
|
2010-06-21 06:08:27 -07:00
|
|
|
AccIterator cellIter(row, filters::GetCell);
|
2010-06-11 21:04:50 -07:00
|
|
|
nsAccessible *cell = nsnull;
|
2010-05-20 00:40:25 -07:00
|
|
|
|
2009-09-10 18:07:56 -07:00
|
|
|
if (nsAccUtils::IsARIASelected(row)) {
|
2011-08-09 18:44:00 -07:00
|
|
|
while ((cell = cellIter.Next()))
|
2011-10-17 07:59:28 -07:00
|
|
|
selCells->AppendElement(static_cast<nsIAccessible *>(cell), false);
|
2009-09-10 18:07:56 -07:00
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2011-08-09 18:44:00 -07:00
|
|
|
while ((cell = cellIter.Next())) {
|
2009-09-10 18:07:56 -07:00
|
|
|
if (nsAccUtils::IsARIASelected(cell))
|
2011-10-17 07:59:28 -07:00
|
|
|
selCells->AppendElement(static_cast<nsIAccessible *>(cell), false);
|
2009-09-10 18:07:56 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_ADDREF(*aCells = selCells);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::GetSelectedCellIndices(PRUint32* aCellsCount,
|
|
|
|
PRInt32** aCells)
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aCellsCount);
|
|
|
|
*aCellsCount = 0;
|
|
|
|
NS_ENSURE_ARG_POINTER(aCells);
|
|
|
|
*aCells = nsnull;
|
|
|
|
|
|
|
|
if (IsDefunct())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
2009-06-12 05:52:29 -07:00
|
|
|
PRInt32 rowCount = 0;
|
2009-09-10 18:07:56 -07:00
|
|
|
GetRowCount(&rowCount);
|
2009-06-12 05:52:29 -07:00
|
|
|
|
|
|
|
PRInt32 colCount = 0;
|
2009-09-10 18:07:56 -07:00
|
|
|
GetColumnCount(&colCount);
|
2009-06-12 05:52:29 -07:00
|
|
|
|
|
|
|
nsTArray<PRInt32> selCells(rowCount * colCount);
|
|
|
|
|
2010-06-21 06:08:27 -07:00
|
|
|
AccIterator rowIter(this, filters::GetRow);
|
2010-05-20 00:40:25 -07:00
|
|
|
|
|
|
|
nsAccessible *row = nsnull;
|
2011-08-09 18:44:00 -07:00
|
|
|
for (PRInt32 rowIdx = 0; (row = rowIter.Next()); rowIdx++) {
|
2009-09-10 18:07:56 -07:00
|
|
|
if (nsAccUtils::IsARIASelected(row)) {
|
2009-06-12 05:52:29 -07:00
|
|
|
for (PRInt32 colIdx = 0; colIdx < colCount; colIdx++)
|
|
|
|
selCells.AppendElement(rowIdx * colCount + colIdx);
|
|
|
|
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2010-06-21 06:08:27 -07:00
|
|
|
AccIterator cellIter(row, filters::GetCell);
|
2010-05-20 00:40:25 -07:00
|
|
|
nsAccessible *cell = nsnull;
|
|
|
|
|
2011-08-09 18:44:00 -07:00
|
|
|
for (PRInt32 colIdx = 0; (cell = cellIter.Next()); colIdx++) {
|
2009-09-10 18:07:56 -07:00
|
|
|
if (nsAccUtils::IsARIASelected(cell))
|
2009-06-12 05:52:29 -07:00
|
|
|
selCells.AppendElement(rowIdx * colCount + colIdx);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
PRUint32 selCellsCount = selCells.Length();
|
|
|
|
if (!selCellsCount)
|
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
*aCells = static_cast<PRInt32*>(
|
|
|
|
nsMemory::Clone(selCells.Elements(), selCellsCount * sizeof(PRInt32)));
|
|
|
|
NS_ENSURE_TRUE(*aCells, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
|
|
|
*aCellsCount = selCellsCount;
|
|
|
|
return NS_OK;
|
2009-05-18 01:35:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::GetSelectedColumnIndices(PRUint32* aColumnCount,
|
|
|
|
PRInt32** aColumns)
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aColumns);
|
|
|
|
|
2012-04-09 03:18:03 -07:00
|
|
|
return GetSelectedColumnsArray(aColumnCount, aColumns);
|
2009-05-18 01:35:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::GetSelectedRowIndices(PRUint32* aRowCount,
|
|
|
|
PRInt32** aRows)
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
2012-04-09 03:18:03 -07:00
|
|
|
NS_ENSURE_ARG_POINTER(aRowCount);
|
|
|
|
*aRowCount = 0;
|
2009-05-18 01:35:21 -07:00
|
|
|
NS_ENSURE_ARG_POINTER(aRows);
|
|
|
|
*aRows = nsnull;
|
|
|
|
|
|
|
|
if (IsDefunct())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
2009-06-12 05:52:29 -07:00
|
|
|
PRInt32 rowCount = 0;
|
2009-09-10 18:07:56 -07:00
|
|
|
GetRowCount(&rowCount);
|
2009-06-12 05:52:29 -07:00
|
|
|
if (!rowCount)
|
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
nsTArray<PRInt32> selRows(rowCount);
|
|
|
|
|
2010-06-21 06:08:27 -07:00
|
|
|
AccIterator rowIter(this, filters::GetRow);
|
2010-05-20 00:40:25 -07:00
|
|
|
|
|
|
|
nsAccessible *row = nsnull;
|
2011-08-09 18:44:00 -07:00
|
|
|
for (PRInt32 rowIdx = 0; (row = rowIter.Next()); rowIdx++) {
|
2009-09-10 18:07:56 -07:00
|
|
|
if (nsAccUtils::IsARIASelected(row)) {
|
2009-06-12 05:52:29 -07:00
|
|
|
selRows.AppendElement(rowIdx);
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2010-06-21 06:08:27 -07:00
|
|
|
AccIterator cellIter(row, filters::GetCell);
|
2011-08-09 18:44:00 -07:00
|
|
|
nsAccessible *cell = cellIter.Next();
|
2009-06-12 05:52:29 -07:00
|
|
|
if (!cell)
|
|
|
|
continue;
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool isRowSelected = true;
|
2009-06-12 05:52:29 -07:00
|
|
|
do {
|
2009-09-10 18:07:56 -07:00
|
|
|
if (!nsAccUtils::IsARIASelected(cell)) {
|
2011-10-17 07:59:28 -07:00
|
|
|
isRowSelected = false;
|
2009-06-12 05:52:29 -07:00
|
|
|
break;
|
|
|
|
}
|
2011-08-09 18:44:00 -07:00
|
|
|
} while ((cell = cellIter.Next()));
|
2009-06-12 05:52:29 -07:00
|
|
|
|
|
|
|
if (isRowSelected)
|
|
|
|
selRows.AppendElement(rowIdx);
|
|
|
|
}
|
|
|
|
|
2009-09-10 18:07:56 -07:00
|
|
|
PRUint32 selrowCount = selRows.Length();
|
|
|
|
if (!selrowCount)
|
2009-06-12 05:52:29 -07:00
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
*aRows = static_cast<PRInt32*>(
|
2009-09-10 18:07:56 -07:00
|
|
|
nsMemory::Clone(selRows.Elements(), selrowCount * sizeof(PRInt32)));
|
2009-06-12 05:52:29 -07:00
|
|
|
NS_ENSURE_TRUE(*aRows, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2012-04-09 03:18:03 -07:00
|
|
|
*aRowCount = selrowCount;
|
2009-06-12 05:52:29 -07:00
|
|
|
return NS_OK;
|
2009-05-18 01:35:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::SelectRow(PRInt32 aRow)
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG(IsValidRow(aRow));
|
|
|
|
|
|
|
|
if (IsDefunct())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
2010-06-21 06:08:27 -07:00
|
|
|
AccIterator rowIter(this, filters::GetRow);
|
2010-05-20 00:40:25 -07:00
|
|
|
|
|
|
|
nsAccessible *row = nsnull;
|
2011-08-09 18:44:00 -07:00
|
|
|
for (PRInt32 rowIdx = 0; (row = rowIter.Next()); rowIdx++) {
|
2009-06-12 05:52:29 -07:00
|
|
|
nsresult rv = SetARIASelected(row, rowIdx == aRow);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
2009-05-18 01:35:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::SelectColumn(PRInt32 aColumn)
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG(IsValidColumn(aColumn));
|
|
|
|
|
|
|
|
if (IsDefunct())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
2010-06-21 06:08:27 -07:00
|
|
|
AccIterator rowIter(this, filters::GetRow);
|
2010-05-20 00:40:25 -07:00
|
|
|
|
|
|
|
nsAccessible *row = nsnull;
|
2011-08-09 18:44:00 -07:00
|
|
|
while ((row = rowIter.Next())) {
|
2009-06-12 05:52:29 -07:00
|
|
|
// Unselect all cells in the row.
|
2011-10-17 07:59:28 -07:00
|
|
|
nsresult rv = SetARIASelected(row, false);
|
2009-06-12 05:52:29 -07:00
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
// Select cell at the column index.
|
2010-05-20 00:40:25 -07:00
|
|
|
nsAccessible *cell = GetCellInRowAt(row, aColumn);
|
2009-06-12 05:52:29 -07:00
|
|
|
if (cell) {
|
2011-10-17 07:59:28 -07:00
|
|
|
rv = SetARIASelected(cell, true);
|
2009-06-12 05:52:29 -07:00
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
2009-05-18 01:35:21 -07:00
|
|
|
}
|
|
|
|
|
2012-04-26 04:19:59 -07:00
|
|
|
void
|
|
|
|
ARIAGridAccessible::UnselectRow(PRUint32 aRowIdx)
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
2012-04-26 04:19:59 -07:00
|
|
|
nsAccessible* row = GetRowAt(aRowIdx);
|
2009-05-18 01:35:21 -07:00
|
|
|
|
2012-04-26 04:19:59 -07:00
|
|
|
if (row)
|
|
|
|
SetARIASelected(row, false);
|
2009-05-18 01:35:21 -07:00
|
|
|
}
|
|
|
|
|
2012-04-26 04:19:59 -07:00
|
|
|
void
|
|
|
|
ARIAGridAccessible::UnselectCol(PRUint32 aColIdx)
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
2010-06-21 06:08:27 -07:00
|
|
|
AccIterator rowIter(this, filters::GetRow);
|
2010-05-20 00:40:25 -07:00
|
|
|
|
2012-04-26 04:19:59 -07:00
|
|
|
nsAccessible* row = nsnull;
|
2011-08-09 18:44:00 -07:00
|
|
|
while ((row = rowIter.Next())) {
|
2012-04-26 04:19:59 -07:00
|
|
|
nsAccessible* cell = GetCellInRowAt(row, aColIdx);
|
|
|
|
if (cell)
|
|
|
|
SetARIASelected(cell, false);
|
2009-06-12 05:52:29 -07:00
|
|
|
}
|
2009-05-18 01:35:21 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Protected
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::IsValidRow(PRInt32 aRow)
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
|
|
|
if (aRow < 0)
|
2011-10-17 07:59:28 -07:00
|
|
|
return false;
|
2009-05-18 01:35:21 -07:00
|
|
|
|
|
|
|
PRInt32 rowCount = 0;
|
2009-09-10 18:07:56 -07:00
|
|
|
GetRowCount(&rowCount);
|
2009-05-18 01:35:21 -07:00
|
|
|
return aRow < rowCount;
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::IsValidColumn(PRInt32 aColumn)
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
|
|
|
if (aColumn < 0)
|
2011-10-17 07:59:28 -07:00
|
|
|
return false;
|
2009-05-18 01:35:21 -07:00
|
|
|
|
|
|
|
PRInt32 colCount = 0;
|
2009-09-10 18:07:56 -07:00
|
|
|
GetColumnCount(&colCount);
|
2009-05-18 01:35:21 -07:00
|
|
|
return aColumn < colCount;
|
|
|
|
}
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
bool
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::IsValidRowNColumn(PRInt32 aRow, PRInt32 aColumn)
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
|
|
|
if (aRow < 0 || aColumn < 0)
|
2011-10-17 07:59:28 -07:00
|
|
|
return false;
|
2009-05-18 01:35:21 -07:00
|
|
|
|
|
|
|
PRInt32 rowCount = 0;
|
2009-09-10 18:07:56 -07:00
|
|
|
GetRowCount(&rowCount);
|
2009-05-18 01:35:21 -07:00
|
|
|
if (aRow >= rowCount)
|
2011-10-17 07:59:28 -07:00
|
|
|
return false;
|
2009-05-18 01:35:21 -07:00
|
|
|
|
|
|
|
PRInt32 colCount = 0;
|
2009-09-10 18:07:56 -07:00
|
|
|
GetColumnCount(&colCount);
|
2009-05-18 01:35:21 -07:00
|
|
|
return aColumn < colCount;
|
|
|
|
}
|
|
|
|
|
2010-05-20 00:40:25 -07:00
|
|
|
nsAccessible*
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::GetRowAt(PRInt32 aRow)
|
2009-06-12 05:52:29 -07:00
|
|
|
{
|
|
|
|
PRInt32 rowIdx = aRow;
|
|
|
|
|
2010-06-21 06:08:27 -07:00
|
|
|
AccIterator rowIter(this, filters::GetRow);
|
2009-06-12 05:52:29 -07:00
|
|
|
|
2011-08-09 18:44:00 -07:00
|
|
|
nsAccessible *row = rowIter.Next();
|
|
|
|
while (rowIdx != 0 && (row = rowIter.Next()))
|
2010-05-20 00:40:25 -07:00
|
|
|
rowIdx--;
|
2009-06-12 05:52:29 -07:00
|
|
|
|
2010-05-20 00:40:25 -07:00
|
|
|
return row;
|
2009-06-12 05:52:29 -07:00
|
|
|
}
|
|
|
|
|
2010-05-20 00:40:25 -07:00
|
|
|
nsAccessible*
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::GetCellInRowAt(nsAccessible* aRow, PRInt32 aColumn)
|
2009-06-12 05:52:29 -07:00
|
|
|
{
|
2010-05-20 00:40:25 -07:00
|
|
|
PRInt32 colIdx = aColumn;
|
2009-06-12 05:52:29 -07:00
|
|
|
|
2010-06-21 06:08:27 -07:00
|
|
|
AccIterator cellIter(aRow, filters::GetCell);
|
2011-08-09 18:44:00 -07:00
|
|
|
nsAccessible *cell = cellIter.Next();
|
|
|
|
while (colIdx != 0 && (cell = cellIter.Next()))
|
2010-05-20 00:40:25 -07:00
|
|
|
colIdx--;
|
2009-06-12 05:52:29 -07:00
|
|
|
|
2010-05-20 00:40:25 -07:00
|
|
|
return cell;
|
2009-06-12 05:52:29 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::SetARIASelected(nsAccessible* aAccessible,
|
|
|
|
bool aIsSelected, bool aNotify)
|
2009-06-12 05:52:29 -07:00
|
|
|
{
|
2010-06-11 01:23:18 -07:00
|
|
|
nsIContent *content = aAccessible->GetContent();
|
2010-05-20 00:40:25 -07:00
|
|
|
NS_ENSURE_STATE(content);
|
2009-06-12 05:52:29 -07:00
|
|
|
|
|
|
|
nsresult rv = NS_OK;
|
|
|
|
if (aIsSelected)
|
2011-06-03 14:35:17 -07:00
|
|
|
rv = content->SetAttr(kNameSpaceID_None, nsGkAtoms::aria_selected,
|
2009-06-12 05:52:29 -07:00
|
|
|
NS_LITERAL_STRING("true"), aNotify);
|
|
|
|
else
|
|
|
|
rv = content->UnsetAttr(kNameSpaceID_None,
|
2011-06-03 14:35:17 -07:00
|
|
|
nsGkAtoms::aria_selected, aNotify);
|
2009-06-12 05:52:29 -07:00
|
|
|
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
// No "smart" select/unselect for internal call.
|
|
|
|
if (!aNotify)
|
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
// If row or cell accessible was selected then we're able to not bother about
|
|
|
|
// selection of its cells or its row because our algorithm is row oriented,
|
|
|
|
// i.e. we check selection on row firstly and then on cells.
|
|
|
|
if (aIsSelected)
|
|
|
|
return NS_OK;
|
|
|
|
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::Role role = aAccessible->Role();
|
2009-06-12 05:52:29 -07:00
|
|
|
|
|
|
|
// If the given accessible is row that was unselected then remove
|
|
|
|
// aria-selected from cell accessible.
|
2012-01-11 19:07:35 -08:00
|
|
|
if (role == roles::ROW) {
|
2010-06-21 06:08:27 -07:00
|
|
|
AccIterator cellIter(aAccessible, filters::GetCell);
|
2010-05-20 00:40:25 -07:00
|
|
|
nsAccessible *cell = nsnull;
|
|
|
|
|
2011-08-09 18:44:00 -07:00
|
|
|
while ((cell = cellIter.Next())) {
|
2011-10-17 07:59:28 -07:00
|
|
|
rv = SetARIASelected(cell, false, false);
|
2009-06-12 05:52:29 -07:00
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
}
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If the given accessible is cell that was unselected and its row is selected
|
|
|
|
// then remove aria-selected from row and put aria-selected on
|
|
|
|
// siblings cells.
|
2012-01-11 19:07:35 -08:00
|
|
|
if (role == roles::GRID_CELL || role == roles::ROWHEADER ||
|
|
|
|
role == roles::COLUMNHEADER) {
|
2011-07-23 01:38:33 -07:00
|
|
|
nsAccessible* row = aAccessible->Parent();
|
2009-06-12 05:52:29 -07:00
|
|
|
|
2012-01-11 19:07:35 -08:00
|
|
|
if (row && row->Role() == roles::ROW &&
|
2009-09-10 18:07:56 -07:00
|
|
|
nsAccUtils::IsARIASelected(row)) {
|
2011-10-17 07:59:28 -07:00
|
|
|
rv = SetARIASelected(row, false, false);
|
2009-06-12 05:52:29 -07:00
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
2010-06-21 06:08:27 -07:00
|
|
|
AccIterator cellIter(row, filters::GetCell);
|
2010-05-20 00:40:25 -07:00
|
|
|
nsAccessible *cell = nsnull;
|
2011-08-09 18:44:00 -07:00
|
|
|
while ((cell = cellIter.Next())) {
|
2009-06-12 05:52:29 -07:00
|
|
|
if (cell != aAccessible) {
|
2011-10-17 07:59:28 -07:00
|
|
|
rv = SetARIASelected(cell, true, false);
|
2009-06-12 05:52:29 -07:00
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsresult
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridAccessible::GetSelectedColumnsArray(PRUint32* aColumnCount,
|
|
|
|
PRInt32** aColumns)
|
2009-06-12 05:52:29 -07:00
|
|
|
{
|
2012-04-09 03:18:03 -07:00
|
|
|
NS_ENSURE_ARG_POINTER(aColumnCount);
|
|
|
|
*aColumnCount = 0;
|
2009-06-12 05:52:29 -07:00
|
|
|
if (aColumns)
|
|
|
|
*aColumns = nsnull;
|
|
|
|
|
|
|
|
if (IsDefunct())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
2010-06-21 06:08:27 -07:00
|
|
|
AccIterator rowIter(this, filters::GetRow);
|
2011-08-09 18:44:00 -07:00
|
|
|
nsAccessible *row = rowIter.Next();
|
2009-06-12 05:52:29 -07:00
|
|
|
if (!row)
|
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
PRInt32 colCount = 0;
|
2009-09-10 18:07:56 -07:00
|
|
|
GetColumnCount(&colCount);
|
2009-06-12 05:52:29 -07:00
|
|
|
if (!colCount)
|
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
PRInt32 selColCount = colCount;
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
nsTArray<bool> isColSelArray(selColCount);
|
2009-06-12 05:52:29 -07:00
|
|
|
isColSelArray.AppendElements(selColCount);
|
|
|
|
for (PRInt32 i = 0; i < selColCount; i++)
|
2011-10-17 07:59:28 -07:00
|
|
|
isColSelArray[i] = true;
|
2009-06-12 05:52:29 -07:00
|
|
|
|
|
|
|
do {
|
2009-09-10 18:07:56 -07:00
|
|
|
if (nsAccUtils::IsARIASelected(row))
|
2009-06-12 05:52:29 -07:00
|
|
|
continue;
|
|
|
|
|
|
|
|
PRInt32 colIdx = 0;
|
2010-05-20 00:40:25 -07:00
|
|
|
|
2010-06-21 06:08:27 -07:00
|
|
|
AccIterator cellIter(row, filters::GetCell);
|
2010-05-20 00:40:25 -07:00
|
|
|
nsAccessible *cell = nsnull;
|
2011-08-09 18:44:00 -07:00
|
|
|
for (colIdx = 0; (cell = cellIter.Next()); colIdx++) {
|
2011-10-17 07:59:28 -07:00
|
|
|
if (isColSelArray.SafeElementAt(colIdx, false) &&
|
2009-09-10 18:07:56 -07:00
|
|
|
!nsAccUtils::IsARIASelected(cell)) {
|
2011-10-17 07:59:28 -07:00
|
|
|
isColSelArray[colIdx] = false;
|
2009-06-12 05:52:29 -07:00
|
|
|
selColCount--;
|
|
|
|
}
|
|
|
|
}
|
2011-08-09 18:44:00 -07:00
|
|
|
} while ((row = rowIter.Next()));
|
2009-06-12 05:52:29 -07:00
|
|
|
|
|
|
|
if (!selColCount)
|
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
if (!aColumns) {
|
2012-04-09 03:18:03 -07:00
|
|
|
*aColumnCount = selColCount;
|
2009-06-12 05:52:29 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
*aColumns = static_cast<PRInt32*>(
|
|
|
|
nsMemory::Alloc(selColCount * sizeof(PRInt32)));
|
|
|
|
NS_ENSURE_TRUE(*aColumns, NS_ERROR_OUT_OF_MEMORY);
|
|
|
|
|
2012-04-09 03:18:03 -07:00
|
|
|
*aColumnCount = selColCount;
|
2009-06-12 05:52:29 -07:00
|
|
|
for (PRInt32 colIdx = 0, idx = 0; colIdx < colCount; colIdx++) {
|
|
|
|
if (isColSelArray[colIdx])
|
|
|
|
(*aColumns)[idx++] = colIdx;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2009-05-18 01:35:21 -07:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
2012-04-09 03:18:03 -07:00
|
|
|
// ARIAGridCellAccessible
|
2009-05-18 01:35:21 -07:00
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Constructor
|
|
|
|
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridCellAccessible::
|
|
|
|
ARIAGridCellAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
|
2012-02-07 14:38:54 -08:00
|
|
|
nsHyperTextAccessibleWrap(aContent, aDoc)
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// nsISupports
|
|
|
|
|
2012-04-09 03:18:03 -07:00
|
|
|
NS_IMPL_ISUPPORTS_INHERITED1(ARIAGridCellAccessible,
|
2009-09-10 18:07:56 -07:00
|
|
|
nsHyperTextAccessible,
|
|
|
|
nsIAccessibleTableCell)
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// nsIAccessibleTableCell
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridCellAccessible::GetTable(nsIAccessibleTable** aTable)
|
2009-09-10 18:07:56 -07:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aTable);
|
|
|
|
*aTable = nsnull;
|
|
|
|
|
2011-07-23 01:38:33 -07:00
|
|
|
nsAccessible* thisRow = Parent();
|
2012-01-11 19:07:35 -08:00
|
|
|
if (!thisRow || thisRow->Role() != roles::ROW)
|
2009-09-10 18:07:56 -07:00
|
|
|
return NS_OK;
|
|
|
|
|
2011-07-23 01:38:33 -07:00
|
|
|
nsAccessible* table = thisRow->Parent();
|
2010-09-06 19:41:53 -07:00
|
|
|
if (!table)
|
|
|
|
return NS_OK;
|
|
|
|
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::Role tableRole = table->Role();
|
|
|
|
if (tableRole != roles::TABLE && tableRole != roles::TREE_TABLE)
|
2009-09-10 18:07:56 -07:00
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
CallQueryInterface(table, aTable);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridCellAccessible::GetColumnIndex(PRInt32* aColumnIndex)
|
2009-09-10 18:07:56 -07:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aColumnIndex);
|
|
|
|
*aColumnIndex = -1;
|
|
|
|
|
|
|
|
if (IsDefunct())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
2011-07-23 01:38:33 -07:00
|
|
|
nsAccessible* row = Parent();
|
2010-09-06 19:41:53 -07:00
|
|
|
if (!row)
|
|
|
|
return NS_OK;
|
2009-09-10 18:07:56 -07:00
|
|
|
|
2010-09-06 19:41:53 -07:00
|
|
|
*aColumnIndex = 0;
|
2009-09-10 18:07:56 -07:00
|
|
|
|
2011-06-13 02:08:40 -07:00
|
|
|
PRInt32 indexInRow = IndexInParent();
|
2010-09-06 19:41:53 -07:00
|
|
|
for (PRInt32 idx = 0; idx < indexInRow; idx++) {
|
|
|
|
nsAccessible* cell = row->GetChildAt(idx);
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::Role role = cell->Role();
|
|
|
|
if (role == roles::GRID_CELL || role == roles::ROWHEADER ||
|
|
|
|
role == roles::COLUMNHEADER)
|
2009-09-10 18:07:56 -07:00
|
|
|
(*aColumnIndex)++;
|
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridCellAccessible::GetRowIndex(PRInt32* aRowIndex)
|
2009-09-10 18:07:56 -07:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aRowIndex);
|
|
|
|
*aRowIndex = -1;
|
|
|
|
|
|
|
|
if (IsDefunct())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
2011-07-23 01:38:33 -07:00
|
|
|
nsAccessible* row = Parent();
|
2010-09-06 19:41:53 -07:00
|
|
|
if (!row)
|
|
|
|
return NS_OK;
|
2009-09-10 18:07:56 -07:00
|
|
|
|
2011-07-23 01:38:33 -07:00
|
|
|
nsAccessible* table = row->Parent();
|
2010-09-06 19:41:53 -07:00
|
|
|
if (!table)
|
|
|
|
return NS_OK;
|
2009-09-10 18:07:56 -07:00
|
|
|
|
2010-09-06 19:41:53 -07:00
|
|
|
*aRowIndex = 0;
|
|
|
|
|
2011-06-13 02:08:40 -07:00
|
|
|
PRInt32 indexInTable = row->IndexInParent();
|
2010-09-06 19:41:53 -07:00
|
|
|
for (PRInt32 idx = 0; idx < indexInTable; idx++) {
|
|
|
|
row = table->GetChildAt(idx);
|
2012-01-11 19:07:35 -08:00
|
|
|
if (row->Role() == roles::ROW)
|
2010-09-06 19:41:53 -07:00
|
|
|
(*aRowIndex)++;
|
2009-09-10 18:07:56 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridCellAccessible::GetColumnExtent(PRInt32* aExtentCount)
|
2009-09-10 18:07:56 -07:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aExtentCount);
|
|
|
|
*aExtentCount = 0;
|
|
|
|
|
|
|
|
if (IsDefunct())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
*aExtentCount = 1;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridCellAccessible::GetRowExtent(PRInt32* aExtentCount)
|
2009-09-10 18:07:56 -07:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aExtentCount);
|
|
|
|
*aExtentCount = 0;
|
|
|
|
|
|
|
|
if (IsDefunct())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
*aExtentCount = 1;
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridCellAccessible::GetColumnHeaderCells(nsIArray** aHeaderCells)
|
2009-09-10 18:07:56 -07:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aHeaderCells);
|
|
|
|
*aHeaderCells = nsnull;
|
|
|
|
|
|
|
|
if (IsDefunct())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIAccessibleTable> table;
|
|
|
|
GetTable(getter_AddRefs(table));
|
|
|
|
if (!table)
|
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
return nsAccUtils::GetHeaderCellsFor(table, this,
|
|
|
|
nsAccUtils::eColumnHeaderCells,
|
|
|
|
aHeaderCells);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridCellAccessible::GetRowHeaderCells(nsIArray** aHeaderCells)
|
2009-09-10 18:07:56 -07:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aHeaderCells);
|
|
|
|
*aHeaderCells = nsnull;
|
|
|
|
|
|
|
|
if (IsDefunct())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIAccessibleTable> table;
|
|
|
|
GetTable(getter_AddRefs(table));
|
|
|
|
if (!table)
|
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
return nsAccUtils::GetHeaderCellsFor(table, this,
|
|
|
|
nsAccUtils::eRowHeaderCells,
|
|
|
|
aHeaderCells);
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHODIMP
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridCellAccessible::IsSelected(bool* aIsSelected)
|
2009-09-10 18:07:56 -07:00
|
|
|
{
|
|
|
|
NS_ENSURE_ARG_POINTER(aIsSelected);
|
2011-10-17 07:59:28 -07:00
|
|
|
*aIsSelected = false;
|
2009-09-10 18:07:56 -07:00
|
|
|
|
|
|
|
if (IsDefunct())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
2011-07-23 01:38:33 -07:00
|
|
|
nsAccessible* row = Parent();
|
2012-01-11 19:07:35 -08:00
|
|
|
if (!row || row->Role() != roles::ROW)
|
2009-09-10 18:07:56 -07:00
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
if (!nsAccUtils::IsARIASelected(row) && !nsAccUtils::IsARIASelected(this))
|
|
|
|
return NS_OK;
|
|
|
|
|
2011-10-17 07:59:28 -07:00
|
|
|
*aIsSelected = true;
|
2009-09-10 18:07:56 -07:00
|
|
|
return NS_OK;
|
|
|
|
}
|
2009-05-18 01:35:21 -07:00
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
// nsAccessible
|
|
|
|
|
2011-04-09 16:38:06 -07:00
|
|
|
void
|
2012-05-17 02:37:37 -07:00
|
|
|
ARIAGridCellAccessible::ApplyARIAState(PRUint64* aState) const
|
2009-07-01 01:10:15 -07:00
|
|
|
{
|
2011-04-09 16:38:06 -07:00
|
|
|
nsHyperTextAccessibleWrap::ApplyARIAState(aState);
|
2009-07-01 01:10:15 -07:00
|
|
|
|
|
|
|
// Return if the gridcell has aria-selected="true".
|
2011-04-09 16:38:06 -07:00
|
|
|
if (*aState & states::SELECTED)
|
|
|
|
return;
|
2009-07-01 01:10:15 -07:00
|
|
|
|
|
|
|
// Check aria-selected="true" on the row.
|
2011-07-23 01:38:33 -07:00
|
|
|
nsAccessible* row = Parent();
|
2012-01-11 19:07:35 -08:00
|
|
|
if (!row || row->Role() != roles::ROW)
|
2011-04-09 16:38:06 -07:00
|
|
|
return;
|
2009-07-01 01:10:15 -07:00
|
|
|
|
2010-06-11 21:04:50 -07:00
|
|
|
nsIContent *rowContent = row->GetContent();
|
2009-07-01 01:10:15 -07:00
|
|
|
if (nsAccUtils::HasDefinedARIAToken(rowContent,
|
2011-06-03 14:35:17 -07:00
|
|
|
nsGkAtoms::aria_selected) &&
|
2009-07-01 01:10:15 -07:00
|
|
|
!rowContent->AttrValueIs(kNameSpaceID_None,
|
2011-06-03 14:35:17 -07:00
|
|
|
nsGkAtoms::aria_selected,
|
|
|
|
nsGkAtoms::_false, eCaseMatters))
|
2011-04-09 16:38:06 -07:00
|
|
|
*aState |= states::SELECTABLE | states::SELECTED;
|
2009-07-01 01:10:15 -07:00
|
|
|
}
|
|
|
|
|
2009-05-18 01:35:21 -07:00
|
|
|
nsresult
|
2012-04-09 03:18:03 -07:00
|
|
|
ARIAGridCellAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
|
2009-05-18 01:35:21 -07:00
|
|
|
{
|
|
|
|
if (IsDefunct())
|
|
|
|
return NS_ERROR_FAILURE;
|
|
|
|
|
|
|
|
nsresult rv = nsHyperTextAccessibleWrap::GetAttributesInternal(aAttributes);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
// Expose "table-cell-index" attribute.
|
|
|
|
|
2011-07-23 01:38:33 -07:00
|
|
|
nsAccessible* thisRow = Parent();
|
2012-01-11 19:07:35 -08:00
|
|
|
if (!thisRow || thisRow->Role() != roles::ROW)
|
2009-05-18 01:35:21 -07:00
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
PRInt32 colIdx = 0, colCount = 0;
|
2010-05-18 07:03:56 -07:00
|
|
|
PRInt32 childCount = thisRow->GetChildCount();
|
|
|
|
for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
|
|
|
|
nsAccessible *child = thisRow->GetChildAt(childIdx);
|
2009-05-18 01:35:21 -07:00
|
|
|
if (child == this)
|
|
|
|
colIdx = colCount;
|
|
|
|
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::Role role = child->Role();
|
|
|
|
if (role == roles::GRID_CELL || role == roles::ROWHEADER ||
|
|
|
|
role == roles::COLUMNHEADER)
|
2009-05-18 01:35:21 -07:00
|
|
|
colCount++;
|
|
|
|
}
|
|
|
|
|
2011-07-23 01:38:33 -07:00
|
|
|
nsAccessible* table = thisRow->Parent();
|
2010-09-06 19:41:53 -07:00
|
|
|
if (!table)
|
|
|
|
return NS_OK;
|
|
|
|
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::Role tableRole = table->Role();
|
|
|
|
if (tableRole != roles::TABLE && tableRole != roles::TREE_TABLE)
|
2009-05-18 01:35:21 -07:00
|
|
|
return NS_OK;
|
|
|
|
|
|
|
|
PRInt32 rowIdx = 0;
|
2010-05-18 07:03:56 -07:00
|
|
|
childCount = table->GetChildCount();
|
|
|
|
for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
|
|
|
|
nsAccessible *child = table->GetChildAt(childIdx);
|
|
|
|
if (child == thisRow)
|
|
|
|
break;
|
|
|
|
|
2012-01-11 19:07:35 -08:00
|
|
|
if (child->Role() == roles::ROW)
|
2009-05-18 01:35:21 -07:00
|
|
|
rowIdx++;
|
|
|
|
}
|
|
|
|
|
|
|
|
PRInt32 idx = rowIdx * colCount + colIdx;
|
|
|
|
|
|
|
|
nsAutoString stringIdx;
|
|
|
|
stringIdx.AppendInt(idx);
|
2011-06-03 14:35:17 -07:00
|
|
|
nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::tableCellIndex,
|
2009-05-18 01:35:21 -07:00
|
|
|
stringIdx);
|
|
|
|
|
|
|
|
return NS_OK;
|
|
|
|
}
|