2007-06-05 08:41:07 -07:00
|
|
|
/* -*- 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 IBM Corporation
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2007
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
* Aaron Leventhal <aleventh@us.ibm.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 "nsARIAMap.h"
|
2010-12-01 00:53:17 -08:00
|
|
|
|
2012-04-16 02:24:23 -07:00
|
|
|
#include "nsCoreUtils.h"
|
2012-01-11 19:07:35 -08:00
|
|
|
#include "Role.h"
|
2011-04-09 16:38:06 -07:00
|
|
|
#include "States.h"
|
2007-06-05 08:41:07 -07:00
|
|
|
|
2010-12-01 00:53:17 -08:00
|
|
|
#include "nsIContent.h"
|
2012-04-16 02:24:23 -07:00
|
|
|
#include "nsWhitespaceTokenizer.h"
|
2010-12-01 00:53:17 -08:00
|
|
|
|
2012-04-16 02:24:23 -07:00
|
|
|
using namespace mozilla;
|
2011-07-27 05:43:01 -07:00
|
|
|
using namespace mozilla::a11y;
|
2012-04-05 09:23:30 -07:00
|
|
|
using namespace mozilla::a11y::aria;
|
2011-07-27 05:43:01 -07:00
|
|
|
|
2007-06-05 08:41:07 -07:00
|
|
|
/**
|
|
|
|
* This list of WAI-defined roles are currently hardcoded.
|
|
|
|
* Eventually we will most likely be loading an RDF resource that contains this information
|
|
|
|
* Using RDF will also allow for role extensibility. See bug 280138.
|
|
|
|
*
|
2012-04-05 09:23:30 -07:00
|
|
|
* Definition of nsRoleMapEntry contains comments explaining this table.
|
2007-06-05 08:41:07 -07:00
|
|
|
*
|
2007-09-24 18:19:03 -07:00
|
|
|
* When no nsIAccessibleRole enum mapping exists for an ARIA role, the
|
2007-06-05 08:41:07 -07:00
|
|
|
* role will be exposed via the object attribute "xml-roles".
|
|
|
|
* In addition, in MSAA, the unmapped role will also be exposed as a BSTR string role.
|
|
|
|
*
|
|
|
|
* There are no nsIAccessibleRole enums for the following landmark roles:
|
|
|
|
* banner, contentinfo, main, navigation, note, search, secondary, seealso, breadcrumbs
|
2009-06-24 19:12:38 -07:00
|
|
|
*/
|
2007-06-05 08:41:07 -07:00
|
|
|
|
2012-04-16 02:24:23 -07:00
|
|
|
static nsRoleMapEntry sWAIRoleMaps[] =
|
2007-06-05 08:41:07 -07:00
|
|
|
{
|
2008-10-08 05:54:58 -07:00
|
|
|
{
|
|
|
|
"alert",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::ALERT,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2009-06-24 19:12:38 -07:00
|
|
|
kNoReqStates
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"alertdialog",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::DIALOG,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2009-06-24 19:12:38 -07:00
|
|
|
kNoReqStates
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"application",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::APPLICATION,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2009-06-24 19:12:38 -07:00
|
|
|
kNoReqStates
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"article",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::DOCUMENT,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
2009-02-18 23:34:40 -08:00
|
|
|
eNoLiveAttr,
|
2012-03-14 10:48:01 -07:00
|
|
|
kNoReqStates,
|
|
|
|
eReadonlyUntilEditable
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"button",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::PUSHBUTTON,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
2012-02-01 17:13:09 -08:00
|
|
|
ePressAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2008-10-08 05:54:58 -07:00
|
|
|
kNoReqStates,
|
2009-06-24 19:12:38 -07:00
|
|
|
eARIAPressed
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"checkbox",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::CHECKBUTTON,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eCheckUncheckAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2009-06-24 19:12:38 -07:00
|
|
|
kNoReqStates,
|
|
|
|
eARIACheckableMixed,
|
|
|
|
eARIAReadonly
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"columnheader",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::COLUMNHEADER,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
2009-04-19 23:06:19 -07:00
|
|
|
eSortAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2008-10-08 05:54:58 -07:00
|
|
|
kNoReqStates,
|
2009-06-29 08:24:36 -07:00
|
|
|
eARIASelectable,
|
2009-06-24 19:12:38 -07:00
|
|
|
eARIAReadonly
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"combobox",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::COMBOBOX,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2012-02-24 20:32:10 -08:00
|
|
|
eNoValue,
|
2008-10-08 05:54:58 -07:00
|
|
|
eOpenCloseAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2011-04-09 16:38:06 -07:00
|
|
|
states::COLLAPSED | states::HASPOPUP,
|
2009-06-24 19:12:38 -07:00
|
|
|
eARIAAutoComplete,
|
|
|
|
eARIAReadonly
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"dialog",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::DIALOG,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2009-06-24 19:12:38 -07:00
|
|
|
kNoReqStates
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
2010-01-12 18:18:24 -08:00
|
|
|
{
|
|
|
|
"directory",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::LIST,
|
2010-01-12 18:18:24 -08:00
|
|
|
kUseMapRole,
|
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
|
|
|
eNoLiveAttr,
|
|
|
|
kNoReqStates
|
|
|
|
},
|
2008-10-08 05:54:58 -07:00
|
|
|
{
|
|
|
|
"document",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::DOCUMENT,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
2009-02-18 23:34:40 -08:00
|
|
|
eNoLiveAttr,
|
2012-03-14 10:48:01 -07:00
|
|
|
kNoReqStates,
|
|
|
|
eReadonlyUntilEditable
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
2012-03-26 07:05:04 -07:00
|
|
|
{
|
|
|
|
"form",
|
|
|
|
roles::FORM,
|
|
|
|
kUseMapRole,
|
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
|
|
|
eNoLiveAttr,
|
|
|
|
kNoReqStates
|
|
|
|
},
|
2008-10-08 05:54:58 -07:00
|
|
|
{
|
|
|
|
"grid",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::TABLE,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2011-04-09 16:38:06 -07:00
|
|
|
states::FOCUSABLE,
|
2009-06-24 19:12:38 -07:00
|
|
|
eARIAMultiSelectable,
|
|
|
|
eARIAReadonly
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"gridcell",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::GRID_CELL,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2008-10-08 05:54:58 -07:00
|
|
|
kNoReqStates,
|
2009-06-29 08:24:36 -07:00
|
|
|
eARIASelectable,
|
2009-06-24 19:12:38 -07:00
|
|
|
eARIAReadonly
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"group",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::GROUPING,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2009-06-24 19:12:38 -07:00
|
|
|
kNoReqStates
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"heading",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::HEADING,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2009-06-24 19:12:38 -07:00
|
|
|
kNoReqStates
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"img",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::GRAPHIC,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2009-06-24 19:12:38 -07:00
|
|
|
kNoReqStates
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"link",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::LINK,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eJumpAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2011-04-09 16:38:06 -07:00
|
|
|
states::LINKED
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"list",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::LIST,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2012-02-10 10:25:48 -08:00
|
|
|
states::READONLY
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"listbox",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::LISTBOX,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2008-10-08 05:54:58 -07:00
|
|
|
kNoReqStates,
|
2009-06-24 19:12:38 -07:00
|
|
|
eARIAMultiSelectable,
|
|
|
|
eARIAReadonly
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"listitem",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::LISTITEM,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction, // XXX: should depend on state, parent accessible
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2012-02-10 10:25:48 -08:00
|
|
|
states::READONLY
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
2009-02-18 22:56:19 -08:00
|
|
|
{
|
|
|
|
"log",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::NOTHING,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseNativeRole,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
|
|
|
ePoliteLiveAttr,
|
2009-06-24 19:12:38 -07:00
|
|
|
kNoReqStates
|
2009-02-18 22:56:19 -08:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"marquee",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::ANIMATION,
|
2010-01-12 18:18:24 -08:00
|
|
|
kUseMapRole,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
|
|
|
eOffLiveAttr,
|
2009-06-24 19:12:38 -07:00
|
|
|
kNoReqStates
|
2009-02-18 22:56:19 -08:00
|
|
|
},
|
2008-10-08 05:54:58 -07:00
|
|
|
{
|
|
|
|
"math",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::FLAT_EQUATION,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2009-06-24 19:12:38 -07:00
|
|
|
kNoReqStates
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"menu",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::MENUPOPUP,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction, // XXX: technically accessibles of menupopup role haven't
|
|
|
|
// any action, but menu can be open or close.
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2009-06-24 19:12:38 -07:00
|
|
|
kNoReqStates
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"menubar",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::MENUBAR,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2009-06-24 19:12:38 -07:00
|
|
|
kNoReqStates
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"menuitem",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::MENUITEM,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eClickAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2008-10-08 05:54:58 -07:00
|
|
|
kNoReqStates,
|
2009-06-24 19:12:38 -07:00
|
|
|
eARIACheckedMixed
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"menuitemcheckbox",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::CHECK_MENU_ITEM,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eClickAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2009-06-24 19:12:38 -07:00
|
|
|
kNoReqStates,
|
|
|
|
eARIACheckableMixed
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"menuitemradio",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::RADIO_MENU_ITEM,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eClickAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2009-06-24 19:12:38 -07:00
|
|
|
kNoReqStates,
|
|
|
|
eARIACheckableBool
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
2012-03-22 22:23:46 -07:00
|
|
|
{
|
|
|
|
"note",
|
|
|
|
roles::NOTE,
|
|
|
|
kUseMapRole,
|
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
|
|
|
eNoLiveAttr,
|
|
|
|
kNoReqStates
|
|
|
|
},
|
2008-10-08 05:54:58 -07:00
|
|
|
{
|
|
|
|
"option",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::OPTION,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eSelectAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2008-10-08 05:54:58 -07:00
|
|
|
kNoReqStates,
|
2009-06-29 08:24:36 -07:00
|
|
|
eARIASelectable,
|
2009-06-24 19:12:38 -07:00
|
|
|
eARIACheckedMixed
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"presentation",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::NOTHING,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2009-06-24 19:12:38 -07:00
|
|
|
kNoReqStates
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"progressbar",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::PROGRESSBAR,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eHasValueMinMax,
|
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2012-04-12 15:44:16 -07:00
|
|
|
states::READONLY,
|
|
|
|
eIndeterminateIfNoValue
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"radio",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::RADIOBUTTON,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eSelectAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2009-06-24 19:12:38 -07:00
|
|
|
kNoReqStates,
|
|
|
|
eARIACheckableBool
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"radiogroup",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::GROUPING,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2009-06-24 19:12:38 -07:00
|
|
|
kNoReqStates
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"region",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::PANE,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2009-06-24 19:12:38 -07:00
|
|
|
kNoReqStates
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"row",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::ROW,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2008-10-08 05:54:58 -07:00
|
|
|
kNoReqStates,
|
2009-06-29 08:24:36 -07:00
|
|
|
eARIASelectable
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"rowheader",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::ROWHEADER,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
2009-04-19 23:06:19 -07:00
|
|
|
eSortAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2008-10-08 05:54:58 -07:00
|
|
|
kNoReqStates,
|
2009-06-29 08:24:36 -07:00
|
|
|
eARIASelectable,
|
2009-06-24 19:12:38 -07:00
|
|
|
eARIAReadonly
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
2009-12-15 08:03:39 -08:00
|
|
|
{
|
|
|
|
"scrollbar",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::SCROLLBAR,
|
2009-12-15 08:03:39 -08:00
|
|
|
kUseMapRole,
|
|
|
|
eHasValueMinMax,
|
|
|
|
eNoAction,
|
|
|
|
eNoLiveAttr,
|
|
|
|
kNoReqStates,
|
|
|
|
eARIAOrientation,
|
|
|
|
eARIAReadonly
|
|
|
|
},
|
2008-10-08 05:54:58 -07:00
|
|
|
{
|
|
|
|
"separator",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::SEPARATOR,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2011-11-17 05:18:54 -08:00
|
|
|
kNoReqStates,
|
|
|
|
eARIAOrientation
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"slider",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::SLIDER,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eHasValueMinMax,
|
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2008-10-08 05:54:58 -07:00
|
|
|
kNoReqStates,
|
2011-11-17 05:18:54 -08:00
|
|
|
eARIAOrientation,
|
2009-06-24 19:12:38 -07:00
|
|
|
eARIAReadonly
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"spinbutton",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::SPINBUTTON,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eHasValueMinMax,
|
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2008-10-08 05:54:58 -07:00
|
|
|
kNoReqStates,
|
2009-06-24 19:12:38 -07:00
|
|
|
eARIAReadonly
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"status",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::STATUSBAR,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
2009-02-19 00:10:45 -08:00
|
|
|
ePoliteLiveAttr,
|
2009-06-24 19:12:38 -07:00
|
|
|
kNoReqStates
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"tab",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::PAGETAB,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eSwitchAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2011-05-24 07:02:44 -07:00
|
|
|
kNoReqStates,
|
|
|
|
eARIASelectable
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"tablist",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::PAGETABLIST,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
ePoliteLiveAttr,
|
2009-06-24 19:12:38 -07:00
|
|
|
kNoReqStates
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"tabpanel",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::PROPERTYPAGE,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2009-06-24 19:12:38 -07:00
|
|
|
kNoReqStates
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"textbox",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::ENTRY,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eActivateAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2008-10-08 05:54:58 -07:00
|
|
|
kNoReqStates,
|
2009-06-24 19:12:38 -07:00
|
|
|
eARIAAutoComplete,
|
|
|
|
eARIAMultiline,
|
|
|
|
eARIAReadonlyOrEditable
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
2009-02-18 22:56:19 -08:00
|
|
|
{
|
|
|
|
"timer",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::NOTHING,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseNativeRole,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
|
|
|
eOffLiveAttr,
|
2009-06-24 19:12:38 -07:00
|
|
|
kNoReqStates
|
2009-02-18 22:56:19 -08:00
|
|
|
},
|
2008-10-08 05:54:58 -07:00
|
|
|
{
|
|
|
|
"toolbar",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::TOOLBAR,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2009-06-24 19:12:38 -07:00
|
|
|
kNoReqStates
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"tooltip",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::TOOLTIP,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2009-06-24 19:12:38 -07:00
|
|
|
kNoReqStates
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"tree",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::OUTLINE,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2008-10-08 05:54:58 -07:00
|
|
|
kNoReqStates,
|
2009-06-24 19:12:38 -07:00
|
|
|
eARIAReadonly,
|
|
|
|
eARIAMultiSelectable
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"treegrid",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::TREE_TABLE,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2008-10-08 05:54:58 -07:00
|
|
|
kNoReqStates,
|
2009-06-24 19:12:38 -07:00
|
|
|
eARIAReadonly,
|
|
|
|
eARIAMultiSelectable
|
2008-10-08 05:54:58 -07:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"treeitem",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::OUTLINEITEM,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoValue,
|
|
|
|
eActivateAction, // XXX: should expose second 'expand/collapse' action based
|
|
|
|
// on states
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2008-10-08 05:54:58 -07:00
|
|
|
kNoReqStates,
|
2009-06-29 08:24:36 -07:00
|
|
|
eARIASelectable,
|
2009-06-24 19:12:38 -07:00
|
|
|
eARIACheckedMixed
|
2009-02-18 23:23:44 -08:00
|
|
|
}
|
2007-11-11 17:05:37 -08:00
|
|
|
};
|
|
|
|
|
2012-04-16 02:24:23 -07:00
|
|
|
static nsRoleMapEntry sLandmarkRoleMap = {
|
2007-11-11 17:05:37 -08:00
|
|
|
"",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::NOTHING,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseNativeRole,
|
2007-11-11 17:05:37 -08:00
|
|
|
eNoValue,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2009-06-24 19:12:38 -07:00
|
|
|
kNoReqStates
|
2007-06-05 08:41:07 -07:00
|
|
|
};
|
|
|
|
|
2008-02-06 20:14:59 -08:00
|
|
|
nsRoleMapEntry nsARIAMap::gEmptyRoleMap = {
|
|
|
|
"",
|
2012-01-11 19:07:35 -08:00
|
|
|
roles::NOTHING,
|
2009-06-11 11:18:24 -07:00
|
|
|
kUseMapRole,
|
2008-02-06 20:14:59 -08:00
|
|
|
eNoValue,
|
2008-10-08 05:54:58 -07:00
|
|
|
eNoAction,
|
2009-02-18 22:56:19 -08:00
|
|
|
eNoLiveAttr,
|
2009-06-24 19:12:38 -07:00
|
|
|
kNoReqStates
|
|
|
|
};
|
|
|
|
|
2007-06-05 08:41:07 -07:00
|
|
|
/**
|
2010-03-18 06:49:28 -07:00
|
|
|
* Universal (Global) states:
|
2007-06-05 08:41:07 -07:00
|
|
|
* The following state rules are applied to any accessible element,
|
|
|
|
* whether there is an ARIA role or not:
|
|
|
|
*/
|
2012-04-05 09:23:30 -07:00
|
|
|
EStateRule nsARIAMap::gWAIUnivStateMap[] = {
|
2009-06-24 19:12:38 -07:00
|
|
|
eARIABusy,
|
|
|
|
eARIADisabled,
|
2010-03-18 06:49:28 -07:00
|
|
|
eARIAExpanded, // Currently under spec review but precedent exists
|
|
|
|
eARIAHasPopup, // Note this is technically a "property"
|
|
|
|
eARIAInvalid,
|
|
|
|
eARIARequired, // XXX not global, Bug 553117
|
2009-06-24 19:12:38 -07:00
|
|
|
eARIANone
|
2007-06-05 08:41:07 -07:00
|
|
|
};
|
|
|
|
|
2009-02-15 00:15:31 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* ARIA attribute map for attribute characteristics
|
|
|
|
*
|
|
|
|
* @note ARIA attributes that don't have any flags are not included here
|
|
|
|
*/
|
|
|
|
nsAttributeCharacteristics nsARIAMap::gWAIUnivAttrMap[] = {
|
2011-06-03 14:35:17 -07:00
|
|
|
{&nsGkAtoms::aria_activedescendant, ATTR_BYPASSOBJ },
|
|
|
|
{&nsGkAtoms::aria_atomic, ATTR_VALTOKEN },
|
|
|
|
{&nsGkAtoms::aria_busy, ATTR_VALTOKEN },
|
|
|
|
{&nsGkAtoms::aria_checked, ATTR_BYPASSOBJ | ATTR_VALTOKEN }, /* exposes checkable obj attr */
|
|
|
|
{&nsGkAtoms::aria_controls, ATTR_BYPASSOBJ },
|
|
|
|
{&nsGkAtoms::aria_describedby, ATTR_BYPASSOBJ },
|
|
|
|
{&nsGkAtoms::aria_disabled, ATTR_BYPASSOBJ | ATTR_VALTOKEN },
|
|
|
|
{&nsGkAtoms::aria_dropeffect, ATTR_VALTOKEN },
|
|
|
|
{&nsGkAtoms::aria_expanded, ATTR_BYPASSOBJ | ATTR_VALTOKEN },
|
|
|
|
{&nsGkAtoms::aria_flowto, ATTR_BYPASSOBJ },
|
|
|
|
{&nsGkAtoms::aria_grabbed, ATTR_VALTOKEN },
|
|
|
|
{&nsGkAtoms::aria_haspopup, ATTR_BYPASSOBJ | ATTR_VALTOKEN },
|
|
|
|
{&nsGkAtoms::aria_hidden, ATTR_VALTOKEN },/* always expose obj attr */
|
|
|
|
{&nsGkAtoms::aria_invalid, ATTR_BYPASSOBJ | ATTR_VALTOKEN },
|
|
|
|
{&nsGkAtoms::aria_label, ATTR_BYPASSOBJ },
|
|
|
|
{&nsGkAtoms::aria_labelledby, ATTR_BYPASSOBJ },
|
|
|
|
{&nsGkAtoms::aria_level, ATTR_BYPASSOBJ }, /* handled via groupPosition */
|
|
|
|
{&nsGkAtoms::aria_live, ATTR_VALTOKEN },
|
|
|
|
{&nsGkAtoms::aria_multiline, ATTR_BYPASSOBJ | ATTR_VALTOKEN },
|
|
|
|
{&nsGkAtoms::aria_multiselectable, ATTR_BYPASSOBJ | ATTR_VALTOKEN },
|
|
|
|
{&nsGkAtoms::aria_owns, ATTR_BYPASSOBJ },
|
|
|
|
{&nsGkAtoms::aria_orientation, ATTR_VALTOKEN },
|
|
|
|
{&nsGkAtoms::aria_posinset, ATTR_BYPASSOBJ }, /* handled via groupPosition */
|
|
|
|
{&nsGkAtoms::aria_pressed, ATTR_BYPASSOBJ | ATTR_VALTOKEN },
|
|
|
|
{&nsGkAtoms::aria_readonly, ATTR_BYPASSOBJ | ATTR_VALTOKEN },
|
|
|
|
{&nsGkAtoms::aria_relevant, ATTR_BYPASSOBJ },
|
|
|
|
{&nsGkAtoms::aria_required, ATTR_BYPASSOBJ | ATTR_VALTOKEN },
|
|
|
|
{&nsGkAtoms::aria_selected, ATTR_BYPASSOBJ | ATTR_VALTOKEN },
|
|
|
|
{&nsGkAtoms::aria_setsize, ATTR_BYPASSOBJ }, /* handled via groupPosition */
|
|
|
|
{&nsGkAtoms::aria_sort, ATTR_VALTOKEN },
|
|
|
|
{&nsGkAtoms::aria_valuenow, ATTR_BYPASSOBJ },
|
|
|
|
{&nsGkAtoms::aria_valuemin, ATTR_BYPASSOBJ },
|
|
|
|
{&nsGkAtoms::aria_valuemax, ATTR_BYPASSOBJ },
|
|
|
|
{&nsGkAtoms::aria_valuetext, ATTR_BYPASSOBJ }
|
2009-02-15 00:15:31 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
PRUint32 nsARIAMap::gWAIUnivAttrMapLength = NS_ARRAY_LENGTH(nsARIAMap::gWAIUnivAttrMap);
|
2012-04-16 02:24:23 -07:00
|
|
|
|
|
|
|
nsRoleMapEntry*
|
|
|
|
aria::GetRoleMap(nsINode* aNode)
|
|
|
|
{
|
|
|
|
nsIContent* content = nsCoreUtils::GetRoleContent(aNode);
|
|
|
|
nsAutoString roleString;
|
|
|
|
if (!content ||
|
|
|
|
!content->GetAttr(kNameSpaceID_None, nsGkAtoms::role, roleString) ||
|
|
|
|
roleString.IsEmpty()) {
|
|
|
|
// We treat role="" as if the role attribute is absent (per aria spec:8.1.1)
|
|
|
|
return nsnull;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsWhitespaceTokenizer tokenizer(roleString);
|
|
|
|
while (tokenizer.hasMoreTokens()) {
|
|
|
|
// Do a binary search through table for the next role in role list
|
|
|
|
NS_LossyConvertUTF16toASCII role(tokenizer.nextToken());
|
|
|
|
PRUint32 low = 0;
|
|
|
|
PRUint32 high = ArrayLength(sWAIRoleMaps);
|
|
|
|
while (low < high) {
|
|
|
|
PRUint32 idx = (low + high) / 2;
|
|
|
|
PRInt32 compare = strcmp(role.get(), sWAIRoleMaps[idx].roleString);
|
|
|
|
if (compare == 0)
|
|
|
|
return sWAIRoleMaps + idx;
|
|
|
|
|
|
|
|
if (compare < 0)
|
|
|
|
high = idx;
|
|
|
|
else
|
|
|
|
low = idx + 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Always use some entry if there is a non-empty role string
|
|
|
|
// To ensure an accessible object is created
|
|
|
|
return &sLandmarkRoleMap;
|
|
|
|
}
|