Bug 460926 A11y hierachy is broken on Ubuntu 8.10 (GNOME 2.24), r=Evan.Yan sr=roc
[wine-gecko.git] / accessible / src / base / nsARIAMap.h
blob3fbb8931db7da5ddca70e44bade756133c5f9eea
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:expandtab:shiftwidth=2:tabstop=2:
3 */
4 /* ***** BEGIN LICENSE BLOCK *****
5 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
7 * The contents of this file are subject to the Mozilla Public License Version
8 * 1.1 (the "License"); you may not use this file except in compliance with
9 * the License. You may obtain a copy of the License at
10 * http://www.mozilla.org/MPL/
12 * Software distributed under the License is distributed on an "AS IS" basis,
13 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
14 * for the specific language governing rights and limitations under the
15 * License.
17 * The Original Code is mozilla.org code.
19 * The Initial Developer of the Original Code is IBM Corporation
20 * Portions created by the Initial Developer are Copyright (C) 2007
21 * the Initial Developer. All Rights Reserved.
23 * Contributor(s):
24 * Aaron Leventhal <aleventh@us.ibm.com>
26 * Alternatively, the contents of this file may be used under the terms of
27 * either the GNU General Public License Version 2 or later (the "GPL"), or
28 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
29 * in which case the provisions of the GPL or the LGPL are applicable instead
30 * of those above. If you wish to allow use of your version of this file only
31 * under the terms of either the GPL or the LGPL, and not to allow others to
32 * use your version of this file under the terms of the MPL, indicate your
33 * decision by deleting the provisions above and replace them with the notice
34 * and other provisions required by the GPL or the LGPL. If you do not delete
35 * the provisions above, a recipient may use your version of this file under
36 * the terms of any one of the MPL, the GPL or the LGPL.
38 * ***** END LICENSE BLOCK ***** */
40 #ifndef _nsARIAMap_H_
41 #define _nsARIAMap_H_
43 #include "prtypes.h"
44 #include "nsAccessibilityAtoms.h"
46 // Is nsIAccessible value supported for this role or not?
47 enum EValueRule
49 eNoValue,
50 eHasValueMinMax // Supports value, min and max from aria-valuenow, aria-valuemin and aria-valuemax
53 // Should we expose action based on the ARIA role?
54 enum EActionRule
56 eNoAction,
57 eActivateAction,
58 eClickAction,
59 eCheckUncheckAction,
60 eJumpAction,
61 eOpenCloseAction,
62 eSelectAction,
63 eSwitchAction
66 // Used for an nsStateMapEntry if a given state attribute supports "true" and "false"
67 #define kBoolState 0
69 // Used in nsRoleMapEntry.state if no nsIAccessibleStates are automatic for a given role
70 #define kNoReqStates 0
72 // For this name and value pair, what is the nsIAccessibleStates mapping.
73 // nsStateMapEntry.state
74 struct nsStateMapEntry
76 nsIAtom** attributeName; // nsnull indicates last entry in map
77 const char* attributeValue; // magic value of kBoolState (0) means supports "true" and "false"
78 PRUint32 state; // If match, this is the nsIAccessibleStates to map to
81 // For each ARIA role, this maps the nsIAccessible information
82 struct nsRoleMapEntry
84 // ARIA role: string representation such as "button"
85 const char *roleString;
87 // Role mapping rule: maps to this nsIAccessibleRole
88 PRUint32 role;
90 // Value mapping rule: how to compute nsIAccessible value
91 EValueRule valueRule;
93 // Action mapping rule, how to expose nsIAccessible action
94 EActionRule actionRule;
96 // Automatic state mapping rule: always include in nsIAccessibleStates
97 PRUint32 state; // or kNoReqStates if no nsIAccessibleStates are automatic for this role.
99 // ARIA properties supported for this role
100 // (in other words, the aria-foo attribute to nsIAccessibleStates mapping rules)
101 // Currently you cannot have unlimited mappings, because
102 // a variable sized array would not allow the use of
103 // C++'s struct initialization feature.
104 nsStateMapEntry attributeMap1;
105 nsStateMapEntry attributeMap2;
106 nsStateMapEntry attributeMap3;
107 nsStateMapEntry attributeMap4;
108 nsStateMapEntry attributeMap5;
109 nsStateMapEntry attributeMap6;
110 nsStateMapEntry attributeMap7;
111 nsStateMapEntry attributeMap8;
115 * These are currently initialized (hardcoded) in nsARIAMap.cpp,
116 * and provide the mappings for WAI-ARIA roles and properties using the
117 * structs defined in this file.
119 struct nsARIAMap
122 * Array of supported ARIA role map entries and its length.
124 static nsRoleMapEntry gWAIRoleMap[];
125 static PRUint32 gWAIRoleMapLength;
128 * Landmark role map entry. Used when specified ARIA role isn't mapped to
129 * accessibility API.
131 static nsRoleMapEntry gLandmarkRoleMap;
134 * Empty role map entry. Used by accessibility service to create an accessible
135 * if the accessible can't use role of used accessible class. For example,
136 * it is used for table cells that aren't contained by table.
138 static nsRoleMapEntry gEmptyRoleMap;
141 * State map of ARIA states applied to any accessible not depending on
142 * the role.
144 static nsStateMapEntry gWAIUnivStateMap[];
147 #endif