Bug 512424 - implement IAccessibleTable2, r=marcoz, davidb, sr=neil

--HG--
rename : accessible/src/atk/nsXULTreeAccessibleWrap.h => accessible/src/atk/nsXULTreeGridAccessibleWrap.h
rename : accessible/src/mac/nsXULTreeAccessibleWrap.h => accessible/src/mac/nsXULTreeGridAccessibleWrap.h
rename : accessible/src/msaa/nsXULTreeAccessibleWrap.cpp => accessible/src/msaa/nsXULTreeGridAccessibleWrap.cpp
rename : accessible/src/msaa/nsXULTreeAccessibleWrap.h => accessible/src/msaa/nsXULTreeGridAccessibleWrap.h
rename : accessible/src/other/nsXULTreeAccessibleWrap.h => accessible/src/other/nsXULTreeGridAccessibleWrap.h
rename : accessible/src/xul/nsXULSelectAccessible.cpp => accessible/src/xul/nsXULListboxAccessible.cpp
rename : accessible/src/xul/nsXULSelectAccessible.h => accessible/src/xul/nsXULListboxAccessible.h
rename : accessible/tests/mochitest/test_relations_table.html => accessible/tests/mochitest/test_table_headers.html
rename : accessible/tests/mochitest/test_nsIAccessibleTable_listboxes.xul => accessible/tests/mochitest/test_table_sels_listbox.xul
rename : accessible/tests/mochitest/test_elm_table.html => accessible/tests/mochitest/test_table_struct.html
This commit is contained in:
Alexander Surkov 2009-09-11 09:07:56 +08:00
Родитель 89afe5c391
Коммит 657a10d353
103 изменённых файлов: 6686 добавлений и 2812 удалений

Просмотреть файл

@ -68,6 +68,8 @@ MIDL_INTERFACES = \
AccessibleImage.idl \
AccessibleRelation.idl \
AccessibleTable.idl \
AccessibleTable2.idl \
AccessibleTableCell.idl \
AccessibleText.idl \
AccessibleValue.idl \
$(NULL)

Просмотреть файл

@ -46,7 +46,7 @@ interface nsObjectFrame;
interface nsIContent;
interface nsITimer;
[uuid(2fb528bc-33ec-4987-bbaa-21cab013f092)]
[uuid(6a58f7e8-587c-40dd-b684-dc3e54f1342a)]
interface nsIAccessibilityService : nsIAccessibleRetrieval
{
nsIAccessible createOuterDocAccessible(in nsIDOMNode aNode);
@ -72,7 +72,6 @@ interface nsIAccessibilityService : nsIAccessibleRetrieval
nsIAccessible createHTMLSelectOptionAccessible(in nsIDOMNode aNode, in nsIAccessible aAccParent, in nsIWeakReference aPresShell);
nsIAccessible createHTMLTableAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLTableCellAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLTableHeadAccessible(in nsIDOMNode aDOMNode);
nsIAccessible createHTMLTextAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLTextFieldAccessible(in nsIFrame aFrame);
nsIAccessible createHTMLCaptionAccessible(in nsIFrame aFrame);

Просмотреть файл

@ -24,6 +24,7 @@
* Paul Sandoz (paul.sandoz@sun.com)
* Bill Haneman (bill.haneman@sun.com)
* John Gaunt (jgaunt@netscape.com)
* Alexander Surkov <surkov.alexander@gmail.com>
*
* 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"),
@ -42,216 +43,201 @@
#include "nsISupports.idl"
interface nsIAccessible;
interface nsIArray;
[scriptable, uuid(dcc1e5c3-966e-45b2-b30a-839d35432b24)]
[scriptable, uuid(035c0c0e-41e3-4985-8ad9-d9f14cdc667a)]
interface nsIAccessibleTable : nsISupports
{
/**
* Returns the caption accessible for the table. For example, html:caption
* Return the caption accessible for the table. For example, html:caption
* element of html:table element.
*/
readonly attribute nsIAccessible caption;
readonly attribute nsIAccessible caption;
/**
* Returns summary description for the table. For example, @summary attribute
* on html:element.
* Return summary description for the table. For example, @summary attribute
* on html:table element.
*/
readonly attribute AString summary;
readonly attribute AString summary;
/**
* Returns columns count in the table.
* XXX: not very well named property.
* Return columns count in the table.
*/
readonly attribute long columns;
readonly attribute long columnCount;
/**
* Returns table accessible containing column headers.
* Return rows count in the table.
*/
readonly attribute nsIAccessibleTable columnHeader;
readonly attribute long rowCount;
/**
* Returns rows count in the table.
* XXX: not very well named property.
*/
readonly attribute long rows;
/**
* Returns table accessible containing row headers.
*/
readonly attribute nsIAccessibleTable rowHeader;
/**
* Returns the accessible object at the specified row and column in the table.
* Return the accessible object at the specified row and column in the table.
* If both row and column index are valid then the corresponding accessible
* object is returned that represents the requested cell regardless of whether
* the cell is currently visible (on the screen).
*
* @param row - The row index for which to retrieve the cell.
* @param column - The column index for which to retrieve the cell.
* @param rowIndex [in] the row index to retrieve the cell at
* @param columnIndex [in] the column index to retrieve the cell at
*/
nsIAccessible cellRefAt(in long row, in long column);
nsIAccessible getCellAt(in long rowIndex, in long columnIndex);
/**
* Translates the given row and column indices into the corresponding cell
* Translate the given row and column indices into the corresponding cell
* index.
*
* @param row - index of the row of the table for which to return the cell
* index.
* @param column - index of the column of the table for which to return
* the cell index.
* @param rowIndex [in] the row index to return cell index at
* @param columnIndex [in] the column index to return cell index at
*/
long getIndexAt(in long row, in long column);
long getCellIndexAt(in long rowIndex, in long columnIndex);
/**
* Translates the given child index into the corresponding column index.
* Translate the given cell index into the corresponding column index.
*
* @param index - index of the child of the table for which to return
* the column index.
* @param cellIndex [in] index of the table cell to return column index for
*/
long getColumnAtIndex(in long index);
long getColumnIndexAt(in long cellIndex);
/**
* Translates the given child index into the corresponding row index.
* Translate the given cell index into the corresponding row index.
*
* @param index - index of the child of the table for which to return
* the row index.
* @param cellIndex [in] index of the table cell to return row index for
*/
long getRowAtIndex(in long index);
long getRowIndexAt(in long cellIndex);
/**
* Returns the number of columns occupied by the accessible object
* at the specified row and column in the table. The result differs from 1
* if the specified cell spans multiple columns.
* Return the number of columns occupied by the accessible cell at
* the specified row and column in the table. The result differs from 1 if
* the specified cell spans multiple columns.
*
* @param row - Row index of the accessible for which to return
* the column extent.
* @param column - Column index of the accessible for which to return
* the column extent.
* @param row [in] row index of the cell to return the column extent for
* @param column [in] column index of the cell to return the column extent
* for
*/
long getColumnExtentAt(in long row, in long column);
/**
* Returns the number of rows occupied by the accessible oject
* at the specified row and column in the table. The result differs from 1
* if the specified cell spans multiple rows.
* Return the number of rows occupied by the accessible cell at the specified
* row and column in the table. The result differs from 1 if the specified
* cell spans multiple rows.
*
* @param row - Row index of the accessible for which to return
* the column extent.
* @param column - Column index of the accessible for which to return
* the column extent.
* @param row [in] row index of the cell to return the column extent for
* @param column [in] column index of the cell to return the column extent
* for
*/
long getRowExtentAt(in long row, in long column);
/**
* Returns the description text of the specified column in the table.
* @param column - The index of the column for which to retrieve
* the description.
*/
AString getColumnDescription(in long column);
/**
* Returns the description text of the specified row in the table.
* @param row - The index of the row for which to retrieve the description.
*/
AString getRowDescription(in long row);
/**
* Returns a boolean value indicating whether the specified column is
* completely selected.
* Return the description text of the specified column in the table.
*
* @param column - Index of the column for which to determine whether it is
* selected.
* @param columnIndex [in] the column index to retrieve description for
*/
boolean isColumnSelected(in long column);
AString getColumnDescription(in long columnIndex);
/**
* Returns a boolean value indicating whether the specified row is completely
* selected.
* Return the description text of the specified row in the table.
*
* @param row - Index of the row for which to determine whether it is
* selected.
* @param rowIndex [in] the row index to retrieve description for
*/
boolean isRowSelected(in long row);
AString getRowDescription(in long rowIndex);
/**
* Returns a boolean value indicating whether the specified cell is selected.
* Return a boolean value indicating whether the specified column is
* selected, i.e. all cells within the column are selected.
*
* @param row - Index of the row for the cell to determine whether it is
* selected.
* @param column - Index of the column for the cell to determine whether it
* is selected.
* @param columnIndex [in] the column index to determine if it's selected
*/
boolean isCellSelected(in long row, in long column);
boolean isColumnSelected(in long columnIndex);
/**
* Returns the total number of selected cells.
*/
readonly attribute unsigned long selectedCellsCount;
/**
* Returns the total number of selected columns.
*/
readonly attribute unsigned long selectedColumnsCount;
/**
* Returns the total number of selected rows.
*/
readonly attribute unsigned long selectedRowsCount;
/**
* Returns a list of cells indexes currently selected.
* Return a boolean value indicating whether the specified row is selected,
* i.e. all cells within the row are selected.
*
* @param cellsSize - length of array
* @param cells - array of indexes of selected cells
* @param rowIndex [in] the row index to determine whether it's selected
*/
void getSelectedCells(out unsigned long cellsSize,
[retval, array, size_is(cellsSize)] out long cells);
boolean isRowSelected(in long rowIndex);
/**
* Returns a list of column indexes currently selected.
* Return a boolean value indicating whether the specified cell is selected.
*
* @param columnsSize - Length of array
* @param columns - Array of indexes of selected columns
* @param rowIndex [in] the row index of the cell
* @param columnIndex [in] the column index of the cell
*/
void getSelectedColumns(out unsigned long columnsSize,
[retval, array, size_is(columnsSize)] out long columns);
boolean isCellSelected(in long rowIndex, in long columnIndex);
/**
* Returns a list of row indexes currently selected.
*
* @param rowsSize - Length of array
* @param rows - Array of indexes of selected rows
* Return the total number of selected cells.
*/
void getSelectedRows(out unsigned long rowsSize,
[retval, array, size_is(rowsSize)] out long rows);
readonly attribute unsigned long selectedCellCount;
/**
* Selects a row and unselects all previously selected rows.
*
* @param row - Index of the row to be selected.
* Return the total number of selected columns.
*/
void selectRow(in long row);
readonly attribute unsigned long selectedColumnCount;
/**
* Selects a column and unselects all previously selected columns.
*
* @param column - Index of the column to be selected.
* Return the total number of selected rows.
*/
void selectColumn(in long column);
readonly attribute unsigned long selectedRowCount;
/**
* Unselects one row, leaving other selected rows selected (if any).
* Return an array of selected cells.
*/
readonly attribute nsIArray selectedCells;
/**
* Return an array of cell indices currently selected.
*
* @param row - Index of the row to be selected.
* @param cellsArraySize [in] length of array
* @param cellsArray [in] array of indexes of selected cells
*/
void getSelectedCellIndices(out unsigned long cellsArraySize,
[retval, array, size_is(cellsArraySize)] out long cellsArray);
/**
* Return an array of column indices currently selected.
*
* @param columnsArraySize [in] length of array
* @param columnsArray [in] array of indices of selected columns
*/
void getSelectedColumnIndices(out unsigned long columnsArraySize,
[retval, array, size_is(columnsArraySize)] out long columnsArray);
/**
* Return an array of row indices currently selected.
*
* @param rowsArraySize [in] Length of array
* @param rowsArray [in] array of indices of selected rows
*/
void getSelectedRowIndices(out unsigned long rowsArraySize,
[retval, array, size_is(rowsArraySize)] out long rowsArray);
/**
* Select a row and unselects all previously selected rows.
*
* @param rowIndex [in] the row index to select
*/
void selectRow(in long rowIndex);
/**
* Select a column and unselects all previously selected columns.
*
* @param columnIndex [in] the column index to select
*/
void selectColumn(in long columnIndex);
/**
* Unselect the given row, leaving other selected rows selected (if any).
*
* @param rowIndex [in] the row index to select
*/
void unselectRow(in long row);
void unselectRow(in long rowIndex);
/**
* Unselects one column, leaving other selected columns selected (if any).
* Unselect the given column, leaving other selected columns selected (if any).
*
* @param column - Index of the column to be selected.
* @param columnIndex [in] the column index to select
*/
void unselectColumn(in long column);
void unselectColumn(in long columnIndex);
/**
* Use heuristics to determine if table is most likely used for layout.
@ -259,3 +245,49 @@ interface nsIAccessibleTable : nsISupports
boolean isProbablyForLayout();
};
[scriptable, uuid(654e296d-fae6-452b-987d-746b20b9514b)]
interface nsIAccessibleTableCell : nsISupports
{
/**
* Return host table accessible.
*/
readonly attribute nsIAccessibleTable table;
/**
* Return column index of this cell.
*/
readonly attribute long columnIndex;
/**
* Return row index of this cell.
*/
readonly attribute long rowIndex;
/**
* Return the number of columns occupied by this cell. The result differs
* from 1 if the specified cell spans multiple columns.
*/
readonly attribute long columnExtent;
/**
* Return the number of rows occupied by this accessible cell. The result
* differs from 1 if the specified cell spans multiple rows.
*/
readonly attribute long rowExtent;
/**
* Return an array of column header cells for this cell.
*/
readonly attribute nsIArray columnHeaderCells;
/**
* Return an array of row header cells for this cell.
*/
readonly attribute nsIArray rowHeaderCells;
/**
* Return a boolean value indicating whether this cell is selected.
*/
boolean isSelected();
};

Просмотреть файл

@ -66,12 +66,6 @@ CPPSRCS = \
nsMaiInterfaceImage.cpp \
$(NULL)
ifdef MOZ_XUL
CPPSRCS += \
nsXULTreeAccessibleWrap.cpp \
$(NULL)
endif
EXPORTS = \
nsAccessNodeWrap.h \
nsARIAGridAccessibleWrap.h \
@ -80,7 +74,8 @@ EXPORTS = \
nsRootAccessibleWrap.h \
nsTextAccessibleWrap.h \
nsXULMenuAccessibleWrap.h \
nsXULTreeAccessibleWrap.h \
nsXULListboxAccessibleWrap.h \
nsXULTreeGridAccessibleWrap.h \
nsHyperTextAccessibleWrap.h \
nsHTMLImageAccessibleWrap.h \
nsHTMLTableAccessibleWrap.h \

Просмотреть файл

@ -44,6 +44,7 @@
#include "nsARIAGridAccessible.h"
typedef class nsARIAGridAccessible nsARIAGridAccessibleWrap;
typedef class nsARIAGridCellAccessible nsARIAGridCellAccessibleWrap;
#endif

Просмотреть файл

@ -44,8 +44,8 @@
#include "nsHTMLTableAccessible.h"
typedef class nsHTMLTableAccessible nsHTMLTableAccessibleWrap;
typedef class nsHTMLTableHeadAccessible nsHTMLTableHeadAccessibleWrap;
typedef class nsHTMLTableCellAccessible nsHTMLTableCellAccessibleWrap;
typedef class nsHTMLTableHeaderCellAccessible nsHTMLTableHeaderCellAccessibleWrap;
#endif

Просмотреть файл

@ -40,6 +40,8 @@
#include "nsMaiInterfaceTable.h"
#include "nsArrayUtils.h"
void
tableInterfaceInitCB(AtkTableIface *aIface)
@ -81,7 +83,7 @@ refAtCB(AtkTable *aTable, gint aRow, gint aColumn)
NS_ENSURE_TRUE(accTable, nsnull);
nsCOMPtr<nsIAccessible> cell;
nsresult rv = accTable->CellRefAt(aRow, aColumn,getter_AddRefs(cell));
nsresult rv = accTable->GetCellAt(aRow, aColumn,getter_AddRefs(cell));
if (NS_FAILED(rv) || !cell)
return nsnull;
@ -105,7 +107,7 @@ getIndexAtCB(AtkTable *aTable, gint aRow, gint aColumn)
NS_ENSURE_TRUE(accTable, -1);
PRInt32 index;
nsresult rv = accTable->GetIndexAt(aRow, aColumn, &index);
nsresult rv = accTable->GetCellIndexAt(aRow, aColumn, &index);
NS_ENSURE_SUCCESS(rv, -1);
return static_cast<gint>(index);
@ -124,7 +126,7 @@ getColumnAtIndexCB(AtkTable *aTable, gint aIndex)
NS_ENSURE_TRUE(accTable, -1);
PRInt32 col;
nsresult rv = accTable->GetColumnAtIndex(aIndex, &col);
nsresult rv = accTable->GetColumnIndexAt(aIndex, &col);
NS_ENSURE_SUCCESS(rv, -1);
return static_cast<gint>(col);
@ -143,7 +145,7 @@ getRowAtIndexCB(AtkTable *aTable, gint aIndex)
NS_ENSURE_TRUE(accTable, -1);
PRInt32 row;
nsresult rv = accTable->GetRowAtIndex(aIndex, &row);
nsresult rv = accTable->GetRowIndexAt(aIndex, &row);
NS_ENSURE_SUCCESS(rv, -1);
return static_cast<gint>(row);
@ -162,7 +164,7 @@ getColumnCountCB(AtkTable *aTable)
NS_ENSURE_TRUE(accTable, -1);
PRInt32 count;
nsresult rv = accTable->GetColumns(&count);
nsresult rv = accTable->GetColumnCount(&count);
NS_ENSURE_SUCCESS(rv, -1);
return static_cast<gint>(count);
@ -181,7 +183,7 @@ getRowCountCB(AtkTable *aTable)
NS_ENSURE_TRUE(accTable, -1);
PRInt32 count;
nsresult rv = accTable->GetRows(&count);
nsresult rv = accTable->GetRowCount(&count);
NS_ENSURE_SUCCESS(rv, -1);
return static_cast<gint>(count);
@ -278,25 +280,34 @@ getColumnHeaderCB(AtkTable *aTable, gint aColumn)
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, nsnull);
nsCOMPtr<nsIAccessibleTable> header;
nsresult rv = accTable->GetColumnHeader(getter_AddRefs(header));
NS_ENSURE_SUCCESS(rv, nsnull);
NS_ENSURE_TRUE(header, nsnull);
nsCOMPtr<nsIAccessible> accCell;
accTable->GetCellAt(0, aColumn, getter_AddRefs(accCell));
if (!accCell)
return nsnull;
// Note: "table column header" has different definition between atk and mai
//
// 1. "getColumnHeaderCB" defined in AtkTableIface should return object
// whose role is "ATK_ROLE_TABLE_COLUMN_HEADER", which is implemented
// by nsXULTreeColumnItemAccessible.
//
// 2. "GetColumnHeader" defined in nsIAccessibleTable returns
// nsXULTreeColumnsAccessibleWrap, which exports nsIAccessibleTable and is
// "ROLE_LIST".
nsCOMPtr<nsIAccessible> accHeader;
header->CellRefAt(0, aColumn, getter_AddRefs(accHeader));
NS_ENSURE_TRUE(accHeader, nsnull);
// If the cell at the first row is column header then assume it is column
// header for all rows,
if (nsAccUtils::Role(accCell) == nsIAccessibleRole::ROLE_COLUMNHEADER)
return nsAccessibleWrap::GetAtkObject(accCell);
return nsAccessibleWrap::GetAtkObject(accHeader);
// otherwise get column header for the data cell at the first row.
nsCOMPtr<nsIAccessibleTableCell> accTableCell =
do_QueryInterface(accCell);
if (accTableCell) {
nsCOMPtr<nsIArray> headerCells;
accTableCell->GetColumnHeaderCells(getter_AddRefs(headerCells));
if (headerCells) {
nsresult rv;
nsCOMPtr<nsIAccessible> accHeaderCell =
do_QueryElementAt(headerCells, 0, &rv);
NS_ENSURE_SUCCESS(rv, nsnull);
return nsAccessibleWrap::GetAtkObject(accHeaderCell);
}
}
return nsnull;
}
const gchar*
@ -330,14 +341,34 @@ getRowHeaderCB(AtkTable *aTable, gint aRow)
getter_AddRefs(accTable));
NS_ENSURE_TRUE(accTable, nsnull);
nsCOMPtr<nsIAccessibleTable> header;
nsresult rv = accTable->GetRowHeader(getter_AddRefs(header));
NS_ENSURE_SUCCESS(rv, nsnull);
nsCOMPtr<nsIAccessible> accCell;
accTable->GetCellAt(aRow, 0, getter_AddRefs(accCell));
if (!accCell)
return nsnull;
nsCOMPtr<nsIAccessible> accHeader(do_QueryInterface(header));
NS_ENSURE_TRUE(accHeader, nsnull);
// If the cell at the first column is row header then assume it is row
// header for all columns,
if (nsAccUtils::Role(accCell) == nsIAccessibleRole::ROLE_ROWHEADER)
return nsAccessibleWrap::GetAtkObject(accCell);
return nsAccessibleWrap::GetAtkObject(accHeader);
// otherwise get row header for the data cell at the first column.
nsCOMPtr<nsIAccessibleTableCell> accTableCell =
do_QueryInterface(accCell);
if (accTableCell) {
nsCOMPtr<nsIArray> headerCells;
accTableCell->GetRowHeaderCells(getter_AddRefs(headerCells));
if (headerCells) {
nsresult rv;
nsCOMPtr<nsIAccessible> accHeaderCell =
do_QueryElementAt(headerCells, 0, &rv);
NS_ENSURE_SUCCESS(rv, nsnull);
return nsAccessibleWrap::GetAtkObject(accHeaderCell);
}
}
return nsnull;
}
AtkObject*
@ -364,7 +395,7 @@ getSelectedColumnsCB(AtkTable *aTable, gint **aSelected)
PRUint32 size = 0;
PRInt32 *columns = NULL;
nsresult rv = accTable->GetSelectedColumns(&size, &columns);
nsresult rv = accTable->GetSelectedColumnIndices(&size, &columns);
if (NS_FAILED(rv) || (size == 0) || !columns) {
*aSelected = nsnull;
return 0;
@ -399,7 +430,7 @@ getSelectedRowsCB(AtkTable *aTable, gint **aSelected)
PRUint32 size = 0;
PRInt32 *rows = NULL;
nsresult rv = accTable->GetSelectedRows(&size, &rows);
nsresult rv = accTable->GetSelectedRowIndices(&size, &rows);
if (NS_FAILED(rv) || (size == 0) || !rows) {
*aSelected = nsnull;
return 0;

Просмотреть файл

@ -0,0 +1,47 @@
/* -*- 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
* Mozilla Corporation.
* 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 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 ***** */
#ifndef __nsXULListboxAccessibleWrap_h__
#define __nsXULListboxAccessibleWrap_h__
#include "nsXULListboxAccessible.h"
typedef class nsXULListboxAccessible nsXULListboxAccessibleWrap;
typedef class nsXULListCellAccessible nsXULListCellAccessibleWrap;
#endif

Просмотреть файл

@ -1,289 +0,0 @@
/* -*- 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
* Sun Microsystems, Inc.
* Portions created by the Initial Developer are Copyright (C) 2002
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Pete Zha (pete.zha@sun.com)
* Kyle Yuan (kyle.yuan@sun.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either 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 ***** */
#include "nsIDOMElement.h"
#include "nsITreeSelection.h"
#include "nsITreeColumns.h"
#include "nsXULTreeAccessibleWrap.h"
// --------------------------------------------------------
// nsXULTreeAccessibleWrap Accessible
// --------------------------------------------------------
nsXULTreeGridAccessibleWrap::
nsXULTreeGridAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell):
nsXULTreeGridAccessible(aDOMNode, aShell)
{
}
NS_IMETHODIMP
nsXULTreeGridAccessibleWrap::GetColumnHeader(nsIAccessibleTable **aColumnHeader)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIAccessible> acc;
nsAccessible::GetFirstChild(getter_AddRefs(acc));
NS_ENSURE_TRUE(acc, NS_ERROR_FAILURE);
nsCOMPtr<nsIAccessibleTable> accTable(do_QueryInterface(acc, &rv));
NS_ENSURE_SUCCESS(rv, rv);
*aColumnHeader = accTable;
NS_IF_ADDREF(*aColumnHeader);
return rv;
}
NS_IMETHODIMP
nsXULTreeGridAccessibleWrap::GetColumnDescription(PRInt32 aColumn, nsAString & _retval)
{
nsCOMPtr<nsIAccessibleTable> columnHeader;
nsresult rv = GetColumnHeader(getter_AddRefs(columnHeader));
if (NS_SUCCEEDED(rv) && columnHeader) {
return columnHeader->GetColumnDescription(aColumn, _retval);
}
return NS_ERROR_FAILURE;
}
// --------------------------------------------------------
// nsXULTreeColumnsAccessibleWrap Accessible
// --------------------------------------------------------
NS_IMPL_ISUPPORTS_INHERITED1(nsXULTreeColumnsAccessibleWrap, nsXULTreeColumnsAccessible, nsIAccessibleTable)
nsXULTreeColumnsAccessibleWrap::nsXULTreeColumnsAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell):
nsXULTreeColumnsAccessible(aDOMNode, aShell)
{
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetCaption(nsIAccessible **aCaption)
{
*aCaption = nsnull;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetSummary(nsAString &aSummary)
{
aSummary.Truncate();
return NS_OK;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetColumns(PRInt32 *aColumns)
{
nsresult rv = GetChildCount(aColumns);
return *aColumns > 0 ? rv : NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetColumnHeader(nsIAccessibleTable * *aColumnHeader)
{
// Column header not supported.
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetRows(PRInt32 *aRows)
{
NS_ENSURE_ARG_POINTER(aRows);
*aRows = 1;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetRowHeader(nsIAccessibleTable * *aRowHeader)
{
// Row header not supported.
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsXULTreeColumnsAccessibleWrap::GetSelectedCellsCount(PRUint32* aCount)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsXULTreeColumnsAccessibleWrap::GetSelectedColumnsCount(PRUint32* aCount)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsXULTreeColumnsAccessibleWrap::GetSelectedRowsCount(PRUint32* aCount)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsXULTreeColumnsAccessibleWrap::GetSelectedCells(PRUint32 *aNumCells,
PRInt32 **aCells)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetSelectedColumns(PRUint32 *columnsSize, PRInt32 **columns)
{
// Header can not be selected.
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetSelectedRows(PRUint32 *rowsSize, PRInt32 **rows)
{
// Header can not be selected.
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::CellRefAt(PRInt32 aRow, PRInt32 aColumn, nsIAccessible **_retval)
{
nsCOMPtr<nsIAccessible> next, temp;
GetFirstChild(getter_AddRefs(next));
NS_ENSURE_TRUE(next, NS_ERROR_FAILURE);
for (PRInt32 col = 0; col < aColumn; col++) {
next->GetNextSibling(getter_AddRefs(temp));
NS_ENSURE_TRUE(temp, NS_ERROR_FAILURE);
next = temp;
}
*_retval = next;
NS_IF_ADDREF(*_retval);
return NS_OK;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetIndexAt(PRInt32 aRow, PRInt32 aColumn, PRInt32 *_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
*_retval = aColumn;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetColumnAtIndex(PRInt32 aIndex, PRInt32 *_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
*_retval = aIndex;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetRowAtIndex(PRInt32 aIndex, PRInt32 *_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
*_retval = 0;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetColumnExtentAt(PRInt32 aRow, PRInt32 aColumn, PRInt32 *_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
*_retval = 1;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetRowExtentAt(PRInt32 aRow, PRInt32 aColumn, PRInt32 *_retval)
{
NS_ENSURE_ARG_POINTER(_retval);
*_retval = 1;
return NS_OK;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetColumnDescription(PRInt32 aColumn, nsAString & _retval)
{
nsCOMPtr<nsIAccessible> column;
nsresult rv = CellRefAt(0, aColumn, getter_AddRefs(column));
if (NS_SUCCEEDED(rv) && column) {
return column->GetName(_retval);
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::GetRowDescription(PRInt32 aRow, nsAString & _retval)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::IsColumnSelected(PRInt32 aColumn, PRBool *_retval)
{
// Header can not be selected.
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::IsRowSelected(PRInt32 aRow, PRBool *_retval)
{
// Header can not be selected.
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::IsCellSelected(PRInt32 aRow, PRInt32 aColumn, PRBool *_retval)
{
// Header can not be selected.
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsXULTreeColumnsAccessibleWrap::SelectRow(PRInt32 aRow)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsXULTreeColumnsAccessibleWrap::SelectColumn(PRInt32 aColumn)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsXULTreeColumnsAccessibleWrap::UnselectRow(PRInt32 aRow)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsXULTreeColumnsAccessibleWrap::UnselectColumn(PRInt32 aColumn)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP nsXULTreeColumnsAccessibleWrap::IsProbablyForLayout(PRBool *aIsProbablyForLayout)
{
*aIsProbablyForLayout = PR_FALSE;
return NS_OK;
}

Просмотреть файл

@ -37,29 +37,13 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef __nsXULTreeAccessibleWrap_h__
#define __nsXULTreeAccessibleWrap_h__
#ifndef __nsXULTreeGridAccessibleWrap_h__
#define __nsXULTreeGridAccessibleWrap_h__
#include "nsXULTreeGridAccessible.h"
class nsXULTreeGridAccessibleWrap : public nsXULTreeGridAccessible
{
public:
nsXULTreeGridAccessibleWrap(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
// nsIAccessibleTable
NS_IMETHOD GetColumnHeader(nsIAccessibleTable **aColumnHeader);
NS_IMETHOD GetColumnDescription(PRInt32 aColumn, nsAString& aDescription);
};
class nsXULTreeColumnsAccessibleWrap : public nsXULTreeColumnsAccessible,
public nsIAccessibleTable
{
public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIACCESSIBLETABLE
nsXULTreeColumnsAccessibleWrap(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
};
typedef class nsXULTreeGridAccessible nsXULTreeGridAccessibleWrap;
typedef class nsXULTreeGridCellAccessible nsXULTreeGridCellAccessibleWrap;
#endif

Просмотреть файл

@ -38,6 +38,7 @@
#include "nsARIAGridAccessible.h"
#include "nsComponentManagerUtils.h"
////////////////////////////////////////////////////////////////////////////////
// nsARIAGridAccessible
@ -89,10 +90,10 @@ nsARIAGridAccessible::GetSummary(nsAString &aSummary)
}
NS_IMETHODIMP
nsARIAGridAccessible::GetColumns(PRInt32 *aColumns)
nsARIAGridAccessible::GetColumnCount(PRInt32 *acolumnCount)
{
NS_ENSURE_ARG_POINTER(aColumns);
*aColumns = 0;
NS_ENSURE_ARG_POINTER(acolumnCount);
*acolumnCount = 0;
if (IsDefunct())
return NS_ERROR_FAILURE;
@ -100,55 +101,29 @@ nsARIAGridAccessible::GetColumns(PRInt32 *aColumns)
nsCOMPtr<nsIAccessible> row = GetNextRow();
nsCOMPtr<nsIAccessible> cell;
while ((cell = GetNextCellInRow(row, cell)))
(*aColumns)++;
(*acolumnCount)++;
return NS_OK;
}
NS_IMETHODIMP
nsARIAGridAccessible::GetColumnHeader(nsIAccessibleTable **aColumnHeader)
nsARIAGridAccessible::GetRowCount(PRInt32 *arowCount)
{
NS_ENSURE_ARG_POINTER(aColumnHeader);
*aColumnHeader = nsnull;
if (IsDefunct())
return NS_ERROR_FAILURE;
// XXX: what should we return here?
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsARIAGridAccessible::GetRows(PRInt32 *aRows)
{
NS_ENSURE_ARG_POINTER(aRows);
*aRows = 0;
NS_ENSURE_ARG_POINTER(arowCount);
*arowCount = 0;
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIAccessible> row;
while ((row = GetNextRow(row)))
(*aRows)++;
(*arowCount)++;
return NS_OK;
}
NS_IMETHODIMP
nsARIAGridAccessible::GetRowHeader(nsIAccessibleTable **aRowHeader)
{
NS_ENSURE_ARG_POINTER(aRowHeader);
*aRowHeader = nsnull;
if (IsDefunct())
return NS_ERROR_FAILURE;
// XXX: what should we return here?
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsARIAGridAccessible::CellRefAt(PRInt32 aRow, PRInt32 aColumn,
nsARIAGridAccessible::GetCellAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
nsIAccessible **aAccessible)
{
NS_ENSURE_ARG_POINTER(aAccessible);
@ -157,10 +132,10 @@ nsARIAGridAccessible::CellRefAt(PRInt32 aRow, PRInt32 aColumn,
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIAccessible> row = GetRowAt(aRow);
nsCOMPtr<nsIAccessible> row = GetRowAt(aRowIndex);
NS_ENSURE_ARG(row);
nsCOMPtr<nsIAccessible> cell = GetCellInRowAt(row, aColumn);
nsCOMPtr<nsIAccessible> cell = GetCellInRowAt(row, aColumnIndex);
NS_ENSURE_ARG(cell);
NS_ADDREF(*aAccessible = cell);
@ -168,71 +143,73 @@ nsARIAGridAccessible::CellRefAt(PRInt32 aRow, PRInt32 aColumn,
}
NS_IMETHODIMP
nsARIAGridAccessible::GetIndexAt(PRInt32 aRow, PRInt32 aColumn, PRInt32 *aIndex)
nsARIAGridAccessible::GetCellIndexAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
PRInt32 *aCellIndex)
{
NS_ENSURE_ARG_POINTER(aIndex);
*aIndex = -1;
NS_ENSURE_ARG_POINTER(aCellIndex);
*aCellIndex = -1;
if (IsDefunct())
return NS_ERROR_FAILURE;
NS_ENSURE_ARG(aRow >= 0 && aColumn >= 0);
NS_ENSURE_ARG(aRowIndex >= 0 && aColumnIndex >= 0);
PRInt32 rowCount = 0;
GetRows(&rowCount);
NS_ENSURE_ARG(aRow < rowCount);
GetRowCount(&rowCount);
NS_ENSURE_ARG(aRowIndex < rowCount);
PRInt32 colCount = 0;
GetColumns(&colCount);
NS_ENSURE_ARG(aColumn < colCount);
PRInt32 colsCount = 0;
GetColumnCount(&colsCount);
NS_ENSURE_ARG(aColumnIndex < colsCount);
*aIndex = colCount * aRow + aColumn;
*aCellIndex = colsCount * aRowIndex + aColumnIndex;
return NS_OK;
}
NS_IMETHODIMP
nsARIAGridAccessible::GetColumnAtIndex(PRInt32 aIndex, PRInt32 *aColumn)
nsARIAGridAccessible::GetColumnIndexAt(PRInt32 aCellIndex,
PRInt32 *aColumnIndex)
{
NS_ENSURE_ARG_POINTER(aColumn);
*aColumn = -1;
NS_ENSURE_ARG_POINTER(aColumnIndex);
*aColumnIndex = -1;
if (IsDefunct())
return NS_ERROR_FAILURE;
NS_ENSURE_ARG(aIndex >= 0);
NS_ENSURE_ARG(aCellIndex >= 0);
PRInt32 rowCount = 0;
GetRows(&rowCount);
PRInt32 colCount = 0;
GetColumns(&colCount);
GetRowCount(&rowCount);
NS_ENSURE_ARG(aIndex < rowCount * colCount);
PRInt32 colsCount = 0;
GetColumnCount(&colsCount);
*aColumn = aIndex % colCount;
NS_ENSURE_ARG(aCellIndex < rowCount * colsCount);
*aColumnIndex = aCellIndex % colsCount;
return NS_OK;
}
NS_IMETHODIMP
nsARIAGridAccessible::GetRowAtIndex(PRInt32 aIndex, PRInt32 *aRow)
nsARIAGridAccessible::GetRowIndexAt(PRInt32 aCellIndex, PRInt32 *aRowIndex)
{
NS_ENSURE_ARG_POINTER(aRow);
*aRow = -1;
NS_ENSURE_ARG_POINTER(aRowIndex);
*aRowIndex = -1;
if (IsDefunct())
return NS_ERROR_FAILURE;
NS_ENSURE_ARG(aIndex >= 0);
NS_ENSURE_ARG(aCellIndex >= 0);
PRInt32 rowCount = 0;
GetRows(&rowCount);
GetRowCount(&rowCount);
PRInt32 colCount = 0;
GetColumns(&colCount);
PRInt32 colsCount = 0;
GetColumnCount(&colsCount);
NS_ENSURE_ARG(aIndex < rowCount * colCount);
NS_ENSURE_ARG(aCellIndex < rowCount * colsCount);
*aRow = aIndex / colCount;
*aRowIndex = aCellIndex / colsCount;
return NS_OK;
}
@ -313,12 +290,12 @@ nsARIAGridAccessible::IsColumnSelected(PRInt32 aColumn, PRBool *aIsSelected)
return NS_OK;
do {
if (!IsARIASelected(row)) {
if (!nsAccUtils::IsARIASelected(row)) {
nsCOMPtr<nsIAccessible> cell = GetCellInRowAt(row, aColumn);
if (!cell) // Do not fail due to wrong markup
return NS_OK;
if (!IsARIASelected(cell))
if (!nsAccUtils::IsARIASelected(cell))
return NS_OK;
}
} while ((row = GetNextRow(row)));
@ -339,10 +316,10 @@ nsARIAGridAccessible::IsRowSelected(PRInt32 aRow, PRBool *aIsSelected)
nsCOMPtr<nsIAccessible> row = GetRowAt(aRow);
NS_ENSURE_ARG(row);
if (!IsARIASelected(row)) {
if (!nsAccUtils::IsARIASelected(row)) {
nsCOMPtr<nsIAccessible> cell;
while ((cell = GetNextCellInRow(row, cell))) {
if (!IsARIASelected(cell))
if (!nsAccUtils::IsARIASelected(cell))
return NS_OK;
}
}
@ -364,11 +341,11 @@ nsARIAGridAccessible::IsCellSelected(PRInt32 aRow, PRInt32 aColumn,
nsCOMPtr<nsIAccessible> row(GetRowAt(aRow));
NS_ENSURE_ARG(row);
if (!IsARIASelected(row)) {
if (!nsAccUtils::IsARIASelected(row)) {
nsCOMPtr<nsIAccessible> cell(GetCellInRowAt(row, aColumn));
NS_ENSURE_ARG(cell);
if (!IsARIASelected(cell))
if (!nsAccUtils::IsARIASelected(cell))
return NS_OK;
}
@ -377,7 +354,7 @@ nsARIAGridAccessible::IsCellSelected(PRInt32 aRow, PRInt32 aColumn,
}
NS_IMETHODIMP
nsARIAGridAccessible::GetSelectedCellsCount(PRUint32* aCount)
nsARIAGridAccessible::GetSelectedCellCount(PRUint32* aCount)
{
NS_ENSURE_ARG_POINTER(aCount);
*aCount = 0;
@ -386,18 +363,18 @@ nsARIAGridAccessible::GetSelectedCellsCount(PRUint32* aCount)
return NS_ERROR_FAILURE;
PRInt32 colCount = 0;
GetColumns(&colCount);
GetColumnCount(&colCount);
nsCOMPtr<nsIAccessible> row;
while ((row = GetNextRow(row))) {
if (IsARIASelected(row)) {
if (nsAccUtils::IsARIASelected(row)) {
(*aCount) += colCount;
continue;
}
nsCOMPtr<nsIAccessible> cell;
while ((cell = GetNextCellInRow(row, cell))) {
if (IsARIASelected(cell))
if (nsAccUtils::IsARIASelected(cell))
(*aCount)++;
}
}
@ -406,13 +383,13 @@ nsARIAGridAccessible::GetSelectedCellsCount(PRUint32* aCount)
}
NS_IMETHODIMP
nsARIAGridAccessible::GetSelectedColumnsCount(PRUint32* aCount)
nsARIAGridAccessible::GetSelectedColumnCount(PRUint32* aCount)
{
return GetSelectedColumnsArray(aCount);
}
NS_IMETHODIMP
nsARIAGridAccessible::GetSelectedRowsCount(PRUint32* aCount)
nsARIAGridAccessible::GetSelectedRowCount(PRUint32* aCount)
{
NS_ENSURE_ARG_POINTER(aCount);
*aCount = 0;
@ -422,7 +399,7 @@ nsARIAGridAccessible::GetSelectedRowsCount(PRUint32* aCount)
nsCOMPtr<nsIAccessible> row;
while ((row = GetNextRow(row))) {
if (IsARIASelected(row)) {
if (nsAccUtils::IsARIASelected(row)) {
(*aCount)++;
continue;
}
@ -433,7 +410,7 @@ nsARIAGridAccessible::GetSelectedRowsCount(PRUint32* aCount)
PRBool isRowSelected = PR_TRUE;
do {
if (!IsARIASelected(cell)) {
if (!nsAccUtils::IsARIASelected(cell)) {
isRowSelected = PR_FALSE;
break;
}
@ -447,7 +424,43 @@ nsARIAGridAccessible::GetSelectedRowsCount(PRUint32* aCount)
}
NS_IMETHODIMP
nsARIAGridAccessible::GetSelectedCells(PRUint32 *aCellsCount, PRInt32 **aCells)
nsARIAGridAccessible::GetSelectedCells(nsIArray **aCells)
{
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);
nsCOMPtr<nsIAccessible> row;
while (row = GetNextRow(row)) {
if (nsAccUtils::IsARIASelected(row)) {
nsCOMPtr<nsIAccessible> cell;
while (cell = GetNextCellInRow(row, cell))
selCells->AppendElement(cell, PR_FALSE);
continue;
}
nsCOMPtr<nsIAccessible> cell;
while (cell = GetNextCellInRow(row, cell)) {
if (nsAccUtils::IsARIASelected(cell))
selCells->AppendElement(cell, PR_FALSE);
}
}
NS_ADDREF(*aCells = selCells);
return NS_OK;
}
NS_IMETHODIMP
nsARIAGridAccessible::GetSelectedCellIndices(PRUint32 *aCellsCount,
PRInt32 **aCells)
{
NS_ENSURE_ARG_POINTER(aCellsCount);
*aCellsCount = 0;
@ -458,16 +471,16 @@ nsARIAGridAccessible::GetSelectedCells(PRUint32 *aCellsCount, PRInt32 **aCells)
return NS_ERROR_FAILURE;
PRInt32 rowCount = 0;
GetRows(&rowCount);
GetRowCount(&rowCount);
PRInt32 colCount = 0;
GetColumns(&colCount);
GetColumnCount(&colCount);
nsTArray<PRInt32> selCells(rowCount * colCount);
nsCOMPtr<nsIAccessible> row;
for (PRInt32 rowIdx = 0; row = GetNextRow(row); rowIdx++) {
if (IsARIASelected(row)) {
if (nsAccUtils::IsARIASelected(row)) {
for (PRInt32 colIdx = 0; colIdx < colCount; colIdx++)
selCells.AppendElement(rowIdx * colCount + colIdx);
@ -476,7 +489,7 @@ nsARIAGridAccessible::GetSelectedCells(PRUint32 *aCellsCount, PRInt32 **aCells)
nsCOMPtr<nsIAccessible> cell;
for (PRInt32 colIdx = 0; cell = GetNextCellInRow(row, cell); colIdx++) {
if (IsARIASelected(cell))
if (nsAccUtils::IsARIASelected(cell))
selCells.AppendElement(rowIdx * colCount + colIdx);
}
}
@ -494,19 +507,20 @@ nsARIAGridAccessible::GetSelectedCells(PRUint32 *aCellsCount, PRInt32 **aCells)
}
NS_IMETHODIMP
nsARIAGridAccessible::GetSelectedColumns(PRUint32 *aColumnsCount,
PRInt32 **aColumns)
nsARIAGridAccessible::GetSelectedColumnIndices(PRUint32 *acolumnCount,
PRInt32 **aColumns)
{
NS_ENSURE_ARG_POINTER(aColumns);
return GetSelectedColumnsArray(aColumnsCount, aColumns);
return GetSelectedColumnsArray(acolumnCount, aColumns);
}
NS_IMETHODIMP
nsARIAGridAccessible::GetSelectedRows(PRUint32 *aRowsCount, PRInt32 **aRows)
nsARIAGridAccessible::GetSelectedRowIndices(PRUint32 *arowCount,
PRInt32 **aRows)
{
NS_ENSURE_ARG_POINTER(aRowsCount);
*aRowsCount = 0;
NS_ENSURE_ARG_POINTER(arowCount);
*arowCount = 0;
NS_ENSURE_ARG_POINTER(aRows);
*aRows = nsnull;
@ -514,7 +528,7 @@ nsARIAGridAccessible::GetSelectedRows(PRUint32 *aRowsCount, PRInt32 **aRows)
return NS_ERROR_FAILURE;
PRInt32 rowCount = 0;
GetRows(&rowCount);
GetRowCount(&rowCount);
if (!rowCount)
return NS_OK;
@ -522,7 +536,7 @@ nsARIAGridAccessible::GetSelectedRows(PRUint32 *aRowsCount, PRInt32 **aRows)
nsCOMPtr<nsIAccessible> row;
for (PRInt32 rowIdx = 0; row = GetNextRow(row); rowIdx++) {
if (IsARIASelected(row)) {
if (nsAccUtils::IsARIASelected(row)) {
selRows.AppendElement(rowIdx);
continue;
}
@ -533,7 +547,7 @@ nsARIAGridAccessible::GetSelectedRows(PRUint32 *aRowsCount, PRInt32 **aRows)
PRBool isRowSelected = PR_TRUE;
do {
if (!IsARIASelected(cell)) {
if (!nsAccUtils::IsARIASelected(cell)) {
isRowSelected = PR_FALSE;
break;
}
@ -543,15 +557,15 @@ nsARIAGridAccessible::GetSelectedRows(PRUint32 *aRowsCount, PRInt32 **aRows)
selRows.AppendElement(rowIdx);
}
PRUint32 selRowsCount = selRows.Length();
if (!selRowsCount)
PRUint32 selrowCount = selRows.Length();
if (!selrowCount)
return NS_OK;
*aRows = static_cast<PRInt32*>(
nsMemory::Clone(selRows.Elements(), selRowsCount * sizeof(PRInt32)));
nsMemory::Clone(selRows.Elements(), selrowCount * sizeof(PRInt32)));
NS_ENSURE_TRUE(*aRows, NS_ERROR_OUT_OF_MEMORY);
*aRowsCount = selRowsCount;
*arowCount = selrowCount;
return NS_OK;
}
@ -648,7 +662,7 @@ nsARIAGridAccessible::IsValidRow(PRInt32 aRow)
return PR_FALSE;
PRInt32 rowCount = 0;
GetRows(&rowCount);
GetRowCount(&rowCount);
return aRow < rowCount;
}
@ -659,7 +673,7 @@ nsARIAGridAccessible::IsValidColumn(PRInt32 aColumn)
return PR_FALSE;
PRInt32 colCount = 0;
GetColumns(&colCount);
GetColumnCount(&colCount);
return aColumn < colCount;
}
@ -670,12 +684,12 @@ nsARIAGridAccessible::IsValidRowNColumn(PRInt32 aRow, PRInt32 aColumn)
return PR_FALSE;
PRInt32 rowCount = 0;
GetRows(&rowCount);
GetRowCount(&rowCount);
if (aRow >= rowCount)
return PR_FALSE;
PRInt32 colCount = 0;
GetColumns(&colCount);
GetColumnCount(&colCount);
return aColumn < colCount;
}
@ -747,25 +761,6 @@ nsARIAGridAccessible::GetNextCellInRow(nsIAccessible *aRow, nsIAccessible *aCell
return nsnull;
}
PRBool
nsARIAGridAccessible::IsARIASelected(nsIAccessible *aAccessible)
{
nsRefPtr<nsAccessible> acc = nsAccUtils::QueryAccessible(aAccessible);
nsCOMPtr<nsIDOMNode> node;
acc->GetDOMNode(getter_AddRefs(node));
NS_ASSERTION(node, "No DOM node!");
if (node) {
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
if (content->AttrValueIs(kNameSpaceID_None,
nsAccessibilityAtoms::aria_selected,
nsAccessibilityAtoms::_true, eCaseMatters))
return PR_TRUE;
}
return PR_FALSE;
}
nsresult
nsARIAGridAccessible::SetARIASelected(nsIAccessible *aAccessible,
PRBool aIsSelected, PRBool aNotify)
@ -820,7 +815,7 @@ nsARIAGridAccessible::SetARIASelected(nsIAccessible *aAccessible,
aAccessible->GetParent(getter_AddRefs(row));
if (nsAccUtils::Role(row) == nsIAccessibleRole::ROLE_ROW &&
IsARIASelected(row)) {
nsAccUtils::IsARIASelected(row)) {
rv = SetARIASelected(row, PR_FALSE, PR_FALSE);
NS_ENSURE_SUCCESS(rv, rv);
@ -838,11 +833,11 @@ nsARIAGridAccessible::SetARIASelected(nsIAccessible *aAccessible,
}
nsresult
nsARIAGridAccessible::GetSelectedColumnsArray(PRUint32 *aColumnsCount,
nsARIAGridAccessible::GetSelectedColumnsArray(PRUint32 *acolumnCount,
PRInt32 **aColumns)
{
NS_ENSURE_ARG_POINTER(aColumnsCount);
*aColumnsCount = 0;
NS_ENSURE_ARG_POINTER(acolumnCount);
*acolumnCount = 0;
if (aColumns)
*aColumns = nsnull;
@ -854,7 +849,7 @@ nsARIAGridAccessible::GetSelectedColumnsArray(PRUint32 *aColumnsCount,
return NS_OK;
PRInt32 colCount = 0;
GetColumns(&colCount);
GetColumnCount(&colCount);
if (!colCount)
return NS_OK;
@ -866,14 +861,14 @@ nsARIAGridAccessible::GetSelectedColumnsArray(PRUint32 *aColumnsCount,
isColSelArray[i] = PR_TRUE;
do {
if (IsARIASelected(row))
if (nsAccUtils::IsARIASelected(row))
continue;
PRInt32 colIdx = 0;
nsCOMPtr<nsIAccessible> cell;
for (colIdx = 0; cell = GetNextCellInRow(row, cell); colIdx++) {
if (isColSelArray.SafeElementAt(colIdx, PR_FALSE) &&
!IsARIASelected(cell)) {
!nsAccUtils::IsARIASelected(cell)) {
isColSelArray[colIdx] = PR_FALSE;
selColCount--;
}
@ -884,7 +879,7 @@ nsARIAGridAccessible::GetSelectedColumnsArray(PRUint32 *aColumnsCount,
return NS_OK;
if (!aColumns) {
*aColumnsCount = selColCount;
*acolumnCount = selColCount;
return NS_OK;
}
@ -892,7 +887,7 @@ nsARIAGridAccessible::GetSelectedColumnsArray(PRUint32 *aColumnsCount,
nsMemory::Alloc(selColCount * sizeof(PRInt32)));
NS_ENSURE_TRUE(*aColumns, NS_ERROR_OUT_OF_MEMORY);
*aColumnsCount = selColCount;
*acolumnCount = selColCount;
for (PRInt32 colIdx = 0, idx = 0; colIdx < colCount; colIdx++) {
if (isColSelArray[colIdx])
(*aColumns)[idx++] = colIdx;
@ -919,8 +914,169 @@ nsARIAGridCellAccessible::nsARIAGridCellAccessible(nsIDOMNode* aDomNode,
////////////////////////////////////////////////////////////////////////////////
// nsISupports
NS_IMPL_ISUPPORTS_INHERITED0(nsARIAGridCellAccessible,
nsHyperTextAccessible)
NS_IMPL_ISUPPORTS_INHERITED1(nsARIAGridCellAccessible,
nsHyperTextAccessible,
nsIAccessibleTableCell)
////////////////////////////////////////////////////////////////////////////////
// nsIAccessibleTableCell
NS_IMETHODIMP
nsARIAGridCellAccessible::GetTable(nsIAccessibleTable **aTable)
{
NS_ENSURE_ARG_POINTER(aTable);
*aTable = nsnull;
nsCOMPtr<nsIAccessible> thisRow;
GetParent(getter_AddRefs(thisRow));
if (nsAccUtils::Role(thisRow) != nsIAccessibleRole::ROLE_ROW)
return NS_OK;
nsCOMPtr<nsIAccessible> table;
thisRow->GetParent(getter_AddRefs(table));
if (nsAccUtils::Role(table) != nsIAccessibleRole::ROLE_TABLE &&
nsAccUtils::Role(table) != nsIAccessibleRole::ROLE_TREE_TABLE)
return NS_OK;
CallQueryInterface(table, aTable);
return NS_OK;
}
NS_IMETHODIMP
nsARIAGridCellAccessible::GetColumnIndex(PRInt32 *aColumnIndex)
{
NS_ENSURE_ARG_POINTER(aColumnIndex);
*aColumnIndex = -1;
if (IsDefunct())
return NS_ERROR_FAILURE;
*aColumnIndex = 0;
nsCOMPtr<nsIAccessible> prevCell, tmpAcc;
GetPreviousSibling(getter_AddRefs(prevCell));
while (prevCell) {
PRUint32 role = nsAccUtils::Role(prevCell);
if (role == nsIAccessibleRole::ROLE_GRID_CELL ||
role == nsIAccessibleRole::ROLE_ROWHEADER ||
role == nsIAccessibleRole::ROLE_COLUMNHEADER)
(*aColumnIndex)++;
prevCell->GetPreviousSibling(getter_AddRefs(tmpAcc));
tmpAcc.swap(prevCell);
}
return NS_OK;
}
NS_IMETHODIMP
nsARIAGridCellAccessible::GetRowIndex(PRInt32 *aRowIndex)
{
NS_ENSURE_ARG_POINTER(aRowIndex);
*aRowIndex = -1;
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIAccessible> row, prevRow;
GetParent(getter_AddRefs(row));
while (row) {
if (nsAccUtils::Role(row) == nsIAccessibleRole::ROLE_ROW)
(*aRowIndex)++;
row->GetPreviousSibling(getter_AddRefs(prevRow));
row.swap(prevRow);
}
return NS_OK;
}
NS_IMETHODIMP
nsARIAGridCellAccessible::GetColumnExtent(PRInt32 *aExtentCount)
{
NS_ENSURE_ARG_POINTER(aExtentCount);
*aExtentCount = 0;
if (IsDefunct())
return NS_ERROR_FAILURE;
*aExtentCount = 1;
return NS_OK;
}
NS_IMETHODIMP
nsARIAGridCellAccessible::GetRowExtent(PRInt32 *aExtentCount)
{
NS_ENSURE_ARG_POINTER(aExtentCount);
*aExtentCount = 0;
if (IsDefunct())
return NS_ERROR_FAILURE;
*aExtentCount = 1;
return NS_OK;
}
NS_IMETHODIMP
nsARIAGridCellAccessible::GetColumnHeaderCells(nsIArray **aHeaderCells)
{
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
nsARIAGridCellAccessible::GetRowHeaderCells(nsIArray **aHeaderCells)
{
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
nsARIAGridCellAccessible::IsSelected(PRBool *aIsSelected)
{
NS_ENSURE_ARG_POINTER(aIsSelected);
*aIsSelected = PR_FALSE;
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIAccessible> row;
GetParent(getter_AddRefs(row));
if (nsAccUtils::Role(row) != nsIAccessibleRole::ROLE_ROW)
return NS_OK;
if (!nsAccUtils::IsARIASelected(row) && !nsAccUtils::IsARIASelected(this))
return NS_OK;
*aIsSelected = PR_TRUE;
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsAccessible

Просмотреть файл

@ -103,12 +103,6 @@ protected:
already_AddRefed<nsIAccessible> GetNextCellInRow(nsIAccessible *aRow,
nsIAccessible *aCell = nsnull);
/**
* Return true if the DOM node of given accessible has aria-selected="true"
* attribute.
*/
PRBool IsARIASelected(nsIAccessible *aAccessible);
/**
* Set aria-selected attribute value on DOM node of the given accessible.
*
@ -121,9 +115,9 @@ protected:
PRBool aNotify = PR_TRUE);
/**
* Helper method for GetSelectedColumnsCount and GetSelectedColumns.
* Helper method for GetSelectedColumnCount and GetSelectedColumns.
*/
nsresult GetSelectedColumnsArray(PRUint32 *aColumnsCount,
nsresult GetSelectedColumnsArray(PRUint32 *acolumnCount,
PRInt32 **aColumns = nsnull);
};
@ -131,7 +125,8 @@ protected:
/**
* Accessible for ARIA gridcell and rowheader/columnheader.
*/
class nsARIAGridCellAccessible : public nsHyperTextAccessibleWrap
class nsARIAGridCellAccessible : public nsHyperTextAccessibleWrap,
public nsIAccessibleTableCell
{
public:
nsARIAGridCellAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
@ -139,6 +134,9 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIAccessibleTableCell
NS_DECL_NSIACCESSIBLETABLECELL
// nsAccessible
virtual nsresult GetARIAState(PRUint32 *aState, PRUint32 *aExtraState);
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);

Просмотреть файл

@ -56,6 +56,7 @@
#include "nsIDOMXULSelectCntrlEl.h"
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsWhitespaceTokenizer.h"
#include "nsComponentManagerUtils.h"
void
nsAccUtils::GetAccAttr(nsIPersistentProperties *aAttributes,
@ -478,6 +479,25 @@ nsAccUtils::GetARIATreeItemParent(nsIAccessible *aStartTreeItem,
}
}
PRBool
nsAccUtils::IsARIASelected(nsIAccessible *aAccessible)
{
nsRefPtr<nsAccessible> acc = nsAccUtils::QueryAccessible(aAccessible);
nsCOMPtr<nsIDOMNode> node;
acc->GetDOMNode(getter_AddRefs(node));
NS_ASSERTION(node, "No DOM node!");
if (node) {
nsCOMPtr<nsIContent> content(do_QueryInterface(node));
if (content->AttrValueIs(kNameSpaceID_None,
nsAccessibilityAtoms::aria_selected,
nsAccessibilityAtoms::_true, eCaseMatters))
return PR_TRUE;
}
return PR_FALSE;
}
already_AddRefed<nsIAccessibleText>
nsAccUtils::GetTextAccessibleFromSelection(nsISelection *aSelection,
nsIDOMNode **aNode)
@ -912,3 +932,58 @@ nsAccUtils::GetMultiSelectFor(nsIDOMNode *aNode)
accessible.swap(returnAccessible);
return returnAccessible;
}
nsresult
nsAccUtils::GetHeaderCellsFor(nsIAccessibleTable *aTable,
nsIAccessibleTableCell *aCell,
PRInt32 aRowOrColHeaderCells, nsIArray **aCells)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIMutableArray> cells = do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 rowIdx = -1;
rv = aCell->GetRowIndex(&rowIdx);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 colIdx = -1;
rv = aCell->GetColumnIndex(&colIdx);
NS_ENSURE_SUCCESS(rv, rv);
PRBool moveToLeft = aRowOrColHeaderCells == eRowHeaderCells;
// Move to the left or top to find row header cells or column header cells.
PRInt32 index = (moveToLeft ? colIdx : rowIdx) - 1;
for (; index >= 0; index--) {
PRInt32 curRowIdx = moveToLeft ? rowIdx : index;
PRInt32 curColIdx = moveToLeft ? index : colIdx;
nsCOMPtr<nsIAccessible> cell;
rv = aTable->GetCellAt(curRowIdx, curColIdx, getter_AddRefs(cell));
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIAccessibleTableCell> tableCellAcc =
do_QueryInterface(cell);
PRInt32 origIdx = 1;
if (moveToLeft)
rv = tableCellAcc->GetColumnIndex(&origIdx);
else
rv = tableCellAcc->GetRowIndex(&origIdx);
NS_ENSURE_SUCCESS(rv, rv);
if (origIdx == index) {
// Append original header cells only.
PRUint32 role = Role(cell);
PRBool isHeader = moveToLeft ?
role == nsIAccessibleRole::ROLE_ROWHEADER :
role == nsIAccessibleRole::ROLE_COLUMNHEADER;
if (isHeader)
cells->AppendElement(cell, PR_FALSE);
}
}
NS_ADDREF(*aCells = cells);
return NS_OK;
}

Просмотреть файл

@ -179,6 +179,12 @@ public:
nsIContent *aStartTreeItemContent,
nsIAccessible **aTreeItemParent);
/**
* Return true if the DOM node of given accessible has aria-selected="true"
* attribute.
*/
static PRBool IsARIASelected(nsIAccessible *aAccessible);
/**
* Return text accessible containing focus point of the given selection.
* Used for normal and misspelling selection changes processing.
@ -452,6 +458,32 @@ public:
* Return multiselectable parent for the given selectable accessible if any.
*/
static already_AddRefed<nsIAccessible> GetMultiSelectFor(nsIDOMNode *aNode);
/**
* Search hint enum constants. Used by GetHeaderCellsFor() method.
*/
enum {
// search for row header cells, left direction
eRowHeaderCells,
// search for column header cells, top direction
eColumnHeaderCells
};
/**
* Return an array of row or column header cells for the given cell.
*
* @param aTable [in] table accessible
* @param aCell [in] cell accessible within the given table to
* get header cells
* @param aRowOrColHeaderCells [in] specifies whether column or row header
* cells are returned (see enum constants
* above)
* @param aCells [out] array of header cell accessibles
*/
static nsresult GetHeaderCellsFor(nsIAccessibleTable *aTable,
nsIAccessibleTableCell *aCell,
PRInt32 aRowOrColHeaderCells,
nsIArray **aCells);
};
#endif

Просмотреть файл

@ -88,13 +88,14 @@
#ifdef MOZ_XUL
#include "nsXULAlertAccessible.h"
#include "nsXULColorPickerAccessible.h"
#include "nsXULComboboxAccessible.h"
#include "nsXULFormControlAccessible.h"
#include "nsXULListboxAccessibleWrap.h"
#include "nsXULMenuAccessibleWrap.h"
#include "nsXULSelectAccessible.h"
#include "nsXULSliderAccessible.h"
#include "nsXULTabAccessible.h"
#include "nsXULTextAccessible.h"
#include "nsXULTreeAccessibleWrap.h"
#include "nsXULTreeGridAccessibleWrap.h"
#endif
// For native window support for object/embed/applet tags
@ -567,11 +568,6 @@ nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame *aFrame,
tag == nsAccessibilityAtoms::h4 ||
tag == nsAccessibilityAtoms::h5 ||
tag == nsAccessibilityAtoms::h6 ||
#ifndef MOZ_ACCESSIBILITY_ATK
tag == nsAccessibilityAtoms::tbody ||
tag == nsAccessibilityAtoms::tfoot ||
tag == nsAccessibilityAtoms::thead ||
#endif
tag == nsAccessibilityAtoms::q) {
return CreateHyperTextAccessible(aFrame, aAccessible);
}
@ -580,7 +576,7 @@ nsAccessibilityService::CreateHTMLAccessibleByMarkup(nsIFrame *aFrame,
nsIAccessibleRole::ROLE_ROW);
}
else if (nsCoreUtils::IsHTMLTableHeader(content)) {
*aAccessible = new nsHTMLTableHeaderAccessible(aNode, aWeakShell);
*aAccessible = new nsHTMLTableHeaderCellAccessibleWrap(aNode, aWeakShell);
}
NS_IF_ADDREF(*aAccessible);
@ -837,34 +833,8 @@ nsAccessibilityService::CreateHTMLTableAccessible(nsIFrame *aFrame, nsIAccessibl
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLTableHeadAccessible(nsIDOMNode *aDOMNode, nsIAccessible **_retval)
{
#ifndef MOZ_ACCESSIBILITY_ATK
*_retval = nsnull;
return NS_ERROR_FAILURE;
#else
NS_ENSURE_ARG_POINTER(aDOMNode);
nsresult rv = NS_OK;
nsCOMPtr<nsIWeakReference> weakShell;
rv = GetShellFromNode(aDOMNode, getter_AddRefs(weakShell));
NS_ENSURE_SUCCESS(rv, rv);
nsHTMLTableHeadAccessibleWrap* accTableHead =
new nsHTMLTableHeadAccessibleWrap(aDOMNode, weakShell);
NS_ENSURE_TRUE(accTableHead, NS_ERROR_OUT_OF_MEMORY);
*_retval = static_cast<nsIAccessible *>(accTableHead);
NS_IF_ADDREF(*_retval);
return rv;
#endif
}
NS_IMETHODIMP
nsAccessibilityService::CreateHTMLTableCellAccessible(nsIFrame *aFrame, nsIAccessible **_retval)
nsAccessibilityService::CreateHTMLTableCellAccessible(nsIFrame *aFrame,
nsIAccessible **aAccessible)
{
nsCOMPtr<nsIDOMNode> node;
nsCOMPtr<nsIWeakReference> weakShell;
@ -872,11 +842,11 @@ nsAccessibilityService::CreateHTMLTableCellAccessible(nsIFrame *aFrame, nsIAcces
if (NS_FAILED(rv))
return rv;
*_retval = new nsHTMLTableCellAccessible(node, weakShell);
if (! *_retval)
*aAccessible = new nsHTMLTableCellAccessibleWrap(node, weakShell);
if (!*aAccessible)
return NS_ERROR_OUT_OF_MEMORY;
NS_ADDREF(*_retval);
NS_ADDREF(*aAccessible);
return NS_OK;
}
@ -1582,7 +1552,7 @@ NS_IMETHODIMP nsAccessibilityService::GetAccessible(nsIDOMNode *aNode,
} else if (roleMapEntry->role == nsIAccessibleRole::ROLE_GRID_CELL ||
roleMapEntry->role == nsIAccessibleRole::ROLE_ROWHEADER ||
roleMapEntry->role == nsIAccessibleRole::ROLE_COLUMNHEADER) {
newAcc = new nsARIAGridCellAccessible(aNode, aWeakShell);
newAcc = new nsARIAGridCellAccessibleWrap(aNode, aWeakShell);
}
}
}
@ -1828,10 +1798,10 @@ nsresult nsAccessibilityService::GetAccessibleByType(nsIDOMNode *aNode,
*aAccessible = new nsXULLinkAccessible(aNode, weakShell);
break;
case nsIAccessibleProvider::XULListbox:
*aAccessible = new nsXULListboxAccessible(aNode, weakShell);
*aAccessible = new nsXULListboxAccessibleWrap(aNode, weakShell);
break;
case nsIAccessibleProvider::XULListCell:
*aAccessible = new nsXULListCellAccessible(aNode, weakShell);
*aAccessible = new nsXULListCellAccessibleWrap(aNode, weakShell);
break;
case nsIAccessibleProvider::XULListHead:
*aAccessible = new nsXULColumnsAccessible(aNode, weakShell);
@ -1909,7 +1879,7 @@ nsresult nsAccessibilityService::GetAccessibleByType(nsIDOMNode *aNode,
case nsIAccessibleProvider::XULTree:
return GetAccessibleForXULTree(aNode, weakShell, aAccessible);
case nsIAccessibleProvider::XULTreeColumns:
*aAccessible = new nsXULTreeColumnsAccessibleWrap(aNode, weakShell);
*aAccessible = new nsXULTreeColumnsAccessible(aNode, weakShell);
break;
case nsIAccessibleProvider::XULTreeColumnItem:
*aAccessible = new nsXULColumnItemAccessible(aNode, weakShell);

Просмотреть файл

@ -1027,7 +1027,7 @@ nsCoreUtils::GetLastSensibleColumn(nsITreeBoxObject *aTree)
}
PRUint32
nsCoreUtils::GetSensibleColumnsCount(nsITreeBoxObject *aTree)
nsCoreUtils::GetSensiblecolumnCount(nsITreeBoxObject *aTree)
{
PRUint32 count = 0;

Просмотреть файл

@ -413,7 +413,7 @@ public:
/**
* Return sensible columns count for the given tree box object.
*/
static PRUint32 GetSensibleColumnsCount(nsITreeBoxObject *aTree);
static PRUint32 GetSensiblecolumnCount(nsITreeBoxObject *aTree);
/**
* Return sensible column at the given index for the given tree box object.

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -39,15 +39,17 @@
#ifndef _nsHTMLTableAccessible_H_
#define _nsHTMLTableAccessible_H_
#include "nsBaseWidgetAccessible.h"
#include "nsHyperTextAccessibleWrap.h"
#include "nsIAccessibleTable.h"
class nsITableLayout;
class nsITableCellLayout;
/**
* HTML table cell accessible (html:td).
*/
class nsHTMLTableCellAccessible : public nsHyperTextAccessibleWrap
class nsHTMLTableCellAccessible : public nsHyperTextAccessibleWrap,
public nsIAccessibleTableCell
{
public:
nsHTMLTableCellAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
@ -55,78 +57,54 @@ public:
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
// nsIAccessible
NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
nsIAccessibleRelation **aRelation);
// nsIAccessibleTableCell
NS_DECL_NSIACCESSIBLETABLECELL
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
protected:
/**
* Return host table accessible.
*/
already_AddRefed<nsIAccessibleTable> GetTableAccessible();
/**
* Return nsITableCellLayout of the table cell frame.
*/
nsITableCellLayout* GetCellLayout();
/**
* Return row and column indices of the cell.
*/
nsresult GetCellIndexes(PRInt32& aRowIdx, PRInt32& aColIdx);
/**
* Search hint enum constants. Used by FindCellsForRelation method.
* Return an array of row or column header cells.
*/
enum {
// search for header cells, up-left direction search
eHeadersForCell,
// search for row header cell, right direction search
eCellsForRowHeader,
// search for column header cell, down direction search
eCellsForColumnHeader
};
/**
* Add found cells as relation targets.
*
* @param aSearchHint [in] enum constan defined above, defines an
* algorithm to search cells
* @param aRelationType [in] relation type
* @param aRelation [in, out] relation object
*/
nsresult FindCellsForRelation(PRInt32 aSearchHint, PRUint32 aRelationType,
nsIAccessibleRelation **aRelation);
/**
* Return the cell or header cell at the given row and column.
*
* @param aTableAcc [in] table accessible the search is prepared in
* @param aAnchorCell [in] anchor cell, found cell should be different
* from it
* @param aRowIdx [in] row index
* @param aColIdx [in] column index
* @param aLookForHeader [in] flag specifies if found cell must be a header
* @return found cell content
*/
nsIContent* FindCell(nsHTMLTableAccessible *aTableAcc, nsIContent *aAnchorCell,
PRInt32 aRowIdx, PRInt32 aColIdx,
PRInt32 aLookForHeader);
nsresult GetHeaderCells(PRInt32 aRowOrColumnHeaderCell,
nsIArray **aHeaderCells);
};
/**
* HTML table row/column header accessible (html:th or html:td@scope).
*/
class nsHTMLTableHeaderAccessible : public nsHTMLTableCellAccessible
class nsHTMLTableHeaderCellAccessible : public nsHTMLTableCellAccessible
{
public:
nsHTMLTableHeaderAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
nsHTMLTableHeaderCellAccessible(nsIDOMNode* aDomNode,
nsIWeakReference* aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
// nsIAccessible
NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
nsIAccessibleRelation **aRelation);
};
/**
* HTML table accessible.
* HTML table accessible (html:table).
*/
// To turn on table debugging descriptions define SHOW_LAYOUT_HEURISTIC
@ -184,8 +162,19 @@ public:
*/
nsresult GetCellAt(PRInt32 aRowIndex, PRInt32 aColIndex,
nsIDOMElement* &aCell);
/**
* Return nsITableLayout for the frame of the accessible table.
*/
nsITableLayout* GetTableLayout();
protected:
// nsAccessible
virtual void CacheChildren();
// nsHTMLTableAccessible
/**
* Add row or column to selection.
*
@ -208,10 +197,6 @@ protected:
PRUint32 aTarget,
PRBool aIsOuter);
virtual void CacheChildren();
nsresult GetTableNode(nsIDOMNode **_retval);
nsresult GetTableLayout(nsITableLayout **aLayoutObject);
/**
* Return true if table has an element with the given tag name.
*
@ -230,23 +215,9 @@ NS_DEFINE_STATIC_IID_ACCESSOR(nsHTMLTableAccessible,
NS_TABLEACCESSIBLE_IMPL_CID)
class nsHTMLTableHeadAccessible : public nsHTMLTableAccessible
{
public:
NS_DECL_ISUPPORTS_INHERITED
nsHTMLTableHeadAccessible(nsIDOMNode *aDomNode, nsIWeakReference *aShell);
/* nsIAccessibleTable */
NS_IMETHOD GetCaption(nsIAccessible **aCaption);
NS_IMETHOD GetSummary(nsAString &aSummary);
NS_IMETHOD GetColumnHeader(nsIAccessibleTable **aColumnHeader);
NS_IMETHOD GetRows(PRInt32 *aRows);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
};
/**
* HTML caption accessible (html:caption).
*/
class nsHTMLCaptionAccessible : public nsHyperTextAccessibleWrap
{
public:

Просмотреть файл

@ -65,7 +65,8 @@ EXPORTS = \
nsDocAccessibleWrap.h \
nsRootAccessibleWrap.h \
nsXULMenuAccessibleWrap.h \
nsXULTreeAccessibleWrap.h \
nsXULListboxAccessibleWrap.h \
nsXULTreeGridAccessibleWrap.h \
nsHyperTextAccessibleWrap.h \
nsHTMLImageAccessibleWrap.h \
nsHTMLTableAccessibleWrap.h \

Просмотреть файл

@ -44,6 +44,7 @@
#include "nsARIAGridAccessible.h"
typedef class nsARIAGridAccessible nsARIAGridAccessibleWrap;
typedef class nsARIAGridCellAccessible nsARIAGridCellAccessibleWrap;
#endif

Просмотреть файл

@ -44,8 +44,8 @@
#include "nsHTMLTableAccessible.h"
typedef class nsHTMLTableAccessible nsHTMLTableAccessibleWrap;
typedef class nsHTMLTableHeadAccessible nsHTMLTableHeadAccessibleWrap;
typedef class nsHTMLTableCellAccessible nsHTMLTableCellAccessibleWrap;
typedef class nsHTMLTableHeaderCellAccessible nsHTMLTableHeaderCellAccessibleWrap;
#endif

Просмотреть файл

@ -0,0 +1,47 @@
/* -*- 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
* Mozilla Corporation.
* 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 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 ***** */
#ifndef __nsXULListboxAccessibleWrap_h__
#define __nsXULListboxAccessibleWrap_h__
#include "nsXULListboxAccessible.h"
typedef class nsXULListboxAccessible nsXULListboxAccessibleWrap;
typedef class nsXULListCellAccessible nsXULListCellAccessibleWrap;
#endif

Просмотреть файл

@ -35,11 +35,12 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef __nsXULTreeAccessibleWrap_h__
#define __nsXULTreeAccessibleWrap_h__
#ifndef __nsXULTreeGridAccessibleWrap_h__
#define __nsXULTreeGridAccessibleWrap_h__
#include "nsXULTreeGridAccessible.h"
typedef class nsXULTreeGridAccessible nsXULTreeGridAccessibleWrap;
typedef class nsXULTreeColumnsAccessible nsXULTreeColumnsAccessibleWrap;
typedef class nsXULTreeGridAccessible nsXULTreeGridAccessibleWrap;
typedef class nsXULTreeGridCellAccessible nsXULTreeGridCellAccessibleWrap;
#endif

Просмотреть файл

@ -96,7 +96,7 @@ __try {
return E_FAIL;
void *instancePtr = NULL;
rv = winAccessNode->QueryNativeInterface(IID_IUnknown, &instancePtr);
rv = winAccessNode->QueryNativeInterface(IID_IUnknown, &instancePtr);
if (NS_FAILED(rv))
return E_FAIL;

Просмотреть файл

@ -42,11 +42,13 @@
#include "Accessible2.h"
#include "AccessibleTable_i.c"
#include "AccessibleTable2_i.c"
#include "nsIAccessible.h"
#include "nsIAccessibleTable.h"
#include "nsIWinAccessNode.h"
#include "nsAccessNodeWrap.h"
#include "nsWinUtils.h"
#include "nsCOMPtr.h"
#include "nsString.h"
@ -67,9 +69,16 @@ CAccessibleTable::QueryInterface(REFIID iid, void** ppv)
return S_OK;
}
if (IID_IAccessibleTable2 == iid) {
*ppv = static_cast<IAccessibleTable2*>(this);
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}
return E_NOINTERFACE;
}
////////////////////////////////////////////////////////////////////////////////
// IAccessibleTable
STDMETHODIMP
@ -85,7 +94,7 @@ __try {
return E_FAIL;
nsCOMPtr<nsIAccessible> cell;
nsresult rv = tableAcc->CellRefAt(aRow, aColumn, getter_AddRefs(cell));
nsresult rv = tableAcc->GetCellAt(aRow, aColumn, getter_AddRefs(cell));
if (NS_FAILED(rv))
return GetHRESULT(rv);
@ -153,14 +162,15 @@ __try {
return E_FAIL;
PRInt32 childIndex = 0;
nsresult rv = tableAcc->GetIndexAt(aRowIndex, aColumnIndex, &childIndex);
nsresult rv = tableAcc->GetCellIndexAt(aRowIndex, aColumnIndex, &childIndex);
if (NS_FAILED(rv))
return GetHRESULT(rv);
*aChildIndex = childIndex;
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(),
GetExceptionInformation())) { }
return E_FAIL;
}
@ -220,37 +230,11 @@ CAccessibleTable::get_columnHeader(IAccessibleTable **aAccessibleTable,
{
__try {
*aAccessibleTable = NULL;
*aStartingRowIndex = -1;
// XXX: starting row index is always 0.
*aStartingRowIndex = 0;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
nsCOMPtr<nsIAccessibleTable> header;
nsresult rv = tableAcc->GetColumnHeader(getter_AddRefs(header));
if (NS_FAILED(rv))
return GetHRESULT(rv);
if (!header)
return S_FALSE;
nsCOMPtr<nsIWinAccessNode> winAccessNode(do_QueryInterface(header));
if (!winAccessNode)
return E_FAIL;
void *instancePtr = NULL;
rv = winAccessNode->QueryNativeInterface(IID_IAccessibleTable, &instancePtr);
if (NS_FAILED(rv))
return GetHRESULT(rv);
*aAccessibleTable = static_cast<IAccessibleTable*>(instancePtr);
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(),
GetExceptionInformation())) {}
return E_NOTIMPL;
}
STDMETHODIMP
@ -265,14 +249,15 @@ __try {
return E_FAIL;
PRInt32 columnIndex = 0;
nsresult rv = tableAcc->GetColumnAtIndex(aChildIndex, &columnIndex);
nsresult rv = tableAcc->GetColumnIndexAt(aChildIndex, &columnIndex);
if (NS_FAILED(rv))
return GetHRESULT(rv);
*aColumnIndex = columnIndex;
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(),
GetExceptionInformation())) {}
return E_FAIL;
}
@ -288,14 +273,15 @@ __try {
return E_FAIL;
PRInt32 columnCount = 0;
nsresult rv = tableAcc->GetColumns(&columnCount);
nsresult rv = tableAcc->GetColumnCount(&columnCount);
if (NS_FAILED(rv))
return GetHRESULT(rv);
*aColumnCount = columnCount;
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(),
GetExceptionInformation())) {}
return E_FAIL;
}
@ -311,14 +297,15 @@ __try {
return E_FAIL;
PRInt32 rowCount = 0;
nsresult rv = tableAcc->GetRows(&rowCount);
nsresult rv = tableAcc->GetRowCount(&rowCount);
if (NS_FAILED(rv))
return GetHRESULT(rv);
*aRowCount = rowCount;
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(),
GetExceptionInformation())) {}
return E_FAIL;
}
@ -334,7 +321,7 @@ __try {
return E_FAIL;
PRUint32 count = 0;
nsresult rv = tableAcc->GetSelectedCellsCount(&count);
nsresult rv = tableAcc->GetSelectedCellCount(&count);
if (NS_FAILED(rv))
return GetHRESULT(rv);
@ -357,7 +344,7 @@ __try {
return E_FAIL;
PRUint32 count = 0;
nsresult rv = tableAcc->GetSelectedColumnsCount(&count);
nsresult rv = tableAcc->GetSelectedColumnCount(&count);
if (NS_FAILED(rv))
return GetHRESULT(rv);
@ -380,7 +367,7 @@ __try {
return E_FAIL;
PRUint32 count = 0;
nsresult rv = tableAcc->GetSelectedRowsCount(&count);
nsresult rv = tableAcc->GetSelectedRowCount(&count);
if (NS_FAILED(rv))
return GetHRESULT(rv);
@ -446,38 +433,11 @@ CAccessibleTable::get_rowHeader(IAccessibleTable **aAccessibleTable,
{
__try {
*aAccessibleTable = NULL;
*aStartingColumnIndex = -1;
// XXX: starting column index is always 0.
*aStartingColumnIndex = 0;
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
nsCOMPtr<nsIAccessibleTable> header;
nsresult rv = tableAcc->GetRowHeader(getter_AddRefs(header));
if (NS_FAILED(rv))
return GetHRESULT(rv);
if (!header)
return S_FALSE;
nsCOMPtr<nsIWinAccessNode> winAccessNode(do_QueryInterface(header));
if (!winAccessNode)
return E_FAIL;
void *instancePtr = NULL;
rv = winAccessNode->QueryNativeInterface(IID_IAccessibleTable,
&instancePtr);
if (NS_FAILED(rv))
return GetHRESULT(rv);
*aAccessibleTable = static_cast<IAccessibleTable*>(instancePtr);
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return E_FAIL;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(),
GetExceptionInformation())) {}
return E_NOTIMPL;
}
STDMETHODIMP
@ -492,14 +452,15 @@ __try {
return E_FAIL;
PRInt32 rowIndex = 0;
nsresult rv = tableAcc->GetRowAtIndex(aChildIndex, &rowIndex);
nsresult rv = tableAcc->GetRowIndexAt(aChildIndex, &rowIndex);
if (NS_FAILED(rv))
return GetHRESULT(rv);
*aRowIndex = rowIndex;
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(),
GetExceptionInformation())) {}
return E_FAIL;
}
@ -508,8 +469,10 @@ CAccessibleTable::get_selectedChildren(long aMaxChildren, long **aChildren,
long *aNChildren)
{
__try {
return GetSelectedItems(aMaxChildren, aChildren, aNChildren, ITEMSTYPE_CELLS);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return GetSelectedItems(aChildren, aNChildren, ITEMSTYPE_CELLS);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(),
GetExceptionInformation())) {}
return E_FAIL;
}
@ -518,8 +481,10 @@ CAccessibleTable::get_selectedColumns(long aMaxColumns, long **aColumns,
long *aNColumns)
{
__try {
return GetSelectedItems(aMaxColumns, aColumns, aNColumns, ITEMSTYPE_COLUMNS);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return GetSelectedItems(aColumns, aNColumns, ITEMSTYPE_COLUMNS);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(),
GetExceptionInformation())) {}
return E_FAIL;
}
@ -527,8 +492,10 @@ STDMETHODIMP
CAccessibleTable::get_selectedRows(long aMaxRows, long **aRows, long *aNRows)
{
__try {
return GetSelectedItems(aMaxRows, aRows, aNRows, ITEMSTYPE_ROWS);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
return GetSelectedItems(aRows, aNRows, ITEMSTYPE_ROWS);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(),
GetExceptionInformation())) {}
return E_FAIL;
}
@ -700,12 +667,12 @@ __try {
return E_FAIL;
PRInt32 row = -1;
nsresult rv = tableAcc->GetRowAtIndex(aIndex, &row);
nsresult rv = tableAcc->GetRowIndexAt(aIndex, &row);
if (NS_FAILED(rv))
return GetHRESULT(rv);
PRInt32 column = -1;
rv = tableAcc->GetColumnAtIndex(aIndex, &column);
rv = tableAcc->GetColumnIndexAt(aIndex, &column);
if (NS_FAILED(rv))
return GetHRESULT(rv);
@ -744,11 +711,71 @@ __try {
return E_NOTIMPL;
}
// CAccessibleTable
////////////////////////////////////////////////////////////////////////////////
// IAccessibleTable2
STDMETHODIMP
CAccessibleTable::get_cellAt(long row, long column, IUnknown **cell)
{
return get_accessibleAt(row, column, cell);
}
STDMETHODIMP
CAccessibleTable::get_nSelectedCells(long *cellCount)
{
return get_nSelectedChildren(cellCount);
}
STDMETHODIMP
CAccessibleTable::get_selectedCells(IUnknown ***cells, long *nSelectedCells)
{
__try {
nsCOMPtr<nsIAccessibleTable> tableAcc(do_QueryInterface(this));
NS_ASSERTION(tableAcc, CANT_QUERY_ASSERTION_MSG);
if (!tableAcc)
return E_FAIL;
nsCOMPtr<nsIArray> geckoCells;
nsresult rv = tableAcc->GetSelectedCells(getter_AddRefs(geckoCells));
if (NS_FAILED(rv))
return GetHRESULT(rv);
return nsWinUtils::ConvertToIA2Array(geckoCells, cells, nSelectedCells);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(),
GetExceptionInformation())) {}
return E_FAIL;
}
STDMETHODIMP
CAccessibleTable::get_selectedColumns(long **aColumns, long *aNColumns)
{
__try {
return GetSelectedItems(aColumns, aNColumns, ITEMSTYPE_COLUMNS);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(),
GetExceptionInformation())) {}
return E_FAIL;
}
STDMETHODIMP
CAccessibleTable::get_selectedRows(long **aRows, long *aNRows)
{
__try {
return GetSelectedItems(aRows, aNRows, ITEMSTYPE_ROWS);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(),
GetExceptionInformation())) {}
return E_FAIL;
}
////////////////////////////////////////////////////////////////////////////////
// CAccessibleTable public
HRESULT
CAccessibleTable::GetSelectedItems(long aMaxItems, long **aItems,
long *aItemsCount, eItemsType aType)
CAccessibleTable::GetSelectedItems(long **aItems, long *aItemsCount,
eItemsType aType)
{
*aItemsCount = 0;
@ -763,13 +790,13 @@ CAccessibleTable::GetSelectedItems(long aMaxItems, long **aItems,
nsresult rv = NS_OK;
switch (aType) {
case ITEMSTYPE_CELLS:
rv = tableAcc->GetSelectedCells(&size, &items);
rv = tableAcc->GetSelectedCellIndices(&size, &items);
break;
case ITEMSTYPE_COLUMNS:
rv = tableAcc->GetSelectedColumns(&size, &items);
rv = tableAcc->GetSelectedColumnIndices(&size, &items);
break;
case ITEMSTYPE_ROWS:
rv = tableAcc->GetSelectedRows(&size, &items);
rv = tableAcc->GetSelectedRowIndices(&size, &items);
break;
default:
return E_FAIL;
@ -781,14 +808,12 @@ CAccessibleTable::GetSelectedItems(long aMaxItems, long **aItems,
if (size == 0 || !items)
return S_FALSE;
PRUint32 maxSize = size < static_cast<PRUint32>(aMaxItems) ? size : aMaxItems;
*aItemsCount = maxSize;
*aItems = static_cast<long*>(nsMemory::Alloc((maxSize) * sizeof(long)));
*aItems = static_cast<long*>(nsMemory::Alloc((size) * sizeof(long)));
if (!*aItems)
return E_OUTOFMEMORY;
for (PRUint32 index = 0; index < maxSize; ++index)
*aItemsCount = size;
for (PRUint32 index = 0; index < size; ++index)
(*aItems)[index] = items[index];
nsMemory::Free(items);

Просмотреть файл

@ -44,9 +44,11 @@
#include "nsISupports.h"
#include "AccessibleTable.h"
#include "AccessibleTable2.h"
class CAccessibleTable: public nsISupports,
public IAccessibleTable
public IAccessibleTable,
public IAccessibleTable2
{
public:
@ -170,6 +172,29 @@ public:
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_modelChange(
/* [retval][out] */ IA2TableModelChange *modelChange);
// IAccessibleTable2
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_cellAt(
/* [in] */ long row,
/* [in] */ long column,
/* [out, retval] */ IUnknown **cell);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_nSelectedCells(
/* [out, retval] */ long *cellCount);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_selectedCells(
/* [out, size_is(,*nSelectedCells,)] */ IUnknown ***cells,
/* [out, retval] */ long *nSelectedCells);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_selectedColumns(
/* [out, size_is(,*nColumns)] */ long **selectedColumns,
/* [out, retval] */ long *nColumns);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_selectedRows(
/* [out, size_is(,*nRows)] */ long **selectedRows,
/* [out, retval] */ long *nRows);
private:
enum eItemsType {
ITEMSTYPE_CELLS,
@ -177,9 +202,7 @@ private:
ITEMSTYPE_ROWS
};
HRESULT GetSelectedItems(long aMaxItems, long **aItems, long *aItemsCount,
eItemsType aType);
HRESULT GetSelectedItems(long **aItems, long *aItemsCount, eItemsType aType);
};
#endif

Просмотреть файл

@ -0,0 +1,341 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=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
* Mozilla Corporation.
* 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 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 ***** */
#include "CAccessibleTableCell.h"
#include "Accessible2.h"
#include "AccessibleTable2_i.c"
#include "AccessibleTableCell_i.c"
#include "nsIAccessible.h"
#include "nsIAccessibleTable.h"
#include "nsIWinAccessNode.h"
#include "nsAccessNodeWrap.h"
#include "nsWinUtils.h"
#include "nsCOMPtr.h"
#include "nsString.h"
#define TABLECELL_INTERFACE_UNSUPPORTED_MSG \
"Subclass of CAccessibleTableCell doesn't implement nsIAccessibleTableCell"\
// IUnknown
STDMETHODIMP
CAccessibleTableCell::QueryInterface(REFIID iid, void** ppv)
{
*ppv = NULL;
if (IID_IAccessibleTableCell == iid) {
*ppv = static_cast<IAccessibleTableCell*>(this);
(reinterpret_cast<IUnknown*>(*ppv))->AddRef();
return S_OK;
}
return E_NOINTERFACE;
}
////////////////////////////////////////////////////////////////////////////////
// IAccessibleTableCell
STDMETHODIMP
CAccessibleTableCell::get_table(IUnknown **table)
{
__try {
nsCOMPtr<nsIAccessibleTableCell> tableCell(do_QueryInterface(this));
NS_ASSERTION(tableCell, TABLECELL_INTERFACE_UNSUPPORTED_MSG);
if (!tableCell)
return E_FAIL;
nsCOMPtr<nsIAccessibleTable> geckoTable;
nsresult rv = tableCell->GetTable(getter_AddRefs(geckoTable));
if (NS_FAILED(rv))
return GetHRESULT(rv);
nsCOMPtr<nsIWinAccessNode> winAccessNode = do_QueryInterface(geckoTable);
if (!winAccessNode)
return E_FAIL;
void *instancePtr = NULL;
rv = winAccessNode->QueryNativeInterface(IID_IUnknown, &instancePtr);
if (NS_FAILED(rv))
return GetHRESULT(rv);
*table = static_cast<IUnknown*>(instancePtr);
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(),
GetExceptionInformation())) {}
return E_FAIL;
}
STDMETHODIMP
CAccessibleTableCell::get_columnExtent(long *nColumnsSpanned)
{
__try {
*nColumnsSpanned = 0;
nsCOMPtr<nsIAccessibleTableCell> tableCell(do_QueryInterface(this));
NS_ASSERTION(tableCell, TABLECELL_INTERFACE_UNSUPPORTED_MSG);
if (!tableCell)
return E_FAIL;
PRInt32 columnsSpanned = 0;
nsresult rv = tableCell->GetColumnExtent(&columnsSpanned);
if (NS_SUCCEEDED(rv)) {
*nColumnsSpanned = columnsSpanned;
return S_OK;
}
return GetHRESULT(rv);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(),
GetExceptionInformation())) {}
return E_FAIL;
}
STDMETHODIMP
CAccessibleTableCell::get_columnHeaderCells(IUnknown ***cellAccessibles,
long *nColumnHeaderCells)
{
__try {
nsCOMPtr<nsIAccessibleTableCell> tableCell(do_QueryInterface(this));
NS_ASSERTION(tableCell, TABLECELL_INTERFACE_UNSUPPORTED_MSG);
if (!tableCell)
return E_FAIL;
nsCOMPtr<nsIArray> headerCells;
nsresult rv = tableCell->GetColumnHeaderCells(getter_AddRefs(headerCells));
if (NS_FAILED(rv))
return GetHRESULT(rv);
return nsWinUtils::ConvertToIA2Array(headerCells, cellAccessibles,
nColumnHeaderCells);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(),
GetExceptionInformation())) {}
return E_FAIL;
}
STDMETHODIMP
CAccessibleTableCell::get_columnIndex(long *columnIndex)
{
__try {
*columnIndex = -1;
nsCOMPtr<nsIAccessibleTableCell> tableCell(do_QueryInterface(this));
NS_ASSERTION(tableCell, TABLECELL_INTERFACE_UNSUPPORTED_MSG);
if (!tableCell)
return E_FAIL;
PRInt32 colIdx = -1;
nsresult rv = tableCell->GetColumnIndex(&colIdx);
if (NS_SUCCEEDED(rv)) {
*columnIndex = colIdx;
return S_OK;
}
return GetHRESULT(rv);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(),
GetExceptionInformation())) {}
return E_FAIL;
}
STDMETHODIMP
CAccessibleTableCell::get_rowExtent(long *nRowsSpanned)
{
__try {
*nRowsSpanned = 0;
nsCOMPtr<nsIAccessibleTableCell> tableCell(do_QueryInterface(this));
NS_ASSERTION(tableCell, TABLECELL_INTERFACE_UNSUPPORTED_MSG);
if (!tableCell)
return E_FAIL;
PRInt32 rowsSpanned = 0;
nsresult rv = tableCell->GetRowExtent(&rowsSpanned);
if (NS_SUCCEEDED(rv)) {
*nRowsSpanned = rowsSpanned;
return S_OK;
}
return GetHRESULT(rv);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(),
GetExceptionInformation())) {}
return E_FAIL;
}
STDMETHODIMP
CAccessibleTableCell::get_rowHeaderCells(IUnknown ***cellAccessibles,
long *nRowHeaderCells)
{
__try {
nsCOMPtr<nsIAccessibleTableCell> tableCell(do_QueryInterface(this));
NS_ASSERTION(tableCell, TABLECELL_INTERFACE_UNSUPPORTED_MSG);
if (!tableCell)
return E_FAIL;
nsCOMPtr<nsIArray> headerCells;
nsresult rv = tableCell->GetRowHeaderCells(getter_AddRefs(headerCells));
if (NS_FAILED(rv))
return GetHRESULT(rv);
return nsWinUtils::ConvertToIA2Array(headerCells, cellAccessibles,
nRowHeaderCells);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(),
GetExceptionInformation())) {}
return E_FAIL;
}
STDMETHODIMP
CAccessibleTableCell::get_rowIndex(long *rowIndex)
{
__try {
*rowIndex = -1;
nsCOMPtr<nsIAccessibleTableCell> tableCell(do_QueryInterface(this));
NS_ASSERTION(tableCell, TABLECELL_INTERFACE_UNSUPPORTED_MSG);
if (!tableCell)
return E_FAIL;
PRInt32 rowIdx = -1;
nsresult rv = tableCell->GetRowIndex(&rowIdx);
if (NS_SUCCEEDED(rv)) {
*rowIndex = rowIdx;
return S_OK;
}
return GetHRESULT(rv);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(),
GetExceptionInformation())) {}
return E_FAIL;
}
STDMETHODIMP
CAccessibleTableCell::get_rowColumnExtents(long *row, long *column,
long *rowExtents,
long *columnExtents,
boolean *isSelected)
{
__try {
*row = 0;
*column = 0;
*rowExtents = 0;
*columnExtents = 0;
*isSelected = false;
nsCOMPtr<nsIAccessibleTableCell> tableCell(do_QueryInterface(this));
NS_ASSERTION(tableCell, TABLECELL_INTERFACE_UNSUPPORTED_MSG);
if (!tableCell)
return E_FAIL;
PRInt32 rowIdx = -1;
nsresult rv = tableCell->GetRowIndex(&rowIdx);
if (NS_FAILED(rv))
return GetHRESULT(rv);
PRInt32 columnIdx = -1;
rv = tableCell->GetColumnIndex(&columnIdx);
if (NS_FAILED(rv))
return GetHRESULT(rv);
PRInt32 spannedRows = 0;
rv = tableCell->GetRowExtent(&spannedRows);
if (NS_FAILED(rv))
return GetHRESULT(rv);
PRInt32 spannedColumns = 0;
rv = tableCell->GetColumnExtent(&spannedColumns);
if (NS_FAILED(rv))
return GetHRESULT(rv);
PRBool isSel = PR_FALSE;
rv = tableCell->IsSelected(&isSel);
if (NS_FAILED(rv))
return GetHRESULT(rv);
*row = rowIdx;
*column = columnIdx;
*rowExtents = spannedRows;
*columnExtents = spannedColumns;
*isSelected = isSel;
return S_OK;
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(),
GetExceptionInformation())) {}
return E_FAIL;
}
STDMETHODIMP
CAccessibleTableCell::get_isSelected(boolean *isSelected)
{
__try {
*isSelected = false;
nsCOMPtr<nsIAccessibleTableCell> tableCell(do_QueryInterface(this));
NS_ASSERTION(tableCell, TABLECELL_INTERFACE_UNSUPPORTED_MSG);
if (!tableCell)
return E_FAIL;
PRBool isSel = PR_FALSE;
nsresult rv = tableCell->IsSelected(&isSel);
if (NS_SUCCEEDED(rv)) {
*isSelected = isSel;
return S_OK;
}
return GetHRESULT(rv);
} __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(),
GetExceptionInformation())) {}
return E_FAIL;
}

Просмотреть файл

@ -0,0 +1,92 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=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
* Mozilla Corporation.
* 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 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 ***** */
#ifndef _ACCESSIBLE_TABLECELL_H
#define _ACCESSIBLE_TABLECELL_H
#include "nsISupports.h"
#include "AccessibleTableCell.h"
class CAccessibleTableCell: public nsISupports,
public IAccessibleTableCell
{
public:
// IUnknown
STDMETHODIMP QueryInterface(REFIID, void**);
// IAccessibleTableCell
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_table(
/* [out, retval] */ IUnknown **table);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_columnExtent(
/* [out, retval] */ long *nColumnsSpanned);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_columnHeaderCells(
/* [out, size_is(,*nColumnHeaderCells,)] */ IUnknown ***cellAccessibles,
/* [out, retval] */ long *nColumnHeaderCells);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_columnIndex(
/* [out, retval] */ long *columnIndex);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_rowExtent(
/* [out, retval] */ long *nRowsSpanned);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_rowHeaderCells(
/* [out, size_is(,*nRowHeaderCells,)] */ IUnknown ***cellAccessibles,
/* [out, retval] */ long *nRowHeaderCells);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_rowIndex(
/* [out, retval] */ long *rowIndex);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_rowColumnExtents(
/* [out] */ long *row,
/* [out] */ long *column,
/* [out] */ long *rowExtents,
/* [out] */ long *columnExtents,
/* [out, retval] */ boolean *isSelected);
virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_isSelected(
/* [out, retval] */ boolean *isSelected);
};
#endif

Просмотреть файл

@ -55,12 +55,14 @@ CPPSRCS = \
nsHTMLWin32ObjectAccessible.cpp \
nsARIAGridAccessibleWrap.cpp \
nsXULMenuAccessibleWrap.cpp \
nsXULTreeAccessibleWrap.cpp \
nsXULListboxAccessibleWrap.cpp \
nsXULTreeGridAccessibleWrap.cpp \
nsHyperTextAccessibleWrap.cpp \
nsHTMLImageAccessibleWrap.cpp \
nsHTMLTableAccessibleWrap.cpp \
nsAccessibleRelationWrap.cpp \
nsApplicationAccessibleWrap.cpp \
nsWinUtils.cpp \
CAccessibleAction.cpp \
CAccessibleImage.cpp \
CAccessibleComponent.cpp \
@ -69,6 +71,7 @@ CPPSRCS = \
CAccessibleHyperlink.cpp \
CAccessibleHypertext.cpp \
CAccessibleTable.cpp \
CAccessibleTableCell.cpp \
CAccessibleValue.cpp \
$(NULL)
@ -81,7 +84,8 @@ EXPORTS = \
nsHTMLWin32ObjectAccessible.h \
nsARIAGridAccessibleWrap.h \
nsXULMenuAccessibleWrap.h \
nsXULTreeAccessibleWrap.h \
nsXULListboxAccessibleWrap.h \
nsXULTreeGridAccessibleWrap.h \
nsHyperTextAccessibleWrap.h \
nsHTMLImageAccessibleWrap.h \
nsHTMLTableAccessibleWrap.h \
@ -95,6 +99,7 @@ EXPORTS = \
CAccessibleHyperlink.h \
CAccessibleHypertext.h \
CAccessibleTable.h \
CAccessibleTableCell.h \
CAccessibleValue.h \
$(NULL)

Просмотреть файл

@ -40,9 +40,25 @@
#include "nsARIAGridAccessibleWrap.h"
////////////////////////////////////////////////////////////////////////////////
// nsARIAGridAccessibleWrap
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS_INHERITED0(nsARIAGridAccessibleWrap,
nsARIAGridAccessible)
IMPL_IUNKNOWN_INHERITED1(nsARIAGridAccessibleWrap,
nsAccessibleWrap,
CAccessibleTable);
CAccessibleTable)
////////////////////////////////////////////////////////////////////////////////
// nsARIAGridCellAccessibleWrap
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS_INHERITED0(nsARIAGridCellAccessibleWrap,
nsARIAGridCellAccessible)
IMPL_IUNKNOWN_INHERITED1(nsARIAGridCellAccessibleWrap,
nsHyperTextAccessibleWrap,
CAccessibleTableCell)

Просмотреть файл

@ -43,10 +43,11 @@
#include "nsARIAGridAccessible.h"
#include "CAccessibleTable.h"
#include "CAccessibleTableCell.h"
/**
* Accessible for ARIA grid and treegrid implementing IAccessibleTable
* interface.
* IA2 wrapper class for nsARIAGridAccessible implementing IAccessibleTable and
* IAccessibleTable2 interfaces.
*/
class nsARIAGridAccessibleWrap : public nsARIAGridAccessible,
public CAccessibleTable
@ -62,4 +63,22 @@ public:
NS_DECL_ISUPPORTS_INHERITED
};
/**
* IA2 wrapper class for nsARIAGridCellAccessible implementing
* IAccessibleTableCell interface.
*/
class nsARIAGridCellAccessibleWrap : public nsARIAGridCellAccessible,
public CAccessibleTableCell
{
public:
nsARIAGridCellAccessibleWrap(nsIDOMNode* aNode, nsIWeakReference* aShell) :
nsARIAGridCellAccessible(aNode, aShell) {}
// IUnknown
DECL_IUNKNOWN_INHERITED
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
};
#endif

Просмотреть файл

@ -70,6 +70,13 @@ Class::QueryInterface(REFIID iid, void** ppv) \
if (SUCCEEDED(hr)) \
return hr; \
#define IMPL_IUNKNOWN_QUERY_ENTRY_COND(Class, Cond) \
if (Cond) { \
hr = Class::QueryInterface(iid, ppv); \
if (SUCCEEDED(hr)) \
return hr; \
} \
#define IMPL_IUNKNOWN_INHERITED0(Class, Super) \
IMPL_IUNKNOWN_QUERY_HEAD(Class) \
IMPL_IUNKNOWN_QUERY_ENTRY(Super) \

Просмотреть файл

@ -40,17 +40,37 @@
#include "nsHTMLTableAccessibleWrap.h"
////////////////////////////////////////////////////////////////////////////////
// nsHTMLTableAccessibleWrap
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLTableAccessibleWrap,
nsHTMLTableAccessible)
IMPL_IUNKNOWN_INHERITED1(nsHTMLTableAccessibleWrap,
nsAccessibleWrap,
CAccessibleTable);
CAccessibleTable)
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLTableHeadAccessibleWrap,
nsHTMLTableHeadAccessible)
IMPL_IUNKNOWN_INHERITED1(nsHTMLTableHeadAccessibleWrap,
nsAccessibleWrap,
CAccessibleTable);
////////////////////////////////////////////////////////////////////////////////
// nsHTMLTableCellAccessibleWrap
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLTableCellAccessibleWrap,
nsHTMLTableCellAccessible)
IMPL_IUNKNOWN_INHERITED1(nsHTMLTableCellAccessibleWrap,
nsHyperTextAccessibleWrap,
CAccessibleTableCell)
////////////////////////////////////////////////////////////////////////////////
// nsHTMLTableCellAccessibleWrap
////////////////////////////////////////////////////////////////////////////////
NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLTableHeaderCellAccessibleWrap,
nsHTMLTableHeaderCellAccessible)
IMPL_IUNKNOWN_INHERITED1(nsHTMLTableHeaderCellAccessibleWrap,
nsHyperTextAccessibleWrap,
CAccessibleTableCell)

Просмотреть файл

@ -42,8 +42,14 @@
#define _NSHTMLTABLEACCESSIBLEWRAP_H
#include "nsHTMLTableAccessible.h"
#include "CAccessibleTable.h"
#include "CAccessibleTable.h"
#include "CAccessibleTableCell.h"
/**
* IA2 wrapper class for nsHTMLTableAccessible implementing IAccessibleTable
* and IAccessibleTable2 interfaces.
*/
class nsHTMLTableAccessibleWrap : public nsHTMLTableAccessible,
public CAccessibleTable
{
@ -58,12 +64,37 @@ public:
NS_DECL_ISUPPORTS_INHERITED
};
class nsHTMLTableHeadAccessibleWrap : public nsHTMLTableHeadAccessible,
public CAccessibleTable
/**
* IA2 wrapper class for nsHTMLTableCellAccessible implementing
* IAccessibleTableCell interface.
*/
class nsHTMLTableCellAccessibleWrap : public nsHTMLTableCellAccessible,
public CAccessibleTableCell
{
public:
nsHTMLTableHeadAccessibleWrap(nsIDOMNode* aNode, nsIWeakReference* aShell) :
nsHTMLTableHeadAccessible(aNode, aShell){}
nsHTMLTableCellAccessibleWrap(nsIDOMNode* aNode, nsIWeakReference* aShell) :
nsHTMLTableCellAccessible(aNode, aShell) {}
// IUnknown
DECL_IUNKNOWN_INHERITED
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
};
/**
* IA2 wrapper class for nsHTMLTableHeaderCellAccessible implementing
* IAccessibleTableCell interface.
*/
class nsHTMLTableHeaderCellAccessibleWrap : public nsHTMLTableHeaderCellAccessible,
public CAccessibleTableCell
{
public:
nsHTMLTableHeaderCellAccessibleWrap(nsIDOMNode* aNode,
nsIWeakReference* aShell) :
nsHTMLTableHeaderCellAccessible(aNode, aShell) {}
// IUnknown
DECL_IUNKNOWN_INHERITED

Просмотреть файл

@ -0,0 +1,92 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=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
* Mozilla Corporation.
* 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 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 ***** */
#include "nsWinUtils.h"
#include "nsAccessibleWrap.h"
#include "nsIWinAccessNode.h"
#include "nsArrayUtils.h"
HRESULT
nsWinUtils::ConvertToIA2Array(nsIArray *aGeckoArray, IUnknown ***aIA2Array,
long *aIA2ArrayLen)
{
*aIA2Array = NULL;
*aIA2ArrayLen = 0;
PRUint32 length = 0;
nsresult rv = aGeckoArray->GetLength(&length);
if (NS_FAILED(rv))
return GetHRESULT(rv);
*aIA2Array =
static_cast<IUnknown**>(nsMemory::Alloc((length) * sizeof(IUnknown*)));
if (!*aIA2Array)
return E_OUTOFMEMORY;
PRUint32 idx = 0;
for (; idx < length; ++idx) {
nsCOMPtr<nsIWinAccessNode> winAccessNode =
do_QueryElementAt(aGeckoArray, idx, &rv);
if (NS_FAILED(rv))
break;
void *instancePtr = NULL;
nsresult rv = winAccessNode->QueryNativeInterface(IID_IUnknown,
&instancePtr);
if (NS_FAILED(rv))
break;
(*aIA2Array)[idx] = static_cast<IUnknown*>(instancePtr);
}
if (NS_FAILED(rv)) {
for (PRUint32 idx2 = 0; idx2 < idx; idx2++) {
(*aIA2Array)[idx2]->Release();
(*aIA2Array)[idx2] = NULL;
}
nsMemory::Free(*aIA2Array);
return GetHRESULT(rv);
}
*aIA2ArrayLen = length;
return S_OK;
}

Просмотреть файл

@ -0,0 +1,60 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim:expandtab:shiftwidth=2:tabstop=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
* Mozilla Corporation.
* 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 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 ***** */
#ifndef nsWinUtils_h_
#define nsWinUtils_h_
#include "Accessible2.h"
#include "nsIArray.h"
class nsWinUtils
{
public:
/**
* Convert nsIArray array of accessible objects to an array of IUnknown*
* objects used in IA2 methods.
*/
static HRESULT ConvertToIA2Array(nsIArray *aCollection,
IUnknown ***aAccessibles, long *aCount);
};
#endif

Просмотреть файл

@ -0,0 +1,75 @@
/* -*- 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
* Mozilla Corporation.
* 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 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 ***** */
#include "nsXULListboxAccessibleWrap.h"
////////////////////////////////////////////////////////////////////////////////
// nsXULListboxAccessibleWrap
////////////////////////////////////////////////////////////////////////////////
nsXULListboxAccessibleWrap::
nsXULListboxAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell) :
nsXULListboxAccessible(aDOMNode, aShell)
{
}
NS_IMPL_ISUPPORTS_INHERITED0(nsXULListboxAccessibleWrap,
nsXULListboxAccessible)
IMPL_IUNKNOWN_QUERY_HEAD(nsXULListboxAccessibleWrap)
IMPL_IUNKNOWN_QUERY_ENTRY_COND(CAccessibleTable, IsMulticolumn());
IMPL_IUNKNOWN_QUERY_ENTRY(nsAccessibleWrap)
IMPL_IUNKNOWN_QUERY_TAIL
////////////////////////////////////////////////////////////////////////////////
// nsXULListCellAccessibleWrap
////////////////////////////////////////////////////////////////////////////////
nsXULListCellAccessibleWrap::
nsXULListCellAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell) :
nsXULListCellAccessible(aDOMNode, aShell)
{
}
NS_IMPL_ISUPPORTS_INHERITED0(nsXULListCellAccessibleWrap,
nsXULListCellAccessible)
IMPL_IUNKNOWN_INHERITED1(nsXULListCellAccessibleWrap,
nsHyperTextAccessibleWrap,
CAccessibleTableCell)

Просмотреть файл

@ -0,0 +1,81 @@
/* -*- 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
* Mozilla Corporation.
* 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 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 ***** */
#ifndef __nsXULListboxAccessibleWrap_h__
#define __nsXULListboxAccessibleWrap_h__
#include "nsXULListboxAccessible.h"
#include "CAccessibleTable.h"
#include "CAccessibleTableCell.h"
/**
* IA2 wrapper class for nsXULListboxAccessible class implementing
* IAccessibleTable and IAccessibleTable2 interfaces.
*/
class nsXULListboxAccessibleWrap : public nsXULListboxAccessible,
public CAccessibleTable
{
public:
nsXULListboxAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell);
// IUnknown
DECL_IUNKNOWN_INHERITED
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
};
/**
* IA2 wrapper class for nsXULListCellAccessible class, implements
* IAccessibleTableCell interface.
*/
class nsXULListCellAccessibleWrap : public nsXULListCellAccessible,
public CAccessibleTableCell
{
public:
nsXULListCellAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell);
// IUnknown
DECL_IUNKNOWN_INHERITED
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
};
#endif

Просмотреть файл

@ -37,7 +37,7 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsXULTreeAccessibleWrap.h"
#include "nsXULTreeGridAccessibleWrap.h"
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeGridAccessibleWrap
@ -54,4 +54,28 @@ NS_IMPL_ISUPPORTS_INHERITED0(nsXULTreeGridAccessibleWrap,
IMPL_IUNKNOWN_INHERITED1(nsXULTreeGridAccessibleWrap,
nsAccessibleWrap,
CAccessibleTable);
CAccessibleTable)
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeGridCellAccessibleWrap
////////////////////////////////////////////////////////////////////////////////
nsXULTreeGridCellAccessibleWrap::
nsXULTreeGridCellAccessibleWrap(nsIDOMNode *aDOMNode,
nsIWeakReference *aShell,
nsXULTreeGridRowAccessible *aRowAcc,
nsITreeBoxObject *aTree,
nsITreeView *aTreeView,
PRInt32 aRow, nsITreeColumn* aColumn) :
nsXULTreeGridCellAccessible(aDOMNode, aShell, aRowAcc, aTree, aTreeView,
aRow, aColumn)
{
}
NS_IMPL_ISUPPORTS_INHERITED0(nsXULTreeGridCellAccessibleWrap,
nsXULTreeGridCellAccessible)
IMPL_IUNKNOWN_INHERITED1(nsXULTreeGridCellAccessibleWrap,
nsAccessibleWrap,
CAccessibleTableCell)

Просмотреть файл

@ -37,25 +37,45 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef __nsXULTreeAccessibleWrap_h__
#define __nsXULTreeAccessibleWrap_h__
#ifndef __nsXULTreeGridAccessibleWrap_h__
#define __nsXULTreeGridAccessibleWrap_h__
#include "nsXULTreeGridAccessible.h"
#include "CAccessibleTable.h"
typedef class nsXULTreeColumnsAccessible nsXULTreeColumnsAccessibleWrap;
#include "CAccessibleTableCell.h"
/**
* IA2 wrapper of nsXULTreeGridAccessible class, implements IAccessibleTable
* interface.
* IA2 wrapper class for nsXULTreeGridAccessible class implementing
* IAccessibleTable and IAccessibleTable2 interfaces.
*/
class nsXULTreeGridAccessibleWrap : public nsXULTreeGridAccessible,
public CAccessibleTable
{
public:
nsXULTreeGridAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell);
virtual ~nsXULTreeGridAccessibleWrap() {}
// IUnknown
DECL_IUNKNOWN_INHERITED
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
};
/**
* IA2 wrapper class for nsXULTreeGridCellAccessible class, implements
* IAccessibleTableCell interface.
*/
class nsXULTreeGridCellAccessibleWrap : public nsXULTreeGridCellAccessible,
public CAccessibleTableCell
{
public:
nsXULTreeGridCellAccessibleWrap(nsIDOMNode *aDOMNode,
nsIWeakReference *aShell,
nsXULTreeGridRowAccessible *aRowAcc,
nsITreeBoxObject *aTree,
nsITreeView *aTreeView,
PRInt32 aRow, nsITreeColumn* aColumn);
// IUnknown
DECL_IUNKNOWN_INHERITED

Просмотреть файл

@ -60,7 +60,8 @@ EXPORTS = \
nsDocAccessibleWrap.h \
nsRootAccessibleWrap.h \
nsXULMenuAccessibleWrap.h \
nsXULTreeAccessibleWrap.h \
nsXULListboxAccessibleWrap.h \
nsXULTreeGridAccessibleWrap.h \
nsHyperTextAccessibleWrap.h \
nsHTMLImageAccessibleWrap.h \
nsHTMLTableAccessibleWrap.h \

Просмотреть файл

@ -44,6 +44,7 @@
#include "nsARIAGridAccessible.h"
typedef class nsARIAGridAccessible nsARIAGridAccessibleWrap;
typedef class nsARIAGridCellAccessible nsARIAGridCellAccessibleWrap;
#endif

Просмотреть файл

@ -44,8 +44,8 @@
#include "nsHTMLTableAccessible.h"
typedef class nsHTMLTableAccessible nsHTMLTableAccessibleWrap;
typedef class nsHTMLTableHeadAccessible nsHTMLTableHeadAccessibleWrap;
typedef class nsHTMLTableCellAccessible nsHTMLTableCellAccessibleWrap;
typedef class nsHTMLTableHeaderCellAccessible nsHTMLTableCellHeaderAccessibleWrap;
#endif

Просмотреть файл

@ -0,0 +1,47 @@
/* -*- 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
* Mozilla Corporation.
* 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 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 ***** */
#ifndef __nsXULListboxAccessibleWrap_h__
#define __nsXULListboxAccessibleWrap_h__
#include "nsXULListboxAccessible.h"
typedef class nsXULListboxAccessible nsXULListboxAccessibleWrap;
typedef class nsXULListCellAccessible nsXULListCellAccessibleWrap;
#endif

Просмотреть файл

@ -35,11 +35,12 @@
*
* ***** END LICENSE BLOCK ***** */
#ifndef __nsXULTreeAccessibleWrap_h__
#define __nsXULTreeAccessibleWrap_h__
#ifndef __nsXULTreeGridAccessibleWrap_h__
#define __nsXULTreeGridAccessibleWrap_h__
#include "nsXULTreeGridAccessible.h"
typedef class nsXULTreeGridAccessible nsXULTreeGridAccessibleWrap;
typedef class nsXULTreeColumnsAccessible nsXULTreeColumnsAccessibleWrap;
typedef class nsXULTreeGridAccessible nsXULTreeGridAccessibleWrap;
typedef class nsXULTreeGridCellAccessible nsXULTreeGridCellAccessibleWrap;
#endif

Просмотреть файл

@ -52,9 +52,10 @@ LIBXUL_LIBRARY = 1
CPPSRCS = \
nsXULAlertAccessible.cpp \
nsXULColorPickerAccessible.cpp \
nsXULComboboxAccessible.cpp \
nsXULFormControlAccessible.cpp \
nsXULListboxAccessible.cpp \
nsXULMenuAccessible.cpp \
nsXULSelectAccessible.cpp \
nsXULSliderAccessible.cpp \
nsXULTabAccessible.cpp \
nsXULTextAccessible.cpp \

Просмотреть файл

@ -0,0 +1,237 @@
/* -*- Mode: C++; tab-width: 4; 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
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aaron Leventhal <aaronl@netscape.com> (original author)
* Kyle Yuan <kyle.yuan@sun.com>
* Alexander Surkov <surkov.alexander@gmail.com>
*
* 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 ***** */
#include "nsXULComboboxAccessible.h"
#include "nsIDOMXULMenuListElement.h"
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsServiceManagerUtils.h"
////////////////////////////////////////////////////////////////////////////////
// nsXULComboboxAccessible
////////////////////////////////////////////////////////////////////////////////
nsXULComboboxAccessible::
nsXULComboboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell) :
nsAccessibleWrap(aDOMNode, aShell)
{
}
nsresult
nsXULComboboxAccessible::Init()
{
nsresult rv = nsAccessibleWrap::Init();
nsXULMenupopupAccessible::GenerateMenu(mDOMNode);
return rv;
}
nsresult
nsXULComboboxAccessible::GetRoleInternal(PRUint32 *aRole)
{
nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode);
if (!content) {
return NS_ERROR_FAILURE;
}
if (content->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
NS_LITERAL_STRING("autocomplete"), eIgnoreCase)) {
*aRole = nsIAccessibleRole::ROLE_AUTOCOMPLETE;
} else {
*aRole = nsIAccessibleRole::ROLE_COMBOBOX;
}
return NS_OK;
}
nsresult
nsXULComboboxAccessible::GetStateInternal(PRUint32 *aState,
PRUint32 *aExtraState)
{
// As a nsComboboxAccessible we can have the following states:
// STATE_FOCUSED
// STATE_FOCUSABLE
// STATE_HASPOPUP
// STATE_EXPANDED
// STATE_COLLAPSED
// Get focus status from base class
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_A11Y_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMXULMenuListElement> menuList(do_QueryInterface(mDOMNode));
if (menuList) {
PRBool isOpen;
menuList->GetOpen(&isOpen);
if (isOpen) {
*aState |= nsIAccessibleStates::STATE_EXPANDED;
}
else {
*aState |= nsIAccessibleStates::STATE_COLLAPSED;
}
}
*aState |= nsIAccessibleStates::STATE_HASPOPUP |
nsIAccessibleStates::STATE_FOCUSABLE;
return NS_OK;
}
NS_IMETHODIMP
nsXULComboboxAccessible::GetValue(nsAString& aValue)
{
aValue.Truncate();
if (IsDefunct())
return NS_ERROR_FAILURE;
// The value is the option or text shown entered in the combobox.
nsCOMPtr<nsIDOMXULMenuListElement> menuList(do_QueryInterface(mDOMNode));
if (menuList)
return menuList->GetLabel(aValue);
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsXULComboboxAccessible::GetDescription(nsAString& aDescription)
{
aDescription.Truncate();
if (IsDefunct())
return NS_ERROR_FAILURE;
// Use description of currently focused option
nsCOMPtr<nsIDOMXULMenuListElement> menuListElm(do_QueryInterface(mDOMNode));
if (!menuListElm)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMXULSelectControlItemElement> focusedOptionItem;
menuListElm->GetSelectedItem(getter_AddRefs(focusedOptionItem));
nsCOMPtr<nsIDOMNode> focusedOptionNode(do_QueryInterface(focusedOptionItem));
if (focusedOptionNode) {
nsCOMPtr<nsIAccessible> focusedOption;
GetAccService()->GetAccessibleInWeakShell(focusedOptionNode, mWeakShell,
getter_AddRefs(focusedOption));
NS_ENSURE_TRUE(focusedOption, NS_ERROR_FAILURE);
return focusedOption->GetDescription(aDescription);
}
return NS_OK;
}
PRBool
nsXULComboboxAccessible::GetAllowsAnonChildAccessibles()
{
nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode);
NS_ASSERTION(content, "No content during accessible tree building!");
if (!content)
return PR_FALSE;
if (content->NodeInfo()->Equals(nsAccessibilityAtoms::textbox, kNameSpaceID_XUL) ||
content->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::editable,
nsAccessibilityAtoms::_true, eIgnoreCase)) {
// Both the XUL <textbox type="autocomplete"> and <menulist editable="true"> widgets
// use nsXULComboboxAccessible. We need to walk the anonymous children for these
// so that the entry field is a child
return PR_TRUE;
}
// Argument of PR_FALSE indicates we don't walk anonymous children for
// menuitems
return PR_FALSE;
}
NS_IMETHODIMP
nsXULComboboxAccessible::GetNumActions(PRUint8 *aNumActions)
{
NS_ENSURE_ARG_POINTER(aNumActions);
// Just one action (click).
*aNumActions = 1;
return NS_OK;
}
NS_IMETHODIMP
nsXULComboboxAccessible::DoAction(PRUint8 aIndex)
{
if (aIndex != nsXULComboboxAccessible::eAction_Click) {
return NS_ERROR_INVALID_ARG;
}
if (IsDefunct())
return NS_ERROR_FAILURE;
// Programmaticaly toggle the combo box.
nsCOMPtr<nsIDOMXULMenuListElement> menuList(do_QueryInterface(mDOMNode));
if (!menuList) {
return NS_ERROR_FAILURE;
}
PRBool isDroppedDown;
menuList->GetOpen(&isDroppedDown);
return menuList->SetOpen(!isDroppedDown);
}
NS_IMETHODIMP
nsXULComboboxAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
{
if (aIndex != nsXULComboboxAccessible::eAction_Click) {
return NS_ERROR_INVALID_ARG;
}
if (IsDefunct())
return NS_ERROR_FAILURE;
// Our action name is the reverse of our state:
// if we are close -> open is our name.
// if we are open -> close is our name.
// Uses the frame to get the state, updated on every click.
nsCOMPtr<nsIDOMXULMenuListElement> menuList(do_QueryInterface(mDOMNode));
if (!menuList) {
return NS_ERROR_FAILURE;
}
PRBool isDroppedDown;
menuList->GetOpen(&isDroppedDown);
if (isDroppedDown)
aName.AssignLiteral("close");
else
aName.AssignLiteral("open");
return NS_OK;
}

Просмотреть файл

@ -0,0 +1,72 @@
/* -*- Mode: C++; tab-width: 4; 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
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 2009
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Aaron Leventhal <aaronl@netscape.com> (original author)
* Alexander Surkov <surkov.alexander@gmail.com>
*
* 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 ***** */
#ifndef __nsXULComboboxAccessible_h__
#define __nsXULComboboxAccessible_h__
#include "nsCOMPtr.h"
#include "nsXULMenuAccessible.h"
/**
* Used for XUL comboboxes like xul:menulist and autocomplete textbox.
*/
class nsXULComboboxAccessible : public nsAccessibleWrap
{
public:
enum { eAction_Click = 0 };
nsXULComboboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
// nsIAccessible
NS_IMETHOD GetValue(nsAString& aValue);
NS_IMETHOD GetDescription(nsAString& aDescription);
NS_IMETHOD DoAction(PRUint8 aIndex);
NS_IMETHOD GetNumActions(PRUint8 *aNumActions);
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
// nsAccessNode
virtual nsresult Init();
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual PRBool GetAllowsAnonChildAccessibles();
};
#endif

Просмотреть файл

@ -43,7 +43,7 @@
// NOTE: alphabetically ordered
#include "nsAccessibleWrap.h"
#include "nsFormControlAccessible.h"
#include "nsXULSelectAccessible.h"
#include "nsXULMenuAccessible.h"
#include "nsHyperTextAccessibleWrap.h"
class nsXULButtonAccessible : public nsAccessibleWrap

Просмотреть файл

@ -20,8 +20,9 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Original Author: Eric Vaughan (evaughan@netscape.com)
* Kyle Yuan (kyle.yuan@sun.com)
* Aaron Leventhal <aaronl@netscape.com> (original author)
* Kyle Yuan <kyle.yuan@sun.com>
* Alexander Surkov <surkov.alexander@gmail.com>
*
* 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"),
@ -37,20 +38,16 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsXULSelectAccessible.h"
#include "nsAccessibilityService.h"
#include "nsIContent.h"
#include "nsIDOMXULMenuListElement.h"
#include "nsXULListboxAccessible.h"
#include "nsIDOMXULPopupElement.h"
#include "nsIDOMXULMultSelectCntrlEl.h"
#include "nsIDOMXULSelectCntrlItemEl.h"
#include "nsIDOMXULTextboxElement.h"
#include "nsIPresShell.h"
#include "nsIServiceManager.h"
#include "nsCaseTreatment.h"
#include "nsServiceManagerUtils.h"
////////////////////////////////////////////////////////////////////////////////
// nsXULColumnsAccessible
////////////////////////////////////////////////////////////////////////////////
nsXULColumnsAccessible::
nsXULColumnsAccessible(nsIDOMNode *aDOMNode, nsIWeakReference *aShell) :
@ -87,8 +84,10 @@ nsXULColumnsAccessible::GetStateInternal(PRUint32 *aState,
return NS_OK;
}
////////////////////////////////////////////////////////////////////////////////
// nsXULColumnItemAccessible
////////////////////////////////////////////////////////////////////////////////
nsXULColumnItemAccessible::
nsXULColumnItemAccessible(nsIDOMNode *aDOMNode, nsIWeakReference *aShell) :
@ -153,6 +152,7 @@ nsXULColumnItemAccessible::DoAction(PRUint8 aIndex)
////////////////////////////////////////////////////////////////////////////////
// nsXULListboxAccessible
////////////////////////////////////////////////////////////////////////////////
nsXULListboxAccessible::
nsXULListboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell) :
@ -170,7 +170,7 @@ nsXULListboxAccessible::QueryInterface(REFNSIID aIID, void** aInstancePtr)
if (*aInstancePtr)
return rv;
if (aIID.Equals(NS_GET_IID(nsIAccessibleTable)) && IsTree()) {
if (aIID.Equals(NS_GET_IID(nsIAccessibleTable)) && IsMulticolumn()) {
*aInstancePtr = static_cast<nsIAccessibleTable*>(this);
NS_ADDREF_THIS();
return NS_OK;
@ -180,13 +180,13 @@ nsXULListboxAccessible::QueryInterface(REFNSIID aIID, void** aInstancePtr)
}
PRBool
nsXULListboxAccessible::IsTree()
nsXULListboxAccessible::IsMulticolumn()
{
PRInt32 numColumns = 0;
nsresult rv = GetColumns(&numColumns);
nsresult rv = GetColumnCount(&numColumns);
if (NS_FAILED(rv))
return PR_FALSE;
return numColumns > 1;
}
@ -250,7 +250,7 @@ nsXULListboxAccessible::GetRoleInternal(PRUint32 *aRole)
}
}
if (IsTree())
if (IsMulticolumn())
*aRole = nsIAccessibleRole::ROLE_TABLE;
else
*aRole = nsIAccessibleRole::ROLE_LISTBOX;
@ -279,12 +279,12 @@ nsXULListboxAccessible::GetSummary(nsAString &aSummary)
}
NS_IMETHODIMP
nsXULListboxAccessible::GetColumns(PRInt32 *aNumColumns)
nsXULListboxAccessible::GetColumnCount(PRInt32 *aColumnsCout)
{
NS_ENSURE_ARG_POINTER(aNumColumns);
*aNumColumns = 0;
NS_ENSURE_ARG_POINTER(aColumnsCout);
*aColumnsCout = 0;
if (!mDOMNode)
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
@ -318,26 +318,17 @@ nsXULListboxAccessible::GetColumns(PRInt32 *aNumColumns)
}
}
*aNumColumns = columnCount;
*aColumnsCout = columnCount;
return NS_OK;
}
NS_IMETHODIMP
nsXULListboxAccessible::GetColumnHeader(nsIAccessibleTable **aColumnHeader)
nsXULListboxAccessible::GetRowCount(PRInt32 *arowCount)
{
NS_ENSURE_ARG_POINTER(aColumnHeader);
*aColumnHeader = nsnull;
NS_ENSURE_ARG_POINTER(arowCount);
*arowCount = 0;
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsXULListboxAccessible::GetRows(PRInt32 *aNumRows)
{
NS_ENSURE_ARG_POINTER(aNumRows);
*aNumRows = 0;
if (!mDOMNode)
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMXULSelectControlElement> element(do_QueryInterface(mDOMNode));
@ -347,21 +338,12 @@ nsXULListboxAccessible::GetRows(PRInt32 *aNumRows)
nsresult rv = element->GetItemCount(&itemCount);
NS_ENSURE_SUCCESS(rv, rv);
*aNumRows = itemCount;
*arowCount = itemCount;
return NS_OK;
}
NS_IMETHODIMP
nsXULListboxAccessible::GetRowHeader(nsIAccessibleTable **aRowHeader)
{
NS_ENSURE_ARG_POINTER(aRowHeader);
*aRowHeader = nsnull;
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsXULListboxAccessible::CellRefAt(PRInt32 aRow, PRInt32 aColumn,
nsXULListboxAccessible::GetCellAt(PRInt32 aRow, PRInt32 aColumn,
nsIAccessible **aAccessibleCell)
{
NS_ENSURE_ARG_POINTER(aAccessibleCell);
@ -377,8 +359,10 @@ nsXULListboxAccessible::CellRefAt(PRInt32 aRow, PRInt32 aColumn,
control->GetItemAtIndex(aRow, getter_AddRefs(item));
NS_ENSURE_TRUE(item, NS_ERROR_INVALID_ARG);
nsCOMPtr<nsIDOMNode> itemNode(do_QueryInterface(item));
nsCOMPtr<nsIAccessible> accessibleRow;
GetAccService()->GetAccessibleInWeakShell(item, mWeakShell,
GetAccService()->GetAccessibleInWeakShell(itemNode, mWeakShell,
getter_AddRefs(accessibleRow));
NS_ENSURE_STATE(accessibleRow);
@ -389,19 +373,19 @@ nsXULListboxAccessible::CellRefAt(PRInt32 aRow, PRInt32 aColumn,
}
NS_IMETHODIMP
nsXULListboxAccessible::GetIndexAt(PRInt32 aRow, PRInt32 aColumn,
PRInt32 *aIndex)
nsXULListboxAccessible::GetCellIndexAt(PRInt32 aRow, PRInt32 aColumn,
PRInt32 *aIndex)
{
NS_ENSURE_ARG_POINTER(aIndex);
*aIndex = -1;
PRInt32 rowCount = 0;
nsresult rv = GetRows(&rowCount);
nsresult rv = GetRowCount(&rowCount);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(0 <= aRow && aRow <= rowCount, NS_ERROR_INVALID_ARG);
PRInt32 columnCount = 0;
rv = GetColumns(&columnCount);
rv = GetColumnCount(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
NS_ENSURE_TRUE(0 <= aColumn && aColumn <= columnCount, NS_ERROR_INVALID_ARG);
@ -410,13 +394,13 @@ nsXULListboxAccessible::GetIndexAt(PRInt32 aRow, PRInt32 aColumn,
}
NS_IMETHODIMP
nsXULListboxAccessible::GetColumnAtIndex(PRInt32 aIndex, PRInt32 *aColumn)
nsXULListboxAccessible::GetColumnIndexAt(PRInt32 aIndex, PRInt32 *aColumn)
{
NS_ENSURE_ARG_POINTER(aColumn);
*aColumn = -1;
PRInt32 columnCount = 0;
nsresult rv = GetColumns(&columnCount);
nsresult rv = GetColumnCount(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
*aColumn = aIndex % columnCount;
@ -424,13 +408,13 @@ nsXULListboxAccessible::GetColumnAtIndex(PRInt32 aIndex, PRInt32 *aColumn)
}
NS_IMETHODIMP
nsXULListboxAccessible::GetRowAtIndex(PRInt32 aIndex, PRInt32 *aRow)
nsXULListboxAccessible::GetRowIndexAt(PRInt32 aIndex, PRInt32 *aRow)
{
NS_ENSURE_ARG_POINTER(aRow);
*aRow = -1;
PRInt32 columnCount = 0;
nsresult rv = GetColumns(&columnCount);
nsresult rv = GetColumnCount(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
*aRow = aIndex / columnCount;
@ -486,15 +470,15 @@ nsXULListboxAccessible::IsColumnSelected(PRInt32 aColumn, PRBool *aIsSelected)
NS_ASSERTION(control,
"Doesn't implement nsIDOMXULMultiSelectControlElement.");
PRInt32 selectedRowsCount = 0;
nsresult rv = control->GetSelectedCount(&selectedRowsCount);
PRInt32 selectedrowCount = 0;
nsresult rv = control->GetSelectedCount(&selectedrowCount);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 rowsCount = 0;
rv = GetRows(&rowsCount);
PRInt32 rowCount = 0;
rv = GetRowCount(&rowCount);
NS_ENSURE_SUCCESS(rv, rv);
*aIsSelected = (selectedRowsCount == rowsCount);
*aIsSelected = (selectedrowCount == rowCount);
return NS_OK;
}
@ -520,14 +504,14 @@ nsXULListboxAccessible::IsRowSelected(PRInt32 aRow, PRBool *aIsSelected)
}
NS_IMETHODIMP
nsXULListboxAccessible::IsCellSelected(PRInt32 aRow, PRInt32 aColumn,
nsXULListboxAccessible::IsCellSelected(PRInt32 aRowIndex, PRInt32 aColumnIndex,
PRBool *aIsSelected)
{
return IsRowSelected(aRow, aIsSelected);
return IsRowSelected(aRowIndex, aIsSelected);
}
NS_IMETHODIMP
nsXULListboxAccessible::GetSelectedCellsCount(PRUint32* aCount)
nsXULListboxAccessible::GetSelectedCellCount(PRUint32* aCount)
{
NS_ENSURE_ARG_POINTER(aCount);
*aCount = 0;
@ -549,49 +533,16 @@ nsXULListboxAccessible::GetSelectedCellsCount(PRUint32* aCount)
if (!selectedItemsCount)
return NS_OK;
PRInt32 columnsCount = 0;
rv = GetColumns(&columnsCount);
PRInt32 columnCount = 0;
rv = GetColumnCount(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
*aCount = selectedItemsCount * columnsCount;
*aCount = selectedItemsCount * columnCount;
return NS_OK;
}
NS_IMETHODIMP
nsXULListboxAccessible::GetSelectedColumnsCount(PRUint32* aCount)
{
NS_ENSURE_ARG_POINTER(aCount);
*aCount = 0;
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMXULMultiSelectControlElement> control =
do_QueryInterface(mDOMNode);
NS_ASSERTION(control,
"Doesn't implement nsIDOMXULMultiSelectControlElement.");
PRInt32 selectedRowsCount = 0;
nsresult rv = control->GetSelectedCount(&selectedRowsCount);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 rowsCount = 0;
rv = GetRows(&rowsCount);
NS_ENSURE_SUCCESS(rv, rv);
if (selectedRowsCount != rowsCount)
return NS_OK;
PRInt32 columnsCount = 0;
rv = GetColumns(&columnsCount);
NS_ENSURE_SUCCESS(rv, rv);
*aCount = columnsCount;
return NS_OK;
}
NS_IMETHODIMP
nsXULListboxAccessible::GetSelectedRowsCount(PRUint32* aCount)
nsXULListboxAccessible::GetSelectedColumnCount(PRUint32* aCount)
{
NS_ENSURE_ARG_POINTER(aCount);
*aCount = 0;
@ -604,16 +555,103 @@ nsXULListboxAccessible::GetSelectedRowsCount(PRUint32* aCount)
NS_ASSERTION(control,
"Doesn't implement nsIDOMXULMultiSelectControlElement.");
PRInt32 selectedRowsCount = 0;
nsresult rv = control->GetSelectedCount(&selectedRowsCount);
PRInt32 selectedrowCount = 0;
nsresult rv = control->GetSelectedCount(&selectedrowCount);
NS_ENSURE_SUCCESS(rv, rv);
*aCount = selectedRowsCount;
PRInt32 rowCount = 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
nsXULListboxAccessible::GetSelectedCells(PRUint32 *aNumCells, PRInt32 **aCells)
nsXULListboxAccessible::GetSelectedRowCount(PRUint32* aCount)
{
NS_ENSURE_ARG_POINTER(aCount);
*aCount = 0;
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMXULMultiSelectControlElement> control =
do_QueryInterface(mDOMNode);
NS_ASSERTION(control,
"Doesn't implement nsIDOMXULMultiSelectControlElement.");
PRInt32 selectedrowCount = 0;
nsresult rv = control->GetSelectedCount(&selectedrowCount);
NS_ENSURE_SUCCESS(rv, rv);
*aCount = selectedrowCount;
return NS_OK;
}
NS_IMETHODIMP
nsXULListboxAccessible::GetSelectedCells(nsIArray **aCells)
{
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);
nsCOMPtr<nsIDOMXULMultiSelectControlElement> control =
do_QueryInterface(mDOMNode);
NS_ASSERTION(control,
"Doesn't implement nsIDOMXULMultiSelectControlElement.");
nsCOMPtr<nsIDOMNodeList> selectedItems;
control->GetSelectedItems(getter_AddRefs(selectedItems));
if (!selectedItems)
return NS_OK;
PRUint32 selectedItemsCount = 0;
rv = selectedItems->GetLength(&selectedItemsCount);
NS_ENSURE_SUCCESS(rv, rv);
PRUint32 index = 0;
for (; index < selectedItemsCount; index++) {
nsCOMPtr<nsIDOMNode> itemNode;
selectedItems->Item(index, getter_AddRefs(itemNode));
nsCOMPtr<nsIAccessible> item;
GetAccService()->GetAccessibleInWeakShell(itemNode, mWeakShell,
getter_AddRefs(item));
if (item) {
nsCOMPtr<nsIAccessible> cell, nextCell;
item->GetFirstChild(getter_AddRefs(cell));
while (cell) {
if (nsAccUtils::Role(cell) == nsIAccessibleRole::ROLE_CELL)
selCells->AppendElement(cell, PR_FALSE);
cell->GetNextSibling(getter_AddRefs(nextCell));
nextCell.swap(cell);
}
}
}
NS_ADDREF(*aCells = selCells);
return NS_OK;
}
NS_IMETHODIMP
nsXULListboxAccessible::GetSelectedCellIndices(PRUint32 *aNumCells,
PRInt32 **aCells)
{
NS_ENSURE_ARG_POINTER(aNumCells);
*aNumCells = 0;
@ -622,7 +660,7 @@ nsXULListboxAccessible::GetSelectedCells(PRUint32 *aNumCells, PRInt32 **aCells)
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMXULMultiSelectControlElement> control =
do_QueryInterface(mDOMNode);
NS_ASSERTION(control,
@ -637,11 +675,11 @@ nsXULListboxAccessible::GetSelectedCells(PRUint32 *aNumCells, PRInt32 **aCells)
nsresult rv = selectedItems->GetLength(&selectedItemsCount);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 columnsCount = 0;
rv = GetColumns(&columnsCount);
PRInt32 columnCount = 0;
rv = GetColumnCount(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
PRUint32 cellsCount = selectedItemsCount * columnsCount;
PRUint32 cellsCount = selectedItemsCount * columnCount;
PRInt32 *cellsIdxArray =
static_cast<PRInt32*>(nsMemory::Alloc((cellsCount) * sizeof(PRInt32)));
@ -659,8 +697,8 @@ nsXULListboxAccessible::GetSelectedCells(PRUint32 *aNumCells, PRInt32 **aCells)
control->GetIndexOfItem(item, &itemIdx);
if (itemIdx != -1) {
PRInt32 colIdx = 0;
for (; colIdx < columnsCount; colIdx++)
cellsIdxArray[cellsIdx++] = itemIdx * columnsCount + colIdx;
for (; colIdx < columnCount; colIdx++)
cellsIdxArray[cellsIdx++] = itemIdx * columnCount + colIdx;
}
}
}
@ -672,8 +710,8 @@ nsXULListboxAccessible::GetSelectedCells(PRUint32 *aNumCells, PRInt32 **aCells)
}
NS_IMETHODIMP
nsXULListboxAccessible::GetSelectedColumns(PRUint32 *aNumColumns,
PRInt32 **aColumns)
nsXULListboxAccessible::GetSelectedColumnIndices(PRUint32 *aNumColumns,
PRInt32 **aColumns)
{
NS_ENSURE_ARG_POINTER(aNumColumns);
*aNumColumns = 0;
@ -683,29 +721,30 @@ nsXULListboxAccessible::GetSelectedColumns(PRUint32 *aNumColumns,
if (IsDefunct())
return NS_ERROR_FAILURE;
PRUint32 columnsCount = 0;
nsresult rv = GetSelectedColumnsCount(&columnsCount);
PRUint32 columnCount = 0;
nsresult rv = GetSelectedColumnCount(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
if (!columnsCount)
if (!columnCount)
return NS_OK;
PRInt32 *colsIdxArray =
static_cast<PRInt32*>(nsMemory::Alloc((columnsCount) * sizeof(PRInt32)));
static_cast<PRInt32*>(nsMemory::Alloc((columnCount) * sizeof(PRInt32)));
NS_ENSURE_TRUE(colsIdxArray, NS_ERROR_OUT_OF_MEMORY);
PRUint32 colIdx = 0;
for (; colIdx < columnsCount; colIdx++)
for (; colIdx < columnCount; colIdx++)
colsIdxArray[colIdx] = colIdx;
*aNumColumns = columnsCount;
*aNumColumns = columnCount;
*aColumns = colsIdxArray;
return NS_OK;
}
NS_IMETHODIMP
nsXULListboxAccessible::GetSelectedRows(PRUint32 *aNumRows, PRInt32 **aRows)
nsXULListboxAccessible::GetSelectedRowIndices(PRUint32 *aNumRows,
PRInt32 **aRows)
{
NS_ENSURE_ARG_POINTER(aNumRows);
*aNumRows = 0;
@ -764,7 +803,7 @@ nsXULListboxAccessible::SelectRow(PRInt32 aRow)
return NS_ERROR_FAILURE;
nsCOMPtr<nsIDOMXULMultiSelectControlElement> control =
do_QueryInterface(mDOMNode);
do_QueryInterface(mDOMNode);
NS_ASSERTION(control,
"Doesn't implement nsIDOMXULMultiSelectControlElement.");
@ -818,13 +857,14 @@ nsXULListboxAccessible::IsProbablyForLayout(PRBool *aIsProbablyForLayout)
////////////////////////////////////////////////////////////////////////////////
// nsXULListitemAccessible
////////////////////////////////////////////////////////////////////////////////
nsXULListitemAccessible::
nsXULListitemAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell) :
nsXULMenuitemAccessible(aDOMNode, aShell)
{
mIsCheckbox = PR_FALSE;
nsCOMPtr<nsIDOMElement> listItem (do_QueryInterface(mDOMNode));
nsCOMPtr<nsIDOMElement> listItem(do_QueryInterface(mDOMNode));
if (listItem) {
nsAutoString typeString;
nsresult res = listItem->GetAttribute(NS_LITERAL_STRING("type"), typeString);
@ -926,7 +966,10 @@ nsXULListitemAccessible::GetStateInternal(PRUint32 *aState,
*aState = nsIAccessibleStates::STATE_FOCUSABLE |
nsIAccessibleStates::STATE_SELECTABLE;
nsCOMPtr<nsIDOMXULSelectControlItemElement> listItem (do_QueryInterface(mDOMNode));
nsCOMPtr<nsIDOMXULSelectControlItemElement> listItem =
do_QueryInterface(mDOMNode);
if (listItem) {
PRBool isSelected;
listItem->GetSelected(&isSelected);
@ -982,15 +1025,222 @@ nsXULListitemAccessible::GetAttributesInternal(nsIPersistentProperties *aAttribu
}
////////////////////////////////////////////////////////////////////////////////
// nsXULListCellAccessible
////////////////////////////////////////////////////////////////////////////////
nsXULListCellAccessible::
nsXULListCellAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
nsHyperTextAccessibleWrap(aDOMNode, aShell)
{
}
////////////////////////////////////////////////////////////////////////////////
// nsISupports
NS_IMPL_ISUPPORTS_INHERITED1(nsXULListCellAccessible,
nsHyperTextAccessible,
nsIAccessibleTableCell)
////////////////////////////////////////////////////////////////////////////////
// nsXULListCellAccessible: nsIAccessibleTableCell implementation
NS_IMETHODIMP
nsXULListCellAccessible::GetTable(nsIAccessibleTable **aTable)
{
NS_ENSURE_ARG_POINTER(aTable);
*aTable = nsnull;
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIAccessible> thisRow;
GetParent(getter_AddRefs(thisRow));
if (nsAccUtils::Role(thisRow) != nsIAccessibleRole::ROLE_ROW)
return NS_OK;
nsCOMPtr<nsIAccessible> table;
thisRow->GetParent(getter_AddRefs(table));
if (nsAccUtils::Role(table) != nsIAccessibleRole::ROLE_TABLE)
return NS_OK;
CallQueryInterface(table, aTable);
return NS_OK;
}
NS_IMETHODIMP
nsXULListCellAccessible::GetColumnIndex(PRInt32 *aColumnIndex)
{
NS_ENSURE_ARG_POINTER(aColumnIndex);
*aColumnIndex = -1;
if (IsDefunct())
return NS_ERROR_FAILURE;
*aColumnIndex = 0;
nsCOMPtr<nsIAccessible> prevCell, tmpAcc;
GetPreviousSibling(getter_AddRefs(prevCell));
while (prevCell) {
PRUint32 role = nsAccUtils::Role(prevCell);
if (role == nsIAccessibleRole::ROLE_CELL ||
role == nsIAccessibleRole::ROLE_GRID_CELL ||
role == nsIAccessibleRole::ROLE_ROWHEADER ||
role == nsIAccessibleRole::ROLE_COLUMNHEADER)
(*aColumnIndex)++;
prevCell->GetPreviousSibling(getter_AddRefs(tmpAcc));
tmpAcc.swap(prevCell);
}
return NS_OK;
}
NS_IMETHODIMP
nsXULListCellAccessible::GetRowIndex(PRInt32 *aRowIndex)
{
NS_ENSURE_ARG_POINTER(aRowIndex);
*aRowIndex = -1;
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIAccessible> row, prevRow;
GetParent(getter_AddRefs(row));
while (row) {
if (nsAccUtils::Role(row) == nsIAccessibleRole::ROLE_ROW)
(*aRowIndex)++;
row->GetPreviousSibling(getter_AddRefs(prevRow));
row.swap(prevRow);
}
return NS_OK;
}
NS_IMETHODIMP
nsXULListCellAccessible::GetColumnExtent(PRInt32 *aExtentCount)
{
NS_ENSURE_ARG_POINTER(aExtentCount);
*aExtentCount = 0;
if (IsDefunct())
return NS_ERROR_FAILURE;
*aExtentCount = 1;
return NS_OK;
}
NS_IMETHODIMP
nsXULListCellAccessible::GetRowExtent(PRInt32 *aExtentCount)
{
NS_ENSURE_ARG_POINTER(aExtentCount);
*aExtentCount = 0;
if (IsDefunct())
return NS_ERROR_FAILURE;
*aExtentCount = 1;
return NS_OK;
}
NS_IMETHODIMP
nsXULListCellAccessible::GetColumnHeaderCells(nsIArray **aHeaderCells)
{
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;
// Get column header cell from XUL listhead.
nsCOMPtr<nsIAccessible> tableAcc(do_QueryInterface(table));
nsCOMPtr<nsIAccessible> list, nextChild;
tableAcc->GetFirstChild(getter_AddRefs(list));
while (list) {
if (nsAccUtils::Role(list) == nsIAccessibleRole::ROLE_LIST)
break;
list->GetNextSibling(getter_AddRefs(nextChild));
nextChild.swap(list);
}
if (list) {
PRInt32 colIdx = -1;
GetColumnIndex(&colIdx);
nsCOMPtr<nsIAccessible> headerCell;
list->GetChildAt(colIdx, getter_AddRefs(headerCell));
if (headerCell) {
nsresult rv = NS_OK;
nsCOMPtr<nsIMutableArray> headerCells =
do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
headerCells->AppendElement(headerCell, PR_FALSE);
NS_ADDREF(*aHeaderCells = headerCells);
return NS_OK;
}
}
// No column header cell from XUL markup, try to get it from ARIA markup.
return nsAccUtils::GetHeaderCellsFor(table, this,
nsAccUtils::eColumnHeaderCells,
aHeaderCells);
}
NS_IMETHODIMP
nsXULListCellAccessible::GetRowHeaderCells(nsIArray **aHeaderCells)
{
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;
// Calculate row header cells from ARIA markup.
return nsAccUtils::GetHeaderCellsFor(table, this,
nsAccUtils::eRowHeaderCells,
aHeaderCells);
}
NS_IMETHODIMP
nsXULListCellAccessible::IsSelected(PRBool *aIsSelected)
{
NS_ENSURE_ARG_POINTER(aIsSelected);
*aIsSelected = PR_FALSE;
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIAccessibleTable> table;
GetTable(getter_AddRefs(table));
if (!table)
return NS_OK;
PRInt32 rowIdx = -1;
GetRowIndex(&rowIdx);
return table->IsRowSelected(rowIdx, aIsSelected);
}
////////////////////////////////////////////////////////////////////////////////
// nsXULListCellAccessible. nsAccessible implementation
nsresult
nsXULListCellAccessible::GetRoleInternal(PRUint32 *aRole)
{
@ -998,183 +1248,30 @@ nsXULListCellAccessible::GetRoleInternal(PRUint32 *aRole)
return NS_OK;
}
/** ------------------------------------------------------ */
/** Finally, the Combobox widgets */
/** ------------------------------------------------------ */
/** ----- nsXULComboboxAccessible ----- */
/** Constructor */
nsXULComboboxAccessible::nsXULComboboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
nsAccessibleWrap(aDOMNode, aShell)
{
}
nsresult
nsXULComboboxAccessible::Init()
nsXULListCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
{
nsresult rv = nsAccessibleWrap::Init();
nsXULMenupopupAccessible::GenerateMenu(mDOMNode);
return rv;
}
NS_ENSURE_ARG_POINTER(aAttributes);
/** We are a combobox */
nsresult
nsXULComboboxAccessible::GetRoleInternal(PRUint32 *aRole)
{
nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode);
if (!content) {
if (IsDefunct())
return NS_ERROR_FAILURE;
}
if (content->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
NS_LITERAL_STRING("autocomplete"), eIgnoreCase)) {
*aRole = nsIAccessibleRole::ROLE_AUTOCOMPLETE;
} else {
*aRole = nsIAccessibleRole::ROLE_COMBOBOX;
}
return NS_OK;
}
/**
* As a nsComboboxAccessible we can have the following states:
* STATE_FOCUSED
* STATE_FOCUSABLE
* STATE_HASPOPUP
* STATE_EXPANDED
* STATE_COLLAPSED
*/
nsresult
nsXULComboboxAccessible::GetStateInternal(PRUint32 *aState,
PRUint32 *aExtraState)
{
// Get focus status from base class
nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
NS_ENSURE_A11Y_SUCCESS(rv, rv);
// "table-cell-index" attribute
nsCOMPtr<nsIAccessibleTable> table;
GetTable(getter_AddRefs(table));
nsCOMPtr<nsIDOMXULMenuListElement> menuList(do_QueryInterface(mDOMNode));
if (menuList) {
PRBool isOpen;
menuList->GetOpen(&isOpen);
if (isOpen) {
*aState |= nsIAccessibleStates::STATE_EXPANDED;
}
else {
*aState |= nsIAccessibleStates::STATE_COLLAPSED;
}
}
PRInt32 rowIdx = -1;
GetRowIndex(&rowIdx);
PRInt32 colIdx = -1;
GetColumnIndex(&colIdx);
*aState |= nsIAccessibleStates::STATE_HASPOPUP |
nsIAccessibleStates::STATE_FOCUSABLE;
PRInt32 cellIdx = -1;
table->GetCellIndexAt(rowIdx, colIdx, &cellIdx);
nsAutoString stringIdx;
stringIdx.AppendInt(cellIdx);
nsAccUtils::SetAccAttr(aAttributes, nsAccessibilityAtoms::tableCellIndex,
stringIdx);
return NS_OK;
}
NS_IMETHODIMP nsXULComboboxAccessible::GetValue(nsAString& _retval)
{
_retval.Truncate();
// The MSAA/ATK value is the option or text shown entered in the combobox
nsCOMPtr<nsIDOMXULMenuListElement> menuList(do_QueryInterface(mDOMNode));
if (menuList) {
return menuList->GetLabel(_retval);
}
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP nsXULComboboxAccessible::GetDescription(nsAString& aDescription)
{
// Use description of currently focused option
aDescription.Truncate();
nsCOMPtr<nsIDOMXULMenuListElement> menuList(do_QueryInterface(mDOMNode));
if (!menuList) {
return NS_ERROR_FAILURE; // Shut down
}
nsCOMPtr<nsIDOMXULSelectControlItemElement> focusedOption;
menuList->GetSelectedItem(getter_AddRefs(focusedOption));
nsCOMPtr<nsIDOMNode> focusedOptionNode(do_QueryInterface(focusedOption));
if (focusedOptionNode) {
nsCOMPtr<nsIAccessibilityService> accService =
do_GetService("@mozilla.org/accessibilityService;1");
NS_ENSURE_TRUE(accService, NS_ERROR_FAILURE);
nsCOMPtr<nsIAccessible> focusedOptionAccessible;
accService->GetAccessibleInWeakShell(focusedOptionNode, mWeakShell,
getter_AddRefs(focusedOptionAccessible));
NS_ENSURE_TRUE(focusedOptionAccessible, NS_ERROR_FAILURE);
return focusedOptionAccessible->GetDescription(aDescription);
}
return NS_OK;
}
PRBool
nsXULComboboxAccessible::GetAllowsAnonChildAccessibles()
{
nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode);
NS_ASSERTION(content, "No content during accessible tree building!");
if (!content)
return PR_FALSE;
if (content->NodeInfo()->Equals(nsAccessibilityAtoms::textbox, kNameSpaceID_XUL) ||
content->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::editable,
nsAccessibilityAtoms::_true, eIgnoreCase)) {
// Both the XUL <textbox type="autocomplete"> and <menulist editable="true"> widgets
// use nsXULComboboxAccessible. We need to walk the anonymous children for these
// so that the entry field is a child
return PR_TRUE;
}
// Argument of PR_FALSE indicates we don't walk anonymous children for
// menuitems
return PR_FALSE;
}
/** Just one action ( click ). */
NS_IMETHODIMP nsXULComboboxAccessible::GetNumActions(PRUint8 *aNumActions)
{
*aNumActions = 1;
return NS_OK;
}
/**
* Programmaticaly toggle the combo box
*/
NS_IMETHODIMP nsXULComboboxAccessible::DoAction(PRUint8 aIndex)
{
if (aIndex != nsXULComboboxAccessible::eAction_Click) {
return NS_ERROR_INVALID_ARG;
}
nsCOMPtr<nsIDOMXULMenuListElement> menuList(do_QueryInterface(mDOMNode));
if (!menuList) {
return NS_ERROR_FAILURE;
}
PRBool isDroppedDown;
menuList->GetOpen(&isDroppedDown);
return menuList->SetOpen(!isDroppedDown);
}
/**
* Our action name is the reverse of our state:
* if we are closed -> open is our name.
* if we are open -> closed is our name.
* Uses the frame to get the state, updated on every click
*/
NS_IMETHODIMP nsXULComboboxAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
{
if (aIndex != nsXULComboboxAccessible::eAction_Click) {
return NS_ERROR_INVALID_ARG;
}
nsCOMPtr<nsIDOMXULMenuListElement> menuList(do_QueryInterface(mDOMNode));
if (!menuList) {
return NS_ERROR_FAILURE;
}
PRBool isDroppedDown;
menuList->GetOpen(&isDroppedDown);
if (isDroppedDown)
aName.AssignLiteral("close");
else
aName.AssignLiteral("open");
return NS_OK;
}

Просмотреть файл

@ -20,7 +20,9 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Kyle Yuan (kyle.yuan@sun.com)
* Aaron Leventhal <aaronl@netscape.com> (original author)
* Kyle Yuan <kyle.yuan@sun.com>
* Alexander Surkov <surkov.alexander@gmail.com>
*
* 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"),
@ -35,8 +37,8 @@
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#ifndef __nsXULSelectAccessible_h__
#define __nsXULSelectAccessible_h__
#ifndef __nsXULListboxAccessible_h__
#define __nsXULListboxAccessible_h__
#include "nsIAccessibleTable.h"
@ -81,25 +83,6 @@ public:
enum { eAction_Click = 0 };
};
/**
* Listboxes (xul:listbox) and Comboboxes (xul:menulist) are made up of a
* number of different widgets, some of which are shared between the two.
* This file contains all of the widgets for both of them, for XUL only.
*
* Listbox:
* - nsXULListboxAccessible
* - nsXULSelectOptionAccessible
*
* Comboboxes:
* - nsXULComboboxAccessible <menulist />
* - nsXULMenuAccessible <menupopup />
* - nsXULMenuitemAccessible(s) <menuitem />
*/
/** ------------------------------------------------------ */
/** First, the common widgets */
/** ------------------------------------------------------ */
/*
* A class the represents the XUL Listbox widget.
*/
@ -121,7 +104,7 @@ public:
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
protected:
PRBool IsTree();
PRBool IsMulticolumn();
};
/**
@ -159,44 +142,21 @@ private:
/**
* Class represents xul:listcell.
*/
class nsXULListCellAccessible : public nsHyperTextAccessibleWrap
class nsXULListCellAccessible : public nsHyperTextAccessibleWrap,
public nsIAccessibleTableCell
{
public:
nsXULListCellAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
// nsAccessible
virtual nsresult GetRoleInternal(PRUint32 *aRole);
};
// nsISupports
NS_DECL_ISUPPORTS_INHERITED
/** ------------------------------------------------------ */
/** Finally, the Combobox widgets */
/** ------------------------------------------------------ */
/*
* A class the represents the XUL Combobox widget.
*/
class nsXULComboboxAccessible : public nsAccessibleWrap
{
public:
enum { eAction_Click = 0 };
nsXULComboboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
virtual ~nsXULComboboxAccessible() {}
// nsIAccessible
NS_IMETHOD GetValue(nsAString& _retval);
NS_IMETHOD GetDescription(nsAString& aDescription);
NS_IMETHOD DoAction(PRUint8 index);
NS_IMETHOD GetNumActions(PRUint8 *aNumActions);
NS_IMETHOD GetActionName(PRUint8 index, nsAString& aName);
// nsAccessNode
virtual nsresult Init();
// nsIAccessibleTableCell
NS_DECL_NSIACCESSIBLETABLECELL
// nsAccessible
virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
virtual nsresult GetRoleInternal(PRUint32 *aRole);
virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
virtual PRBool GetAllowsAnonChildAccessibles();
};
#endif

Просмотреть файл

@ -41,7 +41,7 @@
// NOTE: alphabetically ordered
#include "nsBaseWidgetAccessible.h"
#include "nsXULSelectAccessible.h"
#include "nsXULMenuAccessible.h"
/**
* An individual tab, xul:tab element

Просмотреть файл

@ -801,9 +801,9 @@ nsXULTreeItemAccessibleBase::GetNextSibling(nsIAccessible **aNextSibling)
nsAccUtils::QueryAccessibleTree(mParent);
NS_ENSURE_STATE(treeAcc);
PRInt32 rowsCount = 0;
mTreeView->GetRowCount(&rowsCount);
if (mRow + 1 >= rowsCount)
PRInt32 rowCount = 0;
mTreeView->GetRowCount(&rowCount);
if (mRow + 1 >= rowCount)
return NS_OK;
treeAcc->GetTreeItemAccessible(mRow + 1, aNextSibling);

Просмотреть файл

@ -41,7 +41,7 @@
#include "nsITreeBoxObject.h"
#include "nsITreeView.h"
#include "nsITreeColumns.h"
#include "nsXULSelectAccessible.h"
#include "nsXULListboxAccessible.h"
/*
* A class the represents the XUL Tree widget.

Просмотреть файл

@ -36,9 +36,10 @@
*
* ***** END LICENSE BLOCK ***** */
#include "nsXULTreeGridAccessible.h"
#include "nsXULTreeGridAccessibleWrap.h"
#include "nsITreeSelection.h"
#include "nsServiceManagerUtils.h"
////////////////////////////////////////////////////////////////////////////////
// Internal static functions
@ -94,68 +95,50 @@ nsXULTreeGridAccessible::GetSummary(nsAString &aSummary)
}
NS_IMETHODIMP
nsXULTreeGridAccessible::GetColumns(PRInt32 *aColumnsCount)
nsXULTreeGridAccessible::GetColumnCount(PRInt32 *acolumnCount)
{
NS_ENSURE_ARG_POINTER(aColumnsCount);
*aColumnsCount = 0;
NS_ENSURE_ARG_POINTER(acolumnCount);
*acolumnCount = 0;
if (IsDefunct())
return NS_ERROR_FAILURE;
*aColumnsCount = nsCoreUtils::GetSensibleColumnsCount(mTree);
*acolumnCount = nsCoreUtils::GetSensiblecolumnCount(mTree);
return NS_OK;
}
NS_IMETHODIMP
nsXULTreeGridAccessible::GetColumnHeader(nsIAccessibleTable **aColumnHeader)
nsXULTreeGridAccessible::GetRowCount(PRInt32 *arowCount)
{
NS_ENSURE_ARG_POINTER(aColumnHeader);
*aColumnHeader = nsnull;
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsXULTreeGridAccessible::GetRows(PRInt32 *aRowsCount)
{
NS_ENSURE_ARG_POINTER(aRowsCount);
*aRowsCount = nsnull;
NS_ENSURE_ARG_POINTER(arowCount);
*arowCount = nsnull;
if (IsDefunct())
return NS_ERROR_FAILURE;
return mTreeView->GetRowCount(aRowsCount);
return mTreeView->GetRowCount(arowCount);
}
NS_IMETHODIMP
nsXULTreeGridAccessible::GetRowHeader(nsIAccessibleTable **aRowHeader)
{
NS_ENSURE_ARG_POINTER(aRowHeader);
*aRowHeader = nsnull;
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsXULTreeGridAccessible::GetSelectedCellsCount(PRUint32* aCount)
nsXULTreeGridAccessible::GetSelectedCellCount(PRUint32* aCount)
{
NS_ENSURE_ARG_POINTER(aCount);
*aCount = 0;
PRUint32 selectedRowsCount = 0;
nsresult rv = GetSelectedRowsCount(&selectedRowsCount);
PRUint32 selectedrowCount = 0;
nsresult rv = GetSelectedRowCount(&selectedrowCount);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 columnsCount = 0;
rv = GetColumns(&columnsCount);
PRInt32 columnCount = 0;
rv = GetColumnCount(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
*aCount = selectedRowsCount * columnsCount;
*aCount = selectedrowCount * columnCount;
return NS_OK;
}
NS_IMETHODIMP
nsXULTreeGridAccessible::GetSelectedColumnsCount(PRUint32* aCount)
nsXULTreeGridAccessible::GetSelectedColumnCount(PRUint32* aCount)
{
NS_ENSURE_ARG_POINTER(aCount);
*aCount = 0;
@ -166,27 +149,27 @@ nsXULTreeGridAccessible::GetSelectedColumnsCount(PRUint32* aCount)
// If all the row has been selected, then all the columns are selected,
// because we can't select a column alone.
PRInt32 rowsCount = 0;
nsresult rv = GetRows(&rowsCount);
PRInt32 rowCount = 0;
nsresult rv = GetRowCount(&rowCount);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 selectedRowsCount = 0;
rv = GetSelectionCount(&selectedRowsCount);
PRInt32 selectedrowCount = 0;
rv = GetSelectionCount(&selectedrowCount);
NS_ENSURE_SUCCESS(rv, rv);
if (rowsCount == selectedRowsCount) {
PRInt32 columnsCount = 0;
rv = GetColumns(&columnsCount);
if (rowCount == selectedrowCount) {
PRInt32 columnCount = 0;
rv = GetColumnCount(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
*aCount = columnsCount;
*aCount = columnCount;
}
return NS_OK;
}
NS_IMETHODIMP
nsXULTreeGridAccessible::GetSelectedRowsCount(PRUint32* aCount)
nsXULTreeGridAccessible::GetSelectedRowCount(PRUint32* aCount)
{
NS_ENSURE_ARG_POINTER(aCount);
*aCount = 0;
@ -194,64 +177,105 @@ nsXULTreeGridAccessible::GetSelectedRowsCount(PRUint32* aCount)
if (IsDefunct())
return NS_ERROR_FAILURE;
PRInt32 selectedRowsCount = 0;
nsresult rv = GetSelectionCount(&selectedRowsCount);
PRInt32 selectedrowCount = 0;
nsresult rv = GetSelectionCount(&selectedrowCount);
NS_ENSURE_SUCCESS(rv, rv);
*aCount = selectedRowsCount;
*aCount = selectedrowCount;
return NS_OK;
}
NS_IMETHODIMP
nsXULTreeGridAccessible::GetSelectedCells(PRUint32 *aCellsCount,
PRInt32 **aCells)
nsXULTreeGridAccessible::GetSelectedCells(nsIArray **aCells)
{
NS_ENSURE_ARG_POINTER(aCells);
*aCells = nsnull;
nsCOMPtr<nsIMutableArray> selCells = do_CreateInstance(NS_ARRAY_CONTRACTID);
NS_ENSURE_TRUE(selCells, NS_ERROR_FAILURE);
PRInt32 selectedrowCount = 0;
nsresult rv = GetSelectionCount(&selectedrowCount);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 columnCount = 0;
rv = GetColumnCount(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsITreeSelection> selection;
rv = mTreeView->GetSelection(getter_AddRefs(selection));
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 rowCount = 0;
rv = GetRowCount(&rowCount);
NS_ENSURE_SUCCESS(rv, rv);
PRBool isSelected;
for (PRInt32 rowIdx = 0; rowIdx < rowCount; rowIdx++) {
selection->IsSelected(rowIdx, &isSelected);
if (isSelected) {
for (PRInt32 colIdx = 0; colIdx < columnCount; colIdx++) {
nsCOMPtr<nsIAccessible> cell;
GetCellAt(rowIdx, colIdx, getter_AddRefs(cell));
selCells->AppendElement(cell, PR_FALSE);
}
}
}
NS_ADDREF(*aCells = selCells);
return NS_OK;
}
NS_IMETHODIMP
nsXULTreeGridAccessible::GetSelectedCellIndices(PRUint32 *aCellsCount,
PRInt32 **aCells)
{
NS_ENSURE_ARG_POINTER(aCellsCount);
*aCellsCount = 0;
NS_ENSURE_ARG_POINTER(aCells);
*aCells = nsnull;
PRInt32 selectedRowsCount = 0;
nsresult rv = GetSelectionCount(&selectedRowsCount);
PRInt32 selectedrowCount = 0;
nsresult rv = GetSelectionCount(&selectedrowCount);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 columnsCount = 0;
rv = GetColumns(&columnsCount);
PRInt32 columnCount = 0;
rv = GetColumnCount(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 selectedCellsCount = selectedRowsCount * columnsCount;
PRInt32 selectedCellCount = selectedrowCount * columnCount;
PRInt32* outArray = static_cast<PRInt32*>(
nsMemory::Alloc(selectedCellsCount * sizeof(PRInt32)));
nsMemory::Alloc(selectedCellCount * sizeof(PRInt32)));
NS_ENSURE_TRUE(outArray, NS_ERROR_OUT_OF_MEMORY);
nsCOMPtr<nsITreeSelection> selection;
rv = mTreeView->GetSelection(getter_AddRefs(selection));
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 rowsCount = 0;
rv = GetRows(&rowsCount);
PRInt32 rowCount = 0;
rv = GetRowCount(&rowCount);
NS_ENSURE_SUCCESS(rv, rv);
PRBool isSelected;
for (PRInt32 rowIdx = 0, arrayIdx = 0; rowIdx < rowsCount; rowIdx++) {
for (PRInt32 rowIdx = 0, arrayIdx = 0; rowIdx < rowCount; rowIdx++) {
selection->IsSelected(rowIdx, &isSelected);
if (isSelected) {
for (PRInt32 colIdx = 0; colIdx < columnsCount; colIdx++)
outArray[arrayIdx++] = rowIdx * columnsCount + colIdx;
for (PRInt32 colIdx = 0; colIdx < columnCount; colIdx++)
outArray[arrayIdx++] = rowIdx * columnCount + colIdx;
}
}
*aCellsCount = selectedCellsCount;
*aCellsCount = selectedCellCount;
*aCells = outArray;
return NS_OK;
}
NS_IMETHODIMP
nsXULTreeGridAccessible::GetSelectedColumns(PRUint32 *aColumnsCount,
PRInt32 **aColumns)
nsXULTreeGridAccessible::GetSelectedColumnIndices(PRUint32 *acolumnCount,
PRInt32 **aColumns)
{
NS_ENSURE_ARG_POINTER(aColumnsCount);
*aColumnsCount = 0;
NS_ENSURE_ARG_POINTER(acolumnCount);
*acolumnCount = 0;
NS_ENSURE_ARG_POINTER(aColumns);
*aColumns = nsnull;
@ -261,74 +285,75 @@ nsXULTreeGridAccessible::GetSelectedColumns(PRUint32 *aColumnsCount,
// If all the row has been selected, then all the columns are selected.
// Because we can't select a column alone.
PRInt32 rowsCount = 0;
nsresult rv = GetRows(&rowsCount);
PRInt32 rowCount = 0;
nsresult rv = GetRowCount(&rowCount);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 selectedRowsCount = 0;
rv = GetSelectionCount(&selectedRowsCount);
PRInt32 selectedrowCount = 0;
rv = GetSelectionCount(&selectedrowCount);
NS_ENSURE_SUCCESS(rv, rv);
if (rowsCount != selectedRowsCount)
if (rowCount != selectedrowCount)
return NS_OK;
PRInt32 columnsCount = 0;
rv = GetColumns(&columnsCount);
PRInt32 columnCount = 0;
rv = GetColumnCount(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32* outArray = static_cast<PRInt32*>(
nsMemory::Alloc(columnsCount * sizeof(PRInt32)));
nsMemory::Alloc(columnCount * sizeof(PRInt32)));
NS_ENSURE_TRUE(outArray, NS_ERROR_OUT_OF_MEMORY);
for (PRInt32 colIdx = 0; colIdx < columnsCount; colIdx++)
for (PRInt32 colIdx = 0; colIdx < columnCount; colIdx++)
outArray[colIdx] = colIdx;
*aColumnsCount = columnsCount;
*acolumnCount = columnCount;
*aColumns = outArray;
return NS_OK;
}
NS_IMETHODIMP
nsXULTreeGridAccessible::GetSelectedRows(PRUint32 *aRowsCount, PRInt32 **aRows)
nsXULTreeGridAccessible::GetSelectedRowIndices(PRUint32 *arowCount,
PRInt32 **aRows)
{
NS_ENSURE_ARG_POINTER(aRowsCount);
*aRowsCount = 0;
NS_ENSURE_ARG_POINTER(arowCount);
*arowCount = 0;
NS_ENSURE_ARG_POINTER(aRows);
*aRows = nsnull;
if (IsDefunct())
return NS_ERROR_FAILURE;
PRInt32 selectedRowsCount = 0;
nsresult rv = GetSelectionCount(&selectedRowsCount);
PRInt32 selectedrowCount = 0;
nsresult rv = GetSelectionCount(&selectedrowCount);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32* outArray = static_cast<PRInt32*>(
nsMemory::Alloc(selectedRowsCount * sizeof(PRInt32)));
nsMemory::Alloc(selectedrowCount * sizeof(PRInt32)));
NS_ENSURE_TRUE(outArray, NS_ERROR_OUT_OF_MEMORY);
nsCOMPtr<nsITreeSelection> selection;
rv = mTreeView->GetSelection(getter_AddRefs(selection));
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 rowsCount = 0;
rv = GetRows(&rowsCount);
PRInt32 rowCount = 0;
rv = GetRowCount(&rowCount);
NS_ENSURE_SUCCESS(rv, rv);
PRBool isSelected;
for (PRInt32 rowIdx = 0, arrayIdx = 0; rowIdx < rowsCount; rowIdx++) {
for (PRInt32 rowIdx = 0, arrayIdx = 0; rowIdx < rowCount; rowIdx++) {
selection->IsSelected(rowIdx, &isSelected);
if (isSelected)
outArray[arrayIdx++] = rowIdx;
}
*aRowsCount = selectedRowsCount;
*arowCount = selectedrowCount;
*aRows = outArray;
return NS_OK;
}
NS_IMETHODIMP
nsXULTreeGridAccessible::CellRefAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
nsXULTreeGridAccessible::GetCellAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
nsIAccessible **aCell)
{
NS_ENSURE_ARG_POINTER(aCell);
@ -355,8 +380,8 @@ nsXULTreeGridAccessible::CellRefAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
}
NS_IMETHODIMP
nsXULTreeGridAccessible::GetIndexAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
PRInt32 *aCellIndex)
nsXULTreeGridAccessible::GetCellIndexAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
PRInt32 *aCellIndex)
{
NS_ENSURE_ARG_POINTER(aCellIndex);
*aCellIndex = -1;
@ -364,40 +389,40 @@ nsXULTreeGridAccessible::GetIndexAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
if (IsDefunct())
return NS_ERROR_FAILURE;
PRInt32 columnsCount = 0;
nsresult rv = GetColumns(&columnsCount);
PRInt32 columnCount = 0;
nsresult rv = GetColumnCount(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
*aCellIndex = aRowIndex * columnsCount + aColumnIndex;
*aCellIndex = aRowIndex * columnCount + aColumnIndex;
return NS_OK;
}
NS_IMETHODIMP
nsXULTreeGridAccessible::GetColumnAtIndex(PRInt32 aCellIndex,
nsXULTreeGridAccessible::GetColumnIndexAt(PRInt32 aCellIndex,
PRInt32 *aColumnIndex)
{
NS_ENSURE_ARG_POINTER(aColumnIndex);
*aColumnIndex = -1;
PRInt32 columnsCount = 0;
nsresult rv = GetColumns(&columnsCount);
PRInt32 columnCount = 0;
nsresult rv = GetColumnCount(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
*aColumnIndex = aCellIndex % columnsCount;
*aColumnIndex = aCellIndex % columnCount;
return NS_OK;
}
NS_IMETHODIMP
nsXULTreeGridAccessible::GetRowAtIndex(PRInt32 aCellIndex, PRInt32 *aRowIndex)
nsXULTreeGridAccessible::GetRowIndexAt(PRInt32 aCellIndex, PRInt32 *aRowIndex)
{
NS_ENSURE_ARG_POINTER(aRowIndex);
*aRowIndex = -1;
PRInt32 columnsCount;
nsresult rv = GetColumns(&columnsCount);
PRInt32 columnCount;
nsresult rv = GetColumnCount(&columnCount);
NS_ENSURE_SUCCESS(rv, rv);
*aRowIndex = aCellIndex / columnsCount;
*aRowIndex = aCellIndex / columnCount;
return NS_OK;
}
@ -428,7 +453,19 @@ nsXULTreeGridAccessible::GetColumnDescription(PRInt32 aColumnIndex,
{
aDescription.Truncate();
return NS_ERROR_NOT_IMPLEMENTED;
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsIAccessible> treeColumns;
nsAccessible::GetFirstChild(getter_AddRefs(treeColumns));
if (treeColumns) {
nsCOMPtr<nsIAccessible> treeColumnItem;
treeColumns->GetChildAt(aColumnIndex, getter_AddRefs(treeColumnItem));
if (treeColumnItem)
return treeColumnItem->GetName(aDescription);
}
return NS_OK;
}
NS_IMETHODIMP
@ -436,8 +473,7 @@ nsXULTreeGridAccessible::GetRowDescription(PRInt32 aRowIndex,
nsAString& aDescription)
{
aDescription.Truncate();
return NS_ERROR_NOT_IMPLEMENTED;
return NS_OK;
}
NS_IMETHODIMP
@ -453,15 +489,15 @@ nsXULTreeGridAccessible::IsColumnSelected(PRInt32 aColumnIndex,
// If all the row has been selected, then all the columns are selected.
// Because we can't select a column alone.
PRInt32 rowsCount = 0;
nsresult rv = GetRows(&rowsCount);
PRInt32 rowCount = 0;
nsresult rv = GetRowCount(&rowCount);
NS_ENSURE_SUCCESS(rv, rv);
PRInt32 selectedRowsCount = 0;
rv = GetSelectionCount(&selectedRowsCount);
PRInt32 selectedrowCount = 0;
rv = GetSelectionCount(&selectedrowCount);
NS_ENSURE_SUCCESS(rv, rv);
*aIsSelected = rowsCount == selectedRowsCount;
*aIsSelected = rowCount == selectedrowCount;
return NS_OK;
}
@ -647,7 +683,7 @@ nsXULTreeGridRowAccessible::GetChildCount(PRInt32 *aChildCount)
if (IsDefunct())
return NS_ERROR_FAILURE;
*aChildCount = nsCoreUtils::GetSensibleColumnsCount(mTree);
*aChildCount = nsCoreUtils::GetSensiblecolumnCount(mTree);
return NS_OK;
}
@ -741,8 +777,8 @@ nsXULTreeGridRowAccessible::GetCellAccessible(nsITreeColumn* aColumn,
if (!accessNode) {
nsRefPtr<nsAccessNode> cellAcc =
new nsXULTreeGridCellAccessible(mDOMNode, mWeakShell, this, mTree,
mTreeView, mRow, aColumn);
new nsXULTreeGridCellAccessibleWrap(mDOMNode, mWeakShell, this, mTree,
mTreeView, mRow, aColumn);
if (!cellAcc)
return;
@ -801,8 +837,9 @@ nsXULTreeGridCellAccessible(nsIDOMNode *aDOMNode, nsIWeakReference *aShell,
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeGridCellAccessible: nsISupports implementation
NS_IMPL_ISUPPORTS_INHERITED1(nsXULTreeGridCellAccessible,
NS_IMPL_ISUPPORTS_INHERITED2(nsXULTreeGridCellAccessible,
nsLeafAccessible,
nsIAccessibleTableCell,
nsXULTreeGridCellAccessible)
////////////////////////////////////////////////////////////////////////////////
@ -1030,6 +1067,131 @@ nsXULTreeGridCellAccessible::DoAction(PRUint8 aIndex)
return NS_ERROR_INVALID_ARG;
}
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeGridCellAccessible: nsIAccessibleTableCell implementation
NS_IMETHODIMP
nsXULTreeGridCellAccessible::GetTable(nsIAccessibleTable **aTable)
{
NS_ENSURE_ARG_POINTER(aTable);
*aTable = nsnull;
if (IsDefunct())
return NS_OK;
nsCOMPtr<nsIAccessible> accessible;
mParent->GetParent(getter_AddRefs(accessible));
CallQueryInterface(accessible, aTable);
return NS_OK;
}
NS_IMETHODIMP
nsXULTreeGridCellAccessible::GetColumnIndex(PRInt32 *aColumnIndex)
{
NS_ENSURE_ARG_POINTER(aColumnIndex);
*aColumnIndex = -1;
if (IsDefunct())
return NS_ERROR_FAILURE;
*aColumnIndex = GetColumnIndex();
return NS_OK;
}
NS_IMETHODIMP
nsXULTreeGridCellAccessible::GetRowIndex(PRInt32 *aRowIndex)
{
NS_ENSURE_ARG_POINTER(aRowIndex);
*aRowIndex = -1;
if (IsDefunct())
return NS_ERROR_FAILURE;
*aRowIndex = mRow;
return NS_OK;
}
NS_IMETHODIMP
nsXULTreeGridCellAccessible::GetColumnExtent(PRInt32 *aExtentCount)
{
NS_ENSURE_ARG_POINTER(aExtentCount);
*aExtentCount = 1;
return NS_OK;
}
NS_IMETHODIMP
nsXULTreeGridCellAccessible::GetRowExtent(PRInt32 *aExtentCount)
{
NS_ENSURE_ARG_POINTER(aExtentCount);
*aExtentCount = 1;
return NS_OK;
}
NS_IMETHODIMP
nsXULTreeGridCellAccessible::GetColumnHeaderCells(nsIArray **aHeaderCells)
{
NS_ENSURE_ARG_POINTER(aHeaderCells);
*aHeaderCells = nsnull;
if (IsDefunct())
return NS_ERROR_FAILURE;
nsresult rv = NS_OK;
nsCOMPtr<nsIMutableArray> headerCells =
do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
nsCOMPtr<nsIDOMElement> columnElm;
mColumn->GetElement(getter_AddRefs(columnElm));
nsCOMPtr<nsIAccessible> headerCell;
GetAccService()->GetAccessibleInWeakShell(columnElm, mWeakShell,
getter_AddRefs(headerCell));
if (headerCell)
headerCells->AppendElement(headerCell, PR_FALSE);
NS_ADDREF(*aHeaderCells = headerCells);
return NS_OK;
}
NS_IMETHODIMP
nsXULTreeGridCellAccessible::GetRowHeaderCells(nsIArray **aHeaderCells)
{
NS_ENSURE_ARG_POINTER(aHeaderCells);
*aHeaderCells = nsnull;
if (IsDefunct())
return NS_ERROR_FAILURE;
nsresult rv = NS_OK;
nsCOMPtr<nsIMutableArray> headerCells =
do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
NS_ADDREF(*aHeaderCells = headerCells);
return NS_OK;
}
NS_IMETHODIMP
nsXULTreeGridCellAccessible::IsSelected(PRBool *aIsSelected)
{
NS_ENSURE_ARG_POINTER(aIsSelected);
*aIsSelected = PR_FALSE;
if (IsDefunct())
return NS_ERROR_FAILURE;
nsCOMPtr<nsITreeSelection> selection;
nsresult rv = mTreeView->GetSelection(getter_AddRefs(selection));
NS_ENSURE_SUCCESS(rv, rv);
return selection->IsSelected(mRow, aIsSelected);
}
////////////////////////////////////////////////////////////////////////////////
// nsXULTreeGridCellAccessible: nsAccessNode implementation
@ -1075,7 +1237,7 @@ nsXULTreeGridCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAtt
PRInt32 colIdx = GetColumnIndex();
PRInt32 cellIdx = -1;
tableAccessible->GetIndexAt(mRow, colIdx, &cellIdx);
tableAccessible->GetCellIndexAt(mRow, colIdx, &cellIdx);
nsAutoString stringIdx;
stringIdx.AppendInt(cellIdx);

Просмотреть файл

@ -123,7 +123,8 @@ protected:
{ 0xa9, 0x32, 0x4c, 0x5c, 0xa5, 0xde, 0x5d, 0xff } \
}
class nsXULTreeGridCellAccessible : public nsLeafAccessible
class nsXULTreeGridCellAccessible : public nsLeafAccessible,
public nsIAccessibleTableCell
{
public:
nsXULTreeGridCellAccessible(nsIDOMNode *aDOMNode, nsIWeakReference *aShell,
@ -152,6 +153,9 @@ public:
NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
NS_IMETHOD DoAction(PRUint8 aIndex);
// nsIAccessibleTableCell
NS_DECL_NSIACCESSIBLETABLECELL
// nsAccessNode
virtual PRBool IsDefunct();
virtual nsresult Init();

Просмотреть файл

@ -78,7 +78,6 @@ _TEST_FILES =\
test_aria_activedescendant.html \
test_aria_role_article.html \
test_aria_role_equation.html \
test_aria_role_grid.html \
test_aria_roles.html \
test_aria_roles.xul \
test_aria_token_attrs.html \
@ -89,8 +88,8 @@ _TEST_FILES =\
test_cssattrs.html \
test_descr.html \
test_elm_filectrl.html \
test_elm_listbox.xul \
$(warning test_elm_media.html temporarily disabled) \
test_elm_table.html \
test_elm_tree.xul \
test_elm_txtcntnr.html \
test_events_caretmove.html \
@ -120,13 +119,11 @@ _TEST_FILES =\
test_nsIAccessibleHyperLink.xul \
test_nsIAccessibleHyperText.html \
test_nsIAccessibleImage.html \
$(warning test_nsIAccessibleTable_listboxes.xul temporarily disabled) \
test_nsIAccessNode_utils.html \
test_nsOuterDocAccessible.html \
test_objectattrs.html \
test_relations.html \
test_relations.xul \
test_relations_table.html \
test_relations_tree.xul \
test_role_nsHyperTextAcc.html \
test_role_table_cells.html \
@ -138,15 +135,24 @@ _TEST_FILES =\
test_states_popup.xul \
test_states_tree.xul \
test_table_1.html \
test_table_2.html \
test_table_4.html \
test_table_headers.html \
test_table_headers_ariagrid.html \
test_table_headers_listbox.xul \
test_table_headers_tree.xul \
test_table_indexes.html \
test_table_indexes_ariagrid.html \
test_table_indexes_listbox.xul \
test_table_indexes_tree.xul \
test_table_layoutguess.html \
test_table_sels.html \
test_table_sels_ariagrid.html \
test_table_sels_listbox.xul \
test_table_sels_tree.xul \
test_table_struct.html \
test_table_struct_ariagrid.html \
test_table_struct_listbox.xul \
test_table_struct_tree.xul \
test_textattrs.html \
test_textboxes.html \
test_textboxes.xul \

Просмотреть файл

@ -32,6 +32,7 @@ const nsIAccessibleHyperText = Components.interfaces.nsIAccessibleHyperText;
const nsIAccessibleImage = Components.interfaces.nsIAccessibleImage;
const nsIAccessibleSelectable = Components.interfaces.nsIAccessibleSelectable;
const nsIAccessibleTable = Components.interfaces.nsIAccessibleTable;
const nsIAccessibleTableCell = Components.interfaces.nsIAccessibleTableCell;
const nsIAccessibleValue = Components.interfaces.nsIAccessibleValue;
const nsIObserverService = Components.interfaces.nsIObserverService;
@ -292,6 +293,15 @@ function ensureAccessibleTree(aAccOrElmOrID)
/**
* Compare expected and actual accessibles trees.
*
* @param aAccOrElmOrID [in] accessible identifier
* @param aAccTree [in] JS object, each field corresponds to property of
* accessible object. Additionally special properties
* are presented:
* children - an array of JS objects representing
* children of accessible
* states - an object having states and extraStates
* fields
*/
function testAccessibleTree(aAccOrElmOrID, aAccTree)
{
@ -300,7 +310,7 @@ function testAccessibleTree(aAccOrElmOrID, aAccTree)
return;
for (var prop in aAccTree) {
var msg = "Wrong value of property '" + prop + "'.";
var msg = "Wrong value of property '" + prop + "' for " + prettyName(acc) + ".";
if (prop == "role") {
is(roleToString(acc[prop]), roleToString(aAccTree[prop]), msg);

Просмотреть файл

@ -5,7 +5,7 @@ const nsIDOMKeyEvent = Components.interfaces.nsIDOMKeyEvent;
*/
function grid(aTableIdentifier)
{
this.getRowsCount = function getRowsCount()
this.getrowCount = function getrowCount()
{
return this.table.rows.length - (this.table.tHead ? 1 : 0);
}
@ -21,12 +21,12 @@ function grid(aTableIdentifier)
this.getMaxIndex = function getMaxIndex()
{
return this.getRowsCount() * this.getColsCount() - 1;
return this.getrowCount() * this.getColsCount() - 1;
}
this.getCellAtIndex = function getCellAtIndex(aIndex)
{
var rowsCount = this.getRowsCount();
var rowCount = this.getrowCount();
var colsCount = this.getColsCount();
var rowIdx = Math.floor(aIndex / colsCount);
@ -50,9 +50,9 @@ function grid(aTableIdentifier)
this.getCurrentCell = function getCurrentCell()
{
var rowsCount = this.table.rows.length;
var rowCount = this.table.rows.length;
var colsCount = this.getColsCount();
for (var rowIdx = 0; rowIdx < rowsCount; rowIdx++) {
for (var rowIdx = 0; rowIdx < rowCount; rowIdx++) {
for (var colIdx = 0; colIdx < colsCount; colIdx++) {
var cell = this.table.rows[rowIdx].cells[colIdx];
if (cell.hasAttribute("tabindex"))

Просмотреть файл

@ -4,6 +4,7 @@
const ROLE_ALERT = nsIAccessibleRole.ROLE_ALERT;
const ROLE_APPLICATION = nsIAccessibleRole.ROLE_APPLICATION;
const ROLE_APP_ROOT = nsIAccessibleRole.ROLE_APP_ROOT;
const ROLE_CAPTION = nsIAccessibleRole.ROLE_CAPTION;
const ROLE_CELL = nsIAccessibleRole.ROLE_CELL;
const ROLE_CHROME_WINDOW = nsIAccessibleRole.ROLE_CHROME_WINDOW;
const ROLE_COMBOBOX = nsIAccessibleRole.ROLE_COMBOBOX;
@ -34,6 +35,7 @@ const ROLE_PASSWORD_TEXT = nsIAccessibleRole.ROLE_PASSWORD_TEXT;
const ROLE_PROGRESSBAR = nsIAccessibleRole.ROLE_PROGRESSBAR;
const ROLE_PUSHBUTTON = nsIAccessibleRole.ROLE_PUSHBUTTON;
const ROLE_ROW = nsIAccessibleRole.ROLE_ROW;
const ROLE_ROWHEADER = nsIAccessibleRole.ROLE_ROWHEADER;
const ROLE_SECTION = nsIAccessibleRole.ROLE_SECTION;
const ROLE_SLIDER = nsIAccessibleRole.ROLE_SLIDER;
const ROLE_TABLE = nsIAccessibleRole.ROLE_TABLE;

Просмотреть файл

@ -4,9 +4,190 @@
*
* Required:
* common.js
* role.js
* states.js
*/
/**
* Constants used to describe cells array.
*/
const kDataCell = 1; // Indicates the cell is origin data cell
const kRowHeaderCell = 2; // Indicates the cell is row header cell
const kColHeaderCell = 4; // Indicated teh cell is column header cell
const kOrigin = kDataCell | kRowHeaderCell | kColHeaderCell;
const kRowSpanned = 8; // Indicates the cell is not origin and row spanned
const kColSpanned = 16; // Indicates the cell is not origin and column spanned
const kSpanned = kRowSpanned | kColSpanned;
/**
* Constants to define column header type.
*/
const kNoColumnHeader = 0;
const kListboxColumnHeader = 1;
const kTreeColumnHeader = 2;
/**
* Test table structure and related methods.
*
* @param aIdentifier [in] table accessible identifier
* @param aCellsArray [in] two dimensional array (row X columns) of
* cell types (see constants defined above).
* @param aColHeaderType [in] specifies wether column header cells are
* arranged into the list.
* @param aCaption [in] caption text if any
* @param aSummary [in] summary text if any
*/
function testTableStruct(aIdentifier, aCellsArray, aColHeaderType,
aCaption, aSummary)
{
var tableNode = getNode(aIdentifier);
var isGrid = tableNode.getAttribute("role") == "grid" ||
tableNode.localName == "tree";
var rowCount = aCellsArray.length;
var colsCount = aCellsArray[0].length;
// Test table accessible tree.
var tableObj = {
role: ROLE_TABLE,
children: []
};
// caption accessible handling
if (aCaption) {
var captionObj = {
role: ROLE_CAPTION,
children: [
{
role: ROLE_TEXT_LEAF,
name: aCaption
}
]
};
tableObj.children.push(captionObj);
}
// special types of column headers handling
if (aColHeaderType) {
var headersObj = {
role: ROLE_LIST,
children: []
};
for (var idx = 0; idx < colsCount; idx++) {
var headerCellObj = {
role: ROLE_COLUMNHEADER
};
headersObj.children.push(headerCellObj);
}
if (aColHeaderType == kTreeColumnHeader) {
var columnPickerObj = {
role: ROLE_PUSHBUTTON
};
headersObj.children.push(columnPickerObj);
}
tableObj.children.push(headersObj);
}
// rows and cells accessibles
for (var rowIdx = 0; rowIdx < rowCount; rowIdx++) {
var rowObj = {
role: ROLE_ROW,
children: []
};
for (var colIdx = 0; colIdx < colsCount; colIdx++) {
var celltype = aCellsArray[rowIdx][colIdx];
var role = ROLE_NOTHING;
switch (celltype) {
case kDataCell:
role = (isGrid ? ROLE_GRID_CELL : ROLE_CELL);
break;
case kRowHeaderCell:
role = ROLE_ROWHEADER;
break;
case kColHeaderCell:
role = ROLE_COLUMNHEADER;
break;
}
if (role != ROLE_NOTHING) {
var cellObj = {
role: role
};
rowObj.children.push(cellObj);
}
}
tableObj.children.push(rowObj);
}
testAccessibleTree(aIdentifier, tableObj);
// Test table table interface.
var table = getAccessible(aIdentifier, [nsIAccessibleTable]);
// summary
if (aSummary)
is(table.summary, aSummary,
"Wrong summary of the table " + prettyName(aIdentifier));
// rowCount and columnCount
is(table.rowCount, rowCount,
"Wrong rows count of " + prettyName(aIdentifier));
is(table.columnCount, colsCount,
"Wrong columns count of " + prettyName(aIdentifier));
// rows and columns extents
for (var rowIdx = 0; rowIdx < rowCount; rowIdx++) {
for (var colIdx = 0; colIdx < colsCount; colIdx++) {
var celltype = aCellsArray[rowIdx][colIdx];
if (celltype & kOrigin) {
// table getRowExtentAt
var rowExtent = table.getRowExtentAt(rowIdx, colIdx);
for (var idx = rowIdx + 1;
idx < rowCount && (aCellsArray[idx][colIdx] & kRowSpanned);
idx++);
var expectedRowExtent = idx - rowIdx;
is(rowExtent, expectedRowExtent,
"getRowExtentAt: Wrong number of spanned rows at (" + rowIdx + ", " +
colIdx + ") for " + prettyName(aIdentifier));
// table getColumnExtentAt
var colExtent = table.getColumnExtentAt(rowIdx, colIdx);
for (var idx = colIdx + 1;
idx < colsCount && (aCellsArray[rowIdx][idx] & kColSpanned);
idx++);
var expectedColExtent = idx - colIdx;
is(colExtent, expectedColExtent,
"getColumnExtentAt: Wrong number of spanned columns at (" + rowIdx +
", " + colIdx + ") for " + prettyName(aIdentifier));
// cell rowExtent and columnExtent
var cell = getAccessible(table.getCellAt(rowIdx, colIdx),
[nsIAccessibleTableCell]);
is(cell.rowExtent, expectedRowExtent,
"rowExtent: Wrong number of spanned rows at (" + rowIdx + ", " +
colIdx + ") for " + prettyName(aIdentifier));
is(cell.columnExtent, expectedColExtent,
"columnExtent: Wrong number of spanned column at (" + rowIdx + ", " +
colIdx + ") for " + prettyName(aIdentifier));
}
}
}
}
/**
* Test table indexes.
*
@ -30,16 +211,17 @@ function testTableIndexes(aIdentifier, aIdxes)
for (var colIdx = 0; colIdx < colCount; colIdx++) {
var idx = aIdxes[rowIdx][colIdx];
// cellRefAt
// getCellAt
try {
cellAcc = null;
cellAcc = tableAcc.cellRefAt(rowIdx, colIdx);
cellAcc = tableAcc.getCellAt(rowIdx, colIdx);
} catch (e) { }
ok(idx != -1 && cellAcc || idx == -1 && !cellAcc,
id + ": Can't get cell accessible at row = " + rowIdx + ", column = " + colIdx);
if (idx != - 1) {
// getRowAtIndex
var origRowIdx = rowIdx;
while (origRowIdx > 0 &&
@ -47,13 +229,13 @@ function testTableIndexes(aIdentifier, aIdxes)
origRowIdx--;
try {
obtainedRowIdx = tableAcc.getRowAtIndex(idx);
obtainedRowIdx = tableAcc.getRowIndexAt(idx);
} catch (e) {
ok(false, id + ": can't get row index for cell index " + idx + "," + e);
}
is(obtainedRowIdx, origRowIdx,
id + ": row for index " + idx +" is not correct");
id + ": row for index " + idx +" is not correct");
// getColumnAtIndex
var origColIdx = colIdx;
@ -62,7 +244,7 @@ function testTableIndexes(aIdentifier, aIdxes)
origColIdx--;
try {
obtainedColIdx = tableAcc.getColumnAtIndex(idx);
obtainedColIdx = tableAcc.getColumnIndexAt(idx);
} catch (e) {
ok(false, id + ": can't get column index for cell index " + idx + "," + e);
}
@ -70,27 +252,63 @@ function testTableIndexes(aIdentifier, aIdxes)
is(obtainedColIdx, origColIdx,
id + ": column for index " + idx +" is not correct");
// 'table-cell-index' attribute
if (cellAcc) {
var cellId = prettyName(cellAcc);
cellAcc = getAccessible(cellAcc, [nsIAccessibleTableCell]);
// cell: 'table-cell-index' attribute
var attrs = cellAcc.attributes;
var strIdx = "";
try {
strIdx = attrs.getStringProperty("table-cell-index");
} catch (e) {
ok(false,
id + ": no cell index from object attributes on the cell accessible at index " + idx + ".");
cellId + ": no cell index from object attributes on the cell accessible at index " + idx + ".");
}
if (strIdx) {
is (parseInt(strIdx), idx,
id + ": cell index from object attributes of cell accessible isn't corrent.");
cellId + ": cell index from object attributes of cell accessible isn't corrent.");
}
// cell: table
try {
is(cellAcc.table, tableAcc,
cellId + ": wrong table accessible for the cell.");
} catch (e) {
ok(false,
cellId + ": can't get table accessible from the cell.");
}
// cell: getRowIndex
try {
obtainedRowIdx = cellAcc.rowIndex;
} catch (e) {
ok(false,
cellId + ": can't get row index of the cell at index " + idx + "," + e);
}
is(obtainedRowIdx, origRowIdx,
cellId + ": row for the cell at index " + idx +" is not correct");
// cell: getColumnIndex
try {
obtainedColIdx = cellAcc.columnIndex;
} catch (e) {
ok(false,
cellId + ": can't get column index of the cell at index " + idx + "," + e);
}
is(obtainedColIdx, origColIdx,
id + ": column for the cell at index " + idx +" is not correct");
}
}
// getIndexAt
// getCellIndexAt
try {
obtainedIdx = tableAcc.getIndexAt(rowIdx, colIdx);
obtainedIdx = tableAcc.getCellIndexAt(rowIdx, colIdx);
} catch (e) {
obtainedIdx = -1;
}
@ -101,22 +319,13 @@ function testTableIndexes(aIdentifier, aIdxes)
}
}
/**
* Constants used to describe cells states array. Values 0 and 1 are reserved
* for boolean flag indicating the cell is origin and it is whether unselected
* or selected.
*/
const kRowSpanned = 2; // Indicates the cell is not origin and row spanned
const kColSpanned = 4; // Indicates the cell is not origin and column spanned
const kSpanned = kRowSpanned | kColSpanned;
/**
* Test table getters selection methods.
*
* @param aIdentifier [in] table accessible identifier
* @param aCellsArray [in] two dimensional array (row X columns) of cells
* states (either boolean (selected/unselected) if cell is
* origin, or one of constants defined above).
* origin, otherwise kRowSpanned or kColSpanned constant).
* @param aMsg [in] text appended before every message
*/
function testTableSelection(aIdentifier, aCellsArray, aMsg)
@ -126,7 +335,7 @@ function testTableSelection(aIdentifier, aCellsArray, aMsg)
if (!acc)
return;
var rowsCount = aCellsArray.length;
var rowCount = aCellsArray.length;
var colsCount = aCellsArray[0].length;
// Columns selection tests.
@ -135,7 +344,7 @@ function testTableSelection(aIdentifier, aCellsArray, aMsg)
// isColumnSelected test
for (var colIdx = 0; colIdx < colsCount; colIdx++) {
var isColSelected = true;
for (var rowIdx = 0; rowIdx < rowsCount; rowIdx++) {
for (var rowIdx = 0; rowIdx < rowCount; rowIdx++) {
if (aCellsArray[rowIdx][colIdx] == false) {
isColSelected = false;
break;
@ -151,12 +360,12 @@ function testTableSelection(aIdentifier, aCellsArray, aMsg)
}
// selectedColsCount test
is(acc.selectedColumnsCount, selCols.length,
is(acc.selectedcolumnCount, selCols.length,
msg + "Wrong count of selected columns for " + prettyName(aIdentifier));
// getSelectedColumns test
var actualSelColsCountObj = { value: null };
var actualSelCols = acc.getSelectedColumns(actualSelColsCountObj);
var actualSelCols = acc.getSelectedColumnIndices(actualSelColsCountObj);
var actualSelColsCount = actualSelColsCountObj.value;
is (actualSelColsCount, selCols.length,
@ -172,8 +381,8 @@ function testTableSelection(aIdentifier, aCellsArray, aMsg)
var selRows = new Array();
// isRowSelected test
var selRowsCount = 0;
for (var rowIdx = 0; rowIdx < rowsCount; rowIdx++) {
var selrowCount = 0;
for (var rowIdx = 0; rowIdx < rowCount; rowIdx++) {
var isRowSelected = true;
for (var colIdx = 0; colIdx < colsCount; colIdx++) {
if (aCellsArray[rowIdx][colIdx] == false) {
@ -190,20 +399,20 @@ function testTableSelection(aIdentifier, aCellsArray, aMsg)
selRows.push(rowIdx);
}
// selectedRowsCount test
is(acc.selectedRowsCount, selRows.length,
// selectedrowCount test
is(acc.selectedrowCount, selRows.length,
msg + "Wrong count of selected rows for " + prettyName(aIdentifier));
// getSelectedRows test
var actualSelRowsCountObj = { value: null };
var actualSelRows = acc.getSelectedRows(actualSelRowsCountObj);
var actualSelrowCountObj = { value: null };
var actualSelRows = acc.getSelectedRowIndices(actualSelrowCountObj);
var actualSelRowsCount = actualSelRowsCountObj.value;
is (actualSelRowsCount, selRows.length,
var actualSelrowCount = actualSelrowCountObj.value;
is (actualSelrowCount, selRows.length,
msg + "Wrong count of selected rows for " + prettyName(aIdentifier) +
"from getSelectedRows.");
for (var i = 0; i < actualSelRowsCount; i++) {
for (var i = 0; i < actualSelrowCount; i++) {
is (actualSelRows[i], selRows[i],
msg + "Row at index " + selRows[i] + " should be selected.");
}
@ -212,9 +421,9 @@ function testTableSelection(aIdentifier, aCellsArray, aMsg)
var selCells = new Array();
// isCellSelected test
for (var rowIdx = 0; rowIdx < rowsCount; rowIdx++) {
for (var rowIdx = 0; rowIdx < rowCount; rowIdx++) {
for (var colIdx = 0; colIdx < colsCount; colIdx++) {
if (!isOrigCell(aCellsArray[rowIdx][colIdx]))
if (aCellsArray[rowIdx][colIdx] & kSpanned)
continue;
is(acc.isCellSelected(rowIdx, colIdx), aCellsArray[rowIdx][colIdx],
@ -222,35 +431,54 @@ function testTableSelection(aIdentifier, aCellsArray, aMsg)
colIdx + " column for " + prettyName(aIdentifier));
if (aCellsArray[rowIdx][colIdx])
selCells.push(acc.getIndexAt(rowIdx, colIdx));
selCells.push(acc.getCellIndexAt(rowIdx, colIdx));
}
}
// selectedCellsCount tests
is(acc.selectedCellsCount, selCells.length,
// selectedCellCount tests
is(acc.selectedCellCount, selCells.length,
msg + "Wrong count of selected cells for " + prettyName(aIdentifier));
// getSelectedCells test
// getSelectedCellIndices test
var actualSelCellsCountObj = { value: null };
var actualSelCells = acc.getSelectedCells(actualSelCellsCountObj);
var actualSelCells = acc.getSelectedCellIndices(actualSelCellsCountObj);
var actualSelCellsCount = actualSelCellsCountObj.value;
is (actualSelCellsCount, selCells.length,
msg + "Wrong count of selected cells for " + prettyName(aIdentifier) +
"from getSelectedCells.");
is(actualSelCellsCount, selCells.length,
msg + "Wrong count of selected cells for " + prettyName(aIdentifier) +
"from getSelectedCells.");
for (var i = 0; i < actualSelCellsCount; i++) {
is (actualSelCells[i], selCells[i],
msg + "Cell at index " + selCells[i] + " should be selected.");
is(actualSelCells[i], selCells[i],
msg + "getSelectedCellIndices: Cell at index " + selCells[i] +
" should be selected.");
}
// selectedCells and isSelected tests
var actualSelCellsArray = acc.selectedCells;
for (var i = 0; i < actualSelCellsCount; i++) {
var actualSelCellAccessible =
actualSelCellsArray.queryElementAt(i, nsIAccessibleTableCell);
var colIdx = acc.getColumnIndexAt(selCells[i]);
var rowIdx = acc.getRowIndexAt(selCells[i]);
var expectedSelCellAccessible = acc.getCellAt(rowIdx, colIdx);
ok(actualSelCellAccessible, expectedSelCellAccessible,
msg + "getSelectedCells: Cell at index " + selCells[i] +
" should be selected.");
ok(actualSelCellAccessible.isSelected(),
"isSelected: Cell at index " + selCells[i] + " should be selected.");
}
// selected states tests
for (var rowIdx = 0; rowIdx < rowsCount; rowIdx++) {
for (var rowIdx = 0; rowIdx < rowCount; rowIdx++) {
for (var colIdx = 0; colIdx < colsCount; colIdx++) {
if (!isOrigCell(aCellsArray[rowIdx][colIdx]))
if (aCellsArray[rowIdx][colIdx] & kSpanned)
continue;
var cell = acc.cellRefAt(rowIdx, colIdx);
var cell = acc.getCellAt(rowIdx, colIdx);
var isSel = aCellsArray[rowIdx][colIdx];
if (isSel)
testStates(cell, STATE_SELECTED);
@ -269,8 +497,8 @@ function testUnselectTableColumn(aIdentifier, aColIdx, aCellsArray)
if (!acc)
return;
var rowsCount = aCellsArray.length;
for (var rowIdx = 0; rowIdx < rowsCount; rowIdx++) {
var rowCount = aCellsArray.length;
for (var rowIdx = 0; rowIdx < rowCount; rowIdx++) {
var cellState = aCellsArray[rowIdx][aColIdx];
// Unselect origin cell.
var [origRowIdx, origColIdx] =
@ -292,15 +520,15 @@ function testSelectTableColumn(aIdentifier, aColIdx, aCellsArray)
if (!acc)
return;
var rowsCount = aCellsArray.length;
var rowCount = aCellsArray.length;
var colsCount = aCellsArray[0].length;
for (var rowIdx = 0; rowIdx < rowsCount; rowIdx++) {
for (var rowIdx = 0; rowIdx < rowCount; rowIdx++) {
for (var colIdx = 0; colIdx < colsCount; colIdx++) {
var cellState = aCellsArray[rowIdx][colIdx];
if (colIdx == aColIdx) { // select target column
if (isOrigCell(cellState)) {
if (!(cellState & kSpanned)) {
// Select the cell if it is origin.
aCellsArray[rowIdx][colIdx] = true;
@ -311,13 +539,13 @@ function testSelectTableColumn(aIdentifier, aColIdx, aCellsArray)
aCellsArray[origRowIdx][origColIdx] = true;
}
} else if (isOrigCell(cellState)) { // unselect other columns
} else if (!(cellState & kSpanned)) { // unselect other columns
if (colIdx > aColIdx) {
// Unselect the cell if traversed column index is greater than column
// index of target cell.
aCellsArray[rowIdx][colIdx] = false;
} else if (!isColSpannedCell(aCellsArray[rowIdx][aColIdx])) {
} else if (!(aCellsArray[rowIdx][aColIdx] & kColSpanned)) {
// Unselect the cell if the target cell is not row spanned.
aCellsArray[rowIdx][colIdx] = false;
@ -326,7 +554,7 @@ function testSelectTableColumn(aIdentifier, aColIdx, aCellsArray)
for (var spannedColIdx = colIdx + 1; spannedColIdx < aColIdx;
spannedColIdx++) {
var spannedCellState = aCellsArray[rowIdx][spannedColIdx];
if (!isRowSpannedCell(spannedCellState)) {
if (!(spannedCellState & kRowSpanned)) {
aCellsArray[rowIdx][colIdx] = false;
break;
}
@ -372,15 +600,15 @@ function testSelectTableRow(aIdentifier, aRowIdx, aCellsArray)
if (!acc)
return;
var rowsCount = aCellsArray.length;
var rowCount = aCellsArray.length;
var colsCount = aCellsArray[0].length;
for (var rowIdx = 0; rowIdx < rowsCount; rowIdx++) {
for (var rowIdx = 0; rowIdx < rowCount; rowIdx++) {
for (var colIdx = 0; colIdx < colsCount; colIdx++) {
var cellState = aCellsArray[rowIdx][colIdx];
if (rowIdx == aRowIdx) { // select the given row
if (isOrigCell(cellState)) {
if (!(cellState & kSpanned)) {
// Select the cell if it is origin.
aCellsArray[rowIdx][colIdx] = true;
@ -392,13 +620,13 @@ function testSelectTableRow(aIdentifier, aRowIdx, aCellsArray)
aCellsArray[origRowIdx][origColIdx] = true;
}
} else if (isOrigCell(cellState)) { // unselect other rows
} else if (!(cellState & kSpanned)) { // unselect other rows
if (rowIdx > aRowIdx) {
// Unselect the cell if traversed row index is greater than row
// index of target cell.
aCellsArray[rowIdx][colIdx] = false;
} else if (!isRowSpannedCell(aCellsArray[aRowIdx][colIdx])) {
} else if (!(aCellsArray[aRowIdx][colIdx] & kRowSpanned)) {
// Unselect the cell if the target cell is not row spanned.
aCellsArray[rowIdx][colIdx] = false;
@ -407,7 +635,7 @@ function testSelectTableRow(aIdentifier, aRowIdx, aCellsArray)
for (var spannedRowIdx = rowIdx + 1; spannedRowIdx < aRowIdx;
spannedRowIdx++) {
var spannedCellState = aCellsArray[spannedRowIdx][colIdx];
if (!isRowSpannedCell(spannedCellState)) {
if (!(spannedCellState & kRowSpanned)) {
aCellsArray[rowIdx][colIdx] = false;
break;
}
@ -422,6 +650,59 @@ function testSelectTableRow(aIdentifier, aRowIdx, aCellsArray)
"Select " + aRowIdx + " row: ");
}
/**
* Test columnHeaderCells and rowHeaderCells of accessible table.
*/
function testHeaderCells(aHeaderInfoMap)
{
for (var testIdx = 0; testIdx < aHeaderInfoMap.length; testIdx++) {
var dataCellIdentifier = aHeaderInfoMap[testIdx].cell;
var dataCell = getAccessible(dataCellIdentifier, [nsIAccessibleTableCell]);
// row header cells
var rowHeaderCells = aHeaderInfoMap[testIdx].rowHeaderCells;
var rowHeaderCellsCount = rowHeaderCells.length;
var actualRowHeaderCells = dataCell.rowHeaderCells;
var actualRowHeaderCellsCount = actualRowHeaderCells.length;
is(actualRowHeaderCellsCount, rowHeaderCellsCount,
"Wrong number of row header cells for the cell " +
prettyName(dataCellIdentifier));
if (actualRowHeaderCellsCount == rowHeaderCellsCount) {
for (var idx = 0; idx < rowHeaderCellsCount; idx++) {
var rowHeaderCell = getAccessible(rowHeaderCells[idx]);
var actualRowHeaderCell =
actualRowHeaderCells.queryElementAt(idx, nsIAccessible);
ok(actualRowHeaderCell, rowHeaderCell,
"Wrong row header cell at index " + idx + " for the cell " +
prettyName(rowHeaderCells[idx]));
}
}
// column header cells
var colHeaderCells = aHeaderInfoMap[testIdx].columnHeaderCells;
var colHeaderCellsCount = colHeaderCells.length;
var actualColHeaderCells = dataCell.columnHeaderCells;
var actualColHeaderCellsCount = actualColHeaderCells.length;
is(actualColHeaderCellsCount, colHeaderCellsCount,
"Wrong number of column header cells for the cell " +
prettyName(dataCellIdentifier));
if (actualColHeaderCellsCount == colHeaderCellsCount) {
for (var idx = 0; idx < colHeaderCellsCount; idx++) {
var colHeaderCell = getAccessible(colHeaderCells[idx]);
var actualColHeaderCell =
actualColHeaderCells.queryElementAt(idx, nsIAccessible);
ok(actualColHeaderCell, colHeaderCell,
"Wrong column header cell at index " + idx + " for the cell " +
prettyName(colHeaderCells[idx]));
}
}
}
}
////////////////////////////////////////////////////////////////////////////////
// private implementation
@ -433,20 +714,20 @@ function getOrigRowAndColumn(aCellsArray, aRowIdx, aColIdx)
var cellState = aCellsArray[aRowIdx][aColIdx];
var origRowIdx = aRowIdx, origColIdx = aColIdx;
if (isRowSpannedCell(cellState)) {
if (cellState & kRowSpanned) {
for (var prevRowIdx = aRowIdx - 1; prevRowIdx >= 0; prevRowIdx--) {
var prevCellState = aCellsArray[prevRowIdx][aColIdx];
if (!isRowSpannedCell(prevCellState)) {
if (!(prevCellState & kRowSpanned)) {
origRowIdx = prevRowIdx;
break;
}
}
}
if (isColSpannedCell(cellState)) {
if (cellState & kColSpanned) {
for (var prevColIdx = aColIdx - 1; prevColIdx >= 0; prevColIdx--) {
var prevCellState = aCellsArray[aRowIdx][prevColIdx];
if (!isColSpannedCell(prevCellState)) {
if (!(prevCellState & kColSpanned)) {
origColIdx = prevColIdx;
break;
}
@ -455,18 +736,3 @@ function getOrigRowAndColumn(aCellsArray, aRowIdx, aColIdx)
return [origRowIdx, origColIdx];
}
function isOrigCell(aCellState)
{
return !(aCellState & (kRowSpanned | kColSpanned));
}
function isRowSpannedCell(aCellState)
{
return aCellState & kRowSpanned;
}
function isColSpannedCell(aCellState)
{
return aCellState & kColSpanned;
}

Просмотреть файл

@ -1,146 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<title>ARIA grid based on HTML table tests</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<style>
td:focus {
background-color: lightblue;
}
th {
-moz-box-align: center;
-moz-box-pack: center;
border: 2px solid;
-moz-border-top-colors: ThreeDHighlight ThreeDLightShadow;
-moz-border-right-colors: ThreeDDarkShadow ThreeDShadow;
-moz-border-bottom-colors: ThreeDDarkShadow ThreeDShadow;
-moz-border-left-colors: ThreeDHighlight ThreeDLightShadow;
background-color: -moz-Dialog;
color: -moz-DialogText;
padding: 0px 4px;
}
</style>
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/grid.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
<script type="application/javascript">
var gGrid = null;
function doTest()
{
gGrid = new grid("grid");
// Test accessible hierarchy of ARIA grid.
var accTree = {
role: ROLE_TABLE,
children: [
{
role: ROLE_TEXT_CONTAINER, // thead
children: [
{
role: ROLE_ROW,
children: [
{
role: ROLE_COLUMNHEADER
},
{
role: ROLE_COLUMNHEADER
},
{
role: ROLE_COLUMNHEADER
}
]
}
]
},
{
role: ROLE_TEXT_CONTAINER, // tbody
children: [
{
role: ROLE_ROW,
children: [
{
role: ROLE_GRID_CELL
},
{
role: ROLE_GRID_CELL
},
{
role: ROLE_GRID_CELL
}
]
},
{
role: ROLE_ROW,
children: [
{
role: ROLE_GRID_CELL
},
{
role: ROLE_GRID_CELL
},
{
role: ROLE_GRID_CELL
}
]
}
]
}
]
};
if (LINUX)
todo(false, "No tests on linux because of different hierarchies.");
else
testAccessibleTree("grid", accTree);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=491683"
title="ARIA grid based on HTML table">Mozilla Bug 491683</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<table role="grid" id="grid" border="1" cellpadding="10" cellspacing="0">
<thead>
<tr role="row">
<th role="columnheader">subject</td>
<th role="columnheader">sender</th>
<th role="columnheader">date</th>
</tr>
</thead>
<tbody>
<tr role="row">
<td role="gridcell" tabindex="0">about everything</td>
<td role="gridcell">president</td>
<td role="gridcell">today</td>
</tr>
<tr role="row">
<td role="gridcell">new bugs</td>
<td role="gridcell">mozilla team</td>
<td role="gridcell">today</td>
</tr>
</tbody>
</table>
</body>
</html>

Просмотреть файл

@ -50,7 +50,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=469688
"landmarked table should have nsIAccessibleTable");
if (accessibleTable)
is(accessibleTable.cellRefAt(0,0).firstChild.name, "hi", "no cell");
is(accessibleTable.getCellAt(0,0).firstChild.name, "hi", "no cell");
}
// test gEmptyRoleMap

Просмотреть файл

@ -0,0 +1,76 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="XUL listbox element test.">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
<script type="application/javascript">
<![CDATA[
function doTest()
{
var id = "";
var listbox = null, acc = null;
//////////////////////////////////////////////////////////////////////////
// Simple listbox. There is no nsIAccessibleTable interface.
id = "listbox1";
acc = getAccessible(id);
// query nsIAccessibleTable
try {
acc.QueryInterface(nsIAccessibleTable);
ok(false,
id + " shouldn't implement nsIAccessibleTable interface.");
} catch(e) {
ok(true, id + " doesn't implement nsIAccessibleTable interface.");
}
// role
testRole(id, ROLE_LISTBOX);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(doTest);
]]>
</script>
<hbox style="overflow: auto;">
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=418371"
title="implement the rest of methods of nsIAccessibleTable on xul:listbox">
Mozilla Bug 418371
</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<vbox flex="1">
<label control="listbox1" value="listbox: "/>
<listbox id="listbox1">
<listitem label="item1" id="item1"/>
<listitem label="item2" id="item2"/>
</listbox>
</vbox>
</hbox>
</window>

Просмотреть файл

@ -1,117 +0,0 @@
<!DOCTYPE html>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=483573
-->
<head>
<title>File Input Control tests</title>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
<script type="application/javascript">
function doTest()
{
var accTree = {
role: ROLE_TABLE, // table
children: [
{
role: ROLE_TEXT_CONTAINER, // thead
children: [
{
role: ROLE_ROW,
children: [
{
role: ROLE_COLUMNHEADER
},
{
role: ROLE_COLUMNHEADER
}
]
}
]
},
{
role: ROLE_TEXT_CONTAINER, // tbody
children: [
{
role: ROLE_ROW,
children: [
{
role: ROLE_CELL
},
{
role: ROLE_CELL
}
]
}
]
},
{
role: ROLE_TEXT_CONTAINER, // tfoot
children: [
{
role: ROLE_ROW,
children: [
{
role: ROLE_COLUMNHEADER
},
{
role: ROLE_COLUMNHEADER
}
]
}
]
}
]
};
if (LINUX)
todo(false, "No tests on linux because of different hierarchies.");
else
testAccessibleTree("table", accTree);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
title="create accessibles for HTML tr"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=493695">Mozilla Bug 493695</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<table id="table">
<thead>
<tr>
<th>col1</th><th>col2</th>
</tr>
</thead>
<tbody>
<tr>
<td>cell1</td><td>cell2</td>
</tr>
</tbody>
<tfoot>
<tr>
<th>col1</th><th>col2</th>
</tr>
</tfoot>
</table>
</body>
</html>

Просмотреть файл

@ -26,7 +26,7 @@
////////////////////////////////////////////////////////////////////////////
// Accessible tree testers
function getTreeItemAccTree(aTableRole, aColumnsCount)
function getTreeItemAccTree(aTableRole, acolumnCount)
{
var treeItemRole;
switch (aTableRole) {
@ -47,7 +47,7 @@
};
if (aTableRole == ROLE_TABLE || aTableRole == ROLE_TREE_TABLE) {
for (var idx = 0; idx < aColumnsCount; idx++) {
for (var idx = 0; idx < acolumnCount; idx++) {
var cellAccTree = {
role: ROLE_GRID_CELL,
children: []
@ -75,15 +75,15 @@
var treeBoxObject = aTree.treeBoxObject;
var view = treeBoxObject.view;
var columnsCount = treeBoxObject.columns.count;
var columnCount = treeBoxObject.columns.count;
for (var idx = 0; idx < columnsCount; idx++)
for (var idx = 0; idx < columnCount; idx++)
accTreeForColumns.children.push({ role: ROLE_COLUMNHEADER, children: []});
if (!aTree.hasAttribute("hidecolumnpicker"))
accTreeForColumns.children.push({ role: ROLE_PUSHBUTTON, children: []});
for (var idx = 0; idx < view.rowCount; idx++)
accTreeForTree.children.push(getTreeItemAccTree(aRole, columnsCount));
accTreeForTree.children.push(getTreeItemAccTree(aRole, columnCount));
testAccessibleTree(aTree, accTreeForTree);
}

Просмотреть файл

@ -112,7 +112,7 @@
var acc = getAccessible(gTree);
var tableAcc = getAccessible(acc, [nsIAccessibleTable]);
return tableAcc.cellRefAt(aRow, aCol);
return tableAcc.getCellAt(aRow, aCol);
}
this.getID = function getID()
{

Просмотреть файл

@ -1,112 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/relations.js"></script>
<script type="application/javascript">
function doTest()
{
//////////////////////////////////////////////////////////////////////////
// relations from markup
// 'description_for' relations for column headers
testRelation("table1_0", RELATION_DESCRIPTION_FOR,
["table1_3", "table1_6"]);
testRelation("table1_1", RELATION_DESCRIPTION_FOR,
["table1_4", "table1_7"]);
testRelation("table1_2", RELATION_DESCRIPTION_FOR,
["table1_5", "table1_8"]);
// 'description_for' relations for row headers
testRelation("table1_3", RELATION_DESCRIPTION_FOR,
["table1_4", "table1_5"]);
testRelation("table1_6", RELATION_DESCRIPTION_FOR,
["table1_7", "table1_8"]);
// 'described_by' relations for cells
testRelation("table1_4", RELATION_DESCRIBED_BY,
["table1_1", "table1_3"]);
testRelation("table1_5", RELATION_DESCRIBED_BY,
["table1_2", "table1_3"]);
testRelation("table1_7", RELATION_DESCRIBED_BY,
["table1_1", "table1_6"]);
testRelation("table1_8", RELATION_DESCRIBED_BY,
["table1_2", "table1_6"]);
//////////////////////////////////////////////////////////////////////////
// relations from @headers
// 'description_for' relations for column headers
testRelation("table2_3", RELATION_DESCRIPTION_FOR,
["table2_0"]);
testRelation("table2_4", RELATION_DESCRIPTION_FOR,
["table2_1"]);
// 'description_by' relations for cells
testRelation("table2_0", RELATION_DESCRIBED_BY,
["table2_3"]);
testRelation("table2_1", RELATION_DESCRIBED_BY,
["table2_4"]);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id="
title="">Mozilla Bug </a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<table id="table1">
<thead>
<tr>
<th id="table1_0">col1</th>
<th id="table1_1">col2</th>
<td id="table1_2" scope="col">col3</td>
</tr>
</thead>
<tbody>
<tr>
<th id="table1_3">row1</th>
<td id="table1_4">cell1</td>
<td id="table1_5">cell2</td>
</tr>
<tr>
<td id="table1_6" scope="row">row2</td>
<td id="table1_7">cell3</td>
<td id="table1_8">cell4</td>
</tr>
</tbody>
</table>
<table id="table2">
<tr>
<td id="table2_0" headers="table2_3">cell1</td>
<td id="table2_1" headers="table2_4">cell2</td>
</tr>
<tr>
<td id="table2_3" scope="col">col1</td>
<td id="table2_4" scope="col">col2</td>
</tr>
</table>
</body>
</html>

Просмотреть файл

@ -16,16 +16,6 @@
function doTest()
{
var accTable = getAccessible("table", [nsIAccessibleTable]);
var caption = accTable.caption;
is(caption.firstChild.name, "Test Table", "wrong text inside caption");
is(caption.children.queryElementAt(0, nsIAccessible).name, "Test Table",
"wrong text inside caption");
is(accTable.summary, "this is a test table for nsIAccessibleTable",
"wrong summary on table");
is(accTable.columns, 4, "wrong number of columns");
is(accTable.rows, 3, "wrong number of rows");
var s = window.getSelection();
if (s.rangeCount > 0)
@ -36,14 +26,14 @@ function doTest()
range.selectNode(cell);
s.addRange(range);
is(accTable.selectedCellsCount, 1, "only one cell selected");
is(accTable.selectedCellCount, 1, "only one cell selected");
cell = getNode("col2a");
range.selectNode(cell);
s.addRange(range);
cell = getNode("col2c");
range.selectNode(cell);
s.addRange(range);
is(accTable.selectedColumnsCount, 1, "only one column selected");
is(accTable.selectedcolumnCount, 1, "only one column selected");
cell = getNode("row2a");
range.selectNode(cell);
s.addRange(range);
@ -54,30 +44,7 @@ function doTest()
range.selectNode(cell);
s.addRange(range);
is(accTable.selectedRowsCount, 1, "no cells selected");
var rowheader;
var works = true;
try {
rowheader = accTable.rowHeader;
}
catch (e) {
works = false;
}
todo(works, "rowHeader should not throw");
var columnHeader;
works = true;
try {
columnHeader = accTable.columnHeader;
columnHeaderIndex = columnHeader.getIndexAt(0, 2);
is(columnHeaderIndex, 2, "columnheaderindex is wrong");
}
catch (e) {
works = false;
}
if (!works)
todo(works, "columnHeader should not throw");
is(accTable.selectedrowCount, 1, "no cells selected");
var columnDescription;
works = true;

Просмотреть файл

@ -1,91 +0,0 @@
<!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<title> nsIAccessibleTable Interface Test Case </title>
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
<script type="text/javascript">
function doTest()
{
// bug 410052
var accTable = getAccessible("table", [nsIAccessibleTable]);
is(accTable.getIndexAt(2,4), 17, "wrong index returned");
is(accTable.getColumnExtentAt(2,2), 2, "colspan wrong");
is(accTable.getColumnExtentAt(0,3), 2, "colspan wrong");
is(accTable.getColumnExtentAt(3,5), 1, "colspan");
is(accTable.getRowExtentAt(0,7), 4, "rowspan wrong");
is(accTable.getRowExtentAt(2,7), 4,"rowspan wrong");
is(accTable.getColumnExtentAt(2,3), 1, "colspan wrong");
is(accTable.cellRefAt(2,1).firstChild.name, "c1", "wrong cell");
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=410052">Mozilla Bug 410052</a>
<br>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=417912"
title="GetCellDataAt callers that expect an error if no cell is found are wrong">
Mozilla Bug 417912
</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<!-- Test Table -->
<br><br><b> Testing Table:</b><br><br>
<center>
<table cellpadding="2" cellspacing="2" border="1" width="50%" id="table">
<tbody>
<tr>
<td><br></td>
<td><br></td>
<td rowspan="1" colspan="2"><br></td>
<td><br></td>
<td><br></td>
<td><br></td>
<td rowspan="4" colspan="1"><br></td>
</tr>
<tr>
<td><br></td>
<td><br></td>
<td><br></td>
<td><br></td>
<td><br></td>
<td><br></td>
<td><br></td>
</tr>
<tr>
<td><br></td>
<td rowspan="2" colspan="2">c1</td>
<td><br></td>
<td><br></td>
<td rowspan="2" colspan="1"><br></td>
<td><br></td>
</tr>
<tr>
<td><br></td>
<td><br></td>
<td><br></td>
<td><br></td>
</tr>
</tbody>
</table>
</center>
</body>
</html>

Просмотреть файл

@ -44,8 +44,8 @@ function doTest()
if (tableInterfaceExposed) {
testRole(accTable3, ROLE_ALERT);
is(accTable3.cellRefAt(0,0).firstChild.name, "cell0", "wrong cell");
is(accTable3.cellRefAt(0,1).firstChild.name, "cell1", "wrong cell");
is(accTable3.getCellAt(0,0).firstChild.name, "cell0", "wrong cell");
is(accTable3.getCellAt(0,1).firstChild.name, "cell1", "wrong cell");
}
// Test table with role=log and aria property in tr. We create accessible for
@ -62,10 +62,10 @@ function doTest()
testRole(accTable4, ROLE_TABLE);
is(accTable4.cellRefAt(0,0).firstChild.name, "cell0", "wrong cell");
is(accTable4.cellRefAt(0,1).firstChild.name, "cell1", "wrong cell");
is(accTable4.cellRefAt(1,0).firstChild.name, "cell2", "wrong cell");
is(accTable4.cellRefAt(1,1).firstChild.name, "cell3", "wrong cell");
is(accTable4.getCellAt(0,0).firstChild.name, "cell0", "wrong cell");
is(accTable4.getCellAt(0,1).firstChild.name, "cell1", "wrong cell");
is(accTable4.getCellAt(1,0).firstChild.name, "cell2", "wrong cell");
is(accTable4.getCellAt(1,1).firstChild.name, "cell3", "wrong cell");
}
// Test table with display:inline and an outside table. We shouldn't be fooled

Просмотреть файл

@ -0,0 +1,204 @@
<!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<title>Table header information cells for HTML table</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/table.js"></script>
<script type="application/javascript">
function doTest()
{
//////////////////////////////////////////////////////////////////////////
// column header from thead and row header from @scope inside of tfoot
var headerInfoMap = [
{
cell: "table1_cell_1",
rowHeaderCells: [],
columnHeaderCells: [ "table1_weekday", "table1_date" ]
},
{
cell: "table1_cell_2",
rowHeaderCells: [],
columnHeaderCells: [ "table1_day", "table1_date" ]
},
{
cell: "table1_cell_3",
rowHeaderCells: [],
columnHeaderCells: [ "table1_qty" ]
},
{
cell: "table1_cell_4",
rowHeaderCells: [],
columnHeaderCells: [ "table1_weekday", "table1_date" ]
},
{
cell: "table1_cell_5",
rowHeaderCells: [],
columnHeaderCells: [ "table1_day", "table1_date" ]
},
{
cell: "table1_cell_6",
rowHeaderCells: [],
columnHeaderCells: [ "table1_qty" ]
},
{
cell: "table1_cell_7",
rowHeaderCells: [ "table1_total" ],
columnHeaderCells: [ "table1_qty" ]
}
];
testHeaderCells(headerInfoMap);
//////////////////////////////////////////////////////////////////////////
// column and row headers from thead and @scope
headerInfoMap = [
{
cell: "table2_cell_2",
rowHeaderCells: [ "table2_rh_1" ],
columnHeaderCells: [ "table2_ch_2" ]
},
{
cell: "table2_cell_3",
rowHeaderCells: [ "table2_rh_1" ],
columnHeaderCells: [ "table2_ch_3" ]
},
{
cell: "table2_cell_5",
rowHeaderCells: [ "table2_rh_2" ],
columnHeaderCells: [ "table2_ch_2" ]
},
{
cell: "table2_cell_6",
rowHeaderCells: [ "table2_rh_2" ],
columnHeaderCells: [ "table2_ch_3" ]
},
{
cell: "table2_rh_1",
rowHeaderCells: [],
columnHeaderCells: [ "table2_ch_1" ]
},
{
cell: "table2_rh_2",
rowHeaderCells: [],
columnHeaderCells: [ "table2_ch_1" ]
}
];
testHeaderCells(headerInfoMap);
//////////////////////////////////////////////////////////////////////////
// column headers from @headers
headerInfoMap = [
{
cell: "table3_cell_1",
rowHeaderCells: [],
columnHeaderCells: [ "table3_ch_1" ]
},
{
cell: "table3_cell_2",
rowHeaderCells: [],
columnHeaderCells: [ "table3_ch_2" ]
}
];
testHeaderCells(headerInfoMap);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
title="implement IAccessibleTable2"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=512424">Mozilla Bug 512424</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<table id="table1" border="1">
<thead>
<tr>
<th id="table1_date" colspan="2">Date</th>
<th id="table1_qty" rowspan="2">Qty</th>
</tr>
<tr>
<th id="table1_weekday">Weekday</th>
<th id="table1_day">Day</th>
</tr>
</thead>
<tbody>
<tr>
<td id="table1_cell_1">Mon</td>
<td id="table1_cell_2">1</td>
<td id="table1_cell_3">20</td>
</tr>
<tr>
<td id="table1_cell_4">Thu</td>
<td id="table1_cell_5">2</td>
<td id="table1_cell_6">15</td>
</tr>
</tbody>
<tfoot>
<tr>
<th id="table1_total" scope="row" colspan="2">Total</th>
<td id="table1_cell_7">35</td>
</tr>
</tfoot>
</table>
<table id="table2" border="1">
<thead>
<tr>
<th id="table2_ch_1">col1</th>
<th id="table2_ch_2">col2</th>
<td id="table2_ch_3" scope="col">col3</td>
</tr>
</thead>
<tbody>
<tr>
<th id="table2_rh_1">row1</th>
<td id="table2_cell_2">cell1</td>
<td id="table2_cell_3">cell2</td>
</tr>
<tr>
<td id="table2_rh_2" scope="row">row2</td>
<td id="table2_cell_5">cell3</td>
<td id="table2_cell_6">cell4</td>
</tr>
</tbody>
</table>
<table id="table3" border="1">
<tr>
<td id="table3_cell_1" headers="table3_ch_1">cell1</td>
<td id="table3_cell_2" headers="table3_ch_2">cell2</td>
</tr>
<tr>
<td id="table3_ch_1" scope="col">col1</td>
<td id="table3_ch_2" scope="col">col2</td>
</tr>
</table>
</body>
</html>

Просмотреть файл

@ -0,0 +1,98 @@
<!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<title>Table header information cells for ARIA grid</title>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/table.js"></script>
<script type="application/javascript">
function doTest()
{
//////////////////////////////////////////////////////////////////////////
// column and row headers from markup
headerInfoMap = [
{
cell: "table_dc_1",
rowHeaderCells: [ "table_rh_1" ],
columnHeaderCells: [ "table_ch_2" ]
},
{
cell: "table_dc_2",
rowHeaderCells: [ "table_rh_1" ],
columnHeaderCells: [ "table_ch_3" ]
},
{
cell: "table_dc_3",
rowHeaderCells: [ "table_rh_2" ],
columnHeaderCells: [ "table_ch_2" ]
},
{
cell: "table_dc_4",
rowHeaderCells: [ "table_rh_2" ],
columnHeaderCells: [ "table_ch_3" ]
},
{
cell: "table_rh_1",
rowHeaderCells: [],
columnHeaderCells: [ "table_ch_1" ]
},
{
cell: "table_rh_2",
rowHeaderCells: [],
columnHeaderCells: [ "table_ch_1" ]
},
];
testHeaderCells(headerInfoMap);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
title="implement IAccessibleTable2"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=512424">Mozilla Bug 512424</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<div id="table" role="grid">
<div role="row">
<span id="table_ch_1" role="columnheader">col_1</span>
<span id="table_ch_2" role="columnheader">col_2</span>
<span id="table_ch_3" role="columnheader">col_3</span>
</div>
<div role="row">
<span id="table_rh_1" role="rowheader">row_1</span>
<span id="table_dc_1" role="gridcell">cell1</span>
<span id="table_dc_2" role="gridcell">cell2</span>
</div>
<div role="row">
<span id="table_rh_2" role="rowheader">row_2</span>
<span id="table_dc_3" role="gridcell">cell3</span>
<span id="table_dc_4" role="gridcell">cell4</span>
</div>
</div>
</body>
</html>

Просмотреть файл

@ -0,0 +1,196 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Table header information cells for XUL listbox">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/table.js"></script>
<script type="application/javascript">
<![CDATA[
function doTest()
{
//////////////////////////////////////////////////////////////////////////
// XUL listbox
var headerInfoMap = [
{
cell: "lb1_cell0",
rowHeaderCells: [],
columnHeaderCells: [ "lb1_header1" ]
},
{
cell: "lb1_cell1",
rowHeaderCells: [],
columnHeaderCells: [ "lb1_header2" ]
},
{
cell: "lb1_cell2",
rowHeaderCells: [],
columnHeaderCells: [ "lb1_header3" ]
},
{
cell: "lb1_cell3",
rowHeaderCells: [],
columnHeaderCells: [ "lb1_header1" ]
},
{
cell: "lb1_cell4",
rowHeaderCells: [],
columnHeaderCells: [ "lb1_header2" ]
},
{
cell: "lb1_cell5",
rowHeaderCells: [],
columnHeaderCells: [ "lb1_header3" ]
},
];
testHeaderCells(headerInfoMap);
//////////////////////////////////////////////////////////////////////////
// XUL listbox with ARIA
headerInfoMap = [
{
cell: "lb2_cell0",
rowHeaderCells: [],
columnHeaderCells: []
},
{
cell: "lb2_cell1",
rowHeaderCells: [],
columnHeaderCells: []
},
{
cell: "lb2_cell2",
rowHeaderCells: [],
columnHeaderCells: []
},
{
cell: "lb2_cell3",
rowHeaderCells: [],
columnHeaderCells: [ "lb2_cell0" ]
},
{
cell: "lb2_cell4",
rowHeaderCells: [ "lb2_cell3" ],
columnHeaderCells: [ "lb2_cell1" ]
},
{
cell: "lb2_cell5",
rowHeaderCells: [ "lb2_cell3" ],
columnHeaderCells: [ "lb2_cell2" ]
},
{
cell: "lb2_cell6",
rowHeaderCells: [],
columnHeaderCells: [ "lb2_cell0" ]
},
{
cell: "lb2_cell7",
rowHeaderCells: [ "lb2_cell6" ],
columnHeaderCells: [ "lb2_cell1" ]
},
{
cell: "lb2_cell8",
rowHeaderCells: [ "lb2_cell6" ],
columnHeaderCells: [ "lb2_cell2" ]
}
];
testHeaderCells(headerInfoMap);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(doTest);
]]>
</script>
<hbox style="overflow: auto;">
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=512424"
title="implement IAccessibleTable2">
Mozilla Bug 512424
</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<vbox flex="1">
<label control="listbox" value="multicolumn listbox with header"/>
<listbox id="listbox">
<listhead>
<listheader id="lb1_header1" label="header1"/>
<listheader id="lb1_header2" label="header2"/>
<listheader id="lb1_header3" label="header3"/>
</listhead>
<listcols>
<listcol flex="1"/>
<listcol flex="1"/>
<listcol flex="1"/>
</listcols>
<listitem>
<listcell id="lb1_cell0" label="cell0"/>
<listcell id="lb1_cell1" label="cell1"/>
<listcell id="lb1_cell2" label="cell2"/>
</listitem>
<listitem>
<listcell id="lb1_cell3" label="cell3"/>
<listcell id="lb1_cell4" label="cell4"/>
<listcell id="lb1_cell5" label="cell5"/>
</listitem>
<listitem>
<listcell id="lb1_cell6" label="cell6"/>
<listcell id="lb1_cell7" label="cell7"/>
<listcell id="lb1_cell8" label="cell8"/>
</listitem>
</listbox>
<label control="listbox2" value="multicolumn listbox with ARIA headers"/>
<listbox id="listbox2">
<listcols>
<listcol flex="1"/>
<listcol flex="1"/>
<listcol flex="1"/>
</listcols>
<listitem>
<listcell role="columnheader" id="lb2_cell0" label="cell0"/>
<listcell role="columnheader" id="lb2_cell1" label="cell1"/>
<listcell role="columnheader" id="lb2_cell2" label="cell2"/>
</listitem>
<listitem>
<listcell role="rowheader" id="lb2_cell3" label="cell3"/>
<listcell id="lb2_cell4" label="cell4"/>
<listcell id="lb2_cell5" label="cell5"/>
</listitem>
<listitem>
<listcell role="rowheader" id="lb2_cell6" label="cell6"/>
<listcell id="lb2_cell7" label="cell7"/>
<listcell id="lb2_cell8" label="cell8"/>
</listitem>
</listbox>
</vbox>
</hbox>
</window>

Просмотреть файл

@ -0,0 +1,118 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Table header information cells for XUL tree">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/treeview.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/table.js" />
<script type="application/javascript">
<![CDATA[
////////////////////////////////////////////////////////////////////////////
// Test
var gTree = null;
var gTreeBox = null;
var gTreeView = null;
// gA11yEventDumpID = "debug";
function doTest()
{
// Initialize the tree
gTree = document.getElementById("tree");
gTreeBox = gTree.treeBoxObject;
gView = new nsTableTreeView(3);
gTree.addEventListener("TreeViewChanged", continueTest, false);
gTreeBox.view = gView;
}
function continueTest()
{
gTree.removeEventListener("TreeViewChanged", continueTest, false);
var treeAcc = getAccessible(gTree, [nsIAccessibleTable]);
var headerInfoMap = [
{
cell: treeAcc.getCellAt(0, 0),
rowHeaderCells: [],
columnHeaderCells: [ "col" ]
},
{
cell: treeAcc.getCellAt(0, 1),
rowHeaderCells: [],
columnHeaderCells: [ "scol" ]
},
{
cell: treeAcc.getCellAt(1, 0),
rowHeaderCells: [],
columnHeaderCells: [ "col" ]
},
{
cell: treeAcc.getCellAt(1, 1),
rowHeaderCells: [],
columnHeaderCells: [ "scol" ]
},
{
cell: treeAcc.getCellAt(2, 0),
rowHeaderCells: [],
columnHeaderCells: [ "col" ]
},
{
cell: treeAcc.getCellAt(2, 1),
rowHeaderCells: [],
columnHeaderCells: [ "scol" ]
},
];
testHeaderCells(headerInfoMap);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
]]>
</script>
<hbox flex="1" style="overflow: auto;">
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=512424"
title="implement IAccessibleTable2">
Mozilla Bug 512424
</a><br/>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<vbox id="debug"/>
<tree id="tree" flex="1">
<treecols>
<treecol id="col" flex="1" primary="true" label="column"/>
<treecol id="scol" flex="1" label="column 2"/>
</treecols>
<treechildren id="treechildren"/>
</tree>
</hbox>
</window>

Просмотреть файл

@ -0,0 +1,87 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Table indices of accessible table for XUL listbox">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/table.js"></script>
<script type="application/javascript">
<![CDATA[
function doTest()
{
var idxes = [
[0, 1, 2],
[3, 4, 5],
[6, 7, 8]
];
testTableIndexes("listbox", idxes);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(doTest);
]]>
</script>
<hbox style="overflow: auto;">
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=512424"
title="implement IAccessibleTable2">
Mozilla Bug 512424
</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<vbox flex="1">
<label control="listbox" value="multicolumn listbox with header"/>
<listbox id="listbox">
<listhead>
<listheader label="header1"/>
<listheader label="header2"/>
<listheader label="header3"/>
</listhead>
<listcols>
<listcol flex="1"/>
<listcol flex="1"/>
<listcol flex="1"/>
</listcols>
<listitem>
<listcell label="cell0"/>
<listcell label="cell1"/>
<listcell label="cell2"/>
</listitem>
<listitem>
<listcell label="cell3"/>
<listcell label="cell4"/>
<listcell label="cell5"/>
</listitem>
<listitem>
<listcell label="cell6"/>
<listcell label="cell7"/>
<listcell label="cell8"/>
</listitem>
</listbox>
</vbox>
</hbox>
</window>

Просмотреть файл

@ -32,11 +32,11 @@
testTableSelection("table", cellsArray);
var rowsCount = 4;
for (var rowIdx = 0; rowIdx < rowsCount; rowIdx++)
var rowCount = 4;
for (var rowIdx = 0; rowIdx < rowCount; rowIdx++)
testSelectTableRow("table", rowIdx, cellsArray);
for (var rowIdx = 0; rowIdx < rowsCount; rowIdx++) {
for (var rowIdx = 0; rowIdx < rowCount; rowIdx++) {
testSelectTableRow("table", rowIdx, cellsArray);
testUnselectTableRow("table", rowIdx, cellsArray);
}

Просмотреть файл

@ -4,7 +4,7 @@
type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="nsIAccessibleTable interface on xul:listbox test.">
title="nsIAccessibleTable selection methods on xul:listbox test.">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
@ -14,89 +14,17 @@
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
src="chrome://mochikit/content/a11y/accessible/table.js"></script>
<script type="application/javascript">
<![CDATA[
function doTest()
{
var id = "";
var listbox = null, acc = null;
var id = "listbox3";
var acc = getAccessible(id, [nsIAccessibleTable]);
//////////////////////////////////////////////////////////////////////////
// Simple listbox. There is no nsIAccessibleTable interface.
id = "listbox1";
acc = getAccessible(id);
// query nsIAccessibleTable
try {
acc.QueryInterface(nsIAccessibleTable);
ok(false,
id + " shouldn't implement nsIAccessibleTable interface.");
} catch(e) {
ok(true, id + " doesn't implement nsIAccessibleTable interface.");
}
// role
testRole(id, ROLE_LISTBOX);
//////////////////////////////////////////////////////////////////////////
// Multicolumn listbox.
id = "listbox2";
acc = getAccessible(id, [nsIAccessibleTable]);
// role
testRole(acc, ROLE_TABLE);
// rows count
var rowsCount = acc.rows;
is (rowsCount, 2, id + " has wrong number of rows.");
// columns count
var rowCount = acc.rows;
var colsCount = acc.columns;
is (colsCount, 2, id + " has wrong number of columns.");
//////////////////////////////////////////////////////////////////////////
// Multicolumn listbox with header.
id = "listbox3";
acc = getAccessible(id, [nsIAccessibleTable]);
// role
testRole(acc, ROLE_TABLE);
// rows count
var rowsCount = acc.rows;
is (rowsCount, 3, id + " has wrong number of rows.");
// columns count
var colsCount = acc.columns;
is (colsCount, 3, id + " has wrong number of columns.");
// getCellRefAt, getIndexAt, getRowAtIndex, getColumnAtIndex,
// getColumnExtentAt, getRowExtentAt.
for (var row = 0; row < rowsCount; row++) {
for (var col = 0; col < colsCount; col++) {
var index = row * colsCount + col;
is(acc.cellRefAt(row, col).name, "cell" + index,
id + ": wrong cell returned for (" + row + ", " + col + ")");
is(acc.getIndexAt(row, col), index,
id + ": wrong index returned for (" + row + ", " + col + ")");
is(acc.getRowAtIndex(index), row,
id + ": wrong row at the index " + index);
is(acc.getColumnAtIndex(index), col,
id + ": wrong column at the index " + index);
is(acc.getColumnExtentAt(row, col), 1,
id + ": colspan wrong for (" + row + ", " + col + ")");
is(acc.getRowExtentAt(row, col), 1,
id + ": rowspan wrong for (" + row + ", " + col + ")");
}
}
// columns selection
testColumnSelection(id, acc, colsCount, 0, null);
@ -104,20 +32,20 @@
testColumnSelection(id, acc, colsCount, 0, null);
// rows selection
testRowSelection(id, acc, rowsCount, 0, null);
testRowSelection(id, acc, rowCount, 0, null);
acc.selectRow(0);
testRowSelection(id, acc, rowsCount, 1, [0]);
testRowSelection(id, acc, rowCount, 1, [0]);
acc.selectRow(1);
testRowSelection(id, acc, rowsCount, 1, [1]);
testRowSelection(id, acc, rowCount, 1, [1]);
acc.unselectRow(1);
testRowSelection(id, acc, rowsCount, 0, null);
testRowSelection(id, acc, rowCount, 0, null);
// cells selection
testCellSelection(id, acc, rowsCount, colsCount, 0, null);
testCellSelection(id, acc, rowCount, colsCount, 0, null);
acc.selectRow(2);
testCellSelection(id, acc, rowsCount, colsCount, 3, [6, 7, 8]);
testCellSelection(id, acc, rowCount, colsCount, 3, [6, 7, 8]);
acc.unselectRow(2);
testCellSelection(id, acc, rowsCount, colsCount, 0, null);
testCellSelection(id, acc, rowCount, colsCount, 0, null);
SimpleTest.finish();
}
@ -139,13 +67,13 @@
}
}
// selectedColumnsCount
is(aAcc.selectedColumnsCount, aSelCount,
// selectedcolumnCount
is(aAcc.selectedcolumnCount, aSelCount,
aId + ": wrong number of selected columns");
// getSelectedColumns
var selColsCount = {}, selCols = {};
aAcc.getSelectedColumns(selColsCount, selCols);
aAcc.getSelectedColumnIndices(selColsCount, selCols);
is(selColsCount.value, aSelCount,
aId + ": wrong number of selected columns");
@ -178,13 +106,13 @@
}
}
// selectedRowsCount
is(aAcc.selectedRowsCount, aSelCount,
// selectedrowCount
is(aAcc.selectedrowCount, aSelCount,
aId + ": wrong number of selected rows");
// getSelectedRows
var selColsCount = {}, selCols = {};
aAcc.getSelectedRows(selColsCount, selCols);
aAcc.getSelectedRowIndices(selColsCount, selCols);
is(selColsCount.value, aSelCount,
aId + ": wrong number of selected rows");
@ -222,12 +150,12 @@
}
// selectedCellCount
is(aAcc.selectedCellsCount, aSelCount,
is(aAcc.selectedCellCount, aSelCount,
aId + ": wrong number of selected cells");
// getSelectedCells
var selColsCount = {}, selCols = {};
aAcc.getSelectedCells(selColsCount, selCols);
aAcc.getSelectedCellIndices(selColsCount, selCols);
is(selColsCount.value, aSelCount,
aId + ": wrong number of selected cells");
@ -255,6 +183,12 @@
title="implement the rest of methods of nsIAccessibleTable on xul:listbox">
Mozilla Bug 418371
</a>
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=512424"
title="implement IAccessibleTable2">
Mozilla Bug 512424
</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
@ -263,11 +197,6 @@
</body>
<vbox flex="1">
<label control="listbox1" value="listbox: "/>
<listbox id="listbox1">
<listitem label="item1" id="item1"/>
<listitem label="item2" id="item2"/>
</listbox>
<label control="listbox2" value="multicolumn listbox: "/>
<listbox id="listbox2">

Просмотреть файл

@ -0,0 +1,205 @@
<!DOCTYPE html>
<html>
<head>
<title>Table accessible tree and table interface tests for HTML tables</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/table.js"></script>
<script type="application/javascript">
function doTest()
{
//////////////////////////////////////////////////////////////////////////
// column headers from thead and tfoot
cellsArray = [
[kColHeaderCell, kColHeaderCell, kColSpanned],
[kRowSpanned, kColHeaderCell, kColHeaderCell],
[kDataCell, kDataCell, kDataCell],
[kColHeaderCell, kColHeaderCell, kColHeaderCell]
];
testTableStruct("table1", cellsArray);
//////////////////////////////////////////////////////////////////////////
// row and column headers from thead and @scope
var cellsArray = [
[kColHeaderCell, kColHeaderCell, kColHeaderCell],
[kRowHeaderCell, kDataCell, kDataCell],
[kRowHeaderCell, kDataCell, kDataCell]
];
testTableStruct("table2", cellsArray);
//////////////////////////////////////////////////////////////////////////
// caption and @summary
cellsArray = [
[kColHeaderCell, kColHeaderCell, kColHeaderCell, kColHeaderCell],
[kRowHeaderCell, kDataCell, kDataCell, kDataCell],
[kRowHeaderCell, kDataCell, kDataCell, kDataCell]
];
testTableStruct("table3", cellsArray, kNoColumnHeader,
"Test Table",
"this is a test table for nsIAccessibleTable");
//////////////////////////////////////////////////////////////////////////
// row and column spans
cellsArray = [
[kDataCell, kDataCell, kDataCell, kColSpanned, kDataCell, kDataCell, kDataCell, kDataCell],
[kDataCell, kDataCell, kDataCell, kDataCell, kDataCell, kDataCell, kDataCell, kRowSpanned],
[kDataCell, kDataCell, kColSpanned, kDataCell, kDataCell, kDataCell, kDataCell, kRowSpanned],
[kDataCell, kRowSpanned, kSpanned, kDataCell, kDataCell, kRowSpanned, kDataCell, kRowSpanned]
];
testTableStruct("table4", cellsArray);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
title="Fix our nsHTMLAccessibleTable class so GetIndexAt and GetRowAtIndex and GetColumnAtIndex behave consistently"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=410052">Mozilla Bug 410052</a>
<a target="_blank"
title="GetCellDataAt callers that expect an error if no cell is found are wrong"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=417912">Mozilla Bug 417912</a>
<a target="_blank"
title="create accessibles for HTML tr"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=493695">Mozilla Bug 493695</a>
<a target="_blank"
title="implement IAccessibleTable2"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=512424">Mozilla Bug 512424</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<table id="table1">
<thead>
<tr>
<th rowspan="2">col1</th><th colspan="2">col2</th>
</tr>
<tr>
<th>col2sub1</th><th>col2sub2</th>
</tr>
</thead>
<tbody>
<tr>
<td>cell1</td><td>cell2</td><td>cell3</td>
</tr>
</tbody>
<tfoot>
<tr>
<th>col1</th><th>col2</th><th>col3</th>
</tr>
</tfoot>
</table>
<table id="table2">
<thead>
<tr>
<th id="table1_0">col1</th>
<th id="table1_1">col2</th>
<td id="table1_2" scope="col">col3</td>
</tr>
</thead>
<tbody>
<tr>
<th id="table1_3">row1</th>
<td id="table1_4">cell1</td>
<td id="table1_5">cell2</td>
</tr>
<tr>
<td id="table1_6" scope="row">row2</td>
<td id="table1_7">cell3</td>
<td id="table1_8">cell4</td>
</tr>
</tbody>
</table>
<table id="table3" border="1"
summary="this is a test table for nsIAccessibleTable">
<caption>Test Table</caption>
<thead>
<tr>
<th></th>
<th>columnHeader_1</th>
<th id ="col2a">columnHeader_2</th>
<th>columnHeader_3</th>
</tr>
</thead>
<tr>
<th id="row2a">rowHeader_1</th>
<td id="row2b">row1_column1</td>
<td id ="col2b">row1_column2</td>
<td id="row2c">row1_column3</td>
</tr>
<tr>
<th>rowHeader_2</th>
<td>row2_column1</td>
<td id ="col2c">row2_column2</td>
<td>row2_column3</td>
</tr>
</table>
<table id="table4" cellpadding="2" cellspacing="2" border="1" width="50%">
<tbody>
<tr>
<td><br></td>
<td><br></td>
<td rowspan="1" colspan="2"><br></td>
<td><br></td>
<td><br></td>
<td><br></td>
<td rowspan="4" colspan="1"><br></td>
</tr>
<tr>
<td><br></td>
<td><br></td>
<td><br></td>
<td><br></td>
<td><br></td>
<td><br></td>
<td><br></td>
</tr>
<tr>
<td><br></td>
<td rowspan="2" colspan="2">c1</td>
<td><br></td>
<td><br></td>
<td rowspan="2" colspan="1"><br></td>
<td><br></td>
</tr>
<tr>
<td><br></td>
<td><br></td>
<td><br></td>
<td><br></td>
</tr>
</tbody>
</table>
</body>
</html>

Просмотреть файл

@ -0,0 +1,104 @@
<!DOCTYPE html>
<html>
<head>
<title>Table accessible tree and table interface tests for ARIA grid</title>
<link rel="stylesheet" type="text/css"
href="chrome://mochikit/content/tests/SimpleTest/test.css" />
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/table.js"></script>
<script type="application/javascript">
function doTest()
{
//////////////////////////////////////////////////////////////////////////
// Pure ARIA grid
var cellsArray = [
[kColHeaderCell, kColHeaderCell, kColHeaderCell],
[kRowHeaderCell, kDataCell, kDataCell],
[kRowHeaderCell, kDataCell, kDataCell]
];
testTableStruct("table", cellsArray);
//////////////////////////////////////////////////////////////////////////
// HTML table based ARIA grid
var cellsArray = [
[kColHeaderCell, kColHeaderCell, kColHeaderCell],
[kDataCell, kDataCell, kDataCell],
[kDataCell, kDataCell, kDataCell]
];
testTableStruct("grid", cellsArray);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(doTest);
</script>
</head>
<body>
<a target="_blank"
title="ARIA grid based on HTML table"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=491683">Mozilla Bug 491683</a>
<a target="_blank"
title="implement IAccessibleTable2"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=512424">Mozilla Bug 512424</a>
<p id="display"></p>
<div id="content" style="display: none"></div>
<pre id="test">
</pre>
<!-- Not usual markup to avoid text accessible between cell accessibles -->
<div id="table" role="grid">
<div role="row"><span
id="table_ch_1" role="columnheader">col_1</span><span
id="table_ch_2" role="columnheader">col_2</span><span
id="table_ch_3" role="columnheader">col_3</span></div>
<div role="row"><span
id="table_rh_1" role="rowheader">row_1</span><span
id="table_dc_1" role="gridcell">cell1</span><span
id="table_dc_2" role="gridcell">cell2</span></div>
<div role="row"><span
id="table_rh_2" role="rowheader">row_2</span><span
id="table_dc_3" role="gridcell">cell3</span><span
id="table_dc_4" role="gridcell">cell4</span></div>
</div>
<table role="grid" id="grid" border="1" cellpadding="10" cellspacing="0">
<thead>
<tr role="row">
<th role="columnheader">subject</td>
<th role="columnheader">sender</th>
<th role="columnheader">date</th>
</tr>
</thead>
<tbody>
<tr role="row">
<td role="gridcell" tabindex="0">about everything</td>
<td role="gridcell">president</td>
<td role="gridcell">today</td>
</tr>
<tr role="row">
<td role="gridcell">new bugs</td>
<td role="gridcell">mozilla team</td>
<td role="gridcell">today</td>
</tr>
</tbody>
</table>
</body>
</html>

Просмотреть файл

@ -0,0 +1,119 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Table accessible tree and table interface tests for XUL listboxes">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/role.js"></script>
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/table.js"></script>
<script type="application/javascript">
<![CDATA[
function doTest()
{
//////////////////////////////////////////////////////////////////////////
// Multicolumn listbox.
var cellsArray = [
[kDataCell, kDataCell],
[kDataCell, kDataCell]
];
testTableStruct("listbox1", cellsArray);
//////////////////////////////////////////////////////////////////////////
// Multicolumn listbox with header.
var cellsArray = [
[kDataCell, kDataCell, kDataCell],
[kDataCell, kDataCell, kDataCell],
[kDataCell, kDataCell, kDataCell]
];
testTableStruct("listbox2", cellsArray, kListboxColumnHeader);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addLoadEvent(doTest);
]]>
</script>
<hbox style="overflow: auto;">
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=512424"
title="implement IAccessibleTable2">
Mozilla Bug 512424
</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<vbox flex="1">
<label control="listbox1" value="multicolumn listbox: "/>
<listbox id="listbox1">
<listcols>
<listcol flex="1"/>
<listcol flex="1"/>
</listcols>
<listitem>
<listcell label="cell1"/>
<listcell label="cell2"/>
</listitem>
<listitem>
<listcell label="cell1"/>
<listcell label="cell2"/>
</listitem>
</listbox>
<label control="listbox2" value="multicolumn listbox with header"/>
<listbox id="listbox2">
<listhead>
<listheader label="header1"/>
<listheader label="header2"/>
<listheader label="header3"/>
</listhead>
<listcols>
<listcol flex="1"/>
<listcol flex="1"/>
<listcol flex="1"/>
</listcols>
<listitem>
<listcell label="cell0"/>
<listcell label="cell1"/>
<listcell label="cell2"/>
</listitem>
<listitem>
<listcell label="cell3"/>
<listcell label="cell4"/>
<listcell label="cell5"/>
</listitem>
<listitem>
<listcell label="cell6"/>
<listcell label="cell7"/>
<listcell label="cell8"/>
</listitem>
</listbox>
</vbox>
</hbox>
</window>

Просмотреть файл

@ -0,0 +1,91 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Table accessible tree and table interface tests for XUL trees">
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js" />
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/treeview.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/common.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/role.js" />
<script type="application/javascript"
src="chrome://mochikit/content/a11y/accessible/table.js" />
<script type="application/javascript">
<![CDATA[
////////////////////////////////////////////////////////////////////////////
// Test
var gTree = null;
var gTreeBox = null;
var gTreeView = null;
// gA11yEventDumpID = "debug";
function doTest()
{
// Initialize the tree
gTree = document.getElementById("table");
gTreeBox = gTree.treeBoxObject;
gView = new nsTableTreeView(3);
gTree.addEventListener("TreeViewChanged", continueTest, false);
gTreeBox.view = gView;
}
function continueTest()
{
gTree.removeEventListener("TreeViewChanged", continueTest, false);
var cellsArray = [
[kDataCell, kDataCell],
[kDataCell, kDataCell],
[kDataCell, kDataCell]
];
testTableStruct(gTree, cellsArray, kTreeColumnHeader);
SimpleTest.finish();
}
SimpleTest.waitForExplicitFinish();
addA11yLoadEvent(doTest);
]]>
</script>
<hbox flex="1" style="overflow: auto;">
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=512424"
title="implement IAccessibleTable2">
Mozilla Bug 512424
</a><br/>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<vbox id="debug"/>
<tree id="table" flex="1">
<treecols>
<treecol id="col" flex="1" label="column"/>
<treecol id="scol" flex="1" label="column 2"/>
</treecols>
<treechildren id="treechildren"/>
</tree>
</hbox>
</window>

Просмотреть файл

@ -4,7 +4,8 @@
*
* IAccessible2 IDL Specification
*
* Copyright (c) IBM Corp. 2007
* Copyright (c) Linux Foundation 2007, 2009
* Copyright (c) IBM Corp. 2006
* Copyright (c) Sun Microsystems, Inc. 2000, 2006
*
* This library is free software; you can redistribute it and/or
@ -19,12 +20,12 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
************************************************************************/
/** @mainpage
@section _interfaces Interfaces
IAccessible2\n
IAccessibleAction\n
@ -34,7 +35,9 @@
IAccessibleHyperlink\n
IAccessibleImage\n
IAccessibleRelation\n
IAccessibleTable\n
IAccessibleTable [deprecated]\n
IAccessibleTable2\n
IAccessibleTableCell\n
IAccessibleText\n
IAccessibleEditableText\n
IAccessibleValue
@ -47,21 +50,24 @@
@section _enums Enums
::IA2CoordinateType values define the requested coordinate type (screen or parent window).\n
::IA2EventID values identify events.\n
::IA2Role values define roles.\n
::IA2Role values defines roles which are in addition to the existing MSAA roles.\n
::IA2ScrollType values define where to place an object or substring on the screen.\n
::IA2States values define states which are in addition to the existing MSAA states.\n
::IA2TableModelChangeType values describe the kinds of changes made to a table (insert, delete, update).\n
::IA2TextBoundaryType values define the requested text unit (character, word, sentence, line, paragraph).
::IA2TextBoundaryType values define the requested text unit (character, word, sentence, line, paragraph).\n
::IA2TextSpecialOffsets values define special offsets for use in the text interfaces.
@section _constants Constants
@ref grpRelations\n
@ref grpStates\n
@ref grpRelations
@section _license License
@ref _licensePage "LGPL"
@section _misc Miscellaneous
@ref _licensePage "LGPL License"\n
@ref _generalInfo "General Information"\n
@page _licensePage License
@page _licensePage LGPL License
IAccessible2 IDL Specification
Copyright (c) Linux Foundation 2007, 2008\n
Copyright (c) IBM Corp. 2006\n
Copyright (c) Sun Microsystems, Inc. 2000, 2006
@ -77,9 +83,207 @@
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02110-1301 USA
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
You may also refer to http://www.gnu.org/licenses/lgpl.html
You may also refer to http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html
@page _generalInfo General Information
The following information is applicable to two or more interfaces.
@ref _errors\n
@ref _memory\n
&nbsp;&nbsp;@ref _arrayConsideration\n
@ref _indexes\n
@ref _enums\n
@ref _specialOffsets\n
@ref _dicoveringInterfaces\n
@ref _changingInterfaces\n
@ref _applicationInfo\n
@ref _childIDs\n
@ref _variants\n
@ref _iaaction-iahyperlink\n
@ref _trademark
@section _errors Error Handling
HRESULT values are defined by the Microsoft&reg; Win32&reg; API. For more information, refer to
<a href="http://msdn2.microsoft.com/en-us/library/bb401631.aspx">Interpreting HRESULT Values</a>
in MSDN&reg;.
Note that the S_FALSE return value is considered a non-error value and the
SUCCEEDED macro will return TRUE. S_FALSE is used when there is no failure
but there was nothing valid to return, e.g. in IAccessible2::attributes when
there are no attributes. When S_FALSE is returned [out] pointer types should
be NULL and [out] longs should generally be 0, but sometimes -1 is used such
as IAccessible2::indexInParent, IAccessibleText::caretOffset, and
IAccessibleHypertext::hyperlinkIndex.
Note that for BSTR [out] variables common COM practice is that the server does
the SysAllocString and the client does the SysFreeString. Also note that when
NULL is returned there is no need for the client to call SysFreeString. Please
refer to the documentation for each method for more details regarding error handling.
@section _memory Memory Management
The following memory management issues should be considered:
@li Although [out] BSTR variables are declared by the client, their space is
allocated by the server. They need to be freed with SysFreeString by the
client at end of life; the same is true when BSTRs are used in structs or
arrays which are passed to the server.
@li If there is no valid [out] BSTR to return, the server should return S_FALSE and
assign NULL to the output, e.g. *theOutBSTR = NULL;.
@li COM interfaces need to be referenced with AddRef when used and dereferenced
with Release at end of life.
@li Single [out] longs, HWNDs, booleans, and structs are declared by the caller
and passed by reference. The marshaller does all the memory management.
The following articles may be helpful for understanding memory management issues:
@li An article by Don Box in a
<a href="http://www.microsoft.com/msj/1196/activex1196.aspx">Q & A section</a>
of the November 1996 edition of the Microsoft Systems Journal.
@li A posting to a CodeGuru forum,
<a href="http://www.codeguru.com/forum/showthread.php?t=364511">Windows SDK
String: What are the rules for BSTR allocation and deallocation?</a>
@subsection _arrayConsideration Special Consideration when using Arrays
There are several methods which return arrays. It is considered a best practice
for the client to allocate and free the arrays. This can be done for
IAccessible2::relations and IAccessibleRelation::targets. However, due to the
coding of the IDL for the remaining methods which return arrays, the server must
allocate the array and the client must free the array when no longer needed.
These methods are IAccessible2::extendedStates, IAccessible2::localizedExtendedStates,
IAccessibleAction::keyBinding, IAccessibleTable::selectedChildren,
IAccessibleTable::selectedColumns, and IAccessibleTable::selectedRows. For those
methods, the server must allocate both the top level array and any storage
associated with it, e.g. for BSTRs. The client must use CoTaskMemFree to free
the array and any BSTRs must be freed with SysFreeString.
Also, the IDL for those methods includes an extraneous [in] parameter for the
caller to specify the max size of the array. This parameter will be ignored by
the COM server.
@section _indexes Zero and One Based Indexes
Unless otherwise specified all offsets and indexes are 0 based.
@section _enums Enums
Note that enums start at 0.
@section _specialOffsets Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods
IAccessibleText and IAccessibleEditableText can use one or more of the following
special offset values. They are defined in the ::IA2TextSpecialOffsets enum.
@li Using ::IA2_TEXT_OFFSET_LENGTH (-1) as an offset in any of the IAccessibleText or
IAccessibleEditableText methods is the same as specifying the length of the string.
@li Using ::IA2_TEXT_OFFSET_CARET (-2) as an offset for IAccessibleText::textBeforeOffset,
IAccessibleText::textAtOffset, and IAccessibleText::textAfterOffset indicates that the
text related to the physical location of the caret should be used. This is needed for
applications that consider the character offset of the end of one line (as reached by
pressing the End key) the same as the offset of the first character on the next line.
Since the same offset is associated with two different lines a special means is needed
to fetch text from the line where the caret is physically located.
@section _dicoveringInterfaces Discovery of Interfaces
In general AT (Assistive Technology) should try IAccessible2 interfaces, followed by using
the MSAA (Microsoft&reg; Active Accessibility&reg;) interfaces. (In cases where the an application
is known to have custom interfaces which provide information not supplied by IAccessible2
or MSAA, then those custom interfaces can be used.) The AT can then, by default, support
unknown IAccessible2/MSAA applications, without the application developers having to request
AT vendors for support on an individual application by application basis.
When you have a reference to an IAccessible and require a reference to an IAccessible2 use
QueryService as follows:
@code
// pAcc is a reference to the accessible object's IAccessible interface.
IServiceProvider *pService = NULL;
hr = pAcc->QueryInterface(IID_IServiceProvider, (void **)&pService);
if(SUCCEEDED(hr)) {
IAccessible2 *pIA2 = NULL;
hr = pService->QueryService(IID_IAccessible, IID_IAccessible2, (void**)&pIA2);
if (SUCCEEDED(hr) && pIA2) {
// The control supports IAccessible2.
// pIA2 is the reference to the accessible object's IAccessible2 interface.
}
}
@endcode
@section _changingInterfaces Changing between Accessible Interfaces
Note that developers must always implement MSAA's IAccessible and, if needed, some
of the interfaces in the set of IAccessible2 interfaces. Although the IAccessible2
IDL is currently coded such that IAccessible2 is a subclass of MSAA's IAccessible,
none of MSAA's IAccessible methods are overridden or extended. In order to allow
future removal of the inheritance, Assistive Technologies (ATs) should not rely on
that inheritance.
QueryService must be used to switch from a reference to an MSAA IAccessible interface
to another interface. This has been
<a href="http://www.accessinteropalliance.org/docs/Introducing_IAccessibleEx.doc">
documented by Microsoft</a> and the pertinent facts have been extracted below:
@par
Why use QueryService instead of just using QueryInterface to get IAccessibleEx
directly? The reason is that since MSAA 2.0, clients don't talk to a server's
IAccessible interface directly; instead they talk to an intermediate MSAA-provided
wrapper that calls through to the original IAccessible. This wrapper provides services
such as implementing IDispatch, supplying information from MSAA 2.0's Dynamic Annotation
service, and scaling locations when running on Windows Vista with DPI scaling enabled.
QueryService is the supported way to expose additional interfaces from an existing
IAccessible and was originally used by MSHTML to expose IHTMLElement objects corresponding
to IAccessibles. QueryService is often more convenient for servers to implement than
QueryInterface because it does not have the same requirements for preserving object
identity or symmetry/transitivity as QueryInterface, so QueryService allows servers to
easily implement the interface on the same object or a separate object. The latter is
often hard to do with QueryInterface unless the original object supports aggregation.
Two related references in MSDN&reg; are:
@li <a href="http://msdn.microsoft.com/en-us/library/ms696078(VS.85).aspx">
"Using QueryService to expose a native object model interface for an IAccessible object"</a>
@li <a href="http://msdn.microsoft.com/en-us/library/ms528415.aspx#acc_obj">
"Accessing the Internet Explorer Object Associated with an Accessible Object"</a>
Based on this information from Microsoft, QueryService must be used to switch back and forth
between a reference to an MSAA IAccessible interface and any of the IAccessible2 interfaces.
Regarding switching between any of the IAccessible2 interfaces, applications implementing
IAccessible2 should implement the IAccessible2 interfaces on a single object since ATs
will be using QueryInterface to switch between the IAccessilbe2 interfaces. Implementing
the IAccessible2 interfaces on separate objects would require the use of QueryService.
There is one exception, IAccessibleApplication can be implemented on a separate object so
its common code doesn't have to be included in each accessible object. ATs should use
QueryService to access IAccessibleApplication.
@section _applicationInfo Access to Information about the Application
Servers implementing IAccessible2 should provide access to the IAccessibleApplication
interface via QueryService from any object so that ATs can easily determine specific
information about the application such as its name or version.
@section _childIDs Child IDs
The IAccessible2 interfaces do not support child IDs, i.e. simple child elements.
Full accessible objects must be created for each object that supports IAccessible2.
Therefore MSAA's get_accChild should never return a child ID (other than CHILDID_SELF)
for an object that implements any of the IAccessible2 interfaces.
Microsoft's UI Automation specification has the same limitation and this was resolved
in the UI Automation Express specification by adding IAccessibleEx::GetObjectForChild
and IAccessibleEx::GetIAccessiblePair. These methods allow mapping back and forth
between an IAccessibleEx and an {IAccessible, Child ID} pair. A future version of
IAccessible2 may include similar methods to map back and forth between an IAccessible2
and an {IAccessible, Child ID} pair.
@section _variants VARIANTs
Some methods return a VARIANT. Implementers need to make sure that the return type is
specified, i.e. VT_I4, VT_IDISPATCH, etc. The methods that return VARIANTs are
IAccessibleHyperlink::anchor, IAccessibleHyperlink::anchorTarget, IAccessibleValue::currentValue,
IAccessibleValue::maximumValue, IAccessibleValue::minimumValue.
@section _iaaction-iahyperlink IAccessibleHyperlink as subclass of IAccessibleAction
In this version of the IDL, IAccessibleHyperlink is a subclass of IAccessibleAction.
However, there is no practical need for that inheritance and in some cases, such as
an image map of smart tags, it doesn't make sense because such an image map doesn't
have actionable objects; it's the secondary smart tags that are actionable. As a
result, implementations should not rely on the inheritance as it may be removed in
a later version of the IDL.
@section _trademark Trademark Attribution
The names of actual companies and products mentioned herein may be the trademarks of
their respective owners. In particular, Active Accessibility, Microsoft, MSDN, and Win32
are trademarks of the Microsoft group of companies in the U.S.A. and/or other countries.
**/
@ -90,19 +294,23 @@ import "AccessibleRelation.idl";
import "AccessibleStates.idl";
import "IA2CommonTypes.idl";
/// A structure defining the locale of an accessible object.
typedef struct {
/** A structure defining the locale of an accessible object.
IAccessible2::locale returns this struct.
*/
typedef struct IA2Locale {
BSTR language; ///< ISO 639-1 Alpha-2 two character language code
BSTR country; ///< ISO 3166-1 Alpha-2 two character country code
BSTR variant; ///< Application specific variant of the locale
} IA2Locale;
/** This interface must always be provided for objects that support some
portion of the collection of the IAccessible2 interfaces.
IAccessible2 is a subclass of MSAA's IAccessible. This is a matter of
convenience, i.e. an IAccessible2 is an IAccessible so MSAA methods can be
easily accessed. None of MSAA's IAccessible methods are overridden or extended.
portion of the collection of the %IAccessible2 interfaces.
Please refer to @ref _changingInterfaces "Changing between Accessible Interfaces"
for special considerations related to use of the MSAA IAccessible interface and
the set of %IAccessible2 interfaces.
*/
[object, uuid(E89F726E-C4F4-4c19-BB19-B647D7FA8478)]
interface IAccessible2 : IAccessible
@ -110,6 +318,7 @@ interface IAccessible2 : IAccessible
/** @brief Returns the number of accessible relations for this object.
@param [out] nRelations
@retval S_OK
*/
[propget] HRESULT nRelations
(
@ -118,8 +327,10 @@ interface IAccessible2 : IAccessible
/** @brief Returns one accessible relation for this object.
@param [in] relationIndex
0-based
0 based
@param [out] relation
@retval S_OK
@retval E_INVALIDARG if bad [in] passed, [out] value is NULL
*/
[propget] HRESULT relation
(
@ -129,26 +340,38 @@ interface IAccessible2 : IAccessible
/** @brief Returns multiple accessible relations for this object.
@param [in] maxRelations
maximum number of relations to get
@param [out] relation
array of accessible relation objects
maximum size of the array allocated by the client
@param [out] relations
The array of accessible relation objects. Note that this array is to be
allocated by the client and freed when no longer needed. Refer to @ref
_arrayConsideration "Special Consideration when using Arrays" for more details.
@param [out] nRelations
length of array (not more than maxRelations)
actual number of relations in the returned array (not more than maxRelations)
@retval S_OK
@retval S_FALSE if there are no relations, nRelations is set to 0
*/
[propget] HRESULT relations
(
[in] long maxRelations,
[out, size_is(maxRelations), length_is(*nRelations)]
IAccessibleRelation **relation,
IAccessibleRelation **relations,
[out, retval] long *nRelations
);
/** @brief Returns the role of an IAccessible2 object.
Note: For convenience MSAA roles are also passed through this method so the
AT doesn't have to also fetch roles through MSAA's get_accRole.
/** @brief Returns the role of an %IAccessible2 object.
@param [out] role
The role of an IAccessible2 object.
The role of an %IAccessible2 object.
@retval S_OK
@note
@li For convenience MSAA roles are also passed through this method so the
AT doesn't have to also fetch roles through MSAA's get_accRole.
@li %IAccessible2 roles should not be passed through MSAA's get_accRole.
@li For compatibility with non IAccessible2 enabled ATs, IAccessible2
applications should also add support to get_accRole to return the closest
MSAA role or ROLE_SYSTEM_CLIENT (the MSAA defined default role) if there
is not a good match.
@li This method is missing a [propget] prefix in the IDL. The result is the
method is named role in generated C++ code instead of get_role.
*/
HRESULT role
(
@ -158,6 +381,8 @@ interface IAccessible2 : IAccessible
/** @brief Makes an object visible on the screen.
@param [in] scrollType
Defines where the object should be placed on the screen.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed
*/
HRESULT scrollTo
(
@ -166,13 +391,14 @@ interface IAccessible2 : IAccessible
/** @brief Moves the top left of an object to a specified location.
Note: S_FALSE is returned if the object is already at the specified location.
@param [in] coordinateType
Specifies whether the coordinates are relative to the screen or the parent object.
@param [in] x
Defines the x coordinate.
@param [in] y
Defines the y coordinate.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed
*/
HRESULT scrollToPoint
(
@ -184,15 +410,25 @@ interface IAccessible2 : IAccessible
/** @brief Returns grouping information.
Used for tree items, list items, tab panel labels, radio buttons, etc.
Also used for collectons of non-text objects.
Also used for collections of non-text objects.
@param [out] groupLevel
0-based
1 based, 0 indicates that this value is not applicable
@param [out] similarItemsInGroup
1-based
1 based, 0 indicates that this value is not applicable
@param [out] positionInGroup
0-based
*/
1 based, 0 indicates that this value is not applicable. This is an index
into the objects in the current group, not an index into all the objects
at the same group level.
@retval S_OK if at least one value is valid
@retval S_FALSE if no values are valid
@note This method is meant to describe the nature of an object's containment
structure. This is normally not implemented on a combo box to describe the nature
of its contents. Normally an AT will get that information from its child list
object. However, in some cases when combo boxes are not able to be structured
such that the list is a child of the combo box, this method is implemented
on the combo box itself. ATs can use this interface if a child list is not found.
*/
[propget] HRESULT groupPosition
(
[out] long *groupLevel,
@ -201,7 +437,12 @@ interface IAccessible2 : IAccessible
);
/** @brief Returns the bit strip containing any IAccessible2 states.
The IAccessible2 states are in addition to the MSAA states and are defined in
the IA2States enum.
@param [out] states
@retval S_OK
*/
[propget] HRESULT states
(
@ -211,9 +452,11 @@ interface IAccessible2 : IAccessible
/** @brief Returns the extended role.
An extended role is a role which is dynamically generated by the application.
It is not predefined by the IAccessible2 specification.
It is not predefined by the %IAccessible2 specification.
@param [out] extendedRole
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] value is NULL
*/
[propget] HRESULT extendedRole
(
@ -222,6 +465,8 @@ interface IAccessible2 : IAccessible
/** @brief Returns the localized extended role.
@param [out] localizedExtendedRole
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] value is NULL
*/
[propget] HRESULT localizedExtendedRole
(
@ -230,6 +475,7 @@ interface IAccessible2 : IAccessible
/** @brief Returns the number of extended states.
@param [out] nExtendedStates
@retval S_OK
*/
[propget] HRESULT nExtendedStates
(
@ -239,11 +485,17 @@ interface IAccessible2 : IAccessible
/** @brief Returns the extended states (array of strings).
An extended state is a state which is dynamically generated by the application.
It is not predefined by the IAccessible2 specification.
It is not predefined by the %IAccessible2 specification.
@param [in] maxExtendedStates
This parameter is ignored. Refer to @ref _arrayConsideration
"Special Consideration when using Arrays" for more details.
@param [out] extendedStates
This array is allocated by the server. Free it with CoTaskMemFree.
@param [out] nExtendedStates
The number of extended states returned; the size of the returned array.
@retval S_OK
@retval S_FALSE if there are no states, [out] values are NULL and 0 respectively
*/
[propget] HRESULT extendedStates
(
@ -254,8 +506,14 @@ interface IAccessible2 : IAccessible
/** @brief Returns the localized extended states (array of strings).
@param [in] maxLocalizedExtendedStates
This parameter is ignored. Refer to @ref _arrayConsideration
"Special Consideration when using Arrays" for more details.
@param [out] localizedExtendedStates
This array is allocated by the server. Free it with CoTaskMemFree.
@param [out] nLocalizedExtendedStates
The number of localized extended states returned; the size of the returned array.
@retval S_OK
@retval S_FALSE if there are no states, [out] values are NULL and 0 respectively
*/
[propget] HRESULT localizedExtendedStates
(
@ -268,27 +526,24 @@ interface IAccessible2 : IAccessible
The uniqueID is an identifier for this object, is unique within the
current window, and remains the same for the lifetime of the accessible
object. This is the same value that is passed in the idChild parameter of
the WinEventProc callback function for any events that occur on the object,
and is typically a negative number. Using negative numbers prevents the ID
from conflicting with the use of positive numbers that might possibly be
used to indicate a direct child N of the window's root accessible object,
and thus the implementation of get_accChild() can differentiate between
requests for direct child N vs. a descendant lower in the hierarchy with a
given uniqueID. This is important because get_accChild() is used by
AccessibleObjectFromEvent() to retrieve the accessible object which fired
the event by starting from the window's root accessible object.
This value is provided so the AT can have access to it even when not
handling an event for the object.
object.
An example of when this value is useful if the AT wants to build a cache.
The AT could cache the uniqueIDs in addition to other data being cached.
When an event is fired the AT could map that to its internal model. Thus,
if there's a REORDER/SHOW/HIDE event the AT knows which part of the internal
structure has been invalidated and can refetch just that part.
The uniqueID is not related to:
- the MSAA objectID which is used by the server to disambiguate between
IAccessibles per HWND or
- the MSAA childID which is used to disambiguate between children being
managed by an IAccessible.
This value can also be used by and AT to determine when the current control
This value is provided so the AT can have access to a unique runtime persistent
identifier even when not handling an event for the object.
An example of when this value is useful is if the AT wants to build a cache.
The AT could cache the uniqueIDs in addition to other data being cached.
When an event is fired the AT could map the uniqueID to its internal model.
Thus, if there's a REORDER/SHOW/HIDE event the AT knows which part of the
internal structure has been invalidated and can refetch just that part.
This value can also be used by an AT to determine when the current control
has changed. If the role is the same for two controls that are adjacent in
the tab order, this can be used to detect the new control.
@ -296,7 +551,13 @@ interface IAccessible2 : IAccessible
changed, e.g. when moving from a radio button in one group to a radio button in a
different group.
One means of implementing this would be to create a factory with a 32 bit number
generator and a reuse pool. The number generator would emit numbers starting
at 1. Each time an object's life cycle ended, its number would be saved into a
resuse pool. The number generator would be used whenever the reuse pool was empty.
@param [out] uniqueID
@retval S_OK
*/
[propget] HRESULT uniqueID
(
@ -316,6 +577,7 @@ interface IAccessible2 : IAccessible
a ROLE_WINDOW object, mapping that back to a window handle.
@param [out] windowHandle
@retval S_OK
*/
[propget] HRESULT windowHandle
(
@ -324,6 +586,10 @@ interface IAccessible2 : IAccessible
/** @brief Returns the index of this object in its parent object.
@param [out] indexInParent
0 based; -1 indicates there is no parent; the upper bound is the value
returned by the parent's IAccessible::get_accChildCount.
@retval S_OK
@retval S_FALSE if no parent, [out] value is -1
*/
[propget] HRESULT indexInParent
(
@ -332,14 +598,17 @@ interface IAccessible2 : IAccessible
/** @brief Returns the IA2Locale of the accessible object.
@param [out] locale
@retval S_OK
*/
[propget] HRESULT locale
(
[out, retval] IA2Locale *locale
);
/** @brief Returns the attributes specific to this IAccessible2 object, such as a cell's formula.
/** @brief Returns the attributes specific to this %IAccessible2 object, such as a cell's formula.
@param [out] attributes
@retval S_OK
@retval S_FALSE returned if there is nothing to return, [out] value is NULL
*/
[propget] HRESULT attributes
(
@ -347,4 +616,3 @@ interface IAccessible2 : IAccessible
);
}

Просмотреть файл

@ -4,6 +4,7 @@
*
* IAccessible2 IDL Specification
*
* Copyright (c) Linux Foundation 2007, 2008
* Copyright (c) IBM Corp. 2006
* Copyright (c) Sun Microsystems, Inc. 2000, 2006
*
@ -19,7 +20,7 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
************************************************************************/
@ -29,14 +30,20 @@ import "oleacc.idl";
/** @brief This interface gives access to actions that can be executed
for accessible objects.
Every accessible object that can be manipulated beyond its methods
exported over the accessibility API should support this interface to
expose all actions that it can perform. Each action can be performed
or queried for a name, description or associated key bindings. Actions
are needed more for ATs that assist the mobility impaired. By providing
actions directly, the AT can present them to the user without the user having
to perform the extra steps to navigate a context menu.
Every accessible object that can be manipulated via the native GUI beyond the
methods available either in the MSAA IAccessible interface or in the set of
IAccessible2 interfaces (other than this IAccessibleAction interface) should
support the IAccessibleAction interface in order to provide Assistive Technology
access to all the actions that can be performed by the object. Each action can
be performed or queried for a name, description or associated key bindings.
Actions are needed more for ATs that assist the mobility impaired, such as
on-screen keyboards and voice command software. By providing actions directly,
the AT can present them to the user without the user having to perform the extra
steps to navigate a context menu.
The first action should be equivalent to the MSAA default action. If there is
only one action, %IAccessibleAction should also be implemented.
*/
[object, uuid(B70D9F59-3B5A-4dba-AB9E-22012F607DF5)]
interface IAccessibleAction : IUnknown
@ -49,6 +56,9 @@ interface IAccessibleAction : IUnknown
@param [out] nActions
The returned value of the number of actions is zero if there are
no actions.
@retval S_OK
@note This method is missing a [propget] prefix in the IDL. The result is the
method is named nActions in generated C++ code instead of get_nActions.
*/
HRESULT nActions
(
@ -57,8 +67,10 @@ interface IAccessibleAction : IUnknown
/** @brief Performs the specified Action on the object.
@param [in] actionIndex
This index specifies the action to perform. If it lies outside
0 based index specifying the action to perform. If it lies outside
the valid range no action is performed.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed
*/
HRESULT doAction
(
@ -67,11 +79,13 @@ interface IAccessibleAction : IUnknown
/** @brief Returns a description of the specified action of the object.
@param [in] actionIndex
This index specifies the action of which to return a
description. If it lies outside the valid range an empty string
is returned.
0 based index specifying which action's description to return.
If it lies outside the valid range an empty string is returned.
@param [out] description
The returned value is a localized string of the specified action.
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] value is NULL
@retval E_INVALIDARG if bad [in] passed, [out] value is NULL
*/
[propget] HRESULT description
(
@ -79,8 +93,20 @@ interface IAccessibleAction : IUnknown
[out, retval] BSTR *description
);
/** @brief Returns an array of BSTRs describing one or more key bindings, if there
are any, associated with the specified action.
/** @brief Returns an array of BSTRs describing one or more key bindings, if
there are any, associated with the specified action.
The returned strings are the localized human readable key sequences to be
used to activate each action, e.g. "Ctrl+Shift+D". Since these key
sequences are to be used when the object has focus, they are like
mnemonics (access keys), and not like shortcut (accelerator) keys.
There is no need to implement this method for single action controls since
that would be redundant with the standard MSAA programming practice of
getting the mnemonic from get_accKeyboardShortcut.
An AT such as an On Screen Keyboard might not expose these bindings but
provide alternative means of activation.
Note: the client allocates and passes in an array of pointers. The server
allocates the BSTRs and passes back one or more pointers to these BSTRs into
@ -88,27 +114,35 @@ interface IAccessibleAction : IUnknown
for deallocating the BSTRs.
@param [in] actionIndex
This index specifies the action of which to return the key bindings.
@param [in] nMaxBinding
The maximum number of keybindings requested, i.e. the size of the array
allocated to hold the results.
@param [out] keyBinding
An array of BSTRs, one for each key binding.
@param [out] nBinding
The actual number of key bindings returned.
*/
0 based index specifying which action's key bindings should be returned.
@param [in] nMaxBindings
This parameter is ignored. Refer to @ref _arrayConsideration
"Special Consideration when using Arrays" for more details.
@param [out] keyBindings
An array of BSTRs, allocated by the server, one for each key binding.
Free it with CoTaskMemFree.
@param [out] nBindings
The number of key bindings returned; the size of the returned array.
@retval S_OK
@retval S_FALSE if there are no relations, [out] values are NULL and 0 respectively
@retval E_INVALIDARG if bad [in] passed, [out] values are NULL and 0 respectively
*/
[propget] HRESULT keyBinding
(
[in] long actionIndex,
[in] long nMaxBinding,
[out, size_is(,nMaxBinding), length_is(,*nBinding)] BSTR **keyBinding,
[out, retval] long *nBinding
[in] long nMaxBindings,
[out, size_is(,nMaxBindings), length_is(,*nBindings)] BSTR **keyBindings,
[out, retval] long *nBindings
);
/** @brief Returns the non-localized name of specified action.
@param [in] actionIndex
0 based index specifying which action's non-localized name should be returned.
@param [out] name
*/
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] value is NULL
@retval E_INVALIDARG if bad [in] passed, [out] value is NULL
*/
[propget] HRESULT name
(
[in] long actionIndex,
@ -117,8 +151,12 @@ interface IAccessibleAction : IUnknown
/** @brief Returns the localized name of specified action.
@param [in] actionIndex
0 based index specifying which action's localized name should be returned.
@param [out] localizedName
*/
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] value is NULL
@retval E_INVALIDARG if bad [in] passed, [out] value is NULL
*/
[propget] HRESULT localizedName
(
[in] long actionIndex,

Просмотреть файл

@ -4,7 +4,8 @@
*
* IAccessible2 IDL Specification
*
* Copyright (c) IBM Corp. 2007
* Copyright (c) Linux Foundation 2007, 2008
* Copyright (c) IBM Corp. 2006
* Copyright (c) Sun Microsystems, Inc. 2000, 2006
*
* This library is free software; you can redistribute it and/or
@ -33,6 +34,10 @@ import "oleacc.idl";
this application from other applications, from other versions of this
application, or from other versions of this application running on different
versions of an accessibility bridge or accessibility toolkit.
Servers implementing IAccessible2 should provide access to the %IAccessibleApplication
interface via QueryService from any object so that ATs can easily determine specific
information about the application such as its name or version.
*/
[object, uuid(D49DED83-5B25-43F4-9B95-93B44595979E)]
interface IAccessibleApplication : IUnknown
@ -40,6 +45,8 @@ interface IAccessibleApplication : IUnknown
/** @brief Returns the application name.
@param [out] name
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] value is NULL
*/
[propget] HRESULT appName
(
@ -48,6 +55,8 @@ interface IAccessibleApplication : IUnknown
/** @brief Returns the application version.
@param [out] version
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] value is NULL
*/
[propget] HRESULT appVersion
(
@ -56,6 +65,8 @@ interface IAccessibleApplication : IUnknown
/** @brief Returns the toolkit/bridge name.
@param [out] name
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] value is NULL
*/
[propget] HRESULT toolkitName
(
@ -64,6 +75,8 @@ interface IAccessibleApplication : IUnknown
/** @brief Returns the toolkit/bridge version.
@param [out] version
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] value is NULL
*/
[propget] HRESULT toolkitVersion
(

Просмотреть файл

@ -4,7 +4,8 @@
*
* IAccessible2 IDL Specification
*
* Copyright (c) IBM Corp. 2007
* Copyright (c) Linux Foundation 2007, 2008
* Copyright (c) IBM Corp. 2006
* Copyright (c) Sun Microsystems, Inc. 2000, 2006
*
* This library is free software; you can redistribute it and/or
@ -27,6 +28,9 @@ import "objidl.idl";
import "oaidl.idl";
import "oleacc.idl";
/** A value specifying a color in ARGB format, where each 8 bit color component
specifies alpha, red, green, and blue respectively. The alpha value is optional.
*/
typedef long IA2Color;
/** @brief This interface is implemented by any object that can be rendered
@ -36,7 +40,7 @@ typedef long IA2Color;
to retrieve information concerning the graphical representation of an object.
Coordinates used by the functions of this interface are specified in
different coordinate systems. Their scale is the same and is equal to
that of the screen coordiante system. In other words all coordinates
that of the screen coordinate system. In other words all coordinates
are measured in pixels. They differ in their respective origin:
<ul>
<li>The screen coordinate system has its origin in the upper left
@ -61,6 +65,7 @@ interface IAccessibleComponent : IUnknown
@param [out] x
@param [out] y
@retval S_OK
*/
[propget] HRESULT locationInParent
(
@ -72,6 +77,7 @@ interface IAccessibleComponent : IUnknown
@param [out] foreground
The returned color is the foreground color of this object or, if
that is not supported, the default foreground color.
@retval S_OK
*/
[propget] HRESULT foreground
(
@ -82,6 +88,7 @@ interface IAccessibleComponent : IUnknown
@param [out] background
The returned color is the background color of this object or, if
that is not supported, the default background color.
@retval S_OK
*/
[propget] HRESULT background
(

Просмотреть файл

@ -4,6 +4,7 @@
*
* IAccessible2 IDL Specification
*
* Copyright (c) Linux Foundation 2007, 2008
* Copyright (c) IBM Corp. 2006
* Copyright (c) Sun Microsystems, Inc. 2000, 2006
*
@ -19,19 +20,21 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
************************************************************************/
import "objidl.idl";
import "oaidl.idl";
import "oleacc.idl";
/** @brief This interface gives write access to a text representation.
import "IA2CommonTypes.idl";
/** @brief This interface provides clipboard capability to text objects.
This interface is typically used in conjunction with the IAccessibleText
interface and complements that interface with the additional ability to
modify text.
interface and complements that interface with the additional capability of
clipboard operations. Note that even a read only text object can support
the copy capability so this interface is not limited to editable objects.
The substrings used with this interface are specified as follows:
If startOffset is less than endOffset, the substring starts with the
@ -40,6 +43,10 @@ import "oleacc.idl";
with the two arguments exchanged. The whole text can be defined by passing
the indices zero and IAccessibleText::nCharacters. If both indices have the
same value, an empty string is defined.
Refer to the @ref _specialOffsets
"Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods"
for information about a special offset constant that can be used in %IAccessibleEditableText methods.
*/
[object, uuid(A59AA09A-7011-4b65-939D-32B1FB5547E3)]
interface IAccessibleEditableText : IUnknown
@ -56,6 +63,8 @@ interface IAccessibleEditableText : IUnknown
@param [in] endOffset
End index of the text to moved into the clipboard.
The valid range is 0..length.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed
*/
HRESULT copyText
(
@ -74,6 +83,8 @@ interface IAccessibleEditableText : IUnknown
@param [in] endOffset
End index of the text to be deleted.
The valid range is 0..length.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed
*/
HRESULT deleteText
(
@ -91,6 +102,8 @@ interface IAccessibleEditableText : IUnknown
The valid range is 0..length.
@param [in] text
Text that is inserted.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed
*/
HRESULT insertText
(
@ -109,6 +122,8 @@ interface IAccessibleEditableText : IUnknown
@param [in] endOffset
End index of the text to be deleted.
The valid range is 0..length.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed
*/
HRESULT cutText
(
@ -127,6 +142,8 @@ interface IAccessibleEditableText : IUnknown
Index at which to insert the text from the system clipboard into
the text represented by this object.
The valid range is 0..length.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed
*/
HRESULT pasteText
(
@ -149,6 +166,8 @@ interface IAccessibleEditableText : IUnknown
The valid range is 0..length.
@param [in] text
The Text that replaces the text between the given indices.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed
*/
HRESULT replaceText
(
@ -171,6 +190,8 @@ interface IAccessibleEditableText : IUnknown
@param [in] attributes
Set of attributes that replaces the old list of attributes of
the specified text portion.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed
*/
HRESULT setAttributes
(

Просмотреть файл

@ -4,7 +4,8 @@
*
* IAccessible2 IDL Specification
*
* Copyright (c) IBM Corp. 2007
* Copyright (c) Linux Foundation 2007, 2008
* Copyright (c) IBM Corp. 2006
* Copyright (c) Sun Microsystems, Inc. 2000, 2006
*
* This library is free software; you can redistribute it and/or
@ -23,7 +24,11 @@
*
************************************************************************/
/// These constants identify the event IDs fired by IAccessible2 objects.
/** %IAccessible2 specific event constants
This enum defines the event IDs fired by %IAccessible2 objects. The event IDs
are in addition to those used by MSAA.
*/
enum IA2EventID {
/** The change of the number or attributes of actions of an accessible
@ -31,11 +36,27 @@ enum IA2EventID {
*/
IA2_EVENT_ACTION_CHANGED = 0x101,
/** The active descendant of a component has changed. The active descendant
is used in objects with transient children.
/** The active descendant of a component has changed.
Note: This event constant is misspelled and thus is deprecated and will be
removed in a later version. Please use the correctly spelled version which
follows.
*/
IA2_EVENT_ACTIVE_DECENDENT_CHANGED,
/** The active descendant of a component has changed. The active descendant
is used in objects with transient children.
Note: Due to the fact that MSAA's WinEvents don't allow the active child index
to be passed on the IA2_EVENT_ACTIVE_DESCENDANT_CHANGED event the manages
descendants scheme can't be used. Instead the active child object has to fire
MSAA's EVENT_OBJECT_FOCUS. In a future release a new event mechanism may be
added to provide for event specific data to be passed with the event. At that
time the IA2_EVENT_ACTIVE_DECENDENT_CHANGED event and
IA2_STATE_MANAGES_DESCENDANTS state would be useful.
*/
IA2_EVENT_ACTIVE_DESCENDANT_CHANGED = IA2_EVENT_ACTIVE_DECENDENT_CHANGED,
/** The document wide attributes of the document object have changed.
*/
IA2_EVENT_DOCUMENT_ATTRIBUTE_CHANGED,
@ -60,7 +81,7 @@ enum IA2EventID {
*/
IA2_EVENT_HYPERLINK_END_INDEX_CHANGED,
/** The number of anchors assoicated with this hyperlink object has changed.
/** The number of anchors associated with this hyperlink object has changed.
*/
IA2_EVENT_HYPERLINK_NUMBER_OF_ANCHORS_CHANGED,
@ -142,8 +163,7 @@ enum IA2EventID {
*/
IA2_EVENT_TEXT_CARET_MOVED,
/** This event indicates general text changes, i.e. changes to text that is
exposed through the IAccessibleText and IAccessibleEditableText interfaces.
/** <b>Deprecated.</b> This event is equivalent to ::IA2_EVENT_TEXT_UPDATED.
*/
IA2_EVENT_TEXT_CHANGED,
@ -159,15 +179,22 @@ enum IA2EventID {
*/
IA2_EVENT_TEXT_REMOVED,
/** Text was updated.
/** This event indicates general text changes, i.e. changes to text that are
exposed through the IAccessibleText interface. For compatibility with ATK/AT-SPI
which does not have an equivalent event, servers can alternatively fire
::IA2_EVENT_TEXT_REMOVED and ::IA2_EVENT_TEXT_INSERTED.
*/
IA2_EVENT_TEXT_UPDATED,
/** The text selection changed.
/** The text selection changed. Later versions of Microsoft development environments
have an equivalent event identified, EVENT_OBJECT_TEXTSELECTIONCHANGED. Servers
should use that if it is available and use IA2_EVENT_TEXT_SELECTION_CHANGED otherwise.
Clients should be prepared to respond to either event.
*/
IA2_EVENT_TEXT_SELECTION_CHANGED,
/** A visibile data event indicates the change of the visual appearance
/** A visible data event indicates the change of the visual appearance
of an accessible object. This includes for example most of the
attributes available via the IAccessibleComponent interface.
*/

Просмотреть файл

@ -4,6 +4,7 @@
*
* IAccessible2 IDL Specification
*
* Copyright (c) Linux Foundation 2007, 2008
* Copyright (c) IBM Corp. 2006
* Copyright (c) Sun Microsystems, Inc. 2000, 2006
*
@ -35,14 +36,36 @@ import "AccessibleAction.idl";
single link or a collection of links such as when the non-text object is
an image map.
Linked objects and anchors are implementation dependent. This interface is
derived from IAccessibleAction. IAccessibleAction::nActions indicates the
Linked objects and anchors are implementation dependent. This interface is derived
from IAccessibleAction. IAccessibleAction::nActions is one greater than the
maximum value for the indices used with the methods of this interface.
Furthermore, the object that implements this interface has to be connected
implicitly or explicitly with an object that implements IAccessibleText.
IAccessibleHyperlink::startIndex and IAccessibleHyperlink::endIndex are
indices with respect to the text exposed by IAccessibleText.
This interface provides access to a single object which can have multiple actions.
An example is an image map which is an image with multiple links each of which is
associated with a separate non-overlapping area of the image. This interface could
also be applied to other kinds of objects with multiple actions such as "smart tags"
which are objects, typically strings, which have multiple actions such as
"Activate URI", "Bookmark URI", etc.
An interesting use case is an image map where each area is associated with multiple
actions, e.g. an image map of smart tags. In this case you would have to implement
two levels of accessible hyperlinks. The first level hyperlinks would only implement
anchor and anchorTarget. The anchors would all reference the image object. The
anchorTargets would reference the second level accessible hyperlink objects. None
of the IAccessibleAction methods would be implemented on the first level hyperlink
objects. The second level hyperlink objects would implement the IAccessibleAction
methods. Their anchors would also reference the image object and their anchorTargets
would reference URLs or the objects that would be activated.
This use case demonstrates that in some cases there is no need for IAccessibleHyperlink
to derive from IAccessibleAction. As a result it may be removed in a later version of
the IDL and it is suggested that implementations should not rely on the inheritance.
*/
[object, uuid(01C20F2B-3DD2-400f-949F-AD00BDAB1D41)]
interface IAccessibleHyperlink : IAccessibleAction
@ -56,9 +79,13 @@ interface IAccessibleHyperlink : IAccessibleAction
index is indicated by IAccessibleAction::nActions.
@param [out] anchor
This is an implementation dependent value. For example, for a text link this
method could return the substring of the containing string where the subsgtring
method could return the substring of the containing string where the substring
is overridden with link behavior, and for an image link this method could return
an IUnknown VARIANT for IAccessibleImage.
an IUnknown VARIANT for IAccessibleImage. See the section about
@ref _variants "VARIANTs" for additional information.
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] value is NULL
@retval E_INVALIDARG if bad [in] passed, [out] value is NULL
*/
[propget] HRESULT anchor
(
@ -76,7 +103,11 @@ interface IAccessibleHyperlink : IAccessibleAction
This is an implementation dependent value. For example this method could
return a BSTR VARIANT of the URI. Alternatively this method could return an
IUnknown VARIANT of a COM interface representing a target object to be
activated when the link is activated.
activated when the link is activated. See the section about
@ref _variants "VARIANTs" for additional information.
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] value is NULL
@retval E_INVALIDARG if bad [in] passed, [out] value is NULL
*/
[propget] HRESULT anchorTarget
(
@ -84,22 +115,24 @@ interface IAccessibleHyperlink : IAccessibleAction
[out, retval] VARIANT *anchorTarget
);
/** @brief Returns the index at which the textual representation of the hyperlink starts.
/** @brief Returns the 0 based character offset at which the textual representation of the hyperlink starts.
The returned value is related to the IAccessibleText interface of the object that
owns this hyperlink.
@param [out] index
@retval S_OK
*/
[propget] HRESULT startIndex
(
[out, retval] long *index
);
/** @brief Returns the index at which the textual rerpesentation of the hyperlink ends.
/** @brief Returns the 0 based character offset at which the textual representation of the hyperlink ends.
The returned value is related to the IAccessibleText interface of the object that
owns this hyperlink. The character at the index is not part of the hypertext.
@param [out] index
@retval S_OK
*/
[propget] HRESULT endIndex
(
@ -111,7 +144,15 @@ interface IAccessibleHyperlink : IAccessibleAction
This is a volatile state that may change without sending an appropriate event.
Returns TRUE if the referenced target is still valid and FALSE otherwise.
This has also been used to indicate whether or not the URI of the anchorTarget
is malformed.
Note: This method is not being used, is deprecated, and should not be implemented or
used. It is likely that this method will be removed in a later version of the IDL.
@param [out] valid
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] value is FALSE
*/
[propget] HRESULT valid
(

Просмотреть файл

@ -4,6 +4,7 @@
*
* IAccessible2 IDL Specification
*
* Copyright (c) Linux Foundation 2007, 2008
* Copyright (c) IBM Corp. 2006
* Copyright (c) Sun Microsystems, Inc. 2000, 2006
*
@ -31,10 +32,10 @@ import "AccessibleHyperlink.idl";
/** @brief This interface exposes information about hypertext in a document.
The IAccessibleHypertext interface is the main interface to expose
The %IAccessibleHypertext interface is the main interface to expose
hyperlinks in a document, typically a text document, that are used
to reference other documents. A typical implementation is to implement
this interface the smallest text object such as a paragraph of text.
this interface on the smallest text object such as a paragraph of text.
*/
[object, uuid(6B4F8BBF-F1F2-418a-B35E-A195BC4103B9)]
interface IAccessibleHypertext : IAccessibleText
@ -45,6 +46,7 @@ interface IAccessibleHypertext : IAccessibleText
@param [out] hyperlinkCount
The number of links and link groups within this hypertext paragraph.
Returns 0 if there is no link.
@retval S_OK
*/
[propget] HRESULT nHyperlinks
(
@ -61,6 +63,8 @@ interface IAccessibleHypertext : IAccessibleText
If the given index is valid, i.e. lies in the interval from 0 to the number
of links minus one, a reference to the specified hyperlink object is returned.
If the index is invalid then a NULL pointer is returned.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed, [out] value is NULL
*/
[propget] HRESULT hyperlink
(
@ -79,6 +83,9 @@ interface IAccessibleHypertext : IAccessibleText
@param [out] hyperlinkIndex
Returns the 0 based index of the hyperlink that is associated with this
character index, or -1 if charIndex is not on a link.
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] value is -1
@retval E_INVALIDARG if bad [in] passed, [out] value is NULL
*/
[propget] HRESULT hyperlinkIndex
(

Просмотреть файл

@ -4,6 +4,7 @@
*
* IAccessible2 IDL Specification
*
* Copyright (c) Linux Foundation 2007, 2008
* Copyright (c) IBM Corp. 2006
* Copyright (c) Sun Microsystems, Inc. 2000, 2006
*
@ -31,7 +32,7 @@ import "IA2CommonTypes.idl";
/** @brief This interface represents images and icons.
This interface is used for a representation of images like icons on buttons.
IAccessibleImage only needs to be implemented in certain situations. Some
%IAccessibleImage only needs to be implemented in certain situations. Some
examples are:
<ol>
<li>The accessible name and description are not enough to fully
@ -47,6 +48,8 @@ interface IAccessibleImage : IUnknown
{
/** @brief Returns the localized description of the image.
@param [out] description
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] value is NULL
*/
[propget] HRESULT description
(
@ -58,6 +61,7 @@ interface IAccessibleImage : IUnknown
Specifies whether the returned coordinates should be relative to the screen or the parent object.
@param [out] x
@param [out] y
@retval S_OK
*/
[propget] HRESULT imagePosition
(
@ -69,6 +73,7 @@ interface IAccessibleImage : IUnknown
/** @brief Returns the size of the image in units specified by parent's coordinate system.
@param [out] height
@param [out] width
@retval S_OK
*/
[propget] HRESULT imageSize

Просмотреть файл

@ -4,6 +4,7 @@
*
* IAccessible2 IDL Specification
*
* Copyright (c) Linux Foundation 2007, 2009
* Copyright (c) IBM Corp. 2006
* Copyright (c) Sun Microsystems, Inc. 2000, 2006
*
@ -19,7 +20,7 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
************************************************************************/
@ -54,7 +55,11 @@ const WCHAR *const IA2_RELATION_EMBEDDED_BY = L"embeddedBy";
*/
const WCHAR *const IA2_RELATION_EMBEDS = L"embeds";
/** Content flows to this object from a target object. */
/** Content flows to this object from a target object.
This relation and IA2_RELATION_FLOWS_TO are useful to tie text and non-text
objects together in order to allow assistive technology to follow the
intended reading order.
*/
const WCHAR *const IA2_RELATION_FLOWS_FROM = L"flowsFrom";
/** Content flows from this object to a target object. */
@ -63,9 +68,15 @@ const WCHAR *const IA2_RELATION_FLOWS_TO = L"flowsTo";
/** This object is label for a target object. */
const WCHAR *const IA2_RELATION_LABEL_FOR = L"labelFor";
/** This object is labelled by a target object. */
/** This object is labelled by a target object. Note that the double L spelling
which follows is preferred. Please use it instead. This single L version may
be removed in a later version.
*/
const WCHAR *const IA2_RELATION_LABELED_BY = L"labelledBy";
/** This object is labelled by a target object. */
const WCHAR *const IA2_RELATION_LABELLED_BY = L"labelledBy";
/** This object is a member of a group of one or more objects. When
there is more than one object in the group each member may have one and the
same target, e.g. a grouping object. It is also possible that each member has
@ -80,7 +91,7 @@ const WCHAR *const IA2_RELATION_NODE_CHILD_OF = L"nodeChildOf";
const WCHAR *const IA2_RELATION_PARENT_WINDOW_OF = L"parentWindowOf";
/** This object is a transient component related to the target object.
When this object is activated the target object doesn't lose focus.
When this object is activated the target object doesn't loose focus.
*/
const WCHAR *const IA2_RELATION_POPUP_FOR = L"popupFor";
@ -95,6 +106,8 @@ interface IAccessibleRelation : IUnknown
{
/** @brief Returns the type of the relation.
@param [out] relationType
The strings returned are defined @ref grpRelations "in this section of the documentation".
@retval S_OK
*/
[propget] HRESULT relationType
(
@ -103,6 +116,7 @@ interface IAccessibleRelation : IUnknown
/** @brief Returns a localized version of the relation type.
@param [out] localizedRelationType
@retval S_OK
*/
[propget] HRESULT localizedRelationType
(
@ -111,6 +125,7 @@ interface IAccessibleRelation : IUnknown
/** @brief Returns the number of targets for this relation.
@param [out] nTargets
@retval S_OK
*/
[propget] HRESULT nTargets
(
@ -121,7 +136,10 @@ interface IAccessibleRelation : IUnknown
@param [in] targetIndex
0 based index
@param [out] target
Note: Use QueryInterface to get IAccessible2.
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] value is NULL
@retval E_INVALIDARG if bad [in] passed, [out] value is NULL
@note Use QueryInterface to get IAccessible2.
*/
[propget] HRESULT target
(
@ -131,17 +149,22 @@ interface IAccessibleRelation : IUnknown
/** @brief Returns multiple accessible relation targets
@param [in] maxTargets
Maximum number of targets to get.
@param [out] target
Array of accessible targets. Use QueryInterface to get IAccessible2.
maximum size of the array allocated by the client
@param [out] targets
The array of target objects. Note that this array is to be allocated by the
client and freed when no longer needed. Refer to @ref _arrayConsideration
"Special Consideration when using Arrays" for more details. You will need to use
QueryInterface on the IUnknown to get the IAccessible2.
@param [out] nTargets
length of array (not more than maxTargets)
actual number of targets in the returned array (not more than maxTargets)
@retval S_OK
@retval S_FALSE if there is nothing to return, nTargets is set to 0
*/
[propget] HRESULT targets
(
[in] long maxTargets,
[out, size_is(maxTargets), length_is(*nTargets)]
IUnknown **target,
IUnknown **targets,
[out, retval] long *nTargets
);

Просмотреть файл

@ -4,7 +4,8 @@
*
* IAccessible2 IDL Specification
*
* Copyright (c) IBM Corp. 2007
* Copyright (c) Linux Foundation 2007, 2008
* Copyright (c) IBM Corp. 2006
* Copyright (c) Sun Microsystems, Inc. 2000, 2006
*
* This library is free software; you can redistribute it and/or
@ -25,12 +26,12 @@
import "objidl.idl";
/** Collection of roles.
/** Collection of roles
This enumerator defines the set of possible roles of objects implementing the
IAccessible2 interface. The role of an object describes its generic function
like 'button', 'menu', or 'text'. You can obtain an object's role by calling
the get_accRole method of the IAccessible interface.
This enumerator defines an extended set of accessible roles of objects implementing
the %IAccessible2 interface. These roles are in addition to the MSAA roles obtained
through the MSAA get_accRole method. Examples are 'footnote', 'heading', and
'label'. You obtain an object's %IAccessible2 roles by calling IAccessible2::role.
*/
enum IA2Role {
@ -73,10 +74,14 @@ enum IA2Role {
*/
IA2_ROLE_DIRECTORY_PANE,
/// An editable text object in a toolbar.
/** An editable text object in a toolbar.
<BR><B>Note:</B> This role has been deprecated. The edit bar role was meant
for a text area in a tool bar. However, to detect a text area in a tool bar
the AT can query the parent.
*/
IA2_ROLE_EDITBAR,
/// Embeded (OLE) object.
/// Embedded (OLE) object.
IA2_ROLE_EMBEDDED_OBJECT,
/// Text that is used as an endnote (footnote at the end of a chapter or section).
@ -203,13 +208,11 @@ enum IA2Role {
IA2_ROLE_SCROLL_PANE,
/** A container of document content. An example of the use of this role is to
represent an HTML DIV tag.
A section may be used as a region. A region is a group of elements that
together form a perceivable unit. A region does not necessarily follow the
logical structure of the content, but follows the perceivable structure of
the page. A region may have an attribute in the set of
IAccessible2::attributes which indicates that it is "live". A live region
represent an HTML DIV tag. A section may be used as a region. A region is a
group of elements that together form a perceivable unit. A region does not
necessarily follow the logical structure of the content, but follows the
perceivable structure of the page. A region may have an attribute in the set
of IAccessible2::attributes which indicates that it is "live". A live region
is content that is likely to change in response to a timed change, a user
event, or some other programmed logic or event.
*/

Просмотреть файл

@ -4,7 +4,8 @@
*
* IAccessible2 IDL Specification
*
* Copyright (c) IBM Corp. 2007
* Copyright (c) Linux Foundation 2007, 2008
* Copyright (c) IBM Corp. 2006
* Copyright (c) Sun Microsystems, Inc. 2000, 2006
*
* This library is free software; you can redistribute it and/or
@ -27,94 +28,129 @@ import "objidl.idl";
typedef long AccessibleStates;
/** @defgroup grpStates States
IAccessible2 state constants.
/** %IAccessible2 specific state bit constants
This enum defines the state bits returned by IAccessible2::states. The
%IAccessible2 state bits are in addition to those returned by MSAA.
*/
///@{
enum IA2States {
/** Indicates a window is currently the active window. */
const long IA2_STATE_ACTIVE = 0x1;
/** Indicates a window is currently the active window, or is an active subelement
within a container or table.
/** Indicates that the object is armed. */
const long IA2_STATE_ARMED = 0x2;
This state can be used to indicate the current active item in a container, even
if the container itself is not currently active. In other words this would indicate
the item that will get focus if you tab to the container.
This information is important for knowing what to report for trees and potentially
other containers in a virtual buffer.
Also, see ::IA2_STATE_MANAGES_DESCENDANTS for more information.
*/
IA2_STATE_ACTIVE = 0x1,
/** Indicates that the object is armed.
Used to indicate that the control is "pressed" and will be invoked when the
actuator, e.g. a mouse button, is "released". An AT which either monitors the
mouse or synthesizes mouse events might need to know that, and possibly a talking
interface would even let the user know about it. It could also potentially be
useful to on screen keyboards or test tools since the information does indicate
something about the state of the interface, for example, code operating asynchronously
might need to wait for the armed state to change before doing something else.
*/
IA2_STATE_ARMED = 0x2,
/** Indicates the user interface object corresponding to this object no longer exists. */
const long IA2_STATE_DEFUNCT = 0x4;
IA2_STATE_DEFUNCT = 0x4,
/** Indicates the user can change the contents of this object. */
const long IA2_STATE_EDITABLE = 0x8;
IA2_STATE_EDITABLE = 0x8,
/** Indicates the orientation of this object is horizontal. */
const long IA2_STATE_HORIZONTAL = 0x10;
IA2_STATE_HORIZONTAL = 0x10,
/** Indicates this object is minimized and is represented only by an icon. */
const long IA2_STATE_ICONIFIED = 0x20;
IA2_STATE_ICONIFIED = 0x20,
/** Indicates an input validation failure. */
const long IA2_STATE_INVALID_ENTRY = 0x40;
IA2_STATE_INVALID_ENTRY = 0x40,
/** Indicates that this object manages its children.
Used when children are transient. In this case it is not necessary to add
listeners to the children.
The state is added to improve performance in the case of large containers such
as tables. When an object manages its children it is not necessary to iterate
over all the children and add listeners. The parent object will provide state
notifications regarding the state of its children.
Note: Due to the fact that MSAA's WinEvents don't allow the active child index
to be passed on the IA2_EVENT_ACTIVE_DESCENDANT_CHANGED event, the manages
descendants scheme can't be used. Instead the active child object has to fire
MSAA's EVENT_OBJECT_FOCUS. In a future release a new event mechanism may be
added to provide for event specific data to be passed with the event. At that
time the IA2_EVENT_ACTIVE_DECENDENT_CHANGED event and
IA2_STATE_MANAGES_DESCENDANTS state would be useful.
*/
const long IA2_STATE_MANAGES_DESCENDANTS = 0x80;
IA2_STATE_MANAGES_DESCENDANTS = 0x80,
/** Indicates that an object is modal.
Modal objects have the behavior that something must be done with the object
before the user can interact with an object in a different window.
*/
const long IA2_STATE_MODAL = 0x100;
IA2_STATE_MODAL = 0x100,
/** Indicates this text object can contain multiple lines of text. */
const long IA2_STATE_MULTI_LINE = 0x200;
IA2_STATE_MULTI_LINE = 0x200,
/** Indicates this object paints every pixel within its rectangular region. */
const long IA2_STATE_OPAQUE = 0x400;
IA2_STATE_OPAQUE = 0x400,
/** Indicates that user interaction is required.
An example of when this state is used is when a field in a form must be filled
before a form can be processed.
*/
const long IA2_STATE_REQUIRED = 0x800;
IA2_STATE_REQUIRED = 0x800,
/** Indicates an object which supports text selection.
Note: This is different than MSAA STATE_SYSTEM_SELECTABLE.
*/
const long IA2_STATE_SELECTABLE_TEXT = 0x1000;
IA2_STATE_SELECTABLE_TEXT = 0x1000,
/** Indicates that this text object can contain only a single line of text. */
const long IA2_STATE_SINGLE_LINE = 0x2000;
IA2_STATE_SINGLE_LINE = 0x2000,
/** Indicates that the accessible object is stale.
This state is used when the accessible object no longer accurately
represents the state of the object which it is representing such as when an
object is transient or when an object has been or is in the process of being
destroyed.
destroyed or when the object's index in its parent has changed.
*/
const long IA2_STATE_STALE = 0x4000;
IA2_STATE_STALE = 0x4000,
/** Indicates that the object implements autocompletion.
This state indicates that that a text control will respond to the input of
This state indicates that a text control will respond to the input of
one ore more characters and cause a sub-item to become selected. The
selection may also result in events fired on the parent object.
*/
const long IA2_STATE_SUPPORTS_AUTOCOMPLETION = 0x8000;
IA2_STATE_SUPPORTS_AUTOCOMPLETION = 0x8000,
/** Indicates this object is transient. */
const long IA2_STATE_TRANSIENT = 0x10000;
/** Indicates this object is transient.
An object has this state when its parent object has the state ::IA2_STATE_MANAGES_DESCENDANTS.
For example, a list item object may be managed by its parent list object and may only
exist as long as the object is actually rendered. Similarly a table cell's accessible
object may exist only while the cell has focus. However, from the perspective of an
assistive technology a transient object behaves like a non-transient object. As a
result it is likely that this state is not of use to an assistive technology, but it
is provided in case an assistive technology determines that knowledge of the transient
nature of the object is useful and also for harmony with the Linux accessibility API.
Also, see ::IA2_STATE_MANAGES_DESCENDANTS for more information.
*/
IA2_STATE_TRANSIENT = 0x10000,
/** Indicates the orientation of this object is vertical. */
const long IA2_STATE_VERTICAL = 0x20000;
IA2_STATE_VERTICAL = 0x20000
///@}
};

Просмотреть файл

@ -4,7 +4,8 @@
*
* IAccessible2 IDL Specification
*
* Copyright (c) IBM Corp. 2007
* Copyright (c) Linux Foundation 2007, 2009
* Copyright (c) IBM Corp. 2006
* Copyright (c) Sun Microsystems, Inc. 2000, 2006
*
* This library is free software; you can redistribute it and/or
@ -19,7 +20,7 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
************************************************************************/
@ -27,35 +28,32 @@ import "objidl.idl";
import "oaidl.idl";
import "oleacc.idl";
import "Accessible2.idl";
/// Defines values which specify the kind of change made to a table
enum IA2TableModelChangeType {
IA2_TABLE_MODEL_CHANGE_INSERT, // = 0;
IA2_TABLE_MODEL_CHANGE_DELETE,
IA2_TABLE_MODEL_CHANGE_UPDATE
};
/// A structure defining the type of and extents of changes made to a table
typedef struct {
enum IA2TableModelChangeType type; // insert, delete, update
long firstRow;
long lastRow;
long firstColumn;
long lastColumn;
} IA2TableModelChange;
import "IA2CommonTypes.idl";
/** @brief This interface gives access to a two-dimensional table.
All accessible objects that represent cells or cell-clusters of a table have
to be at the same time children of the table. This is necessary to be able
to convert row and column indices into child indices and vice versa with the
methods IAccessibleTable::childIndex, IAccessibleTable::rowIndex, and
IAccessibleTable::columnIndex.
Typically all accessible objects that represent cells or cell-clusters of a table
will be at the same time children of the table. In this case IAccessible2::indexInParent
will return the child index which then can be used when calling IAccessibleTable::rowIndex
and IAccessibleTable::columnIndex.
However, in some cases that kind of implementation will not be possible. When
the table cells are not direct children of a table, the object representing
the cell can define a "table-cell-index" object attribute identifying the 0
based table cell index. This object attribute is obtained by parsing the
attribute string returned by IAccessible2::attributes. The "table-cell-index"
attribute can be used just like a child index of the typical case. ATs should
first test for the presence of the "table-cell-index" attribute and if it is not
present then IAccessible2::indexInParent can be used as in the typical case
where cells are direct children of the table.
The range of valid coordinates for this interface are implementation dependent.
However, that range includes at least the intervals from the from the first row
or column with the index 0 up to the last (but not including) used row or column
as returned by IAccessibleTable::nRows and IAccessibleTable::nColumns.
Note that newer implementations are now using IAccessibleTable2 and IAccessibleTableCell
rather than this interface.
*/
[object, uuid(35AD8070-C20C-4fb4-B094-F4F7275DD469)]
interface IAccessibleTable : IUnknown
@ -64,13 +62,15 @@ interface IAccessibleTable : IUnknown
/** @brief Returns the accessible object at the specified row and column in
the table. This object could be an IAccessible or an IAccessible2.
@param [in] row
The row index for which to retrieve the cell.
The 0 based row index for which to retrieve the cell.
@param [in] column
The column index for which to retrieve the cell.
The 0 based column index for which to retrieve the cell.
@param [out] accessible
If both row and column index are valid then the corresponding accessible
object is returned that represents the requested cell regardless of whether
the cell is currently visible (on the screen).
@retval S_OK
@retval E_INVALIDARG if bad [in] passed, [out] value is NULL
*/
[propget] HRESULT accessibleAt
(
@ -84,34 +84,44 @@ interface IAccessibleTable : IUnknown
@param [out] accessible
If the table has a caption then a reference to it is returned, else a NULL
pointer is returned.
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] value is NULL
*/
[propget] HRESULT caption
(
[out, retval] IUnknown **accessible
);
/** @brief Translates the given row and column indices into the corresponding child index.
/** @brief Translates the given row and column indexes into the corresponding cell index.
@param [in] rowIndex
Index of the child of the table for which to return the row index.
0 based row index for the cell.
@param [in] columnIndex
Index of the child of the table for which to return the column index.
@param [out] childIndex
Returns the row index of the cell of the specified child or the index of
the first row if the child spans multiple rows.
0 based column index for the cell.
@param [out] cellIndex
Returns the 0 based index of the cell at the specified row and column indexes.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed, [out] value is 0
@note The returned value is not necessarily a child index of the immediate parent.
In cases where the table cells are not direct children of the table the index
is actually the cell index, i.e. conceptually it's an index into a one dimensional
array of cells laid out in row order.
*/
[propget] HRESULT childIndex
(
[in] long rowIndex,
[in] long columnIndex,
[out, retval] long *childIndex
[out, retval] long *cellIndex
);
/** @brief Returns the description text of the specified column in the table.
@param [in] column
The index of the column for which to retrieve the description.
The 0 based index of the column for which to retrieve the description.
@param [out] description
Returns the description text of the specified row in the table if such a
Returns the description text of the specified column in the table if such a
description exists. Otherwise a NULL pointer is returned.
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] value is NULL
@retval E_INVALIDARG if bad [in] passed, [out] value is NULL
*/
[propget] HRESULT columnDescription
(
@ -122,13 +132,15 @@ interface IAccessibleTable : IUnknown
/** @brief Returns the number of columns occupied by the accessible object
at the specified row and column in the table.
The result differs from 1 if the specified cell spans multiple columns.
The result is greater than 1 if the specified cell spans multiple columns.
@param [in] row
Row index of the accessible for which to return the column extent.
0 based row index of the accessible for which to return the column extent.
@param [in] column
Column index of the accessible for which to return the column extent.
0 based column index of the accessible for which to return the column extent.
@param [out] nColumnsSpanned
Returns the column extent of the specified cell.
Returns the 1 based column extent of the specified cell.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed, [out] value is 0
*/
[propget] HRESULT columnExtentAt
(
@ -137,13 +149,15 @@ interface IAccessibleTable : IUnknown
[out, retval] long *nColumnsSpanned
);
/** @brief Returns the column headers as an IAccessibleTable object.
/** @brief Returns the column headers as an %IAccessibleTable object.
Content and size of the returned table are implementation dependent.
@param [out] accessibleTable
The column header
@param [out] startingRowIndex
The row index where the header starts, usually 0.
The 0 based row index where the header starts, usually 0.
@retval S_OK
@retval S_FALSE if there is no header, [out] values are NULL and 0 respectively
*/
[propget] HRESULT columnHeader
(
@ -151,22 +165,29 @@ interface IAccessibleTable : IUnknown
[out, retval] long *startingRowIndex
);
/** @brief Translates the given child index into the corresponding column index.
@param [in] childIndex
Index of the child of the table for which to return the column index.
/** @brief Translates the given cell index into the corresponding column index.
@param [in] cellIndex
0 based index of the cell in the parent or closest ancestor table. Typically this
is the value returned from IAccessible2::indexInParent, but in the case where the
table cells are not direct children of the table this is the cell index specified
by the "table-cell-index" object attribute obtained from parsing the attributes
string returned by calling IAccessible2::attributes on the cell object.
@param [out] columnIndex
Returns the column index of the cell of the specified child or the index of
Returns the 0 based column index of the cell of the specified child or the index of
the first column if the child spans multiple columns.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed, [out] value is 0
*/
[propget] HRESULT columnIndex
(
[in] long childIndex,
[in] long cellIndex,
[out, retval] long *columnIndex
);
/** @brief Returns the total number of columns in table
@param [out] columnCount
Number of columns in table (including columns outside the current viewport)
@retval S_OK
*/
[propget] HRESULT nColumns
(
@ -176,24 +197,27 @@ interface IAccessibleTable : IUnknown
/** @brief Returns the total number of rows in table
@param [out] rowCount
Number of rows in table (including rows outside the current viewport)
@retval S_OK
*/
[propget] HRESULT nRows
(
[out, retval] long *rowCount
);
/** @brief Returns the total number of selected children
@param [out] childCount
Number of children currently selected
/** @brief Returns the total number of selected cells
@param [out] cellCount
Number of cells currently selected
@retval S_OK
*/
[propget] HRESULT nSelectedChildren
(
[out, retval] long *childCount
[out, retval] long *cellCount
);
/** @brief Returns the total number of selected columns
@param [out] columnCount
Number of columns currently selected
@retval S_OK
*/
[propget] HRESULT nSelectedColumns
(
@ -203,6 +227,7 @@ interface IAccessibleTable : IUnknown
/** @brief Returns the total number of selected rows
@param [out] rowCount
Number of rows currently selected
@retval S_OK
*/
[propget] HRESULT nSelectedRows
(
@ -211,10 +236,13 @@ interface IAccessibleTable : IUnknown
/** @brief Returns the description text of the specified row in the table.
@param [in] row
The index of the row for which to retrieve the description.
The 0 based index of the row for which to retrieve the description.
@param [out] description
Returns the description text of the specified row in the table if such a
description exists. Otherwise a NULL pointer is returned.
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] value is NULL
@retval E_INVALIDARG if bad [in] passed, [out] value is NULL
*/
[propget] HRESULT rowDescription
(
@ -222,16 +250,18 @@ interface IAccessibleTable : IUnknown
[out, retval] BSTR *description
);
/** @brief Returns the number of rows occupied by the accessible oject
/** @brief Returns the number of rows occupied by the accessible object
at the specified row and column in the table.
The result differs from 1 if the specified cell spans multiple rows.
The result is greater than 1 if the specified cell spans multiple rows.
@param [in] row
Row index of the accessible for which to return the column extent.
0 based row index of the accessible for which to return the row extent.
@param [in] column
Column index of the accessible for which to return the column extent.
0 based column index of the accessible for which to return the row extent.
@param [out] nRowsSpanned
Returns the row extent of the specified cell.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed, [out] value is 0
*/
[propget] HRESULT rowExtentAt
(
@ -240,13 +270,15 @@ interface IAccessibleTable : IUnknown
[out, retval] long *nRowsSpanned
);
/** @brief Returns the row headers as an IAccessibleTable object.
/** @brief Returns the row headers as an %IAccessibleTable object.
Content and size of the returned table are implementation dependent.
@param [out] accessibleTable
The row header.
@param [out] startingColumnIndex
The column index where the header starts, usually 0.
The 0 based column index where the header starts, usually 0.
@retval S_OK
@retval S_FALSE if there is no header, [out] values are NULL and 0 respectively
*/
[propget] HRESULT rowHeader
(
@ -254,25 +286,35 @@ interface IAccessibleTable : IUnknown
[out, retval] long *startingColumnIndex
);
/** @brief Translates the given child index into a row index.
@param [in] childIndex
Index in parent (0 based)
/** @brief Translates the given cell index into a row index.
@param [in] cellIndex
0 based index of the cell in the parent or closest ancestor table. Typically this
is the value returned from IAccessible2::indexInParent, but in the case where the
table cells are not direct children of the table this is the cell index specified
by the "table-cell-index" object attribute obtained from parsing the attributes
string returned by calling IAccessible2::attributes on the cell object.
@param [out] rowIndex
Row index (0 based)
0 based row index
@retval S_OK
@retval E_INVALIDARG if bad [in] passed, [out] value is 0
*/
[propget] HRESULT rowIndex
(
[in] long childIndex,
[in] long cellIndex,
[out, retval] long *rowIndex
);
/** @brief Returns a list of child indexes currently selected (0-based).
/** @brief Returns a list of cell indexes currently selected (0 based).
@param [in] maxChildren
Max children requested (possibly from IAccessibleTable::nSelectedChildren)
This parameter is ignored. Refer to @ref _arrayConsideration
"Special Consideration when using Arrays" for more details.
@param [out] children
array of indexes of selected children (each index is 0-based)
An array of cell indexes of selected cells (each index is 0 based),
allocated by the server. Free it with CoTaskMemFree.
@param [out] nChildren
Length of array (not more than maxChildren)
The number of cell indexes returned; the size of the returned array.
@retval S_OK
@retval S_FALSE if there are none, [out] values are NULL and 0 respectively
*/
[propget] HRESULT selectedChildren
(
@ -281,13 +323,17 @@ interface IAccessibleTable : IUnknown
[out, retval] long *nChildren
);
/** @brief Returns a list of column indexes currently selected (0-based).
/** @brief Returns a list of column indexes currently selected (0 based).
@param [in] maxColumns
Max rows requested (possibly from IAccessibleTable::nSelectedColumns)
This parameter is ignored. Refer to @ref _arrayConsideration
"Special Consideration when using Arrays" for more details.
@param [out] columns
array of indexes of selected columns (each index is 0-based)
An array of column indexes of selected columns (each index is 0 based), allocated
by the server. Free it with CoTaskMemFree.
@param [out] nColumns
Length of array (not more than maxColumns)
The number of column indexes returned; the size of the returned array.
@retval S_OK
@retval S_FALSE if there are none, [out] values are NULL and 0 respectively
*/
[propget] HRESULT selectedColumns
(
@ -296,13 +342,17 @@ interface IAccessibleTable : IUnknown
[out, retval] long *nColumns
);
/** @brief Returns a list of row indexes currently selected (0-based).
/** @brief Returns a list of row indexes currently selected (0 based).
@param [in] maxRows
Max rows requested (possibly from IAccessibleTable::nSelectedRows)
This parameter is ignored. Refer to @ref _arrayConsideration
"Special Consideration when using Arrays" for more details.
@param [out] rows
array of indexes of selected rows (each index is 0-based)
An array of row indexes of selected rows (each index is 0 based), allocated
by the server. Free it with CoTaskMemFree.
@param [out] nRows
Length of array (not more than maxRows)
The number of row indexes returned; the size of the returned array.
@retval S_OK
@retval S_FALSE if there are none, [out] values are NULL and 0 respectively
*/
[propget] HRESULT selectedRows
(
@ -317,6 +367,8 @@ interface IAccessibleTable : IUnknown
Returns a reference to an implementation dependent accessible object
representing the table's summary or a NULL pointer if the table
does not support a summary.
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] value is NULL
*/
[propget] HRESULT summary
(
@ -326,9 +378,11 @@ interface IAccessibleTable : IUnknown
/** @brief Returns a boolean value indicating whether the specified column is
completely selected.
@param [in] column
Index of the column for which to determine whether it is selected.
0 based index of the column for which to determine whether it is selected.
@param [out] isSelected
Returns TRUE if the specified column is selected completely and FALSE otherwise.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed, [out] value is FALSE
*/
[propget] HRESULT isColumnSelected
(
@ -339,9 +393,11 @@ interface IAccessibleTable : IUnknown
/** @brief Returns a boolean value indicating whether the specified row is completely
selected.
@param [in] row
Index of the row for which to determine whether it is selected.
0 based index of the row for which to determine whether it is selected.
@param [out] isSelected
Returns TRUE if the specified row is selected completely and FALSE otherwise.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed, [out] value is FALSE
*/
[propget] HRESULT isRowSelected
(
@ -351,11 +407,13 @@ interface IAccessibleTable : IUnknown
/** @brief Returns a boolean value indicating whether the specified cell is selected.
@param [in] row
Index of the row for the cell to determine whether it is selected.
0 based index of the row for the cell to determine whether it is selected.
@param [in] column
Index of the column for the cell to determine whether it is selected.
0 based index of the column for the cell to determine whether it is selected.
@param [out] isSelected
Returns TRUE if the specified cell is selected and FALSE otherwise.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed, [out] value is FALSE
*/
[propget] HRESULT isSelected
(
@ -366,7 +424,9 @@ interface IAccessibleTable : IUnknown
/** @brief Selects a row and unselects all previously selected rows.
@param [in] row
Index of the row to be selected.
0 based index of the row to be selected.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed
*/
HRESULT selectRow
(
@ -375,7 +435,9 @@ interface IAccessibleTable : IUnknown
/** @brief Selects a column and unselects all previously selected columns.
@param [in] column
Index of the column to be selected.
0 based index of the column to be selected.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed
*/
HRESULT selectColumn
(
@ -384,7 +446,9 @@ interface IAccessibleTable : IUnknown
/** @brief Unselects one row, leaving other selected rows selected (if any).
@param [in] row
Index of the row to be selected.
0 based index of the row to be unselected.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed
*/
HRESULT unselectRow
(
@ -393,29 +457,33 @@ interface IAccessibleTable : IUnknown
/** @brief Unselects one column, leaving other selected columns selected (if any).
@param [in] column
Index of the column to be selected.
0 based index of the column to be unselected.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed
*/
HRESULT unselectColumn
(
[in] long column
);
/** @brief Given a child index, gets the row and column indexes and extents of a cell
/** @brief Given a cell index, gets the row and column indexes and extents of a cell
and whether or not it is selected.
This is a convenience function. It is not mandatory to implement it.
@param [in] index
Index of this child in the parent.
0 based index of this cell in the table.
@param [out] row
Row index.
0 based row index.
@param [out] column
Column index.
0 based column index.
@param [out] rowExtents
Number of cells spanned by this cell in this row.
@param [out] columnExtents
Number of cells spanned by this cell in this column.
@param [out] isSelected
Indicates if the specified cell is selected.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed, [out] values are 0s and FALSE respectively
*/
[propget] HRESULT rowColumnExtentsAtIndex
(
@ -429,9 +497,24 @@ interface IAccessibleTable : IUnknown
/** @brief Returns the type and extents describing how a table changed.
Provided for use by the IA2_EVENT_TABLE_MODEL_CHANGED event handler.
Provided for use by the IA2_EVENT_TABLE_MODEL_CHANGED event handler.
This data is only guaranteed to be valid while the thread notifying the event
continues. Once the handler has returned, the validity of the data depends on
how the server manages the life cycle of its objects. Also, note that the server
may have different life cycle management strategies for controls depending on
whether or not a control manages its children. Lists, trees, and tables can have
a large number of children and thus it's possible that the child objects for those
controls would only be created as needed. Servers should document their life cycle
strategy as this will be of interest to assistive technology or script engines
accessing data out of process or from other threads. Servers only need to save the
most recent row and column values associated with the change and a scope of the
entire application is adequate.
@param [out] modelChange
A struct of (type(insert, delete, update), firstRow, lastRow, firstColumn, lastColumn).
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] value is NULL
*/
[propget] HRESULT modelChange
(

Просмотреть файл

@ -0,0 +1,345 @@
/*************************************************************************
*
* File Name (AccessibleTable2.idl)
*
* IAccessible2 IDL Specification
*
* Copyright (c) Linux Foundation 2007, 2009
* Copyright (c) IBM Corp. 2006
* Copyright (c) Sun Microsystems, Inc. 2000, 2006
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
************************************************************************/
import "objidl.idl";
import "oaidl.idl";
import "oleacc.idl";
import "Accessible2.idl";
import "IA2CommonTypes.idl";
/** @brief This interface gives access to a two-dimensional table.
Please also refer to the IAccessibleTableCell interface.
If you want to support older applications you should also support the
IAccessibleTable inteface.
*/
[object, uuid(6167f295-06f0-4cdd-a1fa-02e25153d869)]
interface IAccessibleTable2 : IUnknown
{
/** @brief Returns the accessible object at the specified row and column in
the table. This object could be an IAccessible or an IAccessible2.
@param [in] row
The 0 based row index for which to retrieve the cell.
@param [in] column
The 0 based column index for which to retrieve the cell.
@param [out] cell
If both row and column index are valid then the corresponding accessible
object is returned that represents the requested cell regardless of whether
the cell is currently visible (on the screen).
@retval S_OK
@retval E_INVALIDARG if bad [in] passed, [out] value is NULL
*/
[propget] HRESULT cellAt
(
[in] long row,
[in] long column,
[out, retval] IUnknown **cell
);
/** @brief Returns the caption for the table. The returned object could be
an IAccessible or an IAccessible2.
@param [out] accessible
If the table has a caption then a reference to it is returned, else a NULL
pointer is returned.
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] value is NULL
*/
[propget] HRESULT caption
(
[out, retval] IUnknown **accessible
);
/** @brief Returns the description text of the specified column in the table.
@param [in] column
The 0 based index of the column for which to retrieve the description.
@param [out] description
Returns the description text of the specified column in the table if such a
description exists. Otherwise a NULL pointer is returned.
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] value is NULL
@retval E_INVALIDARG if bad [in] passed, [out] value is NULL
*/
[propget] HRESULT columnDescription
(
[in] long column,
[out, retval] BSTR *description
);
/** @brief Returns the total number of columns in table
@param [out] columnCount
Number of columns in table (including columns outside the current viewport)
@retval S_OK
*/
[propget] HRESULT nColumns
(
[out, retval] long *columnCount
);
/** @brief Returns the total number of rows in table
@param [out] rowCount
Number of rows in table (including rows outside the current viewport)
@retval S_OK
*/
[propget] HRESULT nRows
(
[out, retval] long *rowCount
);
/** @brief Returns the total number of selected cells
@param [out] cellCount
Number of cells currently selected
@retval S_OK
*/
[propget] HRESULT nSelectedCells
(
[out, retval] long *cellCount
);
/** @brief Returns the total number of selected columns
@param [out] columnCount
Number of columns currently selected
@retval S_OK
*/
[propget] HRESULT nSelectedColumns
(
[out, retval] long *columnCount
);
/** @brief Returns the total number of selected rows
@param [out] rowCount
Number of rows currently selected
@retval S_OK
*/
[propget] HRESULT nSelectedRows
(
[out, retval] long *rowCount
);
/** @brief Returns the description text of the specified row in the table.
@param [in] row
The 0 based index of the row for which to retrieve the description.
@param [out] description
Returns the description text of the specified row in the table if such a
description exists. Otherwise a NULL pointer is returned.
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] value is NULL
@retval E_INVALIDARG if bad [in] passed, [out] value is NULL
*/
[propget] HRESULT rowDescription
(
[in] long row,
[out, retval] BSTR *description
);
/** @brief Returns a list of accessibles currently selected.
@param [out] cells
Pointer to an array of references to selected accessibles. The array is
allocated by the server. Free it with CoTaskMemFree.
@param [out] nSelectedCells
The number of accessibles returned; the size of the returned array.
@retval S_OK
@retval S_FALSE if there are none, [out] values are NULL and 0 respectively
*/
[propget] HRESULT selectedCells
(
[out, size_is(,*nSelectedCells,)] IUnknown ***cells,
[out, retval] long *nSelectedCells
);
/** @brief Returns a list of column indexes currently selected (0 based).
@param [out] selectedColumns
A pointer to an array of column indexes of selected columns (each index is
0 based). The array is allocated by the server. Free it with CoTaskMemFree.
@param [out] nColumns
The number of column indexes returned; the size of the returned array.
@retval S_OK
@retval S_FALSE if there are none, [out] values are NULL and 0 respectively
*/
[propget] HRESULT selectedColumns
(
[out, size_is(,*nColumns)] long **selectedColumns,
[out, retval] long *nColumns
);
/** @brief Returns a list of row indexes currently selected (0 based).
@param [out] selectedRows
An array of row indexes of selected rows (each index is 0 based), allocated
by the server. Free it with CoTaskMemFree.
@param [out] nRows
The number of row indexes returned; the size of the returned array.
@retval S_OK
@retval S_FALSE if there are none, [out] values are NULL and 0 respectively
*/
[propget] HRESULT selectedRows
(
[out, size_is(,*nRows)] long **selectedRows,
[out, retval] long *nRows
);
/** @brief Returns the summary description of the table. The returned object could be
an IAccessible or an IAccessible2.
@param [out] accessible
Returns a reference to an implementation dependent accessible object
representing the table's summary or a NULL pointer if the table
does not support a summary.
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] value is NULL
*/
[propget] HRESULT summary
(
[out, retval] IUnknown **accessible
);
/** @brief Returns a boolean value indicating whether the specified column is
completely selected.
@param [in] column
0 based index of the column for which to determine whether it is selected.
@param [out] isSelected
Returns TRUE if the specified column is selected completely and FALSE otherwise.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed, [out] value is FALSE
*/
[propget] HRESULT isColumnSelected
(
[in] long column,
[out, retval] boolean *isSelected
);
/** @brief Returns a boolean value indicating whether the specified row is completely
selected.
@param [in] row
0 based index of the row for which to determine whether it is selected.
@param [out] isSelected
Returns TRUE if the specified row is selected completely and FALSE otherwise.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed, [out] value is FALSE
*/
[propget] HRESULT isRowSelected
(
[in] long row,
[out, retval] boolean *isSelected
);
/** @brief Selects a row and unselects all previously selected rows.
The behavior should mimic that of the application, but for those applications
which do not have a means in the GUI to select a full row of cells the behavior
should be as follows: First any selected rows in the table are unselected. Then
the entire row of cells for the specified row is selected. If any of the
cells in the selected row span additional rows, the cells in those rows
are also selected.
@param [in] row
0 based index of the row to be selected.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed
*/
HRESULT selectRow
(
[in] long row
);
/** @brief Selects a column and unselects all previously selected columns.
The behavior should mimic that of the application, but for those applications
which do not have a means in the GUI to select a full column of cells the behavior
should be as follows: First any selected columns in the table are unselected. Then
the entire column of cells for the specified column is selected. If any of the
cells in the selected column span additional columns, the cells in those columns
are also selected.
@param [in] column
0 based index of the column to be selected.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed
*/
HRESULT selectColumn
(
[in] long column
);
/** @brief Unselects one row, leaving other selected rows selected (if any).
The behavior should mimic that of the application, but for those applications
which do not have a means in the GUI to unselect a full row of cells the
behavior should be as follows: The entire row of cells for the specified
row is unselected. If any of the cells in the selected row span additional
rows, the cells in those rows are also unselected.
@param [in] row
0 based index of the row to be unselected.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed
*/
HRESULT unselectRow
(
[in] long row
);
/** @brief Unselects one column, leaving other selected columns selected (if any).
The behavior should mimic that of the application, but for those applications
which do not have a means in the GUI to unselect a full column of cells the
behavior should be as follows: The entire column of cells for the specified
column is unselected. If any of the cells in the selected column span additional
columns, the cells in those columns are also unselected.
@param [in] column
0 based index of the column to be unselected.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed
*/
HRESULT unselectColumn
(
[in] long column
);
/** @brief Returns the type and extents describing how a table changed.
Provided for use by the IA2_EVENT_TABLE_MODEL_CHANGED event handler.
This data is only guaranteed to be valid while the thread notifying the event
continues. Once the handler has returned, the validity of the data depends on
how the server manages the life cycle of its objects. Also, note that the server
may have different life cycle management strategies for controls depending on
whether or not a control manages its children. Lists, trees, and tables can have
a large number of children and thus it's possible that the child objects for those
controls would only be created as needed. Servers should document their life cycle
strategy as this will be of interest to assistive technology or script engines
accessing data out of process or from other threads. Servers only need to save the
most recent row and column values associated with the change and a scope of the
entire application is adequate.
@param [out] modelChange
A struct of (type(insert, delete, update), firstRow, lastRow, firstColumn, lastColumn).
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] value is NULL
*/
[propget] HRESULT modelChange
(
[out, retval] IA2TableModelChange *modelChange
);
}

Просмотреть файл

@ -0,0 +1,167 @@
/*************************************************************************
*
* File Name (AccessibleTableCell.idl)
*
* IAccessible2 IDL Specification
*
* Copyright (c) Linux Foundation 2007, 2009
* Copyright (c) IBM Corp. 2006
* Copyright (c) Sun Microsystems, Inc. 2000, 2006
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License version 2.1, as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
************************************************************************/
import "objidl.idl";
import "oaidl.idl";
import "oleacc.idl";
import "Accessible2.idl";
/** @brief This interface gives access to the cells of a two-dimensional table.
Please also refer to the IAccessibleTable2 interface.
*/
[object, uuid(594116B1-C99F-4847-AD06-0A7A86ECE645)]
interface IAccessibleTableCell : IUnknown
{
/** @brief Returns the number of columns occupied by this cell accessible.
The result is greater than 1 if the specified cell spans multiple columns.
@param [out] nColumnsSpanned
Returns the 1 based column extent of the specified cell.
@retval S_OK
*/
[propget] HRESULT columnExtent
(
[out, retval] long *nColumnsSpanned
);
/** @brief Returns the column headers as an array of cell accessibles.
@param [out] cellAccessibles
Pointer to an array of references to cell accessibles. The array is allocated
by the server. Free it with CoTaskMemFree.
@param [out] nColumnHeaderCells
The number of accessibles returned; the size of the returned array.
@retval S_OK
@retval S_FALSE if there is no header, [out] values are NULL and 0 respectively
*/
[propget] HRESULT columnHeaderCells
(
[out, size_is(,*nColumnHeaderCells,)] IUnknown ***cellAccessibles,
[out, retval] long *nColumnHeaderCells
);
/** @brief Translates this cell accessible into the corresponding column index.
@param [out] columnIndex
Returns the 0 based column index of the cell of the specified cell or the index of
the first column if the cell spans multiple columns.
@retval S_OK
*/
[propget] HRESULT columnIndex
(
[out, retval] long *columnIndex
);
/** @brief Returns the number of rows occupied by this cell accessible.
@param [out] nRowsSpanned
Returns the row extent of the specified cell.
@retval S_OK
*/
[propget] HRESULT rowExtent
(
[out, retval] long *nRowsSpanned
);
/** @brief Returns the row headers as an array of cell accessibles.
@param [out] cellAccessibles
Pointer to an array of references to cell accessibles. The array is allocated
by the server. Free it with CoTaskMemFree.
@param [out] nRowHeaderCells
The number of accessibles returned; the size of the returned array.
@retval S_OK
@retval S_FALSE if there is no header, [out] values are NULL and 0 respectively
*/
[propget] HRESULT rowHeaderCells
(
[out, size_is(,*nRowHeaderCells,)] IUnknown ***cellAccessibles,
[out, retval] long *nRowHeaderCells
);
/** @brief Translates this cell accessible into the corresponding row index.
@param [out] rowIndex
Returns the 0 based row index of the specified cell or the index of
the first row if the cell spans multiple rows.
@retval S_OK
*/
[propget] HRESULT rowIndex
(
[out, retval] long *rowIndex
);
/** @brief Returns a boolean value indicating whether this cell is selected.
@param [out] isSelected
Returns TRUE if the specified cell is selected and FALSE otherwise.
@retval S_OK
*/
[propget] HRESULT isSelected
(
[out, retval] boolean *isSelected
);
/** @brief Gets the row and column indexes and extents of this cell accessible
and whether or not it is selected.
This is a convenience function. It is not mandatory to implement it.
@param [out] row
0 based row index.
@param [out] column
0 based column index.
@param [out] rowExtents
Number of cells spanned by this cell in this row.
@param [out] columnExtents
Number of cells spanned by this cell in this column.
@param [out] isSelected
Indicates if the specified cell is selected.
@retval S_OK
*/
[propget] HRESULT rowColumnExtents
(
[out] long *row,
[out] long *column,
[out] long *rowExtents,
[out] long *columnExtents,
[out, retval] boolean *isSelected
);
/** @brief Returns a reference to the accessbile of the containing table.
@param [out] table
Returns a reference to the IUnknown of the containing table.
@retval S_OK
*/
[propget] HRESULT table
(
[out, retval] IUnknown **table
);
}

Просмотреть файл

@ -4,7 +4,8 @@
*
* IAccessible2 IDL Specification
*
* Copyright (c) IBM Corp. 2007
* Copyright (c) Linux Foundation 2007, 2008
* Copyright (c) IBM Corp. 2006
* Copyright (c) Sun Microsystems, Inc. 2000, 2006
*
* This library is free software; you can redistribute it and/or
@ -19,7 +20,7 @@
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02110-1301 USA
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
************************************************************************/
@ -28,26 +29,48 @@ import "oaidl.idl";
import "oleacc.idl";
import "IA2CommonTypes.idl";
/// A structure containing a substring and the start and end offsets in the enclosing string.
typedef struct {
/** A structure containing a substring and the start and end offsets in the enclosing string.
IAccessibleText::newText and IAccessibleText::oldText return this struct.
*/
typedef struct IA2TextSegment {
BSTR text; ///< A copy of a segment of text taken from an enclosing paragraph.
long start; ///< Index of the first character of the segment in the enclosing text.
long end; ///< Index of the character following the last character of the segment in the enclosing text.
} IA2TextSegment;
/** @brief Defines values to specify a text boundary type.
/** This enum defines values which specify a text boundary type.
If one of these is not implemented, such as IA2_TEXT_BOUNDARY_SENTENCE, S_FALSE is returned.
IA2_TEXT_BOUNDARY_SENTENCE is optional. When a method doesn't implement this
method it must return S_FALSE. Typically this feature would not be implemented
by an application. However, if the application developer was not satisfied with
how screen readers have handled the reading of sentences this boundary type
could be implemented and screen readers could use the application's version of a
sentence rather than the screen reader's.
The rest of the boundary types must be supported.
This enum is used in IAccessibleText::textBeforeOffset, IAccessibleText::textAtOffset,
and IAccessibleText::textAfterOffset.
*/
enum IA2TextBoundaryType {
IA2_TEXT_BOUNDARY_CHAR, ///< =0,
IA2_TEXT_BOUNDARY_WORD, ///< Range is from start of one word to the start of another word.
IA2_TEXT_BOUNDARY_CHAR, /**< Typically, a single character is returned. In some cases more than
one character is returned, for example, when a document contains field
data such as a field containing a date, time, or footnote reference.
In this case the caret can move over several characters in one movement
of the caret. Note that after the caret moves, the caret offset changes
by the number of characters in the field, e.g. by 8 characters in the
following date: 03/26/07. */
IA2_TEXT_BOUNDARY_WORD, /**< The range provided matches the range observed when the application
processes the Ctrl + left arrow and Ctrl + right arrow key sequences.
Typically this is from the start of one word to the start of the next, but
various applications are inconsistent in the handling of the end of a line. */
IA2_TEXT_BOUNDARY_SENTENCE, ///< Range is from start of one sentence to the start of another sentence.
IA2_TEXT_BOUNDARY_PARAGRAPH, ///< Range is from start of one paragraph to the start of another paragraph.
IA2_TEXT_BOUNDARY_LINE, /**< Range is from start of one line to the start of another line. This
often means that an end-of-line character will appear at the end of
the range. However in the case of some apps an end-of-line character
often means that an end-of-line character will appear at the end of the
range. However in the case of some applications an end-of-line character
indicates the end of a paragraph and the lines composing the paragraph,
other than the last line, do not contain an end of line character. */
IA2_TEXT_BOUNDARY_ALL ///< Using this value will cause all text to be returned.
@ -55,7 +78,7 @@ enum IA2TextBoundaryType {
/** @brief This interface gives read-only access to text.
The IAccessibleText interface should be implemented by all components
The %IAccessibleText interface should be implemented by all components
that present textual information on the display like buttons,
text entry fields, or text portions of the document window. The interface
provides access to the text's content, attributes, and spatial location.
@ -71,6 +94,14 @@ enum IA2TextBoundaryType {
Please note that accessible text does not necessarily support selection.
In this case it should behave as if there where no selection. An empty
selection is used for example to express the current cursor position.
Refer to @ref _specialOffsets
"Special Offsets for use in the IAccessibleText and IAccessibleEditableText Methods"
for information about special offsets that can be used in %IAccessibleText methods.
E_FAIL is returned in the following cases
@li endOffset < startOffset
@li endoffset > length
*/
[object, uuid(24FD2FFB-3AAD-4a08-8335-A3AD89C0FB4B)]
interface IAccessibleText : IUnknown
@ -78,9 +109,11 @@ interface IAccessibleText : IUnknown
/** @brief Adds a text selection
@param [in] startOffset
Starting offset ( 0-based).
Starting offset ( 0 based).
@param [in] endOffset
Offset of first character after new selection (0-based).
Offset of first character after new selection (0 based).
@retval S_OK
@retval E_INVALIDARG if bad [in] passed
*/
HRESULT addSelection
(
@ -90,13 +123,21 @@ interface IAccessibleText : IUnknown
/** @brief Returns text attributes.
@param [in] offset
Text offset (0-based).
Text offset (0 based)
@param [out] startOffset
Start of requested text range (0-based)
The starting offset of the character range over which all text attributes match
those of offset. (0 based)
@param [out] endOffset
First character after requested text range (0-based)
The offset of the first character past the character range over which all text
attributes match those of offset. (0 based)
@param [out] textAttributes
A string of attributes describing the text.
A string of attributes describing the text. The attributes are described in the
<a href="http://www.linuxfoundation.org/en/Accessibility/IAccessible2/TextAttributes">
text attributes specification</a> on the %IAccessible2 web site.
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] values are 0s and NULL respectively
@retval E_INVALIDARG if bad [in] passed, [out] values are 0s and NULL respectively
*/
[propget] HRESULT attributes
(
@ -107,11 +148,30 @@ interface IAccessibleText : IUnknown
);
/** @brief Returns the position of the caret.
The caret is the position between two characters. Its position/offset
is that of the character to the right of it.
Returns the 0-based offset of the caret within the text. If the text is
implemented as a tree of text objects with embed characters in higher levels
representing substrings of child text objects and the caret is in one of the
child text objects, then the offset in the higher level text object would be
at the embed character representing child text object that contains the caret.
For example, if the string "one two three" is implemented as a two text objects,
with a top level text object containing an embed character "one ? three" and a
child text object containing "two" and if the caret is in the descendant object
just before the 'o' in "two", then:
<ul>
<li>the caretOffset for the "one ? three" object would be 4, matching the embed character</li>
<li>the caretOffset for "two" would be 2, matching the "o"</li>
</ul>
The caret position/offset is that of the character logically following it, e.g.
to the right of it in a left to right language.
@param [out] offset
The returned offset is relative to the text represented by this object.
@retval S_OK
@retval S_FALSE if the caret is not currently active on this object, i.e. the
caret is located on some other object. The returned offset value will be -1.
@note S_FALSE (and an offset of -1) will not be returned if the caret is somewhere
in the text object or one of its descendants.
*/
[propget] HRESULT caretOffset
(
@ -142,13 +202,15 @@ interface IAccessibleText : IUnknown
@param [in] coordType
Specifies if the coordinates are relative to the screen or to the parent window.
@param [out] x
X coordinate of the bounding box of the referenced character.
X coordinate of the top left corner of the bounding box of the referenced character.
@param [out] y
Y coordinate of the bounding box of the referenced character.
Y coordinate of the top left corner of the bounding box of the referenced character.
@param [out] width
Width of the bounding box of the referenced character.
@param [out] height
Height of the bounding box of the referenced character.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed, [out] values are 0s
*/
[propget] HRESULT characterExtents
(
@ -163,6 +225,7 @@ interface IAccessibleText : IUnknown
/** @brief Returns the number of active non-contiguous selections
@param [out] nSelections
@retval S_OK
*/
[propget] HRESULT nSelections
(
@ -188,6 +251,8 @@ interface IAccessibleText : IUnknown
@param [out] offset
Index of the character under the given point or -1 if the point
is invalid or there is no character under the point.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed, [out] value is 0
*/
[propget] HRESULT offsetAtPoint
(
@ -197,17 +262,20 @@ interface IAccessibleText : IUnknown
[out, retval] long *offset
);
/** @brief Returns the character offsets of N-th active text selection
/** @brief Returns the character offsets of Nth active text selection
@param [in] selectionIndex
Index of selection (0-based).
Index of selection (0 based).
@param [out] startOffset
0 based offset of first selected character
@param [out] endOffset
0 based offset of one past the last selected character.
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] values are 0s
@retval E_INVALIDARG if bad [in] passed, [out] values are 0s
*/
[propget] HRESULT selection
(
[in] long selectionIndex, ///< index of selection (0-based)
[in] long selectionIndex,
[out] long *startOffset,
[out, retval] long *endOffset
);
@ -232,8 +300,9 @@ interface IAccessibleText : IUnknown
Returns the substring starting with the character at startOffset (inclusive)
and up to the character at endOffset (exclusive), if startOffset is less than
or equal to endOffset.
Note: returned string may be longer than endOffset-startOffset bytes if text
@retval S_OK
@retval E_INVALIDARG if bad [in] passed, [out] value is NULL
@note The returned string may be longer than endOffset-startOffset bytes if text
contains multi-byte characters.
*/
[propget] HRESULT text
@ -253,8 +322,9 @@ interface IAccessibleText : IUnknown
For example, if text type is ::IA2_TEXT_BOUNDARY_WORD, then the complete
word that is closest to and located before offset is returned.
If the index is valid, but no suitable word (or other text type) is found, an
empty text segment is returned.
If the index is valid, but no suitable word (or other boundary type) is found, a
NULL pointer is returned.
@param [in] offset
Index of the character for which to return the text part before it. The index
character will not be part of the returned string. The valid range is 0..length.
@ -268,6 +338,11 @@ interface IAccessibleText : IUnknown
@param [out] text
Returns the requested text portion. This portion may be empty or invalid when
no appropriate text portion is found or text type is invalid.
@retval S_OK
@retval S_FALSE if the requested boundary type is not implemented, such as
::IA2_TEXT_BOUNDARY_SENTENCE, or if there is nothing to return;
[out] values are 0s and NULL respectively
@retval E_INVALIDARG if bad [in] passed, [out] values are 0s and NULL respectively
*/
[propget] HRESULT textBeforeOffset
(
@ -282,14 +357,15 @@ interface IAccessibleText : IUnknown
Returns the substring of the specified text type that is located after the
given character and does not include it. The result of this method should be
same as a result for IAccessibleText::textAtOffset with a suitably decreased
same as a result for IAccessibleText::textAtOffset with a suitably increased
index value.
For example, if text type is ::IA2_TEXT_BOUNDARY_WORD, then the complete
word that is closest to and located before offset is returned.
word that is closest to and located after offset is returned.
If the index is valid, but no suitable word (or other text type) is found, a
NULL pointer is returned.
If the index is valid, but no suitable word (or other text type) is found, an
empty text segment is returned.
@param [in] offset
Index of the character for which to return the text part before it. The index
character will not be part of the returned string. The valid range is 0..length.
@ -303,6 +379,11 @@ interface IAccessibleText : IUnknown
@param [out] text
Returns the requested text portion. This portion may be empty or invalid when
no appropriate text portion is found or text type is invalid.
@retval S_OK
@retval S_FALSE if the requested boundary type is not implemented, such as
::IA2_TEXT_BOUNDARY_SENTENCE, or if there is nothing to return;
[out] values are 0s and NULL respectively
@retval E_INVALIDARG if bad [in] passed, [out] values are 0s and NULL respectively
*/
[propget] HRESULT textAfterOffset
(
@ -315,15 +396,11 @@ interface IAccessibleText : IUnknown
/** @brief Returns a text portion that spans the given position.
Returns the substring of the specified text type that the specified offset. The
result of this method should be same as a result for
IAccessibleText::textAtOffset with a suitably decreased index value.
Returns the substring of the specified text type at the specified offset.
For example, if text type is ::IA2_TEXT_BOUNDARY_WORD, then the complete
word that is closest to and located before offset is returned.
If the index is valid, but no suitable word (or other text type) is found, a
NULL pointer is returned.
If the index is valid, but no suitable word (or other text type) is found, an
empty text segment is returned.
@param [in] offset
Index of the character for which to return the text part before it. The index
character will not be part of the returned string. The valid range is 0..length.
@ -337,6 +414,11 @@ interface IAccessibleText : IUnknown
@param [out] text
Returns the requested text portion. This portion may be empty or invalid when
no appropriate text portion is found or text type is invalid.
@retval S_OK
@retval S_FALSE if the requested boundary type is not implemented, such as
::IA2_TEXT_BOUNDARY_SENTENCE, or if there is nothing to return;
[out] values are 0s and NULL respectively
@retval E_INVALIDARG if bad [in] passed, [out] values are 0s and NULL respectively
*/
[propget] HRESULT textAtOffset
(
@ -349,7 +431,9 @@ interface IAccessibleText : IUnknown
/** @brief Unselects a range of text.
@param [in] selectionIndex
Index of selection to remove (0-based).
Index of selection to remove (0 based).
@retval S_OK
@retval E_INVALIDARG if bad [in] passed
*/
HRESULT removeSelection
(
@ -358,8 +442,8 @@ interface IAccessibleText : IUnknown
/** @brief Sets the position of the caret.
The caret is the position between two characters. Its position/offset
is that of the character to the right of it.
The caret position/offset is that of the character logically following it,
e.g. to the right of it in a left to right language.
Setting the caret position may or may not alter the current selection. A
change of the selection is notified to the accessibility event listeners with
@ -373,6 +457,9 @@ interface IAccessibleText : IUnknown
the character with that index. An index of 0 places the caret so that the next
insertion goes before the first character. An index of IAccessibleText::nCharacters
leads to insertion after the last character.
@retval S_OK
@retval E_FAIL if the caret cannot be set
@retval E_INVALIDARG if bad [in] passed
*/
HRESULT setCaretOffset
(
@ -381,11 +468,13 @@ interface IAccessibleText : IUnknown
/** @brief Changes the bounds of an existing selection.
@param [in] selectionIndex
Index of selection to change (0-based)
Index of selection to change (0 based)
@param [in] startOffset
New starting offset (0-based)
New starting offset (0 based)
@param [in] endOffset
New ending offset (0-based) - the offset of the character just past the last character of the selection.
New ending offset (0 based) - the offset of the character just past the last character of the selection.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed
*/
HRESULT setSelection
(
@ -396,9 +485,10 @@ interface IAccessibleText : IUnknown
/** @brief Returns total number of characters.
Note: This may be different than the total number of bytes required to store the
Note that this may be different than the total number of bytes required to store the
text, if the text contains multi-byte characters.
@param [out] nCharacters
@retval S_OK
*/
[propget] HRESULT nCharacters
(
@ -407,11 +497,13 @@ interface IAccessibleText : IUnknown
/** @brief Makes a specific part of string visible on screen.
@param [in] startIndex
0-based character offset.
0 based character offset.
@param [in] endIndex
0-based character offset - the offset of the character just past the last character of the string.
0 based character offset - the offset of the character just past the last character of the string.
@param [in] scrollType
Defines where the object should be placed on the screen.
@retval S_OK
@retval E_INVALIDARG if bad [in] passed
*/
HRESULT scrollSubstringTo
(
@ -422,17 +514,19 @@ interface IAccessibleText : IUnknown
/** @brief Moves the top left of a substring to a specified location.
Note: S_FALSE is returned if the object is already at the specified location.
@param [in] startIndex
0-based character offset.
0 based character offset.
@param [in] endIndex
0-based character offset - the offset of the character just past the last character of the string.
0 based character offset - the offset of the character just past the last character of the string.
@param [in] coordinateType
Specifies whether the coordinates are relative to the screen or the parent object.
@param [in] x
Defines the x coordinate.
@param [in] y
Defines the y coordinate.
@retval S_OK
@retval S_FALSE if the object is already at the specified location.
@retval E_INVALIDARG if bad [in] passed
*/
HRESULT scrollSubstringToPoint
(
@ -447,8 +541,22 @@ interface IAccessibleText : IUnknown
Provided for use by the ::IA2_EVENT_TEXT_INSERTED and ::IA2_EVENT_TEXT_UPDATED
event handlers.
This data is only guaranteed to be valid while the thread notifying the event
continues. Once the handler has returned, the validity of the data depends on
how the server manages the life cycle of its objects. Also, note that the server
may have different life cycle management strategies for controls depending on
whether or not a control manages its children. Lists, trees, and tables can have
a large number of children and thus it's possible that the child objects for those
controls would only be created as needed. Servers should document their life cycle
strategy as this will be of interest to assistive technology or script engines
accessing data out of process or from other threads. Servers only need to save the
last inserted block of text and a scope of the entire application is adequate.
@param [out] newText
The text that was just inserted.
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] value is NULL
*/
[propget] HRESULT newText
(
@ -458,8 +566,22 @@ interface IAccessibleText : IUnknown
/** @brief Returns any removed text.
Provided for use by the IA2_EVENT_TEXT_REMOVED/UPDATED event handlers.
This data is only guaranteed to be valid while the thread notifying the event
continues. Once the handler has returned, the validity of the data depends on
how the server manages the life cycle of its objects. Also, note that the server
may have different life cycle management strategies for controls depending on
whether or not a control manages its children. Lists, trees, and tables can have
a large number of children and thus it's possible that the child objects for those
controls would only be created as needed. Servers should document their life cycle
strategy as this will be of interest to assistive technology or script engines
accessing data out of process or from other threads. Servers only need to save the
last removed block of text and a scope of the entire application is adequate.
@param [out] oldText
The text that was just removed.
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] value is NULL
*/
[propget] HRESULT oldText
(

Просмотреть файл

@ -4,6 +4,7 @@
*
* IAccessible2 IDL Specification
*
* Copyright (c) Linux Foundation 2007, 2008
* Copyright (c) IBM Corp. 2006
* Copyright (c) Sun Microsystems, Inc. 2000, 2006
*
@ -29,7 +30,7 @@ import "oleacc.idl";
/** @brief This interface gives access to a single numerical value.
The IAccessibleValue interface represents a single numerical value and should
The %IAccessibleValue interface represents a single numerical value and should
be implemented by any class that supports numerical value like progress bars
and spin boxes. This interface lets you access the value and its upper and
lower bounds.
@ -43,7 +44,10 @@ interface IAccessibleValue : IUnknown
The exact return type is implementation dependent. Typical types are long and
double.
@param [out] currentValue
Returns the current value represented by this object.
Returns the current value represented by this object. See the section about
@ref _variants "VARIANTs" for additional information.
@retval S_OK
@retval S_FALSE if there is nothing to return, [out] value is NULL
*/
[propget] HRESULT currentValue
(
@ -61,6 +65,7 @@ interface IAccessibleValue : IUnknown
@param [out] value
The new value represented by this object. The set of admissible types for
this argument is implementation dependent.
@retval S_OK
*/
HRESULT setCurrentValue
(
@ -74,7 +79,9 @@ interface IAccessibleValue : IUnknown
@param [out] maximumValue
Returns the maximal value in an implementation dependent type. If this object
has no upper bound then an empty object is returned.
has no upper bound then an empty object is returned. See the section about
@ref _variants "VARIANTs" for additional information.
@retval S_OK
*/
[propget] HRESULT maximumValue
(
@ -88,7 +95,9 @@ interface IAccessibleValue : IUnknown
@param [out] minimumValue
Returns the minimal value in an implementation dependent type. If this object
has no upper bound then an empty object is returned.
has no lower bound then an empty object is returned. See the section about
@ref _variants "VARIANTs" for additional information.
@retval S_OK
*/
[propget] HRESULT minimumValue
(

Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше