mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-27 00:09:46 +00:00
7127a02a35
- Bug 1256424. Get rid of ThreadsafeAutoSafeJSContext. r=bholley (445aa7dd4b) - Bug 1256424 followup to actually address the review comments (d085cf1900) - Bug 1003432: Expose CustomEvent in Worker. r=smaug (3b143dc6e4) - Bug 1256414 - Hide MozSettingsEvent from the Web; r=khuey (52fe18e823) - Bug 1257038: Remove the worker descriptor for WorkerLocation. r=bz (2b9721e4fe) - Bug 1257039: Remove the worker descriptor for FileReaderSync. r=bz (cc33ce76e6) - Bug 1257355: Remove the worker descriptor for WorkerNavigator. r=bz (067f1fc9ea) - Bug 1257480 - null check for GetOrCreateGlobalScope() in WorkerDebuggerGlobalScope, r=khuey (0d3d640fc0) - Make split-profile run jprof in the directory with the jprof-log. No bug. (58f5060e39) - Bug 1250333 - do not create accessibles for trailing BRs, r=davidb, roc (d8e1193adc) - Bug 1251712 - propagate a context flag for alerts, r=davdib (d5ef6167ea) - Bug 1251752 - logging: add tree specific methods, r=yzen (f974c207ca) - Bug 1251218 - add special TreeWalker constructor for children creation, r=marcoz (74f939b93e) - Bug 1251337 - TreeWalker doesn't have to check ARIA owned children for each DOM state, r=yzen (19d83af7e1) - Bug 1249730 - make TreeWalker bi-directional, r=yzen (a229a591e1) - Bug 1249730 - make TreeWalker bi-directional, r=yzen (5acc1155b1) - Bug 1251743 - ARIA owns reallocation may insert a child at wrong index, r=yzen (d95065109b) - Bug 1249253 - content removal processing can wrongly remove ARIA owned children, r=yzen (45df52f4c9) - Bug 1254989 - extend TreeWalker::Next to accept a stopper node, r=yzen (c5dfbbdc96) - Bug 1249730 - make TreeWalker bi-directional, follow up fix, r=yzen (747504b5ec) - Bug 1196652 - OriginSuffix is shown in about:serviceworker on b2g. r=ferjm (f21d534755) - Bug 1224570 - [Service Workers Panel] Service Workers panel fails to show registered service workers after restart. r=fabrice (7d7e95db4c) - Bug 1169674 - Use originNoSuffix for permission event. r=fabrice, f=bholley (8f389cb0c7) - Bug 1207499 - Part 1: Remove use of expression closure from b2g/. r=sicking (42b96cbfdf) - Bug 1207499 - Part 2: Remove use of expression closure from chrome/. r=bsmedberg (7abb390349) - Bug 1207499 - Part 3: Remove use of expression closure from docshell/. r=bz (aee60733a9) - Bug 1207499 - Part 5: Remove use of expression closure from modules/. r=mwu (6c29c775fe) - Bug 1147562 - Update remaining callsites of newChannel before landing the shim in netwerk/ (r=jduell) (2d37fab088) - Bug 1207499 - Part 6: Remove use of expression closure from netwerk/. r=jduell (2881b3450f) - Bug 1207499 - Part 7: Remove use of expression closure from parser/. r=jst (2519fb1fff) - Bug 1207499 - Part 8: Remove use of expression closure from security/. r=keeler (de33d27e8f) - Bug 1207499 - Part 12: Remove use of expression closure from widget/. r=roc (0e7fd889d9) - Bug 1207499 - Part 13: Remove use of expression closure from xpcom/. r=froydnj (f95a4eefde) - Bug 1249219 - Part 1: Define NonOwningAnimationTarget. r=birtles (c13d77b5d9) - Bug 1249219 - Part 2: Remove struct PseudoElementHashKey. r=birtles (f8ff47d484) - Bug 1249219 - Part 3: Replace Pair<Element*, CSSPseudoElementType> with NonOwningAnimationTarget. r=birtles (68a1a5e149) - Bug 1218620 - Allow opacity animation running on compositor even if the frame has any restricted transforms. r=birtles (0f26c81fb0) - Bug 1254419 - Move GetPropertyState alongside GetFrames; r=hiro (046dbce30e) - Bug 1246320 part 0 - Whitespace fixes; r=whitespace-only (eda3e8b8ae) - Bug 1247531 - Annotate intentional switch fallthrough to suppress -Wimplicit-fallthrough warning in dom/animations/. r=dholbert (fbdff98c25) - Bug 1246320 part 1 - Add AnimationUtils::GetCurrentRealmDocument; r=bz (53c52acbe7) - Bug 1246320 part 2 - Pass document to ParseEasing; r=hiro (269325c142) - Bug 1246320 part 3 - Rework KeyframeEffect(ReadOnly) constructor helpers; r=hiro (e0c58fbe49) - Bug 1246320 part 4 - Pass a document to TimingParams; r=hiro (f9ef7bc956) - Bug 1246320 part 5 - Simplify KeyframeEffect(ReadOnly) Constructor overloads further; r=hiro (ec932de9a7) - Bug 1254419 - Rename getPropertyState() to getProperties(); r=heycam, r=bz (4ab86c889d) - Bug 1254419 - Fix zero-length segment handling; r=heycam (a638e5bbd7) - Bug 1254419 - Fill in values sequence in getProperties(); r=heycam (c7c233f5ce) - Bug 1254419 - Return animation property information from getProperties() even if the property is overridden; r=hiro (55537b4445) - Bug 1254419 - Add values member to AnimationPropertyDetails; r=heycam, r=bz (3ea6c1fb7f) - Bug 1254419 - Add tests for getProperties(); r=heycam (ff9999286d) - Bug 1254419 - Make always-set members of AnimationProperty(Value)Details required; r=bz (07ef47d79a) - Bug 1254419 - Throw if we fail to allocate memory for a values array in getProperties(); r=bz (51ae5d9f99)
961 lines
21 KiB
C++
961 lines
21 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim:expandtab:shiftwidth=2:tabstop=2:
|
|
*/
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "ARIAMap.h"
|
|
|
|
#include "nsAccUtils.h"
|
|
#include "nsCoreUtils.h"
|
|
#include "Role.h"
|
|
#include "States.h"
|
|
|
|
#include "nsAttrName.h"
|
|
#include "nsWhitespaceTokenizer.h"
|
|
|
|
#include "mozilla/BinarySearch.h"
|
|
#include "mozilla/dom/Element.h"
|
|
|
|
using namespace mozilla;
|
|
using namespace mozilla::a11y;
|
|
using namespace mozilla::a11y::aria;
|
|
|
|
static const uint32_t kGenericAccType = 0;
|
|
|
|
/**
|
|
* 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.
|
|
*
|
|
* Definition of nsRoleMapEntry contains comments explaining this table.
|
|
*
|
|
* When no Role enum mapping exists for an ARIA role, the role will be exposed
|
|
* via the object attribute "xml-roles".
|
|
*/
|
|
|
|
static const nsRoleMapEntry sWAIRoleMaps[] =
|
|
{
|
|
{ // alert
|
|
&nsGkAtoms::alert,
|
|
roles::ALERT,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
eAlert,
|
|
kNoReqStates
|
|
},
|
|
{ // alertdialog
|
|
&nsGkAtoms::alertdialog,
|
|
roles::DIALOG,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates
|
|
},
|
|
{ // application
|
|
&nsGkAtoms::application,
|
|
roles::APPLICATION,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
eLandmark,
|
|
kNoReqStates
|
|
},
|
|
{ // article
|
|
&nsGkAtoms::article,
|
|
roles::DOCUMENT,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates,
|
|
eReadonlyUntilEditable
|
|
},
|
|
{ // banner
|
|
&nsGkAtoms::banner,
|
|
roles::NOTHING,
|
|
kUseNativeRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
eLandmark,
|
|
kNoReqStates
|
|
},
|
|
{ // button
|
|
&nsGkAtoms::button,
|
|
roles::PUSHBUTTON,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
ePressAction,
|
|
eNoLiveAttr,
|
|
eButton,
|
|
kNoReqStates
|
|
// eARIAPressed is auto applied on any button
|
|
},
|
|
{ // cell
|
|
&nsGkAtoms::cell,
|
|
roles::CELL,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
eTableCell,
|
|
kNoReqStates
|
|
},
|
|
{ // checkbox
|
|
&nsGkAtoms::checkbox,
|
|
roles::CHECKBUTTON,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eCheckUncheckAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates,
|
|
eARIACheckableMixed,
|
|
eARIAReadonly
|
|
},
|
|
{ // columnheader
|
|
&nsGkAtoms::columnheader,
|
|
roles::COLUMNHEADER,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eSortAction,
|
|
eNoLiveAttr,
|
|
eTableCell,
|
|
kNoReqStates,
|
|
eARIASelectableIfDefined,
|
|
eARIAReadonlyOrEditableIfDefined
|
|
},
|
|
{ // combobox
|
|
&nsGkAtoms::combobox,
|
|
roles::COMBOBOX,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eOpenCloseAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
states::COLLAPSED | states::HASPOPUP | states::VERTICAL,
|
|
eARIAAutoComplete,
|
|
eARIAReadonly,
|
|
eARIAOrientation
|
|
},
|
|
{ // complementary
|
|
&nsGkAtoms::complementary,
|
|
roles::NOTHING,
|
|
kUseNativeRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
eLandmark,
|
|
kNoReqStates
|
|
},
|
|
{ // contentinfo
|
|
&nsGkAtoms::contentinfo,
|
|
roles::NOTHING,
|
|
kUseNativeRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
eLandmark,
|
|
kNoReqStates
|
|
},
|
|
{ // dialog
|
|
&nsGkAtoms::dialog,
|
|
roles::DIALOG,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates
|
|
},
|
|
{ // directory
|
|
&nsGkAtoms::directory,
|
|
roles::LIST,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
eList,
|
|
kNoReqStates
|
|
},
|
|
{ // document
|
|
&nsGkAtoms::document,
|
|
roles::DOCUMENT,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates,
|
|
eReadonlyUntilEditable
|
|
},
|
|
{ // form
|
|
&nsGkAtoms::form,
|
|
roles::FORM,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
eLandmark,
|
|
kNoReqStates
|
|
},
|
|
{ // grid
|
|
&nsGkAtoms::grid,
|
|
roles::TABLE,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
eSelect | eTable,
|
|
kNoReqStates,
|
|
eARIAMultiSelectable,
|
|
eARIAReadonlyOrEditable,
|
|
eFocusableUntilDisabled
|
|
},
|
|
{ // gridcell
|
|
&nsGkAtoms::gridcell,
|
|
roles::GRID_CELL,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
eTableCell,
|
|
kNoReqStates,
|
|
eARIASelectable,
|
|
eARIAReadonlyOrEditableIfDefined
|
|
},
|
|
{ // group
|
|
&nsGkAtoms::group,
|
|
roles::GROUPING,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates
|
|
},
|
|
{ // heading
|
|
&nsGkAtoms::heading,
|
|
roles::HEADING,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates
|
|
},
|
|
{ // img
|
|
&nsGkAtoms::img,
|
|
roles::GRAPHIC,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates
|
|
},
|
|
{ // key
|
|
&nsGkAtoms::key,
|
|
roles::KEY,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
ePressAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates,
|
|
eARIAPressed
|
|
},
|
|
{ // link
|
|
&nsGkAtoms::link,
|
|
roles::LINK,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eJumpAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
states::LINKED
|
|
},
|
|
{ // list
|
|
&nsGkAtoms::list,
|
|
roles::LIST,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
eList,
|
|
states::READONLY
|
|
},
|
|
{ // listbox
|
|
&nsGkAtoms::listbox,
|
|
roles::LISTBOX,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
eListControl | eSelect,
|
|
states::VERTICAL,
|
|
eARIAMultiSelectable,
|
|
eARIAReadonly,
|
|
eFocusableUntilDisabled,
|
|
eARIAOrientation
|
|
},
|
|
{ // listitem
|
|
&nsGkAtoms::listitem,
|
|
roles::LISTITEM,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction, // XXX: should depend on state, parent accessible
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
states::READONLY
|
|
},
|
|
{ // log
|
|
&nsGkAtoms::log_,
|
|
roles::NOTHING,
|
|
kUseNativeRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
ePoliteLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates
|
|
},
|
|
{ // main
|
|
&nsGkAtoms::main,
|
|
roles::NOTHING,
|
|
kUseNativeRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
eLandmark,
|
|
kNoReqStates
|
|
},
|
|
{ // marquee
|
|
&nsGkAtoms::marquee,
|
|
roles::ANIMATION,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eOffLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates
|
|
},
|
|
{ // math
|
|
&nsGkAtoms::math,
|
|
roles::FLAT_EQUATION,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates
|
|
},
|
|
{ // menu
|
|
&nsGkAtoms::menu,
|
|
roles::MENUPOPUP,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction, // XXX: technically accessibles of menupopup role haven't
|
|
// any action, but menu can be open or close.
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
states::VERTICAL,
|
|
eARIAOrientation
|
|
},
|
|
{ // menubar
|
|
&nsGkAtoms::menubar,
|
|
roles::MENUBAR,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
states::HORIZONTAL,
|
|
eARIAOrientation
|
|
},
|
|
{ // menuitem
|
|
&nsGkAtoms::menuitem,
|
|
roles::MENUITEM,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eClickAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates,
|
|
eARIACheckedMixed
|
|
},
|
|
{ // menuitemcheckbox
|
|
&nsGkAtoms::menuitemcheckbox,
|
|
roles::CHECK_MENU_ITEM,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eClickAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates,
|
|
eARIACheckableMixed
|
|
},
|
|
{ // menuitemradio
|
|
&nsGkAtoms::menuitemradio,
|
|
roles::RADIO_MENU_ITEM,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eClickAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates,
|
|
eARIACheckableBool
|
|
},
|
|
{ // navigation
|
|
&nsGkAtoms::navigation,
|
|
roles::NOTHING,
|
|
kUseNativeRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
eLandmark,
|
|
kNoReqStates
|
|
},
|
|
{ // none
|
|
&nsGkAtoms::none,
|
|
roles::NOTHING,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates
|
|
},
|
|
{ // note
|
|
&nsGkAtoms::note_,
|
|
roles::NOTE,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates
|
|
},
|
|
{ // option
|
|
&nsGkAtoms::option,
|
|
roles::OPTION,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eSelectAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates,
|
|
eARIASelectable,
|
|
eARIACheckedMixed
|
|
},
|
|
{ // presentation
|
|
&nsGkAtoms::presentation,
|
|
roles::NOTHING,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates
|
|
},
|
|
{ // progressbar
|
|
&nsGkAtoms::progressbar,
|
|
roles::PROGRESSBAR,
|
|
kUseMapRole,
|
|
eHasValueMinMax,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
states::READONLY,
|
|
eIndeterminateIfNoValue
|
|
},
|
|
{ // radio
|
|
&nsGkAtoms::radio,
|
|
roles::RADIOBUTTON,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eSelectAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates,
|
|
eARIACheckableBool
|
|
},
|
|
{ // radiogroup
|
|
&nsGkAtoms::radiogroup,
|
|
roles::RADIO_GROUP,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates,
|
|
eARIAOrientation
|
|
},
|
|
{ // region
|
|
&nsGkAtoms::region,
|
|
roles::PANE,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates
|
|
},
|
|
{ // row
|
|
&nsGkAtoms::row,
|
|
roles::ROW,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
eTableRow,
|
|
kNoReqStates,
|
|
eARIASelectable
|
|
},
|
|
{ // rowgroup
|
|
&nsGkAtoms::rowgroup,
|
|
roles::GROUPING,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates
|
|
},
|
|
{ // rowheader
|
|
&nsGkAtoms::rowheader,
|
|
roles::ROWHEADER,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eSortAction,
|
|
eNoLiveAttr,
|
|
eTableCell,
|
|
kNoReqStates,
|
|
eARIASelectableIfDefined,
|
|
eARIAReadonlyOrEditableIfDefined
|
|
},
|
|
{ // scrollbar
|
|
&nsGkAtoms::scrollbar,
|
|
roles::SCROLLBAR,
|
|
kUseMapRole,
|
|
eHasValueMinMax,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
states::VERTICAL,
|
|
eARIAOrientation,
|
|
eARIAReadonly
|
|
},
|
|
{ // search
|
|
&nsGkAtoms::search,
|
|
roles::NOTHING,
|
|
kUseNativeRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
eLandmark,
|
|
kNoReqStates
|
|
},
|
|
{ // searchbox
|
|
&nsGkAtoms::searchbox,
|
|
roles::ENTRY,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eActivateAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates,
|
|
eARIAAutoComplete,
|
|
eARIAMultiline,
|
|
eARIAReadonlyOrEditable
|
|
},
|
|
{ // separator
|
|
&nsGkAtoms::separator_,
|
|
roles::SEPARATOR,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
states::HORIZONTAL,
|
|
eARIAOrientation
|
|
},
|
|
{ // slider
|
|
&nsGkAtoms::slider,
|
|
roles::SLIDER,
|
|
kUseMapRole,
|
|
eHasValueMinMax,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
states::HORIZONTAL,
|
|
eARIAOrientation,
|
|
eARIAReadonly
|
|
},
|
|
{ // spinbutton
|
|
&nsGkAtoms::spinbutton,
|
|
roles::SPINBUTTON,
|
|
kUseMapRole,
|
|
eHasValueMinMax,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates,
|
|
eARIAReadonly
|
|
},
|
|
{ // status
|
|
&nsGkAtoms::status,
|
|
roles::STATUSBAR,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
ePoliteLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates
|
|
},
|
|
{ // switch
|
|
&nsGkAtoms::_switch,
|
|
roles::SWITCH,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eCheckUncheckAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates,
|
|
eARIACheckableBool
|
|
},
|
|
{ // tab
|
|
&nsGkAtoms::tab,
|
|
roles::PAGETAB,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eSwitchAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates,
|
|
eARIASelectable
|
|
},
|
|
{ // table
|
|
&nsGkAtoms::table,
|
|
roles::TABLE,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
eTable,
|
|
kNoReqStates,
|
|
eARIASelectable
|
|
},
|
|
{ // tablist
|
|
&nsGkAtoms::tablist,
|
|
roles::PAGETABLIST,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
eSelect,
|
|
states::HORIZONTAL,
|
|
eARIAOrientation
|
|
},
|
|
{ // tabpanel
|
|
&nsGkAtoms::tabpanel,
|
|
roles::PROPERTYPAGE,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates
|
|
},
|
|
{ // textbox
|
|
&nsGkAtoms::textbox,
|
|
roles::ENTRY,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eActivateAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates,
|
|
eARIAAutoComplete,
|
|
eARIAMultiline,
|
|
eARIAReadonlyOrEditable
|
|
},
|
|
{ // timer
|
|
&nsGkAtoms::timer,
|
|
roles::NOTHING,
|
|
kUseNativeRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eOffLiveAttr,
|
|
kNoReqStates
|
|
},
|
|
{ // toolbar
|
|
&nsGkAtoms::toolbar,
|
|
roles::TOOLBAR,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
states::HORIZONTAL,
|
|
eARIAOrientation
|
|
},
|
|
{ // tooltip
|
|
&nsGkAtoms::tooltip,
|
|
roles::TOOLTIP,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates
|
|
},
|
|
{ // tree
|
|
&nsGkAtoms::tree,
|
|
roles::OUTLINE,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
eSelect,
|
|
states::VERTICAL,
|
|
eARIAReadonly,
|
|
eARIAMultiSelectable,
|
|
eFocusableUntilDisabled,
|
|
eARIAOrientation
|
|
},
|
|
{ // treegrid
|
|
&nsGkAtoms::treegrid,
|
|
roles::TREE_TABLE,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
eSelect | eTable,
|
|
states::VERTICAL,
|
|
eARIAReadonlyOrEditable,
|
|
eARIAMultiSelectable,
|
|
eFocusableUntilDisabled,
|
|
eARIAOrientation
|
|
},
|
|
{ // treeitem
|
|
&nsGkAtoms::treeitem,
|
|
roles::OUTLINEITEM,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eActivateAction, // XXX: should expose second 'expand/collapse' action based
|
|
// on states
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates,
|
|
eARIASelectable,
|
|
eARIACheckedMixed
|
|
}
|
|
};
|
|
|
|
static const nsRoleMapEntry sLandmarkRoleMap = {
|
|
&nsGkAtoms::_empty,
|
|
roles::NOTHING,
|
|
kUseNativeRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates
|
|
};
|
|
|
|
nsRoleMapEntry aria::gEmptyRoleMap = {
|
|
&nsGkAtoms::_empty,
|
|
roles::NOTHING,
|
|
kUseMapRole,
|
|
eNoValue,
|
|
eNoAction,
|
|
eNoLiveAttr,
|
|
kGenericAccType,
|
|
kNoReqStates
|
|
};
|
|
|
|
/**
|
|
* Universal (Global) states:
|
|
* The following state rules are applied to any accessible element,
|
|
* whether there is an ARIA role or not:
|
|
*/
|
|
static const EStateRule sWAIUnivStateMap[] = {
|
|
eARIABusy,
|
|
eARIADisabled,
|
|
eARIAExpanded, // Currently under spec review but precedent exists
|
|
eARIAHasPopup, // Note this is technically a "property"
|
|
eARIAInvalid,
|
|
eARIAModal,
|
|
eARIARequired, // XXX not global, Bug 553117
|
|
eARIANone
|
|
};
|
|
|
|
|
|
/**
|
|
* ARIA attribute map for attribute characteristics.
|
|
* @note ARIA attributes that don't have any flags are not included here.
|
|
*/
|
|
|
|
struct AttrCharacteristics
|
|
{
|
|
nsIAtom** attributeName;
|
|
const uint8_t characteristics;
|
|
};
|
|
|
|
static const AttrCharacteristics gWAIUnivAttrMap[] = {
|
|
{&nsGkAtoms::aria_activedescendant, ATTR_BYPASSOBJ },
|
|
{&nsGkAtoms::aria_atomic, ATTR_BYPASSOBJ_IF_FALSE | ATTR_VALTOKEN | ATTR_GLOBAL },
|
|
{&nsGkAtoms::aria_busy, ATTR_VALTOKEN | ATTR_GLOBAL },
|
|
{&nsGkAtoms::aria_checked, ATTR_BYPASSOBJ | ATTR_VALTOKEN }, /* exposes checkable obj attr */
|
|
{&nsGkAtoms::aria_controls, ATTR_BYPASSOBJ | ATTR_GLOBAL },
|
|
{&nsGkAtoms::aria_describedby, ATTR_BYPASSOBJ | ATTR_GLOBAL },
|
|
{&nsGkAtoms::aria_disabled, ATTR_BYPASSOBJ | ATTR_VALTOKEN | ATTR_GLOBAL },
|
|
{&nsGkAtoms::aria_dropeffect, ATTR_VALTOKEN | ATTR_GLOBAL },
|
|
{&nsGkAtoms::aria_expanded, ATTR_BYPASSOBJ | ATTR_VALTOKEN },
|
|
{&nsGkAtoms::aria_flowto, ATTR_BYPASSOBJ | ATTR_GLOBAL },
|
|
{&nsGkAtoms::aria_grabbed, ATTR_VALTOKEN | ATTR_GLOBAL },
|
|
{&nsGkAtoms::aria_haspopup, ATTR_BYPASSOBJ | ATTR_VALTOKEN | ATTR_GLOBAL },
|
|
{&nsGkAtoms::aria_hidden, ATTR_BYPASSOBJ | ATTR_VALTOKEN | ATTR_GLOBAL }, /* handled special way */
|
|
{&nsGkAtoms::aria_invalid, ATTR_BYPASSOBJ | ATTR_VALTOKEN | ATTR_GLOBAL },
|
|
{&nsGkAtoms::aria_label, ATTR_BYPASSOBJ | ATTR_GLOBAL },
|
|
{&nsGkAtoms::aria_labelledby, ATTR_BYPASSOBJ | ATTR_GLOBAL },
|
|
{&nsGkAtoms::aria_level, ATTR_BYPASSOBJ }, /* handled via groupPosition */
|
|
{&nsGkAtoms::aria_live, ATTR_VALTOKEN | ATTR_GLOBAL },
|
|
{&nsGkAtoms::aria_modal, ATTR_BYPASSOBJ | ATTR_VALTOKEN | ATTR_GLOBAL },
|
|
{&nsGkAtoms::aria_multiline, ATTR_BYPASSOBJ | ATTR_VALTOKEN },
|
|
{&nsGkAtoms::aria_multiselectable, ATTR_BYPASSOBJ | ATTR_VALTOKEN },
|
|
{&nsGkAtoms::aria_owns, ATTR_BYPASSOBJ | ATTR_GLOBAL },
|
|
{&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 | ATTR_GLOBAL },
|
|
{&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 }
|
|
};
|
|
|
|
namespace {
|
|
|
|
struct RoleComparator
|
|
{
|
|
const nsDependentSubstring& mRole;
|
|
explicit RoleComparator(const nsDependentSubstring& aRole) : mRole(aRole) {}
|
|
int operator()(const nsRoleMapEntry& aEntry) const {
|
|
return Compare(mRole, aEntry.ARIARoleString());
|
|
}
|
|
};
|
|
|
|
}
|
|
|
|
const nsRoleMapEntry*
|
|
aria::GetRoleMap(dom::Element* aEl)
|
|
{
|
|
nsAutoString roles;
|
|
if (!aEl || !aEl->GetAttr(kNameSpaceID_None, nsGkAtoms::role, roles) ||
|
|
roles.IsEmpty()) {
|
|
// We treat role="" as if the role attribute is absent (per aria spec:8.1.1)
|
|
return nullptr;
|
|
}
|
|
|
|
nsWhitespaceTokenizer tokenizer(roles);
|
|
while (tokenizer.hasMoreTokens()) {
|
|
// Do a binary search through table for the next role in role list
|
|
const nsDependentSubstring role = tokenizer.nextToken();
|
|
size_t idx;
|
|
if (BinarySearchIf(sWAIRoleMaps, 0, ArrayLength(sWAIRoleMaps),
|
|
RoleComparator(role), &idx)) {
|
|
return sWAIRoleMaps + idx;
|
|
}
|
|
}
|
|
|
|
// Always use some entry if there is a non-empty role string
|
|
// To ensure an accessible object is created
|
|
return &sLandmarkRoleMap;
|
|
}
|
|
|
|
uint64_t
|
|
aria::UniversalStatesFor(mozilla::dom::Element* aElement)
|
|
{
|
|
uint64_t state = 0;
|
|
uint32_t index = 0;
|
|
while (MapToState(sWAIUnivStateMap[index], aElement, &state))
|
|
index++;
|
|
|
|
return state;
|
|
}
|
|
|
|
uint8_t
|
|
aria::AttrCharacteristicsFor(nsIAtom* aAtom)
|
|
{
|
|
for (uint32_t i = 0; i < ArrayLength(gWAIUnivAttrMap); i++)
|
|
if (*gWAIUnivAttrMap[i].attributeName == aAtom)
|
|
return gWAIUnivAttrMap[i].characteristics;
|
|
|
|
return 0;
|
|
}
|
|
|
|
bool
|
|
aria::HasDefinedARIAHidden(nsIContent* aContent)
|
|
{
|
|
return aContent &&
|
|
nsAccUtils::HasDefinedARIAToken(aContent, nsGkAtoms::aria_hidden) &&
|
|
!aContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::aria_hidden,
|
|
nsGkAtoms::_false, eCaseMatters);
|
|
}
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
// AttrIterator class
|
|
|
|
bool
|
|
AttrIterator::Next(nsAString& aAttrName, nsAString& aAttrValue)
|
|
{
|
|
while (mAttrIdx < mAttrCount) {
|
|
const nsAttrName* attr = mContent->GetAttrNameAt(mAttrIdx);
|
|
mAttrIdx++;
|
|
if (attr->NamespaceEquals(kNameSpaceID_None)) {
|
|
nsIAtom* attrAtom = attr->Atom();
|
|
nsDependentAtomString attrStr(attrAtom);
|
|
if (!StringBeginsWith(attrStr, NS_LITERAL_STRING("aria-")))
|
|
continue; // Not ARIA
|
|
|
|
uint8_t attrFlags = aria::AttrCharacteristicsFor(attrAtom);
|
|
if (attrFlags & ATTR_BYPASSOBJ)
|
|
continue; // No need to handle exposing as obj attribute here
|
|
|
|
if ((attrFlags & ATTR_VALTOKEN) &&
|
|
!nsAccUtils::HasDefinedARIAToken(mContent, attrAtom))
|
|
continue; // only expose token based attributes if they are defined
|
|
|
|
if ((attrFlags & ATTR_BYPASSOBJ_IF_FALSE) &&
|
|
mContent->AttrValueIs(kNameSpaceID_None, attrAtom,
|
|
nsGkAtoms::_false, eCaseMatters)) {
|
|
continue; // only expose token based attribute if value is not 'false'.
|
|
}
|
|
|
|
nsAutoString value;
|
|
if (mContent->GetAttr(kNameSpaceID_None, attrAtom, value)) {
|
|
aAttrName.Assign(Substring(attrStr, 5));
|
|
aAttrValue.Assign(value);
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|
|
return false;
|
|
}
|
|
|