Bug 673689 Introduced name space role. r=tbsaunde
authorJignesh Kakadiya <jigneshhk1992@gmail.com>
Wed, 11 Jan 2012 22:07:35 -0500
changeset 84373 0ef29ddd07e54d636e64586bc09130e1f315a3e9
parent 84372 8f723d91fb82313b0b4226f1168a73dd063d9d67
child 84374 90a2cc46965d1a0e4e6f651f7417e9ad45d806a6
push id4870
push userbmo@edmorley.co.uk
push dateFri, 13 Jan 2012 03:25:02 +0000
treeherdermozilla-inbound@b05c0f2fc18e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstbsaunde
bugs673689
milestone12.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 673689 Introduced name space role. r=tbsaunde
accessible/src/atk/nsMaiInterfaceAction.cpp
accessible/src/atk/nsRoleMap.h
accessible/src/base/AccGroupInfo.cpp
accessible/src/base/AccGroupInfo.h
accessible/src/base/FocusManager.cpp
accessible/src/base/Makefile.in
accessible/src/base/NotificationController.cpp
accessible/src/base/Role.h
accessible/src/base/filters.cpp
accessible/src/base/nsARIAGridAccessible.cpp
accessible/src/base/nsARIAMap.cpp
accessible/src/base/nsARIAMap.h
accessible/src/base/nsAccUtils.cpp
accessible/src/base/nsAccessibilityService.cpp
accessible/src/base/nsAccessible.cpp
accessible/src/base/nsAccessible.h
accessible/src/base/nsApplicationAccessible.cpp
accessible/src/base/nsApplicationAccessible.h
accessible/src/base/nsBaseWidgetAccessible.cpp
accessible/src/base/nsBaseWidgetAccessible.h
accessible/src/base/nsDocAccessible.cpp
accessible/src/base/nsDocAccessible.h
accessible/src/base/nsFormControlAccessible.cpp
accessible/src/base/nsFormControlAccessible.h
accessible/src/base/nsOuterDocAccessible.cpp
accessible/src/base/nsOuterDocAccessible.h
accessible/src/base/nsRootAccessible.cpp
accessible/src/base/nsRootAccessible.h
accessible/src/base/nsTextAccessible.cpp
accessible/src/base/nsTextAccessible.h
accessible/src/html/nsHTMLCanvasAccessible.cpp
accessible/src/html/nsHTMLCanvasAccessible.h
accessible/src/html/nsHTMLFormControlAccessible.cpp
accessible/src/html/nsHTMLFormControlAccessible.h
accessible/src/html/nsHTMLImageAccessible.cpp
accessible/src/html/nsHTMLImageAccessible.h
accessible/src/html/nsHTMLImageMapAccessible.cpp
accessible/src/html/nsHTMLImageMapAccessible.h
accessible/src/html/nsHTMLLinkAccessible.cpp
accessible/src/html/nsHTMLLinkAccessible.h
accessible/src/html/nsHTMLSelectAccessible.cpp
accessible/src/html/nsHTMLSelectAccessible.h
accessible/src/html/nsHTMLTableAccessible.cpp
accessible/src/html/nsHTMLTableAccessible.h
accessible/src/html/nsHTMLTextAccessible.cpp
accessible/src/html/nsHTMLTextAccessible.h
accessible/src/html/nsHyperTextAccessible.cpp
accessible/src/html/nsHyperTextAccessible.h
accessible/src/mac/mozAccessible.mm
accessible/src/mac/nsAccessibleWrap.mm
accessible/src/msaa/nsAccessibleWrap.cpp
accessible/src/msaa/nsDocAccessibleWrap.cpp
accessible/src/msaa/nsHTMLWin32ObjectAccessible.cpp
accessible/src/msaa/nsHTMLWin32ObjectAccessible.h
accessible/src/msaa/nsRoleMap.h
accessible/src/xforms/nsXFormsAccessible.cpp
accessible/src/xforms/nsXFormsAccessible.h
accessible/src/xforms/nsXFormsFormControlsAccessible.cpp
accessible/src/xforms/nsXFormsFormControlsAccessible.h
accessible/src/xforms/nsXFormsWidgetsAccessible.cpp
accessible/src/xforms/nsXFormsWidgetsAccessible.h
accessible/src/xul/nsXULAlertAccessible.cpp
accessible/src/xul/nsXULAlertAccessible.h
accessible/src/xul/nsXULColorPickerAccessible.cpp
accessible/src/xul/nsXULColorPickerAccessible.h
accessible/src/xul/nsXULComboboxAccessible.cpp
accessible/src/xul/nsXULComboboxAccessible.h
accessible/src/xul/nsXULFormControlAccessible.cpp
accessible/src/xul/nsXULFormControlAccessible.h
accessible/src/xul/nsXULListboxAccessible.cpp
accessible/src/xul/nsXULListboxAccessible.h
accessible/src/xul/nsXULMenuAccessible.cpp
accessible/src/xul/nsXULMenuAccessible.h
accessible/src/xul/nsXULSliderAccessible.cpp
accessible/src/xul/nsXULSliderAccessible.h
accessible/src/xul/nsXULTabAccessible.cpp
accessible/src/xul/nsXULTabAccessible.h
accessible/src/xul/nsXULTextAccessible.cpp
accessible/src/xul/nsXULTextAccessible.h
accessible/src/xul/nsXULTreeAccessible.cpp
accessible/src/xul/nsXULTreeAccessible.h
accessible/src/xul/nsXULTreeGridAccessible.cpp
accessible/src/xul/nsXULTreeGridAccessible.h
--- a/accessible/src/atk/nsMaiInterfaceAction.cpp
+++ b/accessible/src/atk/nsMaiInterfaceAction.cpp
@@ -37,19 +37,22 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsMaiInterfaceAction.h"
 
 #include "nsAccUtils.h"
 #include "nsRoleMap.h"
 #include "nsString.h"
+#include "Role.h"
 
 #include "nsIDOMDOMStringList.h"
 
+using namespace mozilla::a11y;
+
 void
 actionInterfaceInitCB(AtkActionIface *aIface)
 {
     NS_ASSERTION(aIface, "Invalid aIface");
     if (!aIface)
         return;
 
     aIface->do_action = doActionCB;
@@ -114,35 +117,32 @@ getKeyBindingCB(AtkAction *aAction, gint
   nsAutoString keyBindingsStr;
 
   // Get access key.
   KeyBinding keyBinding = acc->AccessKey();
   if (!keyBinding.IsEmpty()) {
     keyBinding.AppendToString(keyBindingsStr, KeyBinding::eAtkFormat);
 
     nsAccessible* parent = acc->Parent();
-    PRUint32 role = parent ? parent->Role() : 0;
-    if (role == nsIAccessibleRole::ROLE_PARENT_MENUITEM ||
-        role == nsIAccessibleRole::ROLE_MENUITEM ||
-        role == nsIAccessibleRole::ROLE_RADIO_MENU_ITEM ||
-        role == nsIAccessibleRole::ROLE_CHECK_MENU_ITEM) {
+    roles::Role role = parent ? parent->Role() : roles::NOTHING;
+    if (role == roles::PARENT_MENUITEM || role == roles::MENUITEM ||
+        role == roles::RADIO_MENU_ITEM || role == roles::CHECK_MENU_ITEM) {
       // It is submenu, expose keyboard shortcuts from menu hierarchy like
       // "s;<Alt>f:s"
       nsAutoString keysInHierarchyStr = keyBindingsStr;
       do {
         KeyBinding parentKeyBinding = parent->AccessKey();
         if (!parentKeyBinding.IsEmpty()) {
           nsAutoString str;
           parentKeyBinding.ToString(str, KeyBinding::eAtkFormat);
           str.Append(':');
 
           keysInHierarchyStr.Insert(str, 0);
         }
-      } while ((parent = parent->Parent()) &&
-               parent->Role() != nsIAccessibleRole::ROLE_MENUBAR);
+      } while ((parent = parent->Parent()) && parent->Role() != roles::MENUBAR);
 
       keyBindingsStr.Append(';');
       keyBindingsStr.Append(keysInHierarchyStr);
     }
   } else {
     // No access key, add ';' to point this.
     keyBindingsStr.Append(';');
   }
--- a/accessible/src/atk/nsRoleMap.h
+++ b/accessible/src/atk/nsRoleMap.h
@@ -39,137 +39,137 @@
 
 #include <atk/atk.h>
 #include "nsAccessibleWrap.h"
 
 const PRUint32 kROLE_ATK_LAST_ENTRY = 0xffffffff;
 
 // Map array from cross platform roles to  ATK roles
 static const PRUint32 atkRoleMap[] = {
-                                  // Cross Platform Roles                         #
-    ATK_ROLE_UNKNOWN,             // nsIAccessibleRole::ROLE_NOTHING              0
-    ATK_ROLE_UNKNOWN,             // nsIAccessibleRole::ROLE_TITLEBAR             1
-    ATK_ROLE_MENU_BAR,            // nsIAccessibleRole::ROLE_MENUBAR              2
-    ATK_ROLE_SCROLL_BAR,          // nsIAccessibleRole::ROLE_SCROLLBAR            3
-    ATK_ROLE_UNKNOWN,             // nsIAccessibleRole::ROLE_GRIP                 4
-    ATK_ROLE_UNKNOWN,             // nsIAccessibleRole::ROLE_SOUND                5
-    ATK_ROLE_UNKNOWN,             // nsIAccessibleRole::ROLE_CURSOR               6
-    ATK_ROLE_UNKNOWN,             // nsIAccessibleRole::ROLE_CARET                7
-    ATK_ROLE_ALERT,               // nsIAccessibleRole::ROLE_ALERT                8
-    ATK_ROLE_WINDOW,              // nsIAccessibleRole::ROLE_WINDOW               9
-    ATK_ROLE_INTERNAL_FRAME,      // nsIAccessibleRole::ROLE_INTERNAL_FRAME       10
-    ATK_ROLE_MENU,                // nsIAccessibleRole::ROLE_MENUPOPUP            11
-    ATK_ROLE_MENU_ITEM,           // nsIAccessibleRole::ROLE_MENUITEM             12
-    ATK_ROLE_TOOL_TIP,            // nsIAccessibleRole::ROLE_TOOLTIP              13
-    ATK_ROLE_EMBEDDED,            // nsIAccessibleRole::ROLE_APPLICATION          14
-    ATK_ROLE_DOCUMENT_FRAME,      // nsIAccessibleRole::ROLE_DOCUMENT             15
-    ATK_ROLE_PANEL,               // nsIAccessibleRole::ROLE_PANE                 16
-    ATK_ROLE_CHART,               // nsIAccessibleRole::ROLE_CHART                17
-    ATK_ROLE_DIALOG,              // nsIAccessibleRole::ROLE_DIALOG               18
-    ATK_ROLE_UNKNOWN,             // nsIAccessibleRole::ROLE_BORDER               19
-    ATK_ROLE_PANEL,               // nsIAccessibleRole::ROLE_GROUPING             20
-    ATK_ROLE_SEPARATOR,           // nsIAccessibleRole::ROLE_SEPARATOR            21
-    ATK_ROLE_TOOL_BAR,            // nsIAccessibleRole::ROLE_TOOLBAR              22
-    ATK_ROLE_STATUSBAR,           // nsIAccessibleRole::ROLE_STATUSBAR            23
-    ATK_ROLE_TABLE,               // nsIAccessibleRole::ROLE_TABLE                24
-    ATK_ROLE_COLUMN_HEADER,       // nsIAccessibleRole::ROLE_COLUMNHEADER         25
-    ATK_ROLE_ROW_HEADER,          // nsIAccessibleRole::ROLE_ROWHEADER            26
-    ATK_ROLE_UNKNOWN,             // nsIAccessibleRole::ROLE_COLUMN               27
-    ATK_ROLE_LIST_ITEM,           // nsIAccessibleRole::ROLE_ROW                  28
-    ATK_ROLE_TABLE_CELL,          // nsIAccessibleRole::ROLE_CELL                 29
-    ATK_ROLE_LINK,                // nsIAccessibleRole::ROLE_LINK                 30
-    ATK_ROLE_UNKNOWN,             // nsIAccessibleRole::ROLE_HELPBALLOON          31
-    ATK_ROLE_IMAGE,               // nsIAccessibleRole::ROLE_CHARACTER            32
-    ATK_ROLE_LIST,                // nsIAccessibleRole::ROLE_LIST                 33
-    ATK_ROLE_LIST_ITEM,           // nsIAccessibleRole::ROLE_LISTITEM             34
-    ATK_ROLE_TREE,                // nsIAccessibleRole::ROLE_OUTLINE              35
-    ATK_ROLE_LIST_ITEM,           // nsIAccessibleRole::ROLE_OUTLINEITEM          36
-    ATK_ROLE_PAGE_TAB,            // nsIAccessibleRole::ROLE_PAGETAB              37
-    ATK_ROLE_SCROLL_PANE,         // nsIAccessibleRole::ROLE_PROPERTYPAGE         38
-    ATK_ROLE_UNKNOWN,             // nsIAccessibleRole::ROLE_INDICATOR            39
-    ATK_ROLE_IMAGE,               // nsIAccessibleRole::ROLE_GRAPHIC              40
-    ATK_ROLE_UNKNOWN,             // nsIAccessibleRole::ROLE_STATICTEXT           41
-    ATK_ROLE_UNKNOWN,             // nsIAccessibleRole::ROLE_TEXT_LEAF            42
-    ATK_ROLE_PUSH_BUTTON,         // nsIAccessibleRole::ROLE_PUSHBUTTON           43
-    ATK_ROLE_CHECK_BOX,           // nsIAccessibleRole::ROLE_CHECKBUTTON          44
-    ATK_ROLE_RADIO_BUTTON,        // nsIAccessibleRole::ROLE_RADIOBUTTON          45
-    ATK_ROLE_COMBO_BOX,           // nsIAccessibleRole::ROLE_COMBOBOX             46
-    ATK_ROLE_COMBO_BOX,           // nsIAccessibleRole::ROLE_DROPLIST             47
-    ATK_ROLE_PROGRESS_BAR,        // nsIAccessibleRole::ROLE_PROGRESSBAR          48
-    ATK_ROLE_DIAL,                // nsIAccessibleRole::ROLE_DIAL                 49
-    ATK_ROLE_UNKNOWN,             // nsIAccessibleRole::ROLE_HOTKEYFIELD          50
-    ATK_ROLE_SLIDER,              // nsIAccessibleRole::ROLE_SLIDER               51
-    ATK_ROLE_SPIN_BUTTON,         // nsIAccessibleRole::ROLE_SPINBUTTON           52
-    ATK_ROLE_IMAGE,               // nsIAccessibleRole::ROLE_DIAGRAM              53
-    ATK_ROLE_ANIMATION,           // nsIAccessibleRole::ROLE_ANIMATION            54
-    ATK_ROLE_UNKNOWN,             // nsIAccessibleRole::ROLE_EQUATION             55
-    ATK_ROLE_PUSH_BUTTON,         // nsIAccessibleRole::ROLE_BUTTONDROPDOWN       56
-    ATK_ROLE_PUSH_BUTTON,         // nsIAccessibleRole::ROLE_BUTTONMENU           57
-    ATK_ROLE_UNKNOWN,             // nsIAccessibleRole::ROLE_BUTTONDROPDOWNGRID   58
-    ATK_ROLE_UNKNOWN,             // nsIAccessibleRole::ROLE_WHITESPACE           59
-    ATK_ROLE_PAGE_TAB_LIST,       // nsIAccessibleRole::ROLE_PAGETABLIST          60
-    ATK_ROLE_UNKNOWN,             // nsIAccessibleRole::ROLE_CLOCK                61
-    ATK_ROLE_PUSH_BUTTON,         // nsIAccessibleRole::ROLE_SPLITBUTTON          62
-    ATK_ROLE_UNKNOWN,             // nsIAccessibleRole::ROLE_IPADDRESS            63
-    ATK_ROLE_ACCEL_LABEL,         // nsIAccessibleRole::ROLE_ACCEL_LABEL          64
-    ATK_ROLE_ARROW,               // nsIAccessibleRole::ROLE_ARROW                65
-    ATK_ROLE_CANVAS,              // nsIAccessibleRole::ROLE_CANVAS               66
-    ATK_ROLE_CHECK_MENU_ITEM,     // nsIAccessibleRole::ROLE_CHECK_MENU_ITEM      67
-    ATK_ROLE_COLOR_CHOOSER,       // nsIAccessibleRole::ROLE_COLOR_CHOOSER        68
-    ATK_ROLE_DATE_EDITOR,         // nsIAccessibleRole::ROLE_DATE_EDITOR          69
-    ATK_ROLE_DESKTOP_ICON,        // nsIAccessibleRole::ROLE_DESKTOP_ICON         70
-    ATK_ROLE_DESKTOP_FRAME,       // nsIAccessibleRole::ROLE_DESKTOP_FRAME        71
-    ATK_ROLE_DIRECTORY_PANE,      // nsIAccessibleRole::ROLE_DIRECTORY_PANE       72
-    ATK_ROLE_FILE_CHOOSER,        // nsIAccessibleRole::ROLE_FILE_CHOOSER         73
-    ATK_ROLE_FONT_CHOOSER,        // nsIAccessibleRole::ROLE_FONT_CHOOSER         74
-    ATK_ROLE_FRAME,               // nsIAccessibleRole::ROLE_CHROME_WINDOW        75
-    ATK_ROLE_GLASS_PANE,          // nsIAccessibleRole::ROLE_GLASS_PANE           76
-    ATK_ROLE_HTML_CONTAINER,      // nsIAccessibleRole::ROLE_HTML_CONTAINER       77
-    ATK_ROLE_ICON,                // nsIAccessibleRole::ROLE_ICON                 78
-    ATK_ROLE_LABEL,               // nsIAccessibleRole::ROLE_LABEL                79
-    ATK_ROLE_LAYERED_PANE,        // nsIAccessibleRole::ROLE_LAYERED_PANE         80
-    ATK_ROLE_OPTION_PANE,         // nsIAccessibleRole::ROLE_OPTION_PANE          81
-    ATK_ROLE_PASSWORD_TEXT,       // nsIAccessibleRole::ROLE_PASSWORD_TEXT        82
-    ATK_ROLE_POPUP_MENU,          // nsIAccessibleRole::ROLE_POPUP_MENU           83
-    ATK_ROLE_RADIO_MENU_ITEM,     // nsIAccessibleRole::ROLE_RADIO_MENU_ITEM      84
-    ATK_ROLE_ROOT_PANE,           // nsIAccessibleRole::ROLE_ROOT_PANE            85
-    ATK_ROLE_SCROLL_PANE,         // nsIAccessibleRole::ROLE_SCROLL_PANE          86
-    ATK_ROLE_SPLIT_PANE,          // nsIAccessibleRole::ROLE_SPLIT_PANE           87
-    ATK_ROLE_TABLE_COLUMN_HEADER, // nsIAccessibleRole::ROLE_TABLE_COLUMN_HEADER  88
-    ATK_ROLE_TABLE_ROW_HEADER,    // nsIAccessibleRole::ROLE_TABLE_ROW_HEADER     89
-    ATK_ROLE_TEAR_OFF_MENU_ITEM,  // nsIAccessibleRole::ROLE_TEAR_OFF_MENU_ITEM   90
-    ATK_ROLE_TERMINAL,            // nsIAccessibleRole::ROLE_TERMINAL             91
-    ATK_ROLE_TEXT,                // nsIAccessibleRole::ROLE_TEXT_CONTAINER       92
-    ATK_ROLE_TOGGLE_BUTTON,       // nsIAccessibleRole::ROLE_TOGGLE_BUTTON        93
-    ATK_ROLE_TREE_TABLE,          // nsIAccessibleRole::ROLE_TREE_TABLE           94
-    ATK_ROLE_VIEWPORT,            // nsIAccessibleRole::ROLE_VIEWPORT             95
-    ATK_ROLE_HEADER,              // nsIAccessibleRole::ROLE_HEADER               96
-    ATK_ROLE_FOOTER,              // nsIAccessibleRole::ROLE_FOOTER               97
-    ATK_ROLE_PARAGRAPH,           // nsIAccessibleRole::ROLE_PARAGRAPH            98
-    ATK_ROLE_RULER,               // nsIAccessibleRole::ROLE_RULER                99
-    ATK_ROLE_AUTOCOMPLETE,        // nsIAccessibleRole::ROLE_AUTOCOMPLETE         100
-    ATK_ROLE_EDITBAR,             // nsIAccessibleRole::ROLE_EDITBAR              101
-    ATK_ROLE_ENTRY,               // nsIAccessibleRole::ROLE_ENTRY                102
-    ATK_ROLE_CAPTION,             // nsIAccessibleRole::ROLE_CAPTION              103
-    ATK_ROLE_DOCUMENT_FRAME,      // nsIAccessibleRole::ROLE_DOCUMENT_FRAME       104
-    ATK_ROLE_HEADING,             // nsIAccessibleRole::ROLE_HEADING              105
-    ATK_ROLE_PAGE,                // nsIAccessibleRole::ROLE_PAGE                 106
-    ATK_ROLE_SECTION,             // nsIAccessibleRole::ROLE_SECTION              107
-    ATK_ROLE_REDUNDANT_OBJECT,    // nsIAccessibleRole::ROLE_REDUNDANT_OBJECT     108
-    ATK_ROLE_FORM,                // nsIAccessibleRole::ROLE_FORM                 109
-    ATK_ROLE_INPUT_METHOD_WINDOW, // nsIAccessibleRole::ROLE_IME                  110
-    ATK_ROLE_APPLICATION,         // nsIAccessibleRole::ROLE_APP_ROOT             111
-    ATK_ROLE_MENU,                // nsIAccessibleRole::ROLE_PARENT_MENUITEM      112
-    ATK_ROLE_CALENDAR,            // nsIAccessibleRole::ROLE_CALENDAR             113
-    ATK_ROLE_MENU,                // nsIAccessibleRole::ROLE_COMBOBOX_LIST        114
-    ATK_ROLE_MENU_ITEM,           // nsIAccessibleRole::ROLE_COMBOBOX_OPTION      115
-    ATK_ROLE_IMAGE,               // nsIAccessibleRole::ROLE_IMAGE_MAP            116
-    ATK_ROLE_LIST_ITEM,           // nsIAccessibleRole::ROLE_OPTION               117
-    ATK_ROLE_LIST_ITEM,           // nsIAccessibleRole::ROLE_RICH_OPTION          118
-    ATK_ROLE_LIST,                // nsIAccessibleRole::ROLE_LISTBOX              119
-    ATK_ROLE_UNKNOWN,             // nsIAccessibleRole::ROLE_FLAT_EQUATION        120
-    ATK_ROLE_TABLE_CELL,          // nsIAccessibleRole::ROLE_GRID_CELL            121
-    ATK_ROLE_PANEL,               // nsIAccessibleRole::ROLE_EMBEDDED_OBJECT      122
-    ATK_ROLE_SECTION,             // nsIAccessibleRole::ROLE_NOTE                 123
-    ATK_ROLE_PANEL,               // nsIAccessibleRole::ROLE_FIGURE               124
-    kROLE_ATK_LAST_ENTRY          // nsIAccessibleRole::ROLE_LAST_ENTRY
+                                  // Cross Platform Roles       #
+    ATK_ROLE_UNKNOWN,             // roles::NOTHING              0
+    ATK_ROLE_UNKNOWN,             // roles::TITLEBAR             1
+    ATK_ROLE_MENU_BAR,            // roles::MENUBAR              2
+    ATK_ROLE_SCROLL_BAR,          // roles::SCROLLBAR            3
+    ATK_ROLE_UNKNOWN,             // roles::GRIP                 4
+    ATK_ROLE_UNKNOWN,             // roles::SOUND                5
+    ATK_ROLE_UNKNOWN,             // roles::CURSOR               6
+    ATK_ROLE_UNKNOWN,             // roles::CARET                7
+    ATK_ROLE_ALERT,               // roles::ALERT                8
+    ATK_ROLE_WINDOW,              // roles::WINDOW               9
+    ATK_ROLE_INTERNAL_FRAME,      // roles::INTERNAL_FRAME       10
+    ATK_ROLE_MENU,                // roles::MENUPOPUP            11
+    ATK_ROLE_MENU_ITEM,           // roles::MENUITEM             12
+    ATK_ROLE_TOOL_TIP,            // roles::TOOLTIP              13
+    ATK_ROLE_EMBEDDED,            // roles::APPLICATION          14
+    ATK_ROLE_DOCUMENT_FRAME,      // roles::DOCUMENT             15
+    ATK_ROLE_PANEL,               // roles::PANE                 16
+    ATK_ROLE_CHART,               // roles::CHART                17
+    ATK_ROLE_DIALOG,              // roles::DIALOG               18
+    ATK_ROLE_UNKNOWN,             // roles::BORDER               19
+    ATK_ROLE_PANEL,               // roles::GROUPING             20
+    ATK_ROLE_SEPARATOR,           // roles::SEPARATOR            21
+    ATK_ROLE_TOOL_BAR,            // roles::TOOLBAR              22
+    ATK_ROLE_STATUSBAR,           // roles::STATUSBAR            23
+    ATK_ROLE_TABLE,               // roles::TABLE                24
+    ATK_ROLE_COLUMN_HEADER,       // roles::COLUMNHEADER         25
+    ATK_ROLE_ROW_HEADER,          // roles::ROWHEADER            26
+    ATK_ROLE_UNKNOWN,             // roles::COLUMN               27
+    ATK_ROLE_LIST_ITEM,           // roles::ROW                  28
+    ATK_ROLE_TABLE_CELL,          // roles::CELL                 29
+    ATK_ROLE_LINK,                // roles::LINK                 30
+    ATK_ROLE_UNKNOWN,             // roles::HELPBALLOON          31
+    ATK_ROLE_IMAGE,               // roles::CHARACTER            32
+    ATK_ROLE_LIST,                // roles::LIST                 33
+    ATK_ROLE_LIST_ITEM,           // roles::LISTITEM             34
+    ATK_ROLE_TREE,                // roles::OUTLINE              35
+    ATK_ROLE_LIST_ITEM,           // roles::OUTLINEITEM          36
+    ATK_ROLE_PAGE_TAB,            // roles::PAGETAB              37
+    ATK_ROLE_SCROLL_PANE,         // roles::PROPERTYPAGE         38
+    ATK_ROLE_UNKNOWN,             // roles::INDICATOR            39
+    ATK_ROLE_IMAGE,               // roles::GRAPHIC              40
+    ATK_ROLE_UNKNOWN,             // roles::STATICTEXT           41
+    ATK_ROLE_UNKNOWN,             // roles::TEXT_LEAF            42
+    ATK_ROLE_PUSH_BUTTON,         // roles::PUSHBUTTON           43
+    ATK_ROLE_CHECK_BOX,           // roles::CHECKBUTTON          44
+    ATK_ROLE_RADIO_BUTTON,        // roles::RADIOBUTTON          45
+    ATK_ROLE_COMBO_BOX,           // roles::COMBOBOX             46
+    ATK_ROLE_COMBO_BOX,           // roles::DROPLIST             47
+    ATK_ROLE_PROGRESS_BAR,        // roles::PROGRESSBAR          48
+    ATK_ROLE_DIAL,                // roles::DIAL                 49
+    ATK_ROLE_UNKNOWN,             // roles::HOTKEYFIELD          50
+    ATK_ROLE_SLIDER,              // roles::SLIDER               51
+    ATK_ROLE_SPIN_BUTTON,         // roles::SPINBUTTON           52
+    ATK_ROLE_IMAGE,               // roles::DIAGRAM              53
+    ATK_ROLE_ANIMATION,           // roles::ANIMATION            54
+    ATK_ROLE_UNKNOWN,             // roles::EQUATION             55
+    ATK_ROLE_PUSH_BUTTON,         // roles::BUTTONDROPDOWN       56
+    ATK_ROLE_PUSH_BUTTON,         // roles::BUTTONMENU           57
+    ATK_ROLE_UNKNOWN,             // roles::BUTTONDROPDOWNGRID   58
+    ATK_ROLE_UNKNOWN,             // roles::WHITESPACE           59
+    ATK_ROLE_PAGE_TAB_LIST,       // roles::PAGETABLIST          60
+    ATK_ROLE_UNKNOWN,             // roles::CLOCK                61
+    ATK_ROLE_PUSH_BUTTON,         // roles::SPLITBUTTON          62
+    ATK_ROLE_UNKNOWN,             // roles::IPADDRESS            63
+    ATK_ROLE_ACCEL_LABEL,         // roles::ACCEL_LABEL          64
+    ATK_ROLE_ARROW,               // roles::ARROW                65
+    ATK_ROLE_CANVAS,              // roles::CANVAS               66
+    ATK_ROLE_CHECK_MENU_ITEM,     // roles::CHECK_MENU_ITEM      67
+    ATK_ROLE_COLOR_CHOOSER,       // roles::COLOR_CHOOSER        68
+    ATK_ROLE_DATE_EDITOR,         // roles::DATE_EDITOR          69
+    ATK_ROLE_DESKTOP_ICON,        // roles::DESKTOP_ICON         70
+    ATK_ROLE_DESKTOP_FRAME,       // roles::DESKTOP_FRAME        71
+    ATK_ROLE_DIRECTORY_PANE,      // roles::DIRECTORY_PANE       72
+    ATK_ROLE_FILE_CHOOSER,        // roles::FILE_CHOOSER         73
+    ATK_ROLE_FONT_CHOOSER,        // roles::FONT_CHOOSER         74
+    ATK_ROLE_FRAME,               // roles::CHROME_WINDOW        75
+    ATK_ROLE_GLASS_PANE,          // roles::GLASS_PANE           76
+    ATK_ROLE_HTML_CONTAINER,      // roles::HTML_CONTAINER       77
+    ATK_ROLE_ICON,                // roles::ICON                 78
+    ATK_ROLE_LABEL,               // roles::LABEL                79
+    ATK_ROLE_LAYERED_PANE,        // roles::LAYERED_PANE         80
+    ATK_ROLE_OPTION_PANE,         // roles::OPTION_PANE          81
+    ATK_ROLE_PASSWORD_TEXT,       // roles::PASSWORD_TEXT        82
+    ATK_ROLE_POPUP_MENU,          // roles::POPUP_MENU           83
+    ATK_ROLE_RADIO_MENU_ITEM,     // roles::RADIO_MENU_ITEM      84
+    ATK_ROLE_ROOT_PANE,           // roles::ROOT_PANE            85
+    ATK_ROLE_SCROLL_PANE,         // roles::SCROLL_PANE          86
+    ATK_ROLE_SPLIT_PANE,          // roles::SPLIT_PANE           87
+    ATK_ROLE_TABLE_COLUMN_HEADER, // roles::TABLE_COLUMN_HEADER  88
+    ATK_ROLE_TABLE_ROW_HEADER,    // roles::TABLE_ROW_HEADER     89
+    ATK_ROLE_TEAR_OFF_MENU_ITEM,  // roles::TEAR_OFF_MENU_ITEM   90
+    ATK_ROLE_TERMINAL,            // roles::TERMINAL             91
+    ATK_ROLE_TEXT,                // roles::TEXT_CONTAINER       92
+    ATK_ROLE_TOGGLE_BUTTON,       // roles::TOGGLE_BUTTON        93
+    ATK_ROLE_TREE_TABLE,          // roles::TREE_TABLE           94
+    ATK_ROLE_VIEWPORT,            // roles::VIEWPORT             95
+    ATK_ROLE_HEADER,              // roles::HEADER               96
+    ATK_ROLE_FOOTER,              // roles::FOOTER               97
+    ATK_ROLE_PARAGRAPH,           // roles::PARAGRAPH            98
+    ATK_ROLE_RULER,               // roles::RULER                99
+    ATK_ROLE_AUTOCOMPLETE,        // roles::AUTOCOMPLETE         100
+    ATK_ROLE_EDITBAR,             // roles::EDITBAR              101
+    ATK_ROLE_ENTRY,               // roles::ENTRY                102
+    ATK_ROLE_CAPTION,             // roles::CAPTION              103
+    ATK_ROLE_DOCUMENT_FRAME,      // roles::DOCUMENT_FRAME       104
+    ATK_ROLE_HEADING,             // roles::HEADING              105
+    ATK_ROLE_PAGE,                // roles::PAGE                 106
+    ATK_ROLE_SECTION,             // roles::SECTION              107
+    ATK_ROLE_REDUNDANT_OBJECT,    // roles::REDUNDANT_OBJECT     108
+    ATK_ROLE_FORM,                // roles::FORM                 109
+    ATK_ROLE_INPUT_METHOD_WINDOW, // roles::IME                  110
+    ATK_ROLE_APPLICATION,         // roles::APP_ROOT             111
+    ATK_ROLE_MENU,                // roles::PARENT_MENUITEM      112
+    ATK_ROLE_CALENDAR,            // roles::CALENDAR             113
+    ATK_ROLE_MENU,                // roles::COMBOBOX_LIST        114
+    ATK_ROLE_MENU_ITEM,           // roles::COMBOBOX_OPTION      115
+    ATK_ROLE_IMAGE,               // roles::IMAGE_MAP            116
+    ATK_ROLE_LIST_ITEM,           // roles::OPTION               117
+    ATK_ROLE_LIST_ITEM,           // roles::RICH_OPTION          118
+    ATK_ROLE_LIST,                // roles::LISTBOX              119
+    ATK_ROLE_UNKNOWN,             // roles::FLAT_EQUATION        120
+    ATK_ROLE_TABLE_CELL,          // roles::GRID_CELL            121
+    ATK_ROLE_PANEL,               // roles::EMBEDDED_OBJECT      122
+    ATK_ROLE_SECTION,             // roles::NOTE                 123
+    ATK_ROLE_PANEL,               // roles::FIGURE               124
+    kROLE_ATK_LAST_ENTRY          // roles::LAST_ENTRY
 };
 
--- a/accessible/src/base/AccGroupInfo.cpp
+++ b/accessible/src/base/AccGroupInfo.cpp
@@ -32,21 +32,22 @@
  * 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 "AccGroupInfo.h"
 
+#include "Role.h"
 #include "States.h"
 
 using namespace mozilla::a11y;
 
-AccGroupInfo::AccGroupInfo(nsAccessible* aItem, PRUint32 aRole) :
+AccGroupInfo::AccGroupInfo(nsAccessible* aItem, role aRole) :
   mPosInSet(0), mSetSize(0), mParent(nsnull)
 {
   MOZ_COUNT_CTOR(AccGroupInfo);
   nsAccessible* parent = aItem->Parent();
   if (!parent)
     return;
 
   PRInt32 indexInParent = aItem->IndexInParent();
@@ -57,20 +58,20 @@ AccGroupInfo::AccGroupInfo(nsAccessible*
   }
 
   PRInt32 level = nsAccUtils::GetARIAOrDefaultLevel(aItem);
 
   // Compute position in set.
   mPosInSet = 1;
   for (PRInt32 idx = indexInParent - 1; idx >=0 ; idx--) {
     nsAccessible* sibling = parent->GetChildAt(idx);
-    PRUint32 siblingRole = sibling->Role();
+    roles::Role siblingRole = sibling->Role();
 
     // If the sibling is separator then the group is ended.
-    if (siblingRole == nsIAccessibleRole::ROLE_SEPARATOR)
+    if (siblingRole == roles::SEPARATOR)
       break;
 
     // If sibling is not visible and hasn't the same base role.
     if (BaseRole(siblingRole) != aRole || sibling->State() & states::INVISIBLE)
       continue;
 
     // Check if it's hierarchical flatten structure, i.e. if the sibling
     // level is lesser than this one then group is ended, if the sibling level
@@ -99,20 +100,20 @@ AccGroupInfo::AccGroupInfo(nsAccessible*
   }
 
   // Compute set size.
   mSetSize = mPosInSet;
 
   for (PRInt32 idx = indexInParent + 1; idx < siblingCount; idx++) {
     nsAccessible* sibling = parent->GetChildAt(idx);
 
-    PRUint32 siblingRole = sibling->Role();
+    roles::Role siblingRole = sibling->Role();
 
     // If the sibling is separator then the group is ended.
-    if (siblingRole == nsIAccessibleRole::ROLE_SEPARATOR)
+    if (siblingRole == roles::SEPARATOR)
       break;
 
     // If sibling is visible and has the same base role
     if (BaseRole(siblingRole) != aRole || sibling->State() & states::INVISIBLE)
       continue;
 
     // and check if it's hierarchical flatten structure.
     PRInt32 siblingLevel = nsAccUtils::GetARIAOrDefaultLevel(sibling);
@@ -132,74 +133,65 @@ AccGroupInfo::AccGroupInfo(nsAccessible*
     }
 
     mSetSize++;
   }
 
   if (mParent)
     return;
 
-  PRUint32 parentRole = parent->Role();
+  roles::Role parentRole = parent->Role();
   if (IsConceptualParent(aRole, parentRole))
     mParent = parent;
 
   // In the case of ARIA tree (not ARIA treegrid) a tree can be arranged by
   // using ARIA groups to organize levels. In this case the parent of the tree
   // item will be a group and the previous treeitem of that should be the tree
   // item parent.
-  if (parentRole != nsIAccessibleRole::ROLE_GROUPING ||
-      aRole != nsIAccessibleRole::ROLE_OUTLINEITEM)
+  if (parentRole != roles::GROUPING || aRole != roles::OUTLINEITEM)
     return;
 
   nsAccessible* parentPrevSibling = parent->PrevSibling();
   if (!parentPrevSibling)
     return;
 
-  PRUint32 parentPrevSiblingRole = parentPrevSibling->Role();
-  if (parentPrevSiblingRole == nsIAccessibleRole::ROLE_TEXT_LEAF) {
+  roles::Role parentPrevSiblingRole = parentPrevSibling->Role();
+  if (parentPrevSiblingRole == roles::TEXT_LEAF) {
     // XXX Sometimes an empty text accessible is in the hierarchy here,
     // although the text does not appear to be rendered, GetRenderedText()
     // says that it is so we need to skip past it to find the true
     // previous sibling.
     parentPrevSibling = parentPrevSibling->PrevSibling();
     if (parentPrevSibling)
       parentPrevSiblingRole = parentPrevSibling->Role();
   }
 
   // Previous sibling of parent group is a tree item, this is the
   // conceptual tree item parent.
-  if (parentPrevSiblingRole == nsIAccessibleRole::ROLE_OUTLINEITEM)
+  if (parentPrevSiblingRole == roles::OUTLINEITEM)
     mParent = parentPrevSibling;
 }
 
 bool
-AccGroupInfo::IsConceptualParent(PRUint32 aRole, PRUint32 aParentRole)
+AccGroupInfo::IsConceptualParent(role aRole, role aParentRole)
 {
-  if (aParentRole == nsIAccessibleRole::ROLE_OUTLINE &&
-      aRole == nsIAccessibleRole::ROLE_OUTLINEITEM)
+  if (aParentRole == roles::OUTLINE && aRole == roles::OUTLINEITEM)
     return true;
-  if ((aParentRole == nsIAccessibleRole::ROLE_TABLE ||
-       aParentRole == nsIAccessibleRole::ROLE_TREE_TABLE) &&
-      aRole == nsIAccessibleRole::ROLE_ROW)
+  if ((aParentRole == roles::TABLE || aParentRole == roles::TREE_TABLE) &&
+      aRole == roles::ROW)
     return true;
-  if (aParentRole == nsIAccessibleRole::ROLE_ROW &&
-      (aRole == nsIAccessibleRole::ROLE_CELL ||
-       aRole == nsIAccessibleRole::ROLE_GRID_CELL))
+  if (aParentRole == roles::ROW &&
+      (aRole == roles::CELL || aRole == roles::GRID_CELL))
     return true;
-  if (aParentRole == nsIAccessibleRole::ROLE_LIST &&
-      aRole == nsIAccessibleRole::ROLE_LISTITEM)
+  if (aParentRole == roles::LIST && aRole == roles::LISTITEM)
     return true;
-  if (aParentRole == nsIAccessibleRole::ROLE_COMBOBOX_LIST &&
-      aRole == nsIAccessibleRole::ROLE_COMBOBOX_OPTION)
+  if (aParentRole == roles::COMBOBOX_LIST && aRole == roles::COMBOBOX_OPTION)
     return true;
-  if (aParentRole == nsIAccessibleRole::ROLE_LISTBOX &&
-      aRole == nsIAccessibleRole::ROLE_OPTION)
+  if (aParentRole == roles::LISTBOX && aRole == roles::OPTION)
     return true;
-  if (aParentRole == nsIAccessibleRole::ROLE_PAGETABLIST &&
-      aRole == nsIAccessibleRole::ROLE_PAGETAB)
+  if (aParentRole == roles::PAGETABLIST && aRole == roles::PAGETAB)
     return true;
-  if ((aParentRole == nsIAccessibleRole::ROLE_POPUP_MENU ||
-       aParentRole == nsIAccessibleRole::ROLE_MENUPOPUP) &&
-      aRole == nsIAccessibleRole::ROLE_MENUITEM)
+  if ((aParentRole == roles::POPUP_MENU || aParentRole == roles::MENUPOPUP) &&
+      aRole == roles::MENUITEM)
     return true;
 
   return false;
 }
--- a/accessible/src/base/AccGroupInfo.h
+++ b/accessible/src/base/AccGroupInfo.h
@@ -42,61 +42,62 @@
 #include "nsAccUtils.h"
 
 /**
  * Calculate and store group information.
  */
 class AccGroupInfo
 {
 public:
-  AccGroupInfo(nsAccessible* aItem, PRUint32 aRole);
+  AccGroupInfo(nsAccessible* aItem, mozilla::a11y::role aRole);
   ~AccGroupInfo() { MOZ_COUNT_DTOR(AccGroupInfo); }
 
   PRInt32 PosInSet() const { return mPosInSet; }
   PRUint32 SetSize() const { return mSetSize; }
   nsAccessible* ConceptualParent() const { return mParent; }
 
   /**
    * Create group info.
    */
   static AccGroupInfo* CreateGroupInfo(nsAccessible* aAccessible)
   {
-    PRUint32 role = aAccessible->Role();
-    if (role != nsIAccessibleRole::ROLE_ROW &&
-        role != nsIAccessibleRole::ROLE_GRID_CELL &&
-        role != nsIAccessibleRole::ROLE_OUTLINEITEM &&
-        role != nsIAccessibleRole::ROLE_OPTION &&
-        role != nsIAccessibleRole::ROLE_LISTITEM &&
-        role != nsIAccessibleRole::ROLE_MENUITEM &&
-        role != nsIAccessibleRole::ROLE_CHECK_MENU_ITEM &&
-        role != nsIAccessibleRole::ROLE_RADIO_MENU_ITEM &&
-        role != nsIAccessibleRole::ROLE_RADIOBUTTON &&
-        role != nsIAccessibleRole::ROLE_PAGETAB)
+    mozilla::a11y::role role = aAccessible->Role();
+    if (role != mozilla::a11y::roles::ROW &&
+        role != mozilla::a11y::roles::GRID_CELL &&
+        role != mozilla::a11y::roles::OUTLINEITEM &&
+        role != mozilla::a11y::roles::OPTION &&
+        role != mozilla::a11y::roles::LISTITEM &&
+        role != mozilla::a11y::roles::MENUITEM &&
+        role != mozilla::a11y::roles::CHECK_MENU_ITEM &&
+        role != mozilla::a11y::roles::RADIO_MENU_ITEM &&
+        role != mozilla::a11y::roles::RADIOBUTTON &&
+        role != mozilla::a11y::roles::PAGETAB)
       return nsnull;
 
     AccGroupInfo* info = new AccGroupInfo(aAccessible, BaseRole(role));
     return info;
   }
 
 private:
   AccGroupInfo(const AccGroupInfo&);
   AccGroupInfo& operator =(const AccGroupInfo&);
 
-  static PRUint32 BaseRole(PRUint32 aRole)
+  static mozilla::a11y::role BaseRole(mozilla::a11y::role aRole)
   {
-    if (aRole == nsIAccessibleRole::ROLE_CHECK_MENU_ITEM ||
-        aRole == nsIAccessibleRole::ROLE_RADIO_MENU_ITEM)
-      return nsIAccessibleRole::ROLE_MENUITEM;
+    if (aRole == mozilla::a11y::roles::CHECK_MENU_ITEM ||
+        aRole == mozilla::a11y::roles::RADIO_MENU_ITEM)
+      return mozilla::a11y::roles::MENUITEM;
     return aRole;
   }
 
   /**
    * Return true if the given parent role is conceptual parent of the given
    * role.
    */
-  static bool IsConceptualParent(PRUint32 aRole, PRUint32 aParentRole);
+  static bool IsConceptualParent(mozilla::a11y::role aRole,
+				 mozilla::a11y::role aParentRole);
 
   PRUint32 mPosInSet;
   PRUint32 mSetSize;
   nsAccessible* mParent;
 };
 
 #endif
--- a/accessible/src/base/FocusManager.cpp
+++ b/accessible/src/base/FocusManager.cpp
@@ -35,16 +35,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "FocusManager.h"
 
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "nsRootAccessible.h"
+#include "Role.h"
 
 #include "nsEventStateManager.h"
 #include "nsFocusManager.h"
 
 namespace dom = mozilla::dom;
 using namespace mozilla::a11y;
 
 FocusManager::FocusManager()
@@ -291,20 +292,20 @@ FocusManager::ProcessFocusEvent(AccEvent
     nsAccessible* activeItem = target->CurrentItem();
     if (activeItem) {
       mActiveItem = activeItem;
       target = activeItem;
     }
   }
 
   // Fire menu start/end events for ARIA menus.
-  if (target->ARIARole() == nsIAccessibleRole::ROLE_MENUITEM) {
+  if (target->ARIARole() == roles::MENUITEM) {
     // The focus was moved into menu.
     nsAccessible* ARIAMenubar =
-      nsAccUtils::GetAncestorWithRole(target, nsIAccessibleRole::ROLE_MENUBAR);
+      nsAccUtils::GetAncestorWithRole(target, roles::MENUBAR);
 
     if (ARIAMenubar != mActiveARIAMenubar) {
       // Leaving ARIA menu. Fire menu_end event on current menubar.
       if (mActiveARIAMenubar) {
         nsRefPtr<AccEvent> menuEndEvent =
           new AccEvent(nsIAccessibleEvent::EVENT_MENU_END, mActiveARIAMenubar,
                        fromUserInputFlag);
         nsEventShell::FireEvent(menuEndEvent);
--- a/accessible/src/base/Makefile.in
+++ b/accessible/src/base/Makefile.in
@@ -87,16 +87,17 @@ EXPORTS = \
   nsARIAMap.h \
   $(NULL)
 
 EXPORTS_NAMESPACES = mozilla/a11y
 
 EXPORTS_mozilla/a11y = \
   FocusManager.h \
   States.h \
+  Role.h \
   $(NULL)
 
 # we don't want the shared lib, but we want to force the creation of a static lib.
 FORCE_STATIC_LIB = 1
 
 include $(topsrcdir)/config/rules.mk
 
 LOCAL_INCLUDES += \
--- a/accessible/src/base/NotificationController.cpp
+++ b/accessible/src/base/NotificationController.cpp
@@ -40,16 +40,17 @@
 
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "nsCoreUtils.h"
 #include "nsDocAccessible.h"
 #include "nsEventShell.h"
 #include "nsTextAccessible.h"
 #include "FocusManager.h"
+#include "Role.h"
 #include "TextUpdater.h"
 
 #include "mozilla/dom/Element.h"
 
 using namespace mozilla::a11y;
 
 // Defines the number of selection add/remove events in the queue when they
 // aren't packed into single selection within event.
@@ -674,17 +675,17 @@ NotificationController::CreateTextChange
   if (!container)
     return;
 
   nsHyperTextAccessible* textAccessible = container->AsHyperText();
   if (!textAccessible)
     return;
 
   // Don't fire event for the first html:br in an editor.
-  if (aEvent->mAccessible->Role() == nsIAccessibleRole::ROLE_WHITESPACE) {
+  if (aEvent->mAccessible->Role() == roles::WHITESPACE) {
     nsCOMPtr<nsIEditor> editor;
     textAccessible->GetAssociatedEditor(getter_AddRefs(editor));
     if (editor) {
       bool isEmpty = false;
       editor->GetDocumentIsEmpty(&isEmpty);
       if (isEmpty)
         return;
     }
new file mode 100644
--- /dev/null
+++ b/accessible/src/base/Role.h
@@ -0,0 +1,803 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=2 et sw=2 tw=80: */
+/* ***** 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 Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2011
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Jignesh Kakadiya <jigneshhk1992@gmail.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 ***** */
+
+#ifndef _role_h_
+#define _role_h_
+
+namespace mozilla {
+namespace a11y {
+namespace roles {
+  enum Role {
+  /**
+   * Used when accessible hans't strong defined role.
+   */
+  NOTHING = 0,
+
+  /**
+   * Represents a title or caption bar for a window. It is used by MSAA only,
+   * supported automatically by MS Windows.
+   */
+  TITLEBAR = 1,
+
+  /**
+   * Represents the menu bar (positioned beneath the title bar of a window)
+   * from which menus are selected by the user. The role is used by
+   * xul:menubar or role="menubar".
+   */
+  MENUBAR = 2,
+
+  /**
+   * Represents a vertical or horizontal scroll bar, which is part of the client
+   * area or used in a control.
+   */
+  SCROLLBAR = 3,
+
+  /**
+   * Represents a special mouse pointer, which allows a user to manipulate user
+   * interface elements such as windows. For example, a user clicks and drags
+   * a sizing grip in the lower-right corner of a window to resize it.
+   */
+  GRIP = 4,
+
+  /**
+   * Represents a system sound, which is associated with various system events.
+   */
+  SOUND = 5,
+
+  /**
+   * Represents the system mouse pointer.
+   */
+  CURSOR = 6,
+
+  /**
+   * Represents the system caret. The role is supported for caret.
+   */
+  CARET = 7,
+
+  /**
+   * Represents an alert or a condition that a user should be notified about.
+   * Assistive Technologies typically respond to the role by reading the entire
+   * onscreen contents of containers advertising this role. Should be used for
+   * warning dialogs, etc. The role is used by xul:browsermessage,
+   * role="alert", xforms:message.
+   */
+  ALERT = 8,
+
+  /**
+   * Represents the window frame, which contains child objects such as
+   * a title bar, client, and other objects contained in a window. The role
+   * is supported automatically by MS Windows.
+   */
+  WINDOW = 9,
+
+  /**
+   * A sub-document (<frame> or <iframe>)
+   */
+  INTERNAL_FRAME = 10,
+
+  /**
+   * Represents a menu, which presents a list of options from which the user can
+   * make a selection to perform an action. It is used for role="menu".
+   */
+  MENUPOPUP = 11,
+
+  /**
+   * Represents a menu item, which is an entry in a menu that a user can choose
+   * to carry out a command, select an option. It is used for xul:menuitem,
+   * role="menuitem".
+   */
+  MENUITEM = 12,
+
+  /**
+   * Represents a ToolTip that provides helpful hints.
+   */
+  TOOLTIP = 13,
+
+  /**
+   * Represents a main window for an application. It is used for
+   * role="application". Also refer to APP_ROOT
+   */
+  APPLICATION = 14,
+
+  /**
+   * Represents a document window. A document window is always contained within
+   * an application window. It is used for role="document".
+   */
+  DOCUMENT = 15,
+
+  /**
+   * Represents a pane within a frame or document window. Users can navigate
+   * between panes and within the contents of the current pane, but cannot
+   * navigate between items in different panes. Thus, panes represent a level
+   * of grouping lower than frame windows or documents, but above individual
+   * controls. It is used for the first child of a <frame> or <iframe>.
+   */
+  PANE = 16,
+
+  /**
+   * Represents a graphical image used to represent data.
+   */
+  CHART = 17,
+
+  /**
+   * Represents a dialog box or message box. It is used for xul:dialog, 
+   * role="dialog".
+   */
+  DIALOG = 18,
+
+  /**
+   * Represents a window border.
+   */
+  BORDER = 19,
+
+  /**
+   * Logically groups other objects. There is not always a parent-child
+   * relationship between the grouping object and the objects it contains. It
+   * is used for html:textfield, xul:groupbox, role="group".
+   */
+  GROUPING = 20,
+
+  /**
+   * Used to visually divide a space into two regions, such as a separator menu
+   * item or a bar that divides split panes within a window. It is used for
+   * xul:separator, html:hr, role="separator".
+   */
+  SEPARATOR = 21,
+
+  /**
+   * Represents a toolbar, which is a grouping of controls (push buttons or
+   * toggle buttons) that provides easy access to frequently used features. It
+   * is used for xul:toolbar, role="toolbar".
+   */
+  TOOLBAR = 22,
+
+  /**
+   * Represents a status bar, which is an area at the bottom of a window that
+   * displays information about the current operation, state of the application,
+   * or selected object. The status bar has multiple fields, which display
+   * different kinds of information. It is used for xul:statusbar.
+   */
+  STATUSBAR = 23,
+
+  /**
+   * Represents a table that contains rows and columns of cells, and optionally,
+   * row headers and column headers. It is used for html:table,
+   * role="grid". Also refer to the following role: COLUMNHEADER,
+   * ROWHEADER, COLUMN, ROW, CELL.
+   */
+  TABLE = 24,
+
+  /**
+   * Represents a column header, providing a visual label for a column in
+   * a table. It is used for XUL tree column headers, html:th,
+   * role="colheader". Also refer to TABLE.
+   */
+  COLUMNHEADER = 25,
+
+  /**
+   * Represents a row header, which provides a visual label for a table row.
+   * It is used for role="rowheader". Also, see TABLE.
+   */
+  ROWHEADER = 26,
+
+  /**
+   * Represents a column of cells within a table. Also, see TABLE.
+   */
+  COLUMN = 27,
+
+  /**
+   * Represents a row of cells within a table. Also, see TABLE.
+   */
+  ROW = 28,
+
+  /**
+   * Represents a cell within a table. It is used for html:td,
+   * xul:tree cell and xul:listcell. Also, see TABLE.
+   */
+  CELL = 29,
+
+  /**
+   * Represents a link to something else. This object might look like text or
+   * a graphic, but it acts like a button. It is used for
+   * xul:label@class="text-link", html:a, html:area,
+   * xforms:trigger@appearance="minimal".
+   */
+  LINK = 30,
+
+  /**
+   * Displays a Help topic in the form of a ToolTip or Help balloon.
+   */
+  HELPBALLOON = 31,
+
+  /**
+   * Represents a cartoon-like graphic object, such as Microsoft Office
+   * Assistant, which is displayed to provide help to users of an application.
+   */
+  CHARACTER = 32,
+
+  /**
+   * Represents a list box, allowing the user to select one or more items. It
+   * is used for xul:listbox, html:select@size, role="list". See also
+   * LIST_ITEM.
+   */
+  LIST = 33,
+
+  /**
+   * Represents an item in a list. See also LIST.
+   */
+  LISTITEM = 34,
+
+  /**
+   * Represents an outline or tree structure, such as a tree view control,
+   * that displays a hierarchical list and allows the user to expand and
+   * collapse branches. Is is used for role="tree".
+   */
+  OUTLINE = 35,
+
+  /**
+   * Represents an item in an outline or tree structure. It is used for
+   * role="treeitem".
+   */
+  OUTLINEITEM = 36,
+
+  /**
+   * Represents a page tab, it is a child of a page tab list. It is used for
+   * xul:tab, role="treeitem". Also refer to PAGETABLIST.
+   */
+  PAGETAB = 37,
+
+  /**
+   * Represents a property sheet. It is used for xul:tabpanel,
+   * role="tabpanel".
+   */
+  PROPERTYPAGE = 38,
+
+  /**
+   * Represents an indicator, such as a pointer graphic, that points to the
+   * current item.
+   */
+  INDICATOR = 39,
+
+  /**
+   * Represents a picture. Is is used for xul:image, html:img.
+   */
+  GRAPHIC = 40,
+
+  /**
+   * Represents read-only text, such as labels for other controls or
+   * instructions in a dialog box. Static text cannot be modified or selected.
+   * Is is used for xul:label, xul:description, html:label, role="label",
+   * or xforms:output.
+   */
+  STATICTEXT = 41,
+
+  /**
+   * Represents selectable text that allows edits or is designated read-only.
+   */
+  TEXT_LEAF = 42,
+
+  /**
+   * Represents a push button control. It is used for xul:button, html:button,
+   * role="button", xforms:trigger, xforms:submit.
+   */
+  PUSHBUTTON = 43,
+
+  /**
+   * Represents a check box control. It is used for xul:checkbox,
+   * html:input@type="checkbox", role="checkbox", boolean xforms:input.
+   */
+  CHECKBUTTON = 44,
+  
+  /**
+   * Represents an option button, also called a radio button. It is one of a
+   * group of mutually exclusive options. All objects sharing a single parent
+   * that have this attribute are assumed to be part of single mutually
+   * exclusive group. It is used for xul:radio, html:input@type="radio",
+   * role="radio".
+   */
+  RADIOBUTTON = 45,
+  
+  /**
+   * Represents a combo box; an edit control with an associated list box that
+   * provides a set of predefined choices. It is used for html:select,
+   * xul:menulist, role="combobox".
+   */
+  COMBOBOX = 46,
+
+  /**
+   * Represents the calendar control. It is used for date xforms:input.
+   */
+  DROPLIST = 47,
+
+  /**
+   * Represents a progress bar, dynamically showing the user the percent
+   * complete of an operation in progress. It is used for xul:progressmeter,
+   * role="progressbar".
+   */
+  PROGRESSBAR = 48,
+
+  /**
+   * Represents a dial or knob whose purpose is to allow a user to set a value.
+   */
+  DIAL = 49,
+
+  /**
+   * Represents a hot-key field that allows the user to enter a combination or
+   * sequence of keystrokes.
+   */
+  HOTKEYFIELD = 50,
+
+  /**
+   * Represents a slider, which allows the user to adjust a setting in given
+   * increments between minimum and maximum values. It is used by xul:scale,
+   * role="slider", xforms:range.
+   */
+  SLIDER = 51,
+
+  /**
+   * Represents a spin box, which is a control that allows the user to increment
+   * or decrement the value displayed in a separate "buddy" control associated
+   * with the spin box. It is used for xul:spinbuttons.
+   */
+  SPINBUTTON = 52,
+
+  /**
+   * Represents a graphical image used to diagram data. It is used for svg:svg.
+   */
+  DIAGRAM = 53,
+  
+  /**
+   * Represents an animation control, which contains content that changes over
+   * time, such as a control that displays a series of bitmap frames.
+   */
+  ANIMATION = 54,
+
+  /**
+   * Represents a mathematical equation. It is used by MATHML, where there is a
+   * rich DOM subtree for an equation. Use FLAT_EQUATION for <img role="math" alt="[TeX]"/>
+   */
+  EQUATION = 55,
+
+  /**
+   * Represents a button that drops down a list of items.
+   */
+  BUTTONDROPDOWN = 56,
+
+  /**
+   * Represents a button that drops down a menu.
+   */
+  BUTTONMENU = 57,
+
+  /**
+   * Represents a button that drops down a grid. It is used for xul:colorpicker.
+   */
+  BUTTONDROPDOWNGRID = 58,
+
+  /**
+   * Represents blank space between other objects.
+   */
+  WHITESPACE = 59,
+
+  /**
+   * Represents a container of page tab controls. Is it used for xul:tabs,
+   * DHTML: role="tabs". Also refer to PAGETAB.
+   */
+  PAGETABLIST = 60,
+
+  /**
+   * Represents a control that displays time.
+   */
+  CLOCK = 61,
+
+  /**
+   * Represents a button on a toolbar that has a drop-down list icon directly
+   * adjacent to the button.
+   */
+  SPLITBUTTON = 62,
+
+  /**
+   * Represents an edit control designed for an Internet Protocol (IP) address.
+   * The edit control is divided into sections for the different parts of the
+   * IP address.
+   */
+  IPADDRESS = 63,
+
+  /**
+   * Represents a label control that has an accelerator.
+   */
+  ACCEL_LABEL = 64,
+
+  /**
+   * Represents an arrow in one of the four cardinal directions.
+   */
+  ARROW  = 65,
+
+  /**
+   * Represents a control that can be drawn into and is used to trap events.
+   * It is used for html:canvas.
+   */
+  CANVAS = 66,
+
+  /**
+   * Represents a menu item with a check box.
+   */
+  CHECK_MENU_ITEM = 67,
+
+  /**
+   * Represents a specialized dialog that lets the user choose a color.
+   */
+  COLOR_CHOOSER  = 68,
+
+  /**
+   * Represents control whose purpose is to allow a user to edit a date.
+   */
+  DATE_EDITOR = 69,
+
+  /**
+   * An iconified internal frame in an DESKTOP_PANE. Also refer to
+   * INTERNAL_FRAME.
+   */
+  DESKTOP_ICON = 70,
+
+  /**
+   * A desktop pane. A pane that supports internal frames and iconified
+   * versions of those internal frames.
+   */
+  DESKTOP_FRAME = 71,
+
+  /**
+   * A directory pane. A pane that allows the user to navigate through
+   * and select the contents of a directory. May be used by a file chooser.
+   * Also refer to FILE_CHOOSER.
+   */
+  DIRECTORY_PANE = 72,
+
+  /**
+   * A file chooser. A specialized dialog that displays the files in the
+   * directory and lets the user select a file, browse a different directory,
+   * or specify a filename. May use the directory pane to show the contents of
+   * a directory. Also refer to DIRECTORY_PANE.
+   */
+  FILE_CHOOSER = 73,
+
+  /**
+   * A font chooser. A font chooser is a component that lets the user pick
+   * various attributes for fonts.
+   */
+  FONT_CHOOSER = 74,
+
+  /**
+   * Frame role. A top level window with a title bar, border, menu bar, etc.
+   * It is often used as the primary window for an application.
+   */
+  CHROME_WINDOW = 75,
+
+  /**
+   *  A glass pane. A pane that is guaranteed to be painted on top of all
+   * panes beneath it. Also refer to ROOT_PANE.
+   */
+  GLASS_PANE = 76,
+
+  /**
+   * A document container for HTML, whose children represent the document
+   * content.
+   */
+  HTML_CONTAINER = 77,
+
+  /**
+   * A small fixed size picture, typically used to decorate components.
+   */
+  ICON = 78,
+
+  /**
+   * Presents an icon or short string in an interface.
+   */
+  LABEL = 79,
+
+  /**
+   * A layered pane. A specialized pane that allows its children to be drawn
+   * in layers, providing a form of stacking order. This is usually the pane
+   * that holds the menu bar as  well as the pane that contains most of the
+   * visual components in a window. Also refer to GLASS_PANE and
+   * ROOT_PANE.
+   */
+  LAYERED_PANE = 80,
+
+  /**
+   * A specialized pane whose primary use is inside a dialog.
+   */
+  OPTION_PANE = 81,
+
+  /**
+   * A text object uses for passwords, or other places where the text content
+   * is not shown visibly to the user.
+   */
+  PASSWORD_TEXT = 82,
+
+  /**
+   * A temporary window that is usually used to offer the user a list of
+   * choices, and then hides when the user selects one of those choices.
+   */
+  POPUP_MENU = 83,
+
+  /**
+   * A radio button that is a menu item.
+   */
+  RADIO_MENU_ITEM = 84,
+
+  /**
+   * A root pane. A specialized pane that has a glass pane and a layered pane
+   * as its children. Also refer to GLASS_PANE and LAYERED_PANE.
+   */
+  ROOT_PANE = 85,
+
+  /**
+   * A scroll pane. An object that allows a user to incrementally view a large
+   * amount of information.  Its children can include scroll bars and a
+   * viewport. Also refer to VIEW_PORT.
+   */
+  SCROLL_PANE = 86,
+
+  /**
+   * A split pane. A specialized panel that presents two other panels at the
+   * same time. Between the two panels is a divider the user can manipulate to
+   * make one panel larger and the other panel smaller.
+   */
+  SPLIT_PANE = 87,
+
+  /**
+   * The header for a column of a table.
+   * XXX: it looks this role is dupe of COLUMNHEADER.
+   */
+  TABLE_COLUMN_HEADER = 88,
+
+  /**
+   * The header for a row of a table.
+   * XXX: it looks this role is dupe of ROWHEADER
+   */
+  TABLE_ROW_HEADER = 89,
+
+  /**
+   * A menu item used to tear off and reattach its menu.
+   */
+  TEAR_OFF_MENU_ITEM = 90,
+
+  /**
+   * Represents an accessible terminal.
+   */
+  TERMINAL = 91,
+
+  /**
+   * Collection of objects that constitute a logical text entity.
+   */
+  TEXT_CONTAINER = 92,
+
+  /**
+   * A toggle button. A specialized push button that can be checked or
+   * unchecked, but does not provide a separate indicator for the current state.
+   */
+  TOGGLE_BUTTON = 93,
+
+  /**
+   * Representas a control that is capable of expanding and collapsing rows as
+   * well as showing multiple columns of data.
+   * XXX: it looks like this role is dupe of OUTLINE.
+   */
+  TREE_TABLE = 94,
+
+  /**
+   * A viewport. An object usually used in a scroll pane. It represents the
+   * portion of the entire data that the user can see. As the user manipulates
+   * the scroll bars, the contents of the viewport can change. Also refer to
+   * SCROLL_PANE.
+   */
+  VIEWPORT = 95,
+
+  /**
+   * Header of a document page. Also refer to FOOTER.
+   */
+  HEADER = 96,
+
+  /**
+   * Footer of a document page. Also refer to HEADER.
+   */
+  FOOTER = 97,
+
+  /**
+   * A paragraph of text.
+   */
+  PARAGRAPH = 98,
+
+  /**
+   * A ruler such as those used in word processors.
+   */
+  RULER = 99,
+
+  /**
+   * A text entry having dialog or list containing items for insertion into
+   * an entry widget, for instance a list of words for completion of a
+   * text entry. It is used for xul:textbox@autocomplete
+   */
+  AUTOCOMPLETE = 100,
+
+  /**
+   *  An editable text object in a toolbar.
+   */
+  EDITBAR = 101,
+
+  /**
+   * An control whose textual content may be entered or modified by the user.
+   */
+  ENTRY = 102,
+
+  /**
+   * A caption describing another object.
+   */
+  CAPTION = 103,
+
+  /**
+   * A visual frame or container which contains a view of document content.
+   * Document frames may occur within another Document instance, in which case
+   * the second document may be said to be embedded in the containing instance.
+   * HTML frames are often DOCUMENT_FRAME. Either this object, or a
+   * singleton descendant, should implement the Document interface.
+   */
+  DOCUMENT_FRAME = 104,
+
+  /**
+   * Heading.
+   */
+  HEADING = 105,
+
+  /**
+   * An object representing a page of document content.  It is used in documents
+   * which are accessed by the user on a page by page basis.
+   */
+  PAGE = 106,
+
+  /**
+   * A container of document content.  An example of the use of this role is to
+   * represent an html:div.
+   */
+  SECTION = 107,
+
+  /**
+   * An object which is redundant with another object in the accessible
+   * hierarchy. ATs typically ignore objects with this role.
+   */
+  REDUNDANT_OBJECT = 108,
+
+  /**
+   * A container of form controls. An example of the use of this role is to
+   * represent an html:form.
+   */
+  FORM = 109,
+
+  /**
+   * An object which is used to allow input of characters not found on a
+   * keyboard, such as the input of Chinese characters on a Western keyboard.
+   */
+  IME = 110,
+
+  /**
+   * XXX: document this.
+   */
+  APP_ROOT = 111,
+
+  /**
+   * Represents a menu item, which is an entry in a menu that a user can choose
+   * to display another menu.
+   */
+  PARENT_MENUITEM = 112,
+
+  /**
+   * A calendar that allows the user to select a date.
+   */
+  CALENDAR = 113,
+
+  /**
+   * A list of items that is shown by combobox.
+   */
+  COMBOBOX_LIST = 114,
+
+  /**
+   * A item of list that is shown by combobox.
+   */
+  COMBOBOX_OPTION = 115,
+
+  /**
+   * An image map -- has child links representing the areas
+   */
+  IMAGE_MAP = 116,
+  
+  /**
+   * An option in a listbox
+   */
+  OPTION = 117,
+  
+  /**
+   * A rich option in a listbox, it can have other widgets as children
+   */
+  RICH_OPTION = 118,
+  
+  /**
+   * A list of options
+   */
+  LISTBOX = 119,
+
+  /**
+   * Represents a mathematical equation in the accessible name
+   */
+  FLAT_EQUATION = 120,
+  
+  /**
+   * Represents a cell within a grid. It is used for role="gridcell". Unlike
+   * CELL, it allows the calculation of the accessible name from subtree.
+   * Also, see TABLE.
+   */
+  GRID_CELL = 121,
+
+  /**
+   * Represents an embedded object. It is used for html:object or html:embed.
+   */
+  EMBEDDED_OBJECT = 122,
+
+  /**
+   * A note. Originally intended to be hidden until activated, but now also used
+   * for things like html 'aside'.
+   */
+  NOTE = 123,
+
+  /**
+   * A figure. Used for things like HTML5 figure element.
+   */
+  FIGURE = 124,
+
+  /**
+   * It's not role actually. This constant is important to help ensure
+   * nsRoleMap's are synchronized.
+   */
+  LAST_ENTRY = 125
+  };
+} // namespace role
+typedef enum mozilla::a11y::roles::Role role;
+} // namespace a11y
+} // namespace mozilla
+
+#endif
--- a/accessible/src/base/filters.cpp
+++ b/accessible/src/base/filters.cpp
@@ -34,16 +34,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "filters.h"
 
 #include "nsAccessible.h"
 #include "nsAccUtils.h"
+#include "Role.h"
 #include "States.h"
 
 using namespace mozilla::a11y;
 
 bool
 filters::GetSelected(nsAccessible* aAccessible)
 {
   return aAccessible->State() & states::SELECTED;
@@ -53,25 +54,24 @@ bool
 filters::GetSelectable(nsAccessible* aAccessible)
 {
   return aAccessible->State() & states::SELECTABLE;
 }
 
 bool
 filters::GetRow(nsAccessible* aAccessible)
 {
-  return aAccessible->Role() == nsIAccessibleRole::ROLE_ROW;
+  return aAccessible->Role() == roles::ROW;
 }
 
 bool
 filters::GetCell(nsAccessible* aAccessible)
 {
-  PRUint32 role = aAccessible->Role();
-  return role == nsIAccessibleRole::ROLE_GRID_CELL ||
-      role == nsIAccessibleRole::ROLE_ROWHEADER ||
-      role == nsIAccessibleRole::ROLE_COLUMNHEADER;
+  roles::Role role = aAccessible->Role();
+  return role == roles::GRID_CELL || role == roles::ROWHEADER ||
+      role == roles::COLUMNHEADER;
 }
 
 bool
 filters::GetEmbeddedObject(nsAccessible* aAccessible)
 {
   return nsAccUtils::IsEmbeddedObject(aAccessible);
 }
--- a/accessible/src/base/nsARIAGridAccessible.cpp
+++ b/accessible/src/base/nsARIAGridAccessible.cpp
@@ -35,16 +35,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsARIAGridAccessible.h"
 
 #include "AccIterator.h"
 #include "nsAccUtils.h"
+#include "Role.h"
 #include "States.h"
 
 #include "nsIMutableArray.h"
 #include "nsComponentManagerUtils.h"
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -808,40 +809,39 @@ nsARIAGridAccessible::SetARIASelected(ns
     return NS_OK;
 
   // If row or cell accessible was selected then we're able to not bother about
   // selection of its cells or its row because our algorithm is row oriented,
   // i.e. we check selection on row firstly and then on cells.
   if (aIsSelected)
     return NS_OK;
 
-  PRUint32 role = aAccessible->Role();
+  roles::Role role = aAccessible->Role();
 
   // If the given accessible is row that was unselected then remove
   // aria-selected from cell accessible.
-  if (role == nsIAccessibleRole::ROLE_ROW) {
+  if (role == roles::ROW) {
     AccIterator cellIter(aAccessible, filters::GetCell);
     nsAccessible *cell = nsnull;
 
     while ((cell = cellIter.Next())) {
       rv = SetARIASelected(cell, false, false);
       NS_ENSURE_SUCCESS(rv, rv);
     }
     return NS_OK;
   }
 
   // If the given accessible is cell that was unselected and its row is selected
   // then remove aria-selected from row and put aria-selected on
   // siblings cells.
-  if (role == nsIAccessibleRole::ROLE_GRID_CELL ||
-      role == nsIAccessibleRole::ROLE_ROWHEADER ||
-      role == nsIAccessibleRole::ROLE_COLUMNHEADER) {
+  if (role == roles::GRID_CELL || role == roles::ROWHEADER ||
+      role == roles::COLUMNHEADER) {
     nsAccessible* row = aAccessible->Parent();
 
-    if (row && row->Role() == nsIAccessibleRole::ROLE_ROW &&
+    if (row && row->Role() == roles::ROW &&
         nsAccUtils::IsARIASelected(row)) {
       rv = SetARIASelected(row, false, false);
       NS_ENSURE_SUCCESS(rv, rv);
 
       AccIterator cellIter(row, filters::GetCell);
       nsAccessible *cell = nsnull;
       while ((cell = cellIter.Next())) {
         if (cell != aAccessible) {
@@ -949,26 +949,25 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsARIAGridC
 
 NS_IMETHODIMP
 nsARIAGridCellAccessible::GetTable(nsIAccessibleTable **aTable)
 {
   NS_ENSURE_ARG_POINTER(aTable);
   *aTable = nsnull;
 
   nsAccessible* thisRow = Parent();
-  if (!thisRow || thisRow->Role() != nsIAccessibleRole::ROLE_ROW)
+  if (!thisRow || thisRow->Role() != roles::ROW)
     return NS_OK;
 
   nsAccessible* table = thisRow->Parent();
   if (!table)
     return NS_OK;
 
-  PRUint32 tableRole = table->Role();
-  if (tableRole != nsIAccessibleRole::ROLE_TABLE &&
-      tableRole != nsIAccessibleRole::ROLE_TREE_TABLE)
+  roles::Role tableRole = table->Role();
+  if (tableRole != roles::TABLE && tableRole != roles::TREE_TABLE)
     return NS_OK;
 
   CallQueryInterface(table, aTable);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsARIAGridCellAccessible::GetColumnIndex(PRInt32 *aColumnIndex)
@@ -983,20 +982,19 @@ nsARIAGridCellAccessible::GetColumnIndex
   if (!row)
     return NS_OK;
 
   *aColumnIndex = 0;
 
   PRInt32 indexInRow = IndexInParent();
   for (PRInt32 idx = 0; idx < indexInRow; idx++) {
     nsAccessible* cell = row->GetChildAt(idx);
-    PRUint32 role = cell->Role();
-    if (role == nsIAccessibleRole::ROLE_GRID_CELL ||
-        role == nsIAccessibleRole::ROLE_ROWHEADER ||
-        role == nsIAccessibleRole::ROLE_COLUMNHEADER)
+    roles::Role role = cell->Role();
+    if (role == roles::GRID_CELL || role == roles::ROWHEADER ||
+        role == roles::COLUMNHEADER)
       (*aColumnIndex)++;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsARIAGridCellAccessible::GetRowIndex(PRInt32 *aRowIndex)
@@ -1015,17 +1013,17 @@ nsARIAGridCellAccessible::GetRowIndex(PR
   if (!table)
     return NS_OK;
 
   *aRowIndex = 0;
 
   PRInt32 indexInTable = row->IndexInParent();
   for (PRInt32 idx = 0; idx < indexInTable; idx++) {
     row = table->GetChildAt(idx);
-    if (row->Role() == nsIAccessibleRole::ROLE_ROW)
+    if (row->Role() == roles::ROW)
       (*aRowIndex)++;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsARIAGridCellAccessible::GetColumnExtent(PRInt32 *aExtentCount)
@@ -1096,17 +1094,17 @@ nsARIAGridCellAccessible::IsSelected(boo
 {
   NS_ENSURE_ARG_POINTER(aIsSelected);
   *aIsSelected = false;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsAccessible* row = Parent();
-  if (!row || row->Role() != nsIAccessibleRole::ROLE_ROW)
+  if (!row || row->Role() != roles::ROW)
     return NS_OK;
 
   if (!nsAccUtils::IsARIASelected(row) && !nsAccUtils::IsARIASelected(this))
     return NS_OK;
 
   *aIsSelected = true;
   return NS_OK;
 }
@@ -1120,17 +1118,17 @@ nsARIAGridCellAccessible::ApplyARIAState
   nsHyperTextAccessibleWrap::ApplyARIAState(aState);
 
   // Return if the gridcell has aria-selected="true".
   if (*aState & states::SELECTED)
     return;
 
   // Check aria-selected="true" on the row.
   nsAccessible* row = Parent();
-  if (!row || row->Role() != nsIAccessibleRole::ROLE_ROW)
+  if (!row || row->Role() != roles::ROW)
     return;
 
   nsIContent *rowContent = row->GetContent();
   if (nsAccUtils::HasDefinedARIAToken(rowContent,
                                       nsGkAtoms::aria_selected) &&
       !rowContent->AttrValueIs(kNameSpaceID_None,
                                nsGkAtoms::aria_selected,
                                nsGkAtoms::_false, eCaseMatters))
@@ -1144,50 +1142,48 @@ nsARIAGridCellAccessible::GetAttributesI
     return NS_ERROR_FAILURE;
   
   nsresult rv = nsHyperTextAccessibleWrap::GetAttributesInternal(aAttributes);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Expose "table-cell-index" attribute.
 
   nsAccessible* thisRow = Parent();
-  if (!thisRow || thisRow->Role() != nsIAccessibleRole::ROLE_ROW)
+  if (!thisRow || thisRow->Role() != roles::ROW)
     return NS_OK;
 
   PRInt32 colIdx = 0, colCount = 0;
   PRInt32 childCount = thisRow->GetChildCount();
   for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
     nsAccessible *child = thisRow->GetChildAt(childIdx);
     if (child == this)
       colIdx = colCount;
 
-    PRUint32 role = child->Role();
-    if (role == nsIAccessibleRole::ROLE_GRID_CELL ||
-        role == nsIAccessibleRole::ROLE_ROWHEADER ||
-        role == nsIAccessibleRole::ROLE_COLUMNHEADER)
+    roles::Role role = child->Role();
+    if (role == roles::GRID_CELL || role == roles::ROWHEADER ||
+        role == roles::COLUMNHEADER)
       colCount++;
   }
 
   nsAccessible* table = thisRow->Parent();
   if (!table)
     return NS_OK;
 
-  PRUint32 tableRole = table->Role();
-  if (tableRole != nsIAccessibleRole::ROLE_TABLE &&
-      tableRole != nsIAccessibleRole::ROLE_TREE_TABLE)
+  roles::Role tableRole = table->Role();
+  if (tableRole != roles::TABLE && tableRole != roles::TREE_TABLE)
     return NS_OK;
 
   PRInt32 rowIdx = 0;
   childCount = table->GetChildCount();
   for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
     nsAccessible *child = table->GetChildAt(childIdx);
     if (child == thisRow)
       break;
 
-    if (child->Role() == nsIAccessibleRole::ROLE_ROW)
+    if (child->Role() == roles::ROW)
       rowIdx++;
   }
 
   PRInt32 idx = rowIdx * colCount + colIdx;
 
   nsAutoString stringIdx;
   stringIdx.AppendInt(idx);
   nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::tableCellIndex,
--- a/accessible/src/base/nsARIAMap.cpp
+++ b/accessible/src/base/nsARIAMap.cpp
@@ -35,16 +35,17 @@
  * 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"
 
 #include "nsIAccessibleRole.h"
+#include "Role.h"
 #include "States.h"
 
 #include "nsIContent.h"
 
 using namespace mozilla::a11y;
 
 /**
  *  This list of WAI-defined roles are currently hardcoded.
@@ -60,542 +61,542 @@ using namespace mozilla::a11y;
  *  There are no nsIAccessibleRole enums for the following landmark roles:
  *    banner, contentinfo, main, navigation, note, search, secondary, seealso, breadcrumbs
  */
 
 nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = 
 {
   {
     "alert",
-    nsIAccessibleRole::ROLE_ALERT,
+    roles::ALERT,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     kNoReqStates
   },
   {
     "alertdialog",
-    nsIAccessibleRole::ROLE_DIALOG,
+    roles::DIALOG,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     kNoReqStates
   },
   {
     "application",
-    nsIAccessibleRole::ROLE_APPLICATION,
+    roles::APPLICATION,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     kNoReqStates
   },
   {
     "article",
-    nsIAccessibleRole::ROLE_DOCUMENT,
+    roles::DOCUMENT,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     states::READONLY
   },
   {
     "button",
-    nsIAccessibleRole::ROLE_PUSHBUTTON,
+    roles::PUSHBUTTON,
     kUseMapRole,
     eNoValue,
     eClickAction,
     eNoLiveAttr,
     kNoReqStates,
     eARIAPressed
   },
   {
     "checkbox",
-    nsIAccessibleRole::ROLE_CHECKBUTTON,
+    roles::CHECKBUTTON,
     kUseMapRole,
     eNoValue,
     eCheckUncheckAction,
     eNoLiveAttr,
     kNoReqStates,
     eARIACheckableMixed,
     eARIAReadonly
   },
   {
     "columnheader",
-    nsIAccessibleRole::ROLE_COLUMNHEADER,
+    roles::COLUMNHEADER,
     kUseMapRole,
     eNoValue,
     eSortAction,
     eNoLiveAttr,
     kNoReqStates,
     eARIASelectable,
     eARIAReadonly
   },
   {
     "combobox",
-    nsIAccessibleRole::ROLE_COMBOBOX,
+    roles::COMBOBOX,
     kUseMapRole,
     eHasValueMinMax,
     eOpenCloseAction,
     eNoLiveAttr,
     states::COLLAPSED | states::HASPOPUP,
     eARIAAutoComplete,
     eARIAReadonly
   },
   {
     "dialog",
-    nsIAccessibleRole::ROLE_DIALOG,
+    roles::DIALOG,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     kNoReqStates
   },
   {
     "directory",
-    nsIAccessibleRole::ROLE_LIST,
+    roles::LIST,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     kNoReqStates
   },
   {
     "document",
-    nsIAccessibleRole::ROLE_DOCUMENT,
+    roles::DOCUMENT,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     states::READONLY
   },
   {
     "grid",
-    nsIAccessibleRole::ROLE_TABLE,
+    roles::TABLE,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     states::FOCUSABLE,
     eARIAMultiSelectable,
     eARIAReadonly
   },
   {
     "gridcell",
-    nsIAccessibleRole::ROLE_GRID_CELL,
+    roles::GRID_CELL,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     kNoReqStates,
     eARIASelectable,
     eARIAReadonly
   },
   {
     "group",
-    nsIAccessibleRole::ROLE_GROUPING,
+    roles::GROUPING,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     kNoReqStates
   },
   {
     "heading",
-    nsIAccessibleRole::ROLE_HEADING,
+    roles::HEADING,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     kNoReqStates
   },
   {
     "img",
-    nsIAccessibleRole::ROLE_GRAPHIC,
+    roles::GRAPHIC,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     kNoReqStates
   },
   {
     "label",
-    nsIAccessibleRole::ROLE_LABEL,
+    roles::LABEL,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     kNoReqStates
   },
   {
     "link",
-    nsIAccessibleRole::ROLE_LINK,
+    roles::LINK,
     kUseMapRole,
     eNoValue,
     eJumpAction,
     eNoLiveAttr,
     states::LINKED
   },
   {
     "list",
-    nsIAccessibleRole::ROLE_LIST,
+    roles::LIST,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     states::READONLY,
     eARIAMultiSelectable
   },
   {
     "listbox",
-    nsIAccessibleRole::ROLE_LISTBOX,
+    roles::LISTBOX,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     kNoReqStates,
     eARIAMultiSelectable,
     eARIAReadonly
   },
   {
     "listitem",
-    nsIAccessibleRole::ROLE_LISTITEM,
+    roles::LISTITEM,
     kUseMapRole,
     eNoValue,
     eNoAction, // XXX: should depend on state, parent accessible
     eNoLiveAttr,
     states::READONLY,
     eARIASelectable,
     eARIACheckedMixed
   },
   {
     "log",
-    nsIAccessibleRole::ROLE_NOTHING,
+    roles::NOTHING,
     kUseNativeRole,
     eNoValue,
     eNoAction,
     ePoliteLiveAttr,
     kNoReqStates
   },
   {
     "marquee",
-    nsIAccessibleRole::ROLE_ANIMATION,
+    roles::ANIMATION,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eOffLiveAttr,
     kNoReqStates
   },
   {
     "math",
-    nsIAccessibleRole::ROLE_FLAT_EQUATION,
+    roles::FLAT_EQUATION,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     kNoReqStates
   },
   {
     "menu",
-    nsIAccessibleRole::ROLE_MENUPOPUP,
+    roles::MENUPOPUP,
     kUseMapRole,
     eNoValue,
     eNoAction, // XXX: technically accessibles of menupopup role haven't
                // any action, but menu can be open or close.
     eNoLiveAttr,
     kNoReqStates
   },
   {
     "menubar",
-    nsIAccessibleRole::ROLE_MENUBAR,
+    roles::MENUBAR,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     kNoReqStates
   },
   {
     "menuitem",
-    nsIAccessibleRole::ROLE_MENUITEM,
+    roles::MENUITEM,
     kUseMapRole,
     eNoValue,
     eClickAction,
     eNoLiveAttr,
     kNoReqStates,
     eARIACheckedMixed
   },
   {
     "menuitemcheckbox",
-    nsIAccessibleRole::ROLE_CHECK_MENU_ITEM,
+    roles::CHECK_MENU_ITEM,
     kUseMapRole,
     eNoValue,
     eClickAction,
     eNoLiveAttr,
     kNoReqStates,
     eARIACheckableMixed
   },
   {
     "menuitemradio",
-    nsIAccessibleRole::ROLE_RADIO_MENU_ITEM,
+    roles::RADIO_MENU_ITEM,
     kUseMapRole,
     eNoValue,
     eClickAction,
     eNoLiveAttr,
     kNoReqStates,
     eARIACheckableBool
   },
   {
     "option",
-    nsIAccessibleRole::ROLE_OPTION,
+    roles::OPTION,
     kUseMapRole,
     eNoValue,
     eSelectAction,
     eNoLiveAttr,
     kNoReqStates,
     eARIASelectable,
     eARIACheckedMixed
   },
   {
     "presentation",
-    nsIAccessibleRole::ROLE_NOTHING,
+    roles::NOTHING,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     kNoReqStates
   },
   {
     "progressbar",
-    nsIAccessibleRole::ROLE_PROGRESSBAR,
+    roles::PROGRESSBAR,
     kUseMapRole,
     eHasValueMinMax,
     eNoAction,
     eNoLiveAttr,
     states::READONLY
   },
   {
     "radio",
-    nsIAccessibleRole::ROLE_RADIOBUTTON,
+    roles::RADIOBUTTON,
     kUseMapRole,
     eNoValue,
     eSelectAction,
     eNoLiveAttr,
     kNoReqStates,
     eARIACheckableBool
   },
   {
     "radiogroup",
-    nsIAccessibleRole::ROLE_GROUPING,
+    roles::GROUPING,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     kNoReqStates
   },
   {
     "region",
-    nsIAccessibleRole::ROLE_PANE,
+    roles::PANE,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     kNoReqStates
   },
   {
     "row",
-    nsIAccessibleRole::ROLE_ROW,
+    roles::ROW,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     kNoReqStates,
     eARIASelectable
   },
   {
     "rowheader",
-    nsIAccessibleRole::ROLE_ROWHEADER,
+    roles::ROWHEADER,
     kUseMapRole,
     eNoValue,
     eSortAction,
     eNoLiveAttr,
     kNoReqStates,
     eARIASelectable,
     eARIAReadonly
   },
   {
     "scrollbar",
-    nsIAccessibleRole::ROLE_SCROLLBAR,
+    roles::SCROLLBAR,
     kUseMapRole,
     eHasValueMinMax,
     eNoAction,
     eNoLiveAttr,
     kNoReqStates,
     eARIAOrientation,
     eARIAReadonly
   },
   {
     "separator",
-    nsIAccessibleRole::ROLE_SEPARATOR,
+    roles::SEPARATOR,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     kNoReqStates,
     eARIAOrientation
   },
   {
     "slider",
-    nsIAccessibleRole::ROLE_SLIDER,
+    roles::SLIDER,
     kUseMapRole,
     eHasValueMinMax,
     eNoAction,
     eNoLiveAttr,
     kNoReqStates,
     eARIAOrientation,
     eARIAReadonly
   },
   {
     "spinbutton",
-    nsIAccessibleRole::ROLE_SPINBUTTON,
+    roles::SPINBUTTON,
     kUseMapRole,
     eHasValueMinMax,
     eNoAction,
     eNoLiveAttr,
     kNoReqStates,
     eARIAReadonly
   },
   {
     "status",
-    nsIAccessibleRole::ROLE_STATUSBAR,
+    roles::STATUSBAR,
     kUseMapRole,
     eNoValue,
     eNoAction,
     ePoliteLiveAttr,
     kNoReqStates
   },
   {
     "tab",
-    nsIAccessibleRole::ROLE_PAGETAB,
+    roles::PAGETAB,
     kUseMapRole,
     eNoValue,
     eSwitchAction,
     eNoLiveAttr,
     kNoReqStates,
     eARIASelectable
   },
   {
     "tablist",
-    nsIAccessibleRole::ROLE_PAGETABLIST,
+    roles::PAGETABLIST,
     kUseMapRole,
     eNoValue,
     eNoAction,
     ePoliteLiveAttr,
     kNoReqStates
   },
   {
     "tabpanel",
-    nsIAccessibleRole::ROLE_PROPERTYPAGE,
+    roles::PROPERTYPAGE,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     kNoReqStates
   },
   {
     "textbox",
-    nsIAccessibleRole::ROLE_ENTRY,
+    roles::ENTRY,
     kUseMapRole,
     eNoValue,
     eActivateAction,
     eNoLiveAttr,
     kNoReqStates,
     eARIAAutoComplete,
     eARIAMultiline,
     eARIAReadonlyOrEditable
   },
   {
     "timer",
-    nsIAccessibleRole::ROLE_NOTHING,
+    roles::NOTHING,
     kUseNativeRole,
     eNoValue,
     eNoAction,
     eOffLiveAttr,
     kNoReqStates
   },
   {
     "toolbar",
-    nsIAccessibleRole::ROLE_TOOLBAR,
+    roles::TOOLBAR,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     kNoReqStates
   },
   {
     "tooltip",
-    nsIAccessibleRole::ROLE_TOOLTIP,
+    roles::TOOLTIP,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     kNoReqStates
   },
   {
     "tree",
-    nsIAccessibleRole::ROLE_OUTLINE,
+    roles::OUTLINE,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     kNoReqStates,
     eARIAReadonly,
     eARIAMultiSelectable
   },
   {
     "treegrid",
-    nsIAccessibleRole::ROLE_TREE_TABLE,
+    roles::TREE_TABLE,
     kUseMapRole,
     eNoValue,
     eNoAction,
     eNoLiveAttr,
     kNoReqStates,
     eARIAReadonly,
     eARIAMultiSelectable
   },
   {
     "treeitem",
-    nsIAccessibleRole::ROLE_OUTLINEITEM,
+    roles::OUTLINEITEM,
     kUseMapRole,
     eNoValue,
     eActivateAction, // XXX: should expose second 'expand/collapse' action based
                      // on states
     eNoLiveAttr,
     kNoReqStates,
     eARIASelectable,
     eARIACheckedMixed
   }
 };
 
 PRUint32 nsARIAMap::gWAIRoleMapLength = NS_ARRAY_LENGTH(nsARIAMap::gWAIRoleMap);
 
 nsRoleMapEntry nsARIAMap::gLandmarkRoleMap = {
   "",
-  nsIAccessibleRole::ROLE_NOTHING,
+  roles::NOTHING,
   kUseNativeRole,
   eNoValue,
   eNoAction,
   eNoLiveAttr,
   kNoReqStates
 };
 
 nsRoleMapEntry nsARIAMap::gEmptyRoleMap = {
   "",
-  nsIAccessibleRole::ROLE_NOTHING,
+  roles::NOTHING,
   kUseMapRole,
   eNoValue,
   eNoAction,
   eNoLiveAttr,
   kNoReqStates
 };
 
 nsStateMapEntry nsARIAMap::gWAIStateMap[] = {
--- a/accessible/src/base/nsARIAMap.h
+++ b/accessible/src/base/nsARIAMap.h
@@ -35,16 +35,17 @@
  * 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 _nsARIAMap_H_
 #define _nsARIAMap_H_
 
+#include "mozilla/a11y/Role.h"
 #include "prtypes.h"
 
 class nsIAtom;
 class nsIContent;
 
 ////////////////////////////////////////////////////////////////////////////////
 // Value constants
 
@@ -268,17 +269,17 @@ private:
  * For each ARIA role, this maps the nsIAccessible information.
  */
 struct nsRoleMapEntry
 {
   // ARIA role: string representation such as "button"
   const char *roleString;
   
   // Role mapping rule: maps to this nsIAccessibleRole
-  PRUint32 role;
+  mozilla::a11y::role role;
   
   // Role rule: whether to use mapped role or native semantics
   bool roleRule;
   
   // Value mapping rule: how to compute nsIAccessible value
   EValueRule valueRule;
 
   // Action mapping rule, how to expose nsIAccessible action
--- a/accessible/src/base/nsAccUtils.cpp
+++ b/accessible/src/base/nsAccUtils.cpp
@@ -34,18 +34,19 @@
  * 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 "nsCoreUtils.h"
 #include "nsAccUtils.h"
 
+#include "nsIAccessibleTypes.h"
+#include "Role.h"
 #include "States.h"
-#include "nsIAccessibleTypes.h"
 
 #include "nsAccessibilityService.h"
 #include "nsARIAMap.h"
 #include "nsDocAccessible.h"
 #include "nsHyperTextAccessible.h"
 #include "nsHTMLTableAccessible.h"
 #include "nsTextAccessible.h"
 #include "nsXULTreeGridAccessible.h"
@@ -99,28 +100,27 @@ nsAccUtils::SetAccGroupAttrs(nsIPersiste
     value.AppendInt(aSetSize);
     SetAccAttr(aAttributes, nsGkAtoms::setsize, value);
   }
 }
 
 PRInt32
 nsAccUtils::GetDefaultLevel(nsAccessible *aAccessible)
 {
-  PRUint32 role = aAccessible->Role();
+  roles::Role role = aAccessible->Role();
 
-  if (role == nsIAccessibleRole::ROLE_OUTLINEITEM)
+  if (role == roles::OUTLINEITEM)
     return 1;
 
-  if (role == nsIAccessibleRole::ROLE_ROW) {
+  if (role == roles::ROW) {
     nsAccessible* parent = aAccessible->Parent();
-    if (parent && parent->Role() == nsIAccessibleRole::ROLE_TREE_TABLE) {
-      // It is a row inside flatten treegrid. Group level is always 1 until it
-      // is overriden by aria-level attribute.
+    // It is a row inside flatten treegrid. Group level is always 1 until it
+    // is overriden by aria-level attribute.
+    if (parent && parent->Role() == roles::TREE_TABLE) 
       return 1;
-    }
   }
 
   return 0;
 }
 
 PRInt32
 nsAccUtils::GetARIAOrDefaultLevel(nsAccessible *aAccessible)
 {
--- a/accessible/src/base/nsAccessibilityService.cpp
+++ b/accessible/src/base/nsAccessibilityService.cpp
@@ -54,16 +54,17 @@
 #include "nsHTMLImageMapAccessible.h"
 #include "nsHTMLLinkAccessible.h"
 #include "nsHTMLSelectAccessible.h"
 #include "nsHTMLTableAccessibleWrap.h"
 #include "nsHTMLTextAccessible.h"
 #include "nsHyperTextAccessibleWrap.h"
 #include "nsIAccessibilityService.h"
 #include "nsIAccessibleProvider.h"
+#include "Role.h"
 #include "States.h"
 #include "Statistics.h"
 
 #include "nsIDOMDocument.h"
 #include "nsIDOMHTMLAreaElement.h"
 #include "nsIDOMHTMLLegendElement.h"
 #include "nsIDOMHTMLObjectElement.h"
 #include "nsIDOMHTMLOptGroupElement.h"
@@ -334,17 +335,17 @@ nsAccessibilityService::CreateHTMLListbo
 }
 
 already_AddRefed<nsAccessible>
 nsAccessibilityService::CreateHTMLMediaAccessible(nsIContent* aContent,
                                                   nsIPresShell* aPresShell)
 {
   nsCOMPtr<nsIWeakReference> weakShell(do_GetWeakReference(aPresShell));
   nsAccessible* accessible = new nsEnumRoleAccessible(aContent, weakShell,
-                                                      nsIAccessibleRole::ROLE_GROUPING);
+                                                      roles::GROUPING);
   NS_IF_ADDREF(accessible);
   return accessible;
 }
 
 already_AddRefed<nsAccessible>
 nsAccessibilityService::CreateHTMLObjectFrameAccessible(nsObjectFrame* aFrame,
                                                         nsIContent* aContent,
                                                         nsIPresShell* aPresShell)
@@ -1087,23 +1088,21 @@ nsAccessibilityService::GetOrCreateAcces
           continue;
 
         if (tableFrame->GetType() == nsGkAtoms::tableOuterFrame) {
           nsAccessible *tableAccessible =
             GetAccessibleInWeakShell(tableContent, aWeakShell);
 
           if (tableAccessible) {
             if (!roleMapEntry) {
-              PRUint32 role = tableAccessible->Role();
-              if (role != nsIAccessibleRole::ROLE_TABLE &&
-                  role != nsIAccessibleRole::ROLE_TREE_TABLE) {
-                // No ARIA role and not in table: override role. For example,
-                // <table role="label"><td>content</td></table>
+              roles::Role role = tableAccessible->Role();
+              // No ARIA role and not in table: override role. For example,
+              // <table role="label"><td>content</td></table>
+              if (role != roles::TABLE && role != roles::TREE_TABLE)
                 roleMapEntry = &nsARIAMap::gEmptyRoleMap;
-              }
             }
 
             break;
           }
 
 #ifdef DEBUG
           nsRoleMapEntry *tableRoleMapEntry =
             nsAccUtils::GetRoleMapEntry(tableContent);
@@ -1138,23 +1137,23 @@ nsAccessibilityService::GetOrCreateAcces
     }
 
     if (roleMapEntry) {
       // Create ARIA grid/treegrid accessibles if node is not of a child or
       // valid child of HTML table and is not a HTML table.
       if ((!partOfHTMLTable || !tryTagNameOrFrame) &&
           frameType != nsGkAtoms::tableOuterFrame) {
 
-        if (roleMapEntry->role == nsIAccessibleRole::ROLE_TABLE ||
-            roleMapEntry->role == nsIAccessibleRole::ROLE_TREE_TABLE) {
+        if (roleMapEntry->role == roles::TABLE ||
+            roleMapEntry->role == roles::TREE_TABLE) {
           newAcc = new nsARIAGridAccessibleWrap(content, aWeakShell);
 
-        } else if (roleMapEntry->role == nsIAccessibleRole::ROLE_GRID_CELL ||
-            roleMapEntry->role == nsIAccessibleRole::ROLE_ROWHEADER ||
-            roleMapEntry->role == nsIAccessibleRole::ROLE_COLUMNHEADER) {
+        } else if (roleMapEntry->role == roles::GRID_CELL ||
+            roleMapEntry->role == roles::ROWHEADER ||
+            roleMapEntry->role == roles::COLUMNHEADER) {
           newAcc = new nsARIAGridCellAccessibleWrap(content, aWeakShell);
         }
       }
     }
 
     if (!newAcc && tryTagNameOrFrame) {
       // Prefer to use markup (mostly tag name, perhaps attributes) to
       // decide if and what kind of accessible to create.
@@ -1196,21 +1195,21 @@ nsAccessibilityService::GetOrCreateAcces
     // say what kind of accessible to create.
     newAcc = CreateAccessibleByType(content, aWeakShell);
   }
 
   if (!newAcc) {
     // Create generic accessibles for SVG and MathML nodes.
     if (content->IsSVG(nsGkAtoms::svg)) {
       newAcc = new nsEnumRoleAccessible(content, aWeakShell,
-                                        nsIAccessibleRole::ROLE_DIAGRAM);
+                                        roles::DIAGRAM);
     }
     else if (content->IsMathML(nsGkAtoms::math)) {
       newAcc = new nsEnumRoleAccessible(content, aWeakShell,
-                                        nsIAccessibleRole::ROLE_EQUATION);
+                                        roles::EQUATION);
     }
   }
 
   if (!newAcc) {
     newAcc = CreateAccessibleForDeckChild(weakFrame.GetFrame(), content,
                                           aWeakShell);
   }
 
@@ -1431,17 +1430,17 @@ nsAccessibilityService::CreateAccessible
 
     }
     case nsIAccessibleProvider::XULMenuSeparator:
       accessible = new nsXULMenuSeparatorAccessible(aContent, aWeakShell);
       break;
 
     case nsIAccessibleProvider::XULPane:
       accessible = new nsEnumRoleAccessible(aContent, aWeakShell,
-                                            nsIAccessibleRole::ROLE_PANE);
+                                            roles::PANE);
       break;
 
     case nsIAccessibleProvider::XULProgressMeter:
       accessible = new XULProgressMeterAccessible(aContent, aWeakShell);
       break;
 
     case nsIAccessibleProvider::XULStatusBar:
       accessible = new nsXULStatusBarAccessible(aContent, aWeakShell);
@@ -1643,18 +1642,18 @@ nsAccessibilityService::CreateHTMLAccess
     NS_IF_ADDREF(accessible);
     return accessible;
   }
 
   if (tag == nsGkAtoms::a) {
     // Only some roles truly enjoy life as nsHTMLLinkAccessibles, for details
     // see closed bug 494807.
     nsRoleMapEntry *roleMapEntry = nsAccUtils::GetRoleMapEntry(aContent);
-    if (roleMapEntry && roleMapEntry->role != nsIAccessibleRole::ROLE_NOTHING &&
-        roleMapEntry->role != nsIAccessibleRole::ROLE_LINK) {
+    if (roleMapEntry && roleMapEntry->role != roles::NOTHING &&
+        roleMapEntry->role != roles::LINK) {
       nsAccessible* accessible = new nsHyperTextAccessibleWrap(aContent,
                                                                aWeakShell);
       NS_IF_ADDREF(accessible);
       return accessible;
     }
 
     nsAccessible* accessible = new nsHTMLLinkAccessible(aContent, aWeakShell);
     NS_IF_ADDREF(accessible);
@@ -1686,17 +1685,17 @@ nsAccessibilityService::CreateHTMLAccess
       tag == nsGkAtoms::q) {
     nsAccessible* accessible = new nsHyperTextAccessibleWrap(aContent, aWeakShell);
     NS_IF_ADDREF(accessible);
     return accessible;
   }
 
   if (tag == nsGkAtoms::tr) {
     nsAccessible* accessible = new nsEnumRoleAccessible(aContent, aWeakShell,
-                                                        nsIAccessibleRole::ROLE_ROW);
+                                                        roles::ROW);
     NS_IF_ADDREF(accessible);
     return accessible;
   }
 
   if (nsCoreUtils::IsHTMLTableHeader(aContent)) {
     nsAccessible* accessible = new nsHTMLTableHeaderCellAccessibleWrap(aContent,
                                                                        aWeakShell);
     NS_IF_ADDREF(accessible);
@@ -1810,17 +1809,17 @@ nsAccessibilityService::CreateAccessible
                                             kNameSpaceID_XUL)) {
         nsAccessible* accessible = new nsXULTabpanelAccessible(aContent,
                                                                aWeakShell);
         NS_IF_ADDREF(accessible);
         return accessible;
       }
 #endif
       nsAccessible* accessible = new nsEnumRoleAccessible(aContent, aWeakShell,
-                                                          nsIAccessibleRole::ROLE_PROPERTYPAGE);
+                                                          roles::PROPERTYPAGE);
       NS_IF_ADDREF(accessible);
       return accessible;
     }
   }
 
   return nsnull;
 }
 
--- a/accessible/src/base/nsAccessible.cpp
+++ b/accessible/src/base/nsAccessible.cpp
@@ -49,16 +49,17 @@
 
 #include "nsAccEvent.h"
 #include "nsAccessibleRelation.h"
 #include "nsAccessibilityService.h"
 #include "nsAccTreeWalker.h"
 #include "nsIAccessibleRelation.h"
 #include "nsTextEquivUtils.h"
 #include "Relation.h"
+#include "Role.h"
 #include "States.h"
 
 #include "nsIDOMElement.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMDocumentXBL.h"
 #include "nsIDOMHTMLDocument.h"
 #include "nsIDOMHTMLFormElement.h"
 #include "nsIDOMNodeFilter.h"
@@ -1470,31 +1471,31 @@ nsAccessible::State()
 {
   if (IsDefunct())
     return states::DEFUNCT;
 
   PRUint64 state = NativeState();
   // Apply ARIA states to be sure accessible states will be overridden.
   ApplyARIAState(&state);
 
-  if (mRoleMapEntry && mRoleMapEntry->role == nsIAccessibleRole::ROLE_PAGETAB &&
+  if (mRoleMapEntry && mRoleMapEntry->role == roles::PAGETAB &&
       !(state & states::SELECTED) &&
       !mContent->AttrValueIs(kNameSpaceID_None,
                              nsGkAtoms::aria_selected,
                              nsGkAtoms::_false, eCaseMatters)) {
     // Special case: for tabs, focused implies selected, unless explicitly
     // false, i.e. aria-selected="false".
     if (state & states::FOCUSED) {
       state |= states::SELECTED;
     } else {
       // If focus is in a child of the tab panel surely the tab is selected!
       Relation rel = RelationByType(nsIAccessibleRelation::RELATION_LABEL_FOR);
       nsAccessible* relTarget = nsnull;
       while ((relTarget = rel.Next())) {
-        if (relTarget->Role() == nsIAccessibleRole::ROLE_PROPERTYPAGE &&
+        if (relTarget->Role() == roles::PROPERTYPAGE &&
             FocusMgr()->IsFocusWithin(relTarget))
           state |= states::SELECTED;
       }
     }
   }
 
   const PRUint32 kExpandCollapseStates = states::COLLAPSED | states::EXPANDED;
   if ((state & kExpandCollapseStates) == kExpandCollapseStates) {
@@ -1557,17 +1558,17 @@ nsAccessible::ApplyARIAState(PRUint64* a
   // Test for universal states first
   *aState |= nsARIAMap::UniversalStatesFor(mContent);
 
   if (mRoleMapEntry) {
 
     // We only force the readonly bit off if we have a real mapping for the aria
     // role. This preserves the ability for screen readers to use readonly
     // (primarily on the document) as the hint for creating a virtual buffer.
-    if (mRoleMapEntry->role != nsIAccessibleRole::ROLE_NOTHING)
+    if (mRoleMapEntry->role != roles::NOTHING)
       *aState &= ~states::READONLY;
 
     if (mContent->HasAttr(kNameSpaceID_None, mContent->GetIDAttributeName())) {
       // If has a role & ID and aria-activedescendant on the container, assume focusable
       nsIContent *ancestorContent = mContent;
       while ((ancestorContent = ancestorContent->GetParent()) != nsnull) {
         if (ancestorContent->HasAttr(kNameSpaceID_None, nsGkAtoms::aria_activedescendant)) {
             // ancestor has activedescendant property, this content could be active
@@ -1734,65 +1735,64 @@ nsAccessible::GetKeyBindings(PRUint8 aAc
 
   if (!defaultKey.IsEmpty())
     keyBindings->Add(defaultKey);
 
   NS_ADDREF(*aKeyBindings = keyBindings);
   return NS_OK;
 }
 
-PRUint32
+role
 nsAccessible::ARIARoleInternal()
 {
   NS_PRECONDITION(mRoleMapEntry && mRoleMapEntry->roleRule == kUseMapRole,
                   "ARIARoleInternal should only be called when ARIA role overrides!");
 
   // XXX: these unfortunate exceptions don't fit into the ARIA table. This is
   // where the accessible role depends on both the role and ARIA state.
-  if (mRoleMapEntry->role == nsIAccessibleRole::ROLE_PUSHBUTTON) {
+  if (mRoleMapEntry->role == roles::PUSHBUTTON) {
     if (nsAccUtils::HasDefinedARIAToken(mContent, nsGkAtoms::aria_pressed)) {
       // For simplicity, any existing pressed attribute except "" or "undefined"
       // indicates a toggle.
-      return nsIAccessibleRole::ROLE_TOGGLE_BUTTON;
+      return roles::TOGGLE_BUTTON;
     }
 
     if (mContent->AttrValueIs(kNameSpaceID_None,
                               nsGkAtoms::aria_haspopup,
                               nsGkAtoms::_true,
                               eCaseMatters)) {
       // For button with aria-haspopup="true".
-      return nsIAccessibleRole::ROLE_BUTTONMENU;
+      return roles::BUTTONMENU;
     }
 
-  } else if (mRoleMapEntry->role == nsIAccessibleRole::ROLE_LISTBOX) {
+  } else if (mRoleMapEntry->role == roles::LISTBOX) {
     // A listbox inside of a combobox needs a special role because of ATK
     // mapping to menu.
-    if (mParent && mParent->Role() == nsIAccessibleRole::ROLE_COMBOBOX) {
-      return nsIAccessibleRole::ROLE_COMBOBOX_LIST;
+    if (mParent && mParent->Role() == roles::COMBOBOX) {
+      return roles::COMBOBOX_LIST;
 
       Relation rel = RelationByType(nsIAccessibleRelation::RELATION_NODE_CHILD_OF);
       nsAccessible* targetAcc = nsnull;
       while ((targetAcc = rel.Next()))
-        if (targetAcc->Role() == nsIAccessibleRole::ROLE_COMBOBOX)
-          return nsIAccessibleRole::ROLE_COMBOBOX_LIST;
+        if (targetAcc->Role() == roles::COMBOBOX)
+          return roles::COMBOBOX_LIST;
     }
 
-  } else if (mRoleMapEntry->role == nsIAccessibleRole::ROLE_OPTION) {
-    if (mParent && mParent->Role() == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
-      return nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
+  } else if (mRoleMapEntry->role == roles::OPTION) {
+    if (mParent && mParent->Role() == roles::COMBOBOX_LIST)
+      return roles::COMBOBOX_OPTION;
   }
 
   return mRoleMapEntry->role;
 }
 
-PRUint32
+role
 nsAccessible::NativeRole()
 {
-  return nsCoreUtils::IsXLink(mContent) ?
-    nsIAccessibleRole::ROLE_LINK : nsIAccessibleRole::ROLE_NOTHING;
+  return nsCoreUtils::IsXLink(mContent) ? roles::LINK : roles::NOTHING;
 }
 
 // readonly attribute PRUint8 numActions
 NS_IMETHODIMP
 nsAccessible::GetNumActions(PRUint8* aActionCount)
 {
   NS_ENSURE_ARG_POINTER(aActionCount);
   *aActionCount = 0;
@@ -1988,19 +1988,18 @@ nsAccessible::RelationByType(PRUint32 aT
       return rel;
     }
     case nsIAccessibleRelation::RELATION_NODE_CHILD_OF: {
       Relation rel(new RelatedAccIterator(GetDocAccessible(), mContent,
                                             nsGkAtoms::aria_owns));
       
       // This is an ARIA tree or treegrid that doesn't use owns, so we need to
       // get the parent the hard way.
-      if (mRoleMapEntry &&
-          (mRoleMapEntry->role == nsIAccessibleRole::ROLE_OUTLINEITEM ||
-           mRoleMapEntry->role == nsIAccessibleRole::ROLE_ROW)) {
+      if (mRoleMapEntry && (mRoleMapEntry->role == roles::OUTLINEITEM || 
+	  mRoleMapEntry->role == roles::ROW)) {
         AccGroupInfo* groupInfo = GetGroupInfo();
         if (!groupInfo)
           return rel;
 
         rel.AppendTarget(groupInfo->ConceptualParent());
       }
 
       // If accessible is in its own Window, or is the root of a document,
@@ -3133,64 +3132,63 @@ nsAccessible::GetPositionAndSizeInternal
 PRInt32
 nsAccessible::GetLevelInternal()
 {
   PRInt32 level = nsAccUtils::GetDefaultLevel(this);
 
   if (!IsBoundToParent())
     return level;
 
-  PRUint32 role = Role();
-  if (role == nsIAccessibleRole::ROLE_OUTLINEITEM) {
+  roles::Role role = Role();
+  if (role == roles::OUTLINEITEM) {
     // Always expose 'level' attribute for 'outlineitem' accessible. The number
     // of nested 'grouping' accessibles containing 'outlineitem' accessible is
     // its level.
     level = 1;
 
     nsAccessible* parent = this;
     while ((parent = parent->Parent())) {
-      PRUint32 parentRole = parent->Role();
-
-      if (parentRole == nsIAccessibleRole::ROLE_OUTLINE)
+      roles::Role parentRole = parent->Role();
+
+      if (parentRole == roles::OUTLINE)
         break;
-      if (parentRole == nsIAccessibleRole::ROLE_GROUPING)
+      if (parentRole == roles::GROUPING)
         ++ level;
 
     }
 
-  } else if (role == nsIAccessibleRole::ROLE_LISTITEM) {
+  } else if (role == roles::LISTITEM) {
     // Expose 'level' attribute on nested lists. We assume nested list is a last
     // child of listitem of parent list. We don't handle the case when nested
     // lists have more complex structure, for example when there are accessibles
     // between parent listitem and nested list.
 
     // Calculate 'level' attribute based on number of parent listitems.
     level = 0;
     nsAccessible* parent = this;
     while ((parent = parent->Parent())) {
-      PRUint32 parentRole = parent->Role();
-
-      if (parentRole == nsIAccessibleRole::ROLE_LISTITEM)
+      roles::Role parentRole = parent->Role();
+
+      if (parentRole == roles::LISTITEM)
         ++ level;
-      else if (parentRole != nsIAccessibleRole::ROLE_LIST)
+      else if (parentRole != roles::LIST)
         break;
 
     }
 
     if (level == 0) {
       // If this listitem is on top of nested lists then expose 'level'
       // attribute.
       parent = Parent();
       PRInt32 siblingCount = parent->GetChildCount();
       for (PRInt32 siblingIdx = 0; siblingIdx < siblingCount; siblingIdx++) {
         nsAccessible* sibling = parent->GetChildAt(siblingIdx);
 
         nsAccessible* siblingChild = sibling->LastChild();
-        if (siblingChild &&
-            siblingChild->Role() == nsIAccessibleRole::ROLE_LIST)
+        if (siblingChild && siblingChild->Role() == roles::LIST)
           return 1;
       }
     } else {
       ++ level; // level is 1-index based
     }
   }
 
   return level;
--- a/accessible/src/base/nsAccessible.h
+++ b/accessible/src/base/nsAccessible.h
@@ -34,18 +34,19 @@
  * 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 _nsAccessible_H_
 #define _nsAccessible_H_
 
+#include "mozilla/a11y/Role.h"
+#include "mozilla/a11y/States.h"
 #include "nsAccessNodeWrap.h"
-#include "mozilla/a11y/States.h"
 
 #include "nsIAccessible.h"
 #include "nsIAccessibleHyperLink.h"
 #include "nsIAccessibleSelectable.h"
 #include "nsIAccessibleValue.h"
 #include "nsIAccessibleRole.h"
 #include "nsIAccessibleStates.h"
 
@@ -150,43 +151,43 @@ public:
    *
    * @return NS_OK_EMPTY_NAME  points empty name was specified by native markup
    *                           explicitly (see nsIAccessible::name attribute for
    *                           details)
    */
   virtual nsresult GetNameInternal(nsAString& aName);
 
   /**
-   * Return enumerated accessible role (see constants in nsIAccessibleRole).
+   * Return enumerated accessible role (see constants in Role.h).
    */
-  inline PRUint32 Role()
+  inline mozilla::a11y::role Role()
   {
     if (!mRoleMapEntry || mRoleMapEntry->roleRule != kUseMapRole)
       return NativeRole();
 
     return ARIARoleInternal();
   }
 
   /**
    * Return accessible role specified by ARIA (see constants in
-   * nsIAccessibleRole).
+   * roles).
    */
-  inline PRUint32 ARIARole()
+  inline mozilla::a11y::role ARIARole()
   {
     if (!mRoleMapEntry || mRoleMapEntry->roleRule != kUseMapRole)
-      return nsIAccessibleRole::ROLE_NOTHING;
+      return mozilla::a11y::roles::NOTHING;
 
     return ARIARoleInternal();
   }
 
   /**
    * Returns enumerated accessible role from native markup (see constants in
-   * nsIAccessibleRole). Doesn't take into account ARIA roles.
+   * Role.h). Doesn't take into account ARIA roles.
    */
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
 
   /**
    * Return all states of accessible (including ARIA states).
    */
   virtual PRUint64 State();
 
   /**
    * Return the states of accessible, not taking into account ARIA states.
@@ -667,17 +668,17 @@ protected:
   };
 
   //////////////////////////////////////////////////////////////////////////////
   // Miscellaneous helpers
 
   /**
    * Return ARIA role (helper method).
    */
-  PRUint32 ARIARoleInternal();
+  mozilla::a11y::role ARIARoleInternal();
 
   virtual nsIFrame* GetBoundsFrame();
   virtual void GetBoundsRect(nsRect& aRect, nsIFrame** aRelativeFrame);
 
   PRUint64 VisibilityState(); 
 
   //////////////////////////////////////////////////////////////////////////////
   // Name helpers
--- a/accessible/src/base/nsApplicationAccessible.cpp
+++ b/accessible/src/base/nsApplicationAccessible.cpp
@@ -37,20 +37,21 @@
  * 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 "nsApplicationAccessible.h"
 
-#include "Relation.h"
-#include "States.h"
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
+#include "Relation.h"
+#include "Role.h"
+#include "States.h"
 
 #include "nsIComponentManager.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMWindow.h"
 #include "nsIWindowMediator.h"
 #include "nsServiceManagerUtils.h"
 #include "mozilla/Services.h"
 
@@ -336,20 +337,20 @@ nsApplicationAccessible::IsPrimaryForNod
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessible public methods
 
 void
 nsApplicationAccessible::ApplyARIAState(PRUint64* aState)
 {
 }
 
-PRUint32
+role
 nsApplicationAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_APP_ROOT;
+  return roles::APP_ROOT;
 }
 
 PRUint64
 nsApplicationAccessible::NativeState()
 {
   return 0;
 }
 
--- a/accessible/src/base/nsApplicationAccessible.h
+++ b/accessible/src/base/nsApplicationAccessible.h
@@ -109,17 +109,17 @@ public:
   virtual bool IsDefunct() const;
   virtual bool Init();
   virtual void Shutdown();
   virtual bool IsPrimaryForNode() const;
 
   // nsAccessible
   virtual void ApplyARIAState(PRUint64* aState);
   virtual void Description(nsString& aDescription);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 State();
   virtual PRUint64 NativeState();
   virtual Relation RelationByType(PRUint32 aRelType);
 
   virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY,
                                      EWhichChildAtPoint aWhichChild);
   virtual nsAccessible* FocusedChild();
 
--- a/accessible/src/base/nsBaseWidgetAccessible.cpp
+++ b/accessible/src/base/nsBaseWidgetAccessible.cpp
@@ -34,21 +34,22 @@
  * 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 "nsBaseWidgetAccessible.h"
 
-#include "States.h"
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "nsCoreUtils.h"
 #include "nsHyperTextAccessibleWrap.h"
+#include "Role.h"
+#include "States.h"
 
 #include "nsGUIEvent.h"
 #include "nsILink.h"
 #include "nsIFrame.h"
 #include "nsINameSpaceManager.h"
 #include "nsIURI.h"
 
 using namespace mozilla::a11y;
@@ -227,41 +228,41 @@ nsLinkableAccessible::BindToParent(nsAcc
     return;
   }
 
   // XXX: The logic looks broken since the click listener may be registered
   // on non accessible node in parent chain but this node is skipped when tree
   // is traversed.
   nsAccessible* walkUpAcc = this;
   while ((walkUpAcc = walkUpAcc->Parent()) && !walkUpAcc->IsDoc()) {
-    if (walkUpAcc->Role() == nsIAccessibleRole::ROLE_LINK &&
+    if (walkUpAcc->Role() == roles::LINK &&
         walkUpAcc->State() & states::LINKED) {
-      mIsLink = true;
-      mActionAcc = walkUpAcc;
-      return;
+        mIsLink = true;
+        mActionAcc = walkUpAcc;
+        return;
     }
 
     if (nsCoreUtils::HasClickListener(walkUpAcc->GetContent())) {
       mActionAcc = walkUpAcc;
       mIsOnclick = true;
       return;
     }
   }
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsEnumRoleAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsEnumRoleAccessible::
   nsEnumRoleAccessible(nsIContent *aNode, nsIWeakReference *aShell,
-                       PRUint32 aRole) :
+                       roles::Role aRole) :
   nsAccessibleWrap(aNode, aShell), mRole(aRole)
 {
 }
 
 NS_IMPL_ISUPPORTS_INHERITED0(nsEnumRoleAccessible, nsAccessible)
 
-PRUint32
+role
 nsEnumRoleAccessible::NativeRole()
 {
   return mRole;
 }
--- a/accessible/src/base/nsBaseWidgetAccessible.h
+++ b/accessible/src/base/nsBaseWidgetAccessible.h
@@ -119,21 +119,21 @@ protected:
 
 /**
  * A simple accessible that gets its enumerated role passed into constructor.
  */ 
 class nsEnumRoleAccessible : public nsAccessibleWrap
 {
 public:
   nsEnumRoleAccessible(nsIContent *aContent, nsIWeakReference *aShell,
-                       PRUint32 aRole);
+                       mozilla::a11y::role aRole);
   virtual ~nsEnumRoleAccessible() { }
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
 
 protected:
-  PRUint32 mRole;
+  mozilla::a11y::role mRole;
 };
 
 #endif  
--- a/accessible/src/base/nsDocAccessible.cpp
+++ b/accessible/src/base/nsDocAccessible.cpp
@@ -32,23 +32,24 @@
  * 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 "AccIterator.h"
-#include "States.h"
 #include "nsAccCache.h"
 #include "nsAccessibilityService.h"
 #include "nsAccTreeWalker.h"
 #include "nsAccUtils.h"
 #include "nsRootAccessible.h"
 #include "nsTextEquivUtils.h"
+#include "Role.h"
+#include "States.h"
 
 #include "nsIMutableArray.h"
 #include "nsICommandManager.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIDocument.h"
 #include "nsIDOMAttr.h"
 #include "nsIDOMCharacterData.h"
@@ -214,46 +215,46 @@ nsDocAccessible::GetName(nsAString& aNam
   if (aName.IsEmpty()) {   // Last resort: use URL
     rv = GetURL(aName);
   }
 
   return rv;
 }
 
 // nsAccessible public method
-PRUint32
+role
 nsDocAccessible::NativeRole()
 {
   nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
     nsCoreUtils::GetDocShellTreeItemFor(mDocument);
   if (docShellTreeItem) {
     nsCOMPtr<nsIDocShellTreeItem> sameTypeRoot;
     docShellTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(sameTypeRoot));
     PRInt32 itemType;
     docShellTreeItem->GetItemType(&itemType);
     if (sameTypeRoot == docShellTreeItem) {
       // Root of content or chrome tree
       if (itemType == nsIDocShellTreeItem::typeChrome)
-        return nsIAccessibleRole::ROLE_CHROME_WINDOW;
+        return roles::CHROME_WINDOW;
 
       if (itemType == nsIDocShellTreeItem::typeContent) {
 #ifdef MOZ_XUL
         nsCOMPtr<nsIXULDocument> xulDoc(do_QueryInterface(mDocument));
         if (xulDoc)
-          return nsIAccessibleRole::ROLE_APPLICATION;
+          return roles::APPLICATION;
 #endif
-        return nsIAccessibleRole::ROLE_DOCUMENT;
+        return roles::DOCUMENT;
       }
     }
     else if (itemType == nsIDocShellTreeItem::typeContent) {
-      return nsIAccessibleRole::ROLE_DOCUMENT;
+      return roles::DOCUMENT;
     }
   }
 
-  return nsIAccessibleRole::ROLE_PANE; // Fall back;
+  return roles::PANE; // Fall back;
 }
 
 // nsAccessible public method
 void
 nsDocAccessible::SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry)
 {
   NS_ASSERTION(mDocument, "No document during initialization!");
   if (!mDocument)
@@ -1837,17 +1838,17 @@ nsDocAccessible::UpdateTree(nsAccessible
 
   // Check to see if change occurred inside an alert, and fire an EVENT_ALERT
   // if it did.
   if (aIsInsert && !(updateFlags & eAlertAccessible)) {
     // XXX: tree traversal is perf issue, accessible should know if they are
     // children of alert accessible to avoid this.
     nsAccessible* ancestor = aContainer;
     while (ancestor) {
-      if (ancestor->ARIARole() == nsIAccessibleRole::ROLE_ALERT) {
+      if (ancestor->ARIARole() == roles::ALERT) {
         FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_ALERT,
                                    ancestor->GetNode());
         break;
       }
 
       // Don't climb above this document.
       if (ancestor == this)
         break;
@@ -1882,17 +1883,17 @@ nsDocAccessible::UpdateTreeInternal(nsAc
 
     // XXX: We don't look into children of hidden subtree to find hiding
     // menupopup (as we did prior bug 570275) because we don't do that when
     // menu is showing (and that's impossible until bug 606924 is fixed).
     // Nevertheless we should do this at least because layout coalesces
     // the changes before our processing and we may miss some menupopup
     // events. Now we just want to be consistent in content insertion/removal
     // handling.
-    if (aChild->ARIARole() == nsIAccessibleRole::ROLE_MENUPOPUP) {
+    if (aChild->ARIARole() == roles::MENUPOPUP) {
       nsRefPtr<AccEvent> event =
         new AccEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END, aChild);
 
       if (event)
         FireDelayedAccessibleEvent(event);
     }
   }
 
@@ -1902,23 +1903,23 @@ nsDocAccessible::UpdateTreeInternal(nsAc
     event = new AccShowEvent(aChild, node);
   else
     event = new AccHideEvent(aChild, node);
 
   if (event)
     FireDelayedAccessibleEvent(event);
 
   if (aIsInsert) {
-    PRUint32 ariaRole = aChild->ARIARole();
-    if (ariaRole == nsIAccessibleRole::ROLE_MENUPOPUP) {
+    roles::Role ariaRole = aChild->ARIARole();
+    if (ariaRole == roles::MENUPOPUP) {
       // Fire EVENT_MENUPOPUP_START if ARIA menu appears.
       FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_START,
                                  node, AccEvent::eRemoveDupes);
 
-    } else if (ariaRole == nsIAccessibleRole::ROLE_ALERT) {
+    } else if (ariaRole == roles::ALERT) {
       // Fire EVENT_ALERT if ARIA alert appears.
       updateFlags = eAlertAccessible;
       FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_ALERT, node,
                                  AccEvent::eRemoveDupes);
     }
 
     // If focused node has been shown then it means its frame was recreated
     // while it's focused. Fire focus event on new focused accessible. If
--- a/accessible/src/base/nsDocAccessible.h
+++ b/accessible/src/base/nsDocAccessible.h
@@ -109,17 +109,17 @@ public:
   virtual nsIFrame* GetFrame() const;
   virtual bool IsDefunct() const;
   virtual nsINode* GetNode() const { return mDocument; }
   virtual nsIDocument* GetDocumentNode() const { return mDocument; }
 
   // nsAccessible
   virtual void Description(nsString& aDescription);
   virtual nsAccessible* FocusedChild();
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
   virtual void ApplyARIAState(PRUint64* aState);
 
   virtual void SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry);
 
 #ifdef DEBUG_ACCDOCMGR
   virtual nsresult HandleAccEvent(AccEvent* aAccEvent);
 #endif
--- a/accessible/src/base/nsFormControlAccessible.cpp
+++ b/accessible/src/base/nsFormControlAccessible.cpp
@@ -33,22 +33,27 @@
  * 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 ***** */
 
 // NOTE: alphabetically ordered
+
+#include "Role.h"
+
 #include "nsFormControlAccessible.h"
 #include "nsIDOMHTMLFormElement.h"
 #include "nsIDOMHTMLInputElement.h"
 #include "nsIDOMXULElement.h"
 #include "nsIDOMXULControlElement.h"
 
+using namespace mozilla::a11y;
+
 ////////////////////////////////////////////////////////////////////////////////
 // ProgressMeterAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 template class ProgressMeterAccessible<1>;
 template class ProgressMeterAccessible<100>;
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -64,20 +69,20 @@ template<int Max>
 NS_IMPL_QUERY_INTERFACE_INHERITED1(ProgressMeterAccessible<Max>,
                                    nsFormControlAccessible,
                                    nsIAccessibleValue)
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessible
 
 template<int Max>
-PRUint32
+role
 ProgressMeterAccessible<Max>::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_PROGRESSBAR;
+  return roles::PROGRESSBAR;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // ProgressMeterAccessible<Max>: Widgets
 
 template<int Max>
 bool
 ProgressMeterAccessible<Max>::IsWidget() const
@@ -221,20 +226,20 @@ nsRadioButtonAccessible::DoAction(PRUint
 {
   if (aIndex != eAction_Click)
     return NS_ERROR_INVALID_ARG;
 
   DoCommand();
   return NS_OK;
 }
 
-PRUint32
+role
 nsRadioButtonAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_RADIOBUTTON;
+  return roles::RADIOBUTTON;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsRadioButtonAccessible: Widgets
 
 bool
 nsRadioButtonAccessible::IsWidget() const
 {
--- a/accessible/src/base/nsFormControlAccessible.h
+++ b/accessible/src/base/nsFormControlAccessible.h
@@ -57,17 +57,17 @@ public:
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIACCESSIBLEVALUE
 
   // nsIAccessible
   NS_IMETHOD GetValue(nsAString &aValue);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
 
   // Widgets
   virtual bool IsWidget() const;
 };
 
 /**
   * Generic class used for radio buttons.
   */
@@ -77,17 +77,17 @@ class nsRadioButtonAccessible : public n
 public:
   nsRadioButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
   enum { eAction_Click = 0 };
 
   // Widgets
   virtual bool IsWidget() const;
--- a/accessible/src/base/nsOuterDocAccessible.cpp
+++ b/accessible/src/base/nsOuterDocAccessible.cpp
@@ -33,19 +33,20 @@
  * 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 "nsOuterDocAccessible.h"
 
-#include "States.h"
 #include "nsAccUtils.h"
 #include "nsDocAccessible.h"
+#include "Role.h"
+#include "States.h"
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsOuterDocAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsOuterDocAccessible::
@@ -58,20 +59,20 @@ nsOuterDocAccessible::
 // nsISupports
 
 NS_IMPL_ISUPPORTS_INHERITED0(nsOuterDocAccessible,
                              nsAccessible)
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessible public (DON'T add methods here)
 
-PRUint32
+role
 nsOuterDocAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_INTERNAL_FRAME;
+  return roles::INTERNAL_FRAME;
 }
 
 nsAccessible*
 nsOuterDocAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
                                    EWhichChildAtPoint aWhichChild)
 {
   PRInt32 docX = 0, docY = 0, docWidth = 0, docHeight = 0;
   nsresult rv = GetBounds(&docX, &docY, &docWidth, &docHeight);
--- a/accessible/src/base/nsOuterDocAccessible.h
+++ b/accessible/src/base/nsOuterDocAccessible.h
@@ -61,17 +61,17 @@ public:
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD GetActionDescription(PRUint8 aIndex, nsAString& aDescription);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsAccessNode
   virtual void Shutdown();
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
   virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY,
                                      EWhichChildAtPoint aWhichChild);
 
   virtual void InvalidateChildren();
   virtual bool AppendChild(nsAccessible *aAccessible);
   virtual bool RemoveChild(nsAccessible *aAccessible);
 
--- a/accessible/src/base/nsRootAccessible.cpp
+++ b/accessible/src/base/nsRootAccessible.cpp
@@ -40,16 +40,17 @@
 #define CreateEvent CreateEventA
 #include "nsIDOMDocument.h"
 
 #include "nsAccessibilityService.h"
 #include "nsApplicationAccessibleWrap.h"
 #include "nsAccUtils.h"
 #include "nsCoreUtils.h"
 #include "Relation.h"
+#include "Role.h"
 #include "States.h"
 
 #include "mozilla/dom/Element.h"
 #include "nsHTMLSelectAccessible.h"
 #include "nsIAccessibleRelation.h"
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeItem.h"
 #include "nsIDocShellTreeNode.h"
@@ -137,28 +138,28 @@ nsRootAccessible::GetName(nsAString& aNa
       return NS_OK;
     }
   }
 
   nsCOMPtr<nsIDOMDocument> document = do_QueryInterface(mDocument);
   return document->GetTitle(aName);
 }
 
-PRUint32
+role
 nsRootAccessible::NativeRole()
 {
-  // If it's a <dialog> or <wizard>, use nsIAccessibleRole::ROLE_DIALOG instead
+  // If it's a <dialog> or <wizard>, use roles::DIALOG instead
   dom::Element *root = mDocument->GetRootElement();
   if (root) {
     nsCOMPtr<nsIDOMElement> rootElement(do_QueryInterface(root));
     if (rootElement) {
       nsAutoString name;
       rootElement->GetLocalName(name);
       if (name.EqualsLiteral("dialog") || name.EqualsLiteral("wizard")) {
-        return nsIAccessibleRole::ROLE_DIALOG; // Always at the root
+        return roles::DIALOG; // Always at the root
       }
     }
   }
 
   return nsDocAccessibleWrap::NativeRole();
 }
 
 // nsRootAccessible protected member
@@ -497,17 +498,17 @@ nsRootAccessible::ProcessDOMEvent(nsIDOM
 #endif
   if (eventType.EqualsLiteral("AlertActive")) {
     nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_ALERT, accessible);
   }
   else if (eventType.EqualsLiteral("popupshown")) {
     HandlePopupShownEvent(accessible);
   }
   else if (eventType.EqualsLiteral("DOMMenuInactive")) {
-    if (accessible->Role() == nsIAccessibleRole::ROLE_MENUPOPUP) {
+    if (accessible->Role() == roles::MENUPOPUP) {
       nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END,
                               accessible);
     }
   }
   else if (eventType.EqualsLiteral("DOMMenuItemActive")) {
     FocusMgr()->ActiveItemChanged(accessible);
     A11YDEBUG_FOCUS_ACTIVEITEMCHANGE_CAUSE("DOMMenuItemActive", accessible)
   }
@@ -644,43 +645,43 @@ nsRootAccessible::RelationByType(PRUint3
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // Protected members
 
 void
 nsRootAccessible::HandlePopupShownEvent(nsAccessible* aAccessible)
 {
-  PRUint32 role = aAccessible->Role();
+  roles::Role role = aAccessible->Role();
 
-  if (role == nsIAccessibleRole::ROLE_MENUPOPUP) {
+  if (role == roles::MENUPOPUP) {
     // Don't fire menupopup events for combobox and autocomplete lists.
     nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_START,
                             aAccessible);
     return;
   }
 
-  if (role == nsIAccessibleRole::ROLE_TOOLTIP) {
+  if (role == roles::TOOLTIP) {
     // There is a single <xul:tooltip> node which Mozilla moves around.
     // The accessible for it stays the same no matter where it moves. 
     // AT's expect to get an EVENT_SHOW for the tooltip. 
     // In event callback the tooltip's accessible will be ready.
     nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_SHOW, aAccessible);
     return;
   }
 
-  if (role == nsIAccessibleRole::ROLE_COMBOBOX_LIST) {
+  if (role == roles::COMBOBOX_LIST) {
     // Fire expanded state change event for comboboxes and autocompeletes.
     nsAccessible* combobox = aAccessible->Parent();
     if (!combobox)
       return;
 
-    PRUint32 comboboxRole = combobox->Role();
-    if (comboboxRole == nsIAccessibleRole::ROLE_COMBOBOX ||
-        comboboxRole == nsIAccessibleRole::ROLE_AUTOCOMPLETE) {
+    roles::Role comboboxRole = combobox->Role();
+    if (comboboxRole == roles::COMBOBOX || 
+	comboboxRole == roles::AUTOCOMPLETE) {
       nsRefPtr<AccEvent> event =
         new AccStateChangeEvent(combobox, states::EXPANDED, true);
       if (event)
         nsEventShell::FireEvent(event);
     }
   }
 }
 
--- a/accessible/src/base/nsRootAccessible.h
+++ b/accessible/src/base/nsRootAccessible.h
@@ -79,17 +79,17 @@ public:
   // nsIDOMEventListener
   NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
 
   // nsAccessNode
   virtual void Shutdown();
 
   // nsAccessible
   virtual Relation RelationByType(PRUint32 aType);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // nsRootAccessible
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_ROOTACCESSIBLE_IMPL_CID)
 
     nsCaretAccessible *GetCaretAccessible();
 
   /**
--- a/accessible/src/base/nsTextAccessible.cpp
+++ b/accessible/src/base/nsTextAccessible.cpp
@@ -35,31 +35,35 @@
  * 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 "nsTextAccessible.h"
 
+#include "Role.h"
+
+using namespace mozilla::a11y;
+
 ////////////////////////////////////////////////////////////////////////////////
 // nsTextAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsTextAccessible::
   nsTextAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsLinkableAccessible(aContent, aShell)
 {
   mFlags |= eTextLeafAccessible;
 }
 
-PRUint32
+role
 nsTextAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_TEXT_LEAF;
+  return roles::TEXT_LEAF;
 }
 
 void
 nsTextAccessible::AppendTextTo(nsAString& aText, PRUint32 aStartOffset,
                                PRUint32 aLength)
 {
   aText.Append(Substring(mText, aStartOffset, aLength));
 }
--- a/accessible/src/base/nsTextAccessible.h
+++ b/accessible/src/base/nsTextAccessible.h
@@ -45,17 +45,17 @@
  * Generic class used for text nodes.
  */
 class nsTextAccessible : public nsLinkableAccessible
 {
 public:
   nsTextAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual void AppendTextTo(nsAString& aText, PRUint32 aStartOffset = 0,
                             PRUint32 aLength = PR_UINT32_MAX);
 
   // nsTextAccessible
   void SetText(const nsAString& aText) { mText = aText; }
   const nsString& Text() const { return mText; }
 
 protected:
--- a/accessible/src/html/nsHTMLCanvasAccessible.cpp
+++ b/accessible/src/html/nsHTMLCanvasAccessible.cpp
@@ -32,21 +32,23 @@
  * 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 "nsHTMLCanvasAccessible.h"
 
+#include "Role.h"
+
 using namespace mozilla::a11y;
 
 nsHTMLCanvasAccessible::
   nsHTMLCanvasAccessible(nsIContent* aContent, nsIWeakReference* aShell) :
   nsHyperTextAccessible(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsHTMLCanvasAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_CANVAS;
+  return roles::CANVAS;
 }
--- a/accessible/src/html/nsHTMLCanvasAccessible.h
+++ b/accessible/src/html/nsHTMLCanvasAccessible.h
@@ -45,12 +45,12 @@
  */
 class nsHTMLCanvasAccessible : public nsHyperTextAccessible
 {
 public:
   nsHTMLCanvasAccessible(nsIContent* aContent, nsIWeakReference* aShell);
   virtual ~nsHTMLCanvasAccessible() { }
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
 };
 
 #endif
--- a/accessible/src/html/nsHTMLFormControlAccessible.cpp
+++ b/accessible/src/html/nsHTMLFormControlAccessible.cpp
@@ -33,20 +33,21 @@
  * 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 "nsHTMLFormControlAccessible.h"
 
-#include "Relation.h"
-#include "States.h"
 #include "nsAccUtils.h"
 #include "nsTextEquivUtils.h"
+#include "Relation.h"
+#include "Role.h"
+#include "States.h"
 
 #include "nsIAccessibleRelation.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMHTMLInputElement.h"
 #include "nsIDOMNSEditableElement.h"
 #include "nsIDOMHTMLFormElement.h"
 #include "nsIDOMHTMLLegendElement.h"
 #include "nsIDOMHTMLTextAreaElement.h"
@@ -67,20 +68,20 @@ using namespace mozilla::a11y;
 ////////////////////////////////////////////////////////////////////////////////
 
 nsHTMLCheckboxAccessible::
   nsHTMLCheckboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsFormControlAccessible(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsHTMLCheckboxAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_CHECKBUTTON;
+  return roles::CHECKBUTTON;
 }
 
 PRUint8
 nsHTMLCheckboxAccessible::ActionCount()
 {
   return 1;
 }
 
@@ -298,20 +299,20 @@ nsHTMLButtonAccessible::NativeState()
 
   nsEventStates elmState = mContent->AsElement()->State();
   if (elmState.HasState(NS_EVENT_STATE_DEFAULT))
     state |= states::DEFAULT;
 
   return state;
 }
 
-PRUint32
+role
 nsHTMLButtonAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_PUSHBUTTON;
+  return roles::PUSHBUTTON;
 }
 
 nsresult
 nsHTMLButtonAccessible::GetNameInternal(nsAString& aName)
 {
   nsAccessible::GetNameInternal(aName);
   if (!aName.IsEmpty())
     return NS_OK;
@@ -382,20 +383,20 @@ nsHTML4ButtonAccessible::DoAction(PRUint
 {
   if (aIndex != 0)
     return NS_ERROR_INVALID_ARG;
 
   DoCommand();
   return NS_OK;
 }
 
-PRUint32
+role
 nsHTML4ButtonAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_PUSHBUTTON;
+  return roles::PUSHBUTTON;
 }
 
 PRUint64
 nsHTML4ButtonAccessible::NativeState()
 {
   PRUint64 state = nsHyperTextAccessibleWrap::NativeState();
 
   state |= states::FOCUSABLE;
@@ -424,24 +425,25 @@ nsHTML4ButtonAccessible::IsWidget() cons
 nsHTMLTextFieldAccessible::
   nsHTMLTextFieldAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsHyperTextAccessibleWrap(aContent, aShell)
 {
 }
 
 NS_IMPL_ISUPPORTS_INHERITED3(nsHTMLTextFieldAccessible, nsAccessible, nsHyperTextAccessible, nsIAccessibleText, nsIAccessibleEditableText)
 
-PRUint32
+role
 nsHTMLTextFieldAccessible::NativeRole()
 {
   if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                             nsGkAtoms::password, eIgnoreCase)) {
-    return nsIAccessibleRole::ROLE_PASSWORD_TEXT;
+    return roles::PASSWORD_TEXT;
   }
-  return nsIAccessibleRole::ROLE_ENTRY;
+  
+  return roles::ENTRY;
 }
 
 nsresult
 nsHTMLTextFieldAccessible::GetNameInternal(nsAString& aName)
 {
   nsresult rv = nsAccessible::GetNameInternal(aName);
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -639,38 +641,37 @@ bool
 nsHTMLTextFieldAccessible::IsWidget() const
 {
   return true;
 }
 
 nsAccessible*
 nsHTMLTextFieldAccessible::ContainerWidget() const
 {
-  return mParent && mParent->Role() == nsIAccessibleRole::ROLE_AUTOCOMPLETE ?
-    mParent : nsnull;
+  return mParent && mParent->Role() == roles::AUTOCOMPLETE ? mParent : nsnull;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLGroupboxAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsHTMLFileInputAccessible::
 nsHTMLFileInputAccessible(nsIContent* aContent, nsIWeakReference* aShell) :
   nsHyperTextAccessibleWrap(aContent, aShell)
 {
   mFlags |= eHTMLFileInputAccessible;
 }
 
-PRUint32
+role
 nsHTMLFileInputAccessible::NativeRole()
 {
   // JAWS wants a text container, others don't mind. No specific role in
   // AT APIs.
-  return nsIAccessibleRole::ROLE_TEXT_CONTAINER;
+  return roles::TEXT_CONTAINER;
 }
 
 nsresult
 nsHTMLFileInputAccessible::HandleAccEvent(AccEvent* aEvent)
 {
   nsresult rv = nsHyperTextAccessibleWrap::HandleAccEvent(aEvent);
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -679,26 +680,26 @@ nsHTMLFileInputAccessible::HandleAccEven
   // state handling.
   AccStateChangeEvent* event = downcast_accEvent(aEvent);
   if (event &&
       (event->GetState() == states::BUSY ||
        event->GetState() == states::REQUIRED ||
        event->GetState() == states::HASPOPUP ||
        event->GetState() == states::INVALID)) {
     nsAccessible* input = GetChildAt(0);
-    if (input && input->Role() == nsIAccessibleRole::ROLE_ENTRY) {
+    if (input && input->Role() == roles::ENTRY) {
       nsRefPtr<AccStateChangeEvent> childEvent =
         new AccStateChangeEvent(input, event->GetState(),
                                 event->IsStateEnabled(),
                                 (event->IsFromUserInput() ? eFromUserInput : eNoUserInput));
       nsEventShell::FireEvent(childEvent);
     }
 
     nsAccessible* button = GetChildAt(1);
-    if (button && button->Role() == nsIAccessibleRole::ROLE_PUSHBUTTON) {
+    if (button && button->Role() == roles::PUSHBUTTON) {
       nsRefPtr<AccStateChangeEvent> childEvent =
         new AccStateChangeEvent(button, event->GetState(),
                                 event->IsStateEnabled(),
                                 (event->IsFromUserInput() ? eFromUserInput : eNoUserInput));
       nsEventShell::FireEvent(childEvent);
     }
   }
   return NS_OK;
@@ -709,20 +710,20 @@ nsHTMLFileInputAccessible::HandleAccEven
 ////////////////////////////////////////////////////////////////////////////////
 
 nsHTMLGroupboxAccessible::
   nsHTMLGroupboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsHyperTextAccessibleWrap(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsHTMLGroupboxAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_GROUPING;
+  return roles::GROUPING;
 }
 
 nsIContent*
 nsHTMLGroupboxAccessible::GetLegend()
 {
   for (nsIContent* legendContent = mContent->GetFirstChild(); legendContent;
        legendContent = legendContent->GetNextSibling()) {
     if (legendContent->NodeInfo()->Equals(nsGkAtoms::legend,
@@ -777,26 +778,26 @@ nsHTMLLegendAccessible::
 Relation
 nsHTMLLegendAccessible::RelationByType(PRUint32 aType)
 {
   Relation rel = nsHyperTextAccessibleWrap::RelationByType(aType);
   if (aType != nsIAccessibleRelation::RELATION_LABEL_FOR)
     return rel;
 
   nsAccessible* groupbox = Parent();
-  if (groupbox && groupbox->Role() == nsIAccessibleRole::ROLE_GROUPING)
+  if (groupbox && groupbox->Role() == roles::GROUPING)
     rel.AppendTarget(groupbox);
 
   return rel;
 }
 
-PRUint32
+role
 nsHTMLLegendAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_LABEL;
+  return roles::LABEL;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLFigureAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsHTMLFigureAccessible::
   nsHTMLFigureAccessible(nsIContent* aContent, nsIWeakReference* aShell) :
@@ -811,20 +812,20 @@ nsHTMLFigureAccessible::GetAttributesInt
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Expose figure xml-role.
   nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::xmlroles,
                          NS_LITERAL_STRING("figure"));
   return NS_OK;
 }
 
-PRUint32
+role
 nsHTMLFigureAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_FIGURE;
+  return roles::FIGURE;
 }
 
 nsresult
 nsHTMLFigureAccessible::GetNameInternal(nsAString& aName)
 {
   nsresult rv = nsHyperTextAccessibleWrap::GetNameInternal(aName);
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -869,20 +870,20 @@ nsHTMLFigureAccessible::Caption() const
 ////////////////////////////////////////////////////////////////////////////////
 
 nsHTMLFigcaptionAccessible::
   nsHTMLFigcaptionAccessible(nsIContent* aContent, nsIWeakReference* aShell) :
   nsHyperTextAccessibleWrap(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsHTMLFigcaptionAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_CAPTION;
+  return roles::CAPTION;
 }
 
 Relation
 nsHTMLFigcaptionAccessible::RelationByType(PRUint32 aType)
 {
   Relation rel = nsHyperTextAccessibleWrap::RelationByType(aType);
   if (aType != nsIAccessibleRelation::RELATION_LABEL_FOR)
     return rel;
--- a/accessible/src/html/nsHTMLFormControlAccessible.h
+++ b/accessible/src/html/nsHTMLFormControlAccessible.h
@@ -58,17 +58,17 @@ public:
 
   nsHTMLCheckboxAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
   // Widgets
   virtual bool IsWidget() const;
 };
@@ -103,17 +103,17 @@ public:
   nsHTMLButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 State();
   virtual PRUint64 NativeState();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
   // Widgets
   virtual bool IsWidget() const;
@@ -131,17 +131,17 @@ public:
 
   nsHTML4ButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
   // Widgets
   virtual bool IsWidget() const;
 };
@@ -166,17 +166,17 @@ public:
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsIAccessibleEditableText
   NS_IMETHOD GetAssociatedEditor(nsIEditor **aEditor);
 
   // nsAccessible
   virtual void ApplyARIAState(PRUint64* aState);
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 State();
   virtual PRUint64 NativeState();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
   // Widgets
   virtual bool IsWidget() const;
@@ -188,76 +188,76 @@ public:
  * Accessible for input@type="file" element.
  */
 class nsHTMLFileInputAccessible : public nsHyperTextAccessibleWrap
 {
 public:
   nsHTMLFileInputAccessible(nsIContent* aContent, nsIWeakReference* aShell);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual nsresult HandleAccEvent(AccEvent* aAccEvent);
 };
 
 /**
  * Accessible for HTML fieldset element.
  */
 class nsHTMLGroupboxAccessible : public nsHyperTextAccessibleWrap
 {
 public:
   nsHTMLGroupboxAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual Relation RelationByType(PRUint32 aType);
 
 protected:
   nsIContent* GetLegend();
 };
 
 
 /**
  * Accessible for HTML legend element.
  */
 class nsHTMLLegendAccessible : public nsHyperTextAccessibleWrap
 {
 public:
   nsHTMLLegendAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual Relation RelationByType(PRUint32 aType);
 };
 
 /**
  * Accessible for HTML5 figure element.
  */
 class nsHTMLFigureAccessible : public nsHyperTextAccessibleWrap
 {
 public:
   nsHTMLFigureAccessible(nsIContent* aContent, nsIWeakReference* aShell);
 
   // nsAccessible
   virtual nsresult GetAttributesInternal(nsIPersistentProperties* aAttributes);
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual Relation RelationByType(PRUint32 aType);
 
 protected:
   nsIContent* Caption() const;
 };
 
 
 /**
  * Accessible for HTML5 figcaption element.
  */
 class nsHTMLFigcaptionAccessible : public nsHyperTextAccessibleWrap
 {
 public:
   nsHTMLFigcaptionAccessible(nsIContent* aContent, nsIWeakReference* aShell);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual Relation RelationByType(PRUint32 aType);
 };
 
 #endif
--- a/accessible/src/html/nsHTMLImageAccessible.cpp
+++ b/accessible/src/html/nsHTMLImageAccessible.cpp
@@ -33,18 +33,19 @@
  * 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 "nsHTMLImageAccessible.h"
 
+#include "nsAccUtils.h"
+#include "Role.h"
 #include "States.h"
-#include "nsAccUtils.h"
 
 #include "imgIContainer.h"
 #include "imgIRequest.h"
 #include "nsIDocument.h"
 #include "nsIImageLoadingContent.h"
 #include "nsILink.h"
 #include "nsIPresShell.h"
 #include "nsIServiceManager.h"
@@ -116,20 +117,20 @@ nsHTMLImageAccessible::GetNameInternal(n
     // an empty 'alt' attribute was used to indicate a decorative image (see
     // nsIAccessible::name attribute for details).
     return NS_OK_EMPTY_NAME;
   }
 
   return NS_OK;
 }
 
-PRUint32
+role
 nsHTMLImageAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_GRAPHIC;
+  return roles::GRAPHIC;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessible
 
 PRUint8
 nsHTMLImageAccessible::ActionCount()
 {
--- a/accessible/src/html/nsHTMLImageAccessible.h
+++ b/accessible/src/html/nsHTMLImageAccessible.h
@@ -60,17 +60,17 @@ public:
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsIAccessibleImage
   NS_DECL_NSIACCESSIBLEIMAGE
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
 private:
   /**
--- a/accessible/src/html/nsHTMLImageMapAccessible.cpp
+++ b/accessible/src/html/nsHTMLImageMapAccessible.cpp
@@ -36,25 +36,27 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsHTMLImageMapAccessible.h"
 
 #include "nsAccUtils.h"
 #include "nsDocAccessible.h"
+#include "Role.h"
 
 #include "nsIDOMHTMLCollection.h"
 #include "nsIServiceManager.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMHTMLAreaElement.h"
 #include "nsIFrame.h"
 #include "nsImageFrame.h"
 #include "nsImageMap.h"
 
+using namespace mozilla::a11y;
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLImageMapAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsHTMLImageMapAccessible::
   nsHTMLImageMapAccessible(nsIContent *aContent, nsIWeakReference *aShell,
                            nsIDOMHTMLMapElement *aMapElm) :
   nsHTMLImageAccessibleWrap(aContent, aShell), mMapElement(aMapElm)
@@ -64,20 +66,20 @@ nsHTMLImageMapAccessible::
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLImageMapAccessible: nsISupports
 
 NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLImageMapAccessible, nsHTMLImageAccessible)
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLImageMapAccessible: nsAccessible public
 
-PRUint32
+role
 nsHTMLImageMapAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_IMAGE_MAP;
+  return roles::IMAGE_MAP;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLImageMapAccessible: HyperLinkAccessible
 
 PRUint32
 nsHTMLImageMapAccessible::AnchorCount()
 {
@@ -227,18 +229,18 @@ nsHTMLAreaAccessible::GetBounds(PRInt32 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLAreaAccessible: nsAccessible public
 
 PRUint64
 nsHTMLAreaAccessible::NativeState()
 {
   // Bypass the link states specialization for non links.
   if (mRoleMapEntry &&
-      mRoleMapEntry->role != nsIAccessibleRole::ROLE_NOTHING &&
-      mRoleMapEntry->role != nsIAccessibleRole::ROLE_LINK) {
+      mRoleMapEntry->role != roles::NOTHING &&
+      mRoleMapEntry->role != roles::LINK) {
     return nsAccessible::NativeState();
   }
 
   return nsHTMLLinkAccessible::NativeState();
 }
 
 nsAccessible*
 nsHTMLAreaAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
--- a/accessible/src/html/nsHTMLImageMapAccessible.h
+++ b/accessible/src/html/nsHTMLImageMapAccessible.h
@@ -53,17 +53,17 @@ class nsHTMLImageMapAccessible : public 
 public:
   nsHTMLImageMapAccessible(nsIContent *aContent, nsIWeakReference *aShell,
                            nsIDOMHTMLMapElement *aMapElm);
 
   // nsISupports and cycle collector
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
 
   // HyperLinkAccessible
   virtual PRUint32 AnchorCount();
   virtual nsAccessible* AnchorAt(PRUint32 aAnchorIndex);
   virtual already_AddRefed<nsIURI> AnchorURIAt(PRUint32 aAnchorIndex);
 
 protected:
 
--- a/accessible/src/html/nsHTMLLinkAccessible.cpp
+++ b/accessible/src/html/nsHTMLLinkAccessible.cpp
@@ -34,18 +34,19 @@
  * 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 "nsHTMLLinkAccessible.h"
 
+#include "nsCoreUtils.h"
+#include "Role.h"
 #include "States.h"
-#include "nsCoreUtils.h"
 
 #include "nsEventStates.h"
 #include "mozilla/dom/Element.h"
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLLinkAccessible
@@ -59,20 +60,20 @@ nsHTMLLinkAccessible::
 
 // Expose nsIAccessibleHyperLink unconditionally
 NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLLinkAccessible, nsHyperTextAccessibleWrap,
                              nsIAccessibleHyperLink)
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessible
 
-PRUint32
+role
 nsHTMLLinkAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_LINK;
+  return roles::LINK;
 }
 
 PRUint64
 nsHTMLLinkAccessible::NativeState()
 {
   PRUint64 states = nsHyperTextAccessibleWrap::NativeState();
 
   states  &= ~states::READONLY;
--- a/accessible/src/html/nsHTMLLinkAccessible.h
+++ b/accessible/src/html/nsHTMLLinkAccessible.h
@@ -51,17 +51,17 @@ public:
 
   // nsIAccessible
   NS_IMETHOD GetValue(nsAString& aValue);
 
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
   // HyperLinkAccessible
   virtual bool IsLink();
   virtual already_AddRefed<nsIURI> AnchorURIAt(PRUint32 aAnchorIndex);
--- a/accessible/src/html/nsHTMLSelectAccessible.cpp
+++ b/accessible/src/html/nsHTMLSelectAccessible.cpp
@@ -39,16 +39,17 @@
 #include "nsHTMLSelectAccessible.h"
 
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "nsDocAccessible.h"
 #include "nsEventShell.h"
 #include "nsIAccessibleEvent.h"
 #include "nsTextEquivUtils.h"
+#include "Role.h"
 #include "States.h"
 
 #include "nsCOMPtr.h"
 #include "nsIFrame.h"
 #include "nsIComboboxControlFrame.h"
 #include "nsIDocument.h"
 #include "nsIDOMHTMLInputElement.h"
 #include "nsIDOMHTMLOptGroupElement.h"
@@ -78,23 +79,23 @@ nsHTMLSelectListAccessible::NativeState(
 {
   PRUint64 state = nsAccessibleWrap::NativeState();
   if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::multiple))
     state |= states::MULTISELECTABLE | states::EXTSELECTABLE;
 
   return state;
 }
 
-PRUint32
+role
 nsHTMLSelectListAccessible::NativeRole()
 {
-  if (mParent && mParent->Role() == nsIAccessibleRole::ROLE_COMBOBOX)
-    return nsIAccessibleRole::ROLE_COMBOBOX_LIST;
+  if (mParent && mParent->Role() == roles::COMBOBOX)
+    return roles::COMBOBOX_LIST;
 
-  return nsIAccessibleRole::ROLE_LISTBOX;
+  return roles::LISTBOX;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLSelectListAccessible: SelectAccessible
 
 bool
 nsHTMLSelectListAccessible::IsSelect()
 {
@@ -212,23 +213,23 @@ nsHTMLSelectOptionAccessible::
   nsHTMLSelectOptionAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsHyperTextAccessibleWrap(aContent, aShell)
 {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLSelectOptionAccessible: nsAccessible public
 
-PRUint32
+role
 nsHTMLSelectOptionAccessible::NativeRole()
 {
-  if (mParent && mParent->Role() == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
-    return nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
+  if (mParent && mParent->Role() == roles::COMBOBOX_LIST)
+    return roles::COMBOBOX_OPTION;
 
-  return nsIAccessibleRole::ROLE_OPTION;
+  return roles::OPTION;
 }
 
 nsresult
 nsHTMLSelectOptionAccessible::GetNameInternal(nsAString& aName)
 {
   // CASE #1 -- great majority of the cases
   // find the label attribute - this is what the W3C says we should use
   mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::label, aName);
@@ -337,17 +338,17 @@ nsHTMLSelectOptionAccessible::NativeStat
 PRInt32
 nsHTMLSelectOptionAccessible::GetLevelInternal()
 {
   nsIContent *parentContent = mContent->GetParent();
 
   PRInt32 level =
     parentContent->NodeInfo()->Equals(nsGkAtoms::optgroup) ? 2 : 1;
 
-  if (level == 1 && Role() != nsIAccessibleRole::ROLE_HEADING)
+  if (level == 1 && Role() != roles::HEADING)
     level = 0; // In a single level list, the level is irrelevant
 
   return level;
 }
 
 void
 nsHTMLSelectOptionAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
                                                          PRInt32 *aSetSize)
@@ -454,20 +455,20 @@ nsHTMLSelectOptionAccessible::GetSelectS
 
 nsHTMLSelectOptGroupAccessible::
   nsHTMLSelectOptGroupAccessible(nsIContent *aContent,
                                  nsIWeakReference *aShell) :
   nsHTMLSelectOptionAccessible(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsHTMLSelectOptGroupAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_HEADING;
+  return roles::HEADING;
 }
 
 PRUint64
 nsHTMLSelectOptGroupAccessible::NativeState()
 {
   PRUint64 state = nsHTMLSelectOptionAccessible::NativeState();
 
   state &= ~(states::FOCUSABLE | states::SELECTABLE);
@@ -514,20 +515,20 @@ nsHTMLComboboxAccessible::
   nsAccessibleWrap(aContent, aShell)
 {
   mFlags |= eComboboxAccessible;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLComboboxAccessible: nsAccessible
 
-PRUint32
+role
 nsHTMLComboboxAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_COMBOBOX;
+  return roles::COMBOBOX;
 }
 
 void
 nsHTMLComboboxAccessible::InvalidateChildren()
 {
   nsAccessibleWrap::InvalidateChildren();
 
   if (mListAccessible)
--- a/accessible/src/html/nsHTMLSelectAccessible.h
+++ b/accessible/src/html/nsHTMLSelectAccessible.h
@@ -67,17 +67,17 @@ class nsIMutableArray;
 class nsHTMLSelectListAccessible : public nsAccessibleWrap
 {
 public:
   
   nsHTMLSelectListAccessible(nsIContent *aContent, nsIWeakReference *aShell);
   virtual ~nsHTMLSelectListAccessible() {}
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // SelectAccessible
   virtual bool IsSelect();
   virtual bool SelectAll();
   virtual bool UnselectAll();
 
   // Widgets
@@ -113,17 +113,17 @@ public:
 
   // nsIAccessible
   NS_IMETHOD DoAction(PRUint8 index);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD SetSelected(bool aSelect);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   virtual PRInt32 GetLevelInternal();
   virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
                                           PRInt32 *aSetSize);
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
@@ -155,17 +155,17 @@ public:
   nsHTMLSelectOptGroupAccessible(nsIContent *aContent, nsIWeakReference *aShell);
   virtual ~nsHTMLSelectOptGroupAccessible() {}
 
   // nsIAccessible
   NS_IMETHOD DoAction(PRUint8 index);  
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
 protected:
   // nsAccessible
   virtual void CacheChildren();
@@ -193,17 +193,17 @@ public:
   NS_IMETHOD DoAction(PRUint8 index);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
 
   // nsAccessNode
   virtual void Shutdown();
 
   // nsAccessible
   virtual void Description(nsString& aDescription);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
   virtual void InvalidateChildren();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
   // Widgets
   virtual bool IsWidget() const;
--- a/accessible/src/html/nsHTMLTableAccessible.cpp
+++ b/accessible/src/html/nsHTMLTableAccessible.cpp
@@ -34,23 +34,24 @@
  * 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 "nsHTMLTableAccessible.h"
 
-#include "Relation.h"
-#include "States.h"
 #include "nsAccessibilityService.h"
 #include "nsAccTreeWalker.h"
 #include "nsAccUtils.h"
 #include "nsDocAccessible.h"
 #include "nsTextEquivUtils.h"
+#include "Relation.h"
+#include "Role.h"
+#include "States.h"
 
 #include "nsIAccessibleRelation.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMRange.h"
 #include "nsISelectionPrivate.h"
 #include "nsINameSpaceManager.h"
 #include "nsIDOMNodeList.h"
@@ -85,20 +86,20 @@ nsHTMLTableCellAccessible::
 
 NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLTableCellAccessible,
                              nsHyperTextAccessible,
                              nsIAccessibleTableCell)
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLTableCellAccessible: nsAccessible implementation
 
-PRUint32
+role
 nsHTMLTableCellAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_CELL;
+  return roles::CELL;
 }
 
 PRUint64
 nsHTMLTableCellAccessible::NativeState()
 {
   PRUint64 state = nsHyperTextAccessibleWrap::NativeState();
 
   nsIFrame *frame = mContent->GetPrimaryFrame();
@@ -290,19 +291,18 @@ nsHTMLTableCellAccessible::IsSelected(bo
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLTableCellAccessible: protected implementation
 
 already_AddRefed<nsIAccessibleTable>
 nsHTMLTableCellAccessible::GetTableAccessible()
 {
   nsAccessible* parent = this;
   while ((parent = parent->Parent())) {
-    PRUint32 role = parent->Role();
-    if (role == nsIAccessibleRole::ROLE_TABLE ||
-        role == nsIAccessibleRole::ROLE_TREE_TABLE) {
+    roles::Role role = parent->Role();
+    if (role == roles::TABLE || role == roles::TREE_TABLE) {
       nsIAccessibleTable* tableAcc = nsnull;
       CallQueryInterface(parent, &tableAcc);
       return tableAcc;
     }
   }
 
   return nsnull;
 }
@@ -336,21 +336,21 @@ nsHTMLTableCellAccessible::GetHeaderCell
   // Get header cells from @header attribute.
   IDRefsIterator iter(mContent, nsGkAtoms::headers);
   nsIContent* headerCellElm = iter.NextElem();
   if (headerCellElm) {
     nsresult rv = NS_OK;
     nsCOMPtr<nsIMutableArray> headerCells =
       do_CreateInstance(NS_ARRAY_CONTRACTID, &rv);
     NS_ENSURE_SUCCESS(rv, rv);
-    PRUint32 desiredRole = -1;
+    roles::Role desiredRole = static_cast<roles::Role>(-1) ;
     if (aRowOrColumnHeaderCell == nsAccUtils::eRowHeaderCells)
-      desiredRole = nsIAccessibleRole::ROLE_ROWHEADER;
+      desiredRole = roles::ROWHEADER;
     else if (aRowOrColumnHeaderCell == nsAccUtils::eColumnHeaderCells)
-      desiredRole = nsIAccessibleRole::ROLE_COLUMNHEADER;
+      desiredRole = roles::COLUMNHEADER;
 
     do {
       nsAccessible* headerCell =
         GetAccService()->GetAccessibleInWeakShell(headerCellElm, mWeakShell);
 
       if (headerCell && headerCell->Role() == desiredRole)
         headerCells->AppendElement(static_cast<nsIAccessible*>(headerCell),
                                    false);
@@ -380,62 +380,60 @@ nsHTMLTableHeaderCellAccessible::
                                   nsIWeakReference *aShell) :
   nsHTMLTableCellAccessible(aContent, aShell)
 {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLTableHeaderAccessible: nsAccessible implementation
 
-PRUint32
+role
 nsHTMLTableHeaderCellAccessible::NativeRole()
 {
   // Check value of @scope attribute.
   static nsIContent::AttrValuesArray scopeValues[] =
     {&nsGkAtoms::col, &nsGkAtoms::row, nsnull};
   PRInt32 valueIdx = 
     mContent->FindAttrValueIn(kNameSpaceID_None, nsGkAtoms::scope,
                               scopeValues, eCaseMatters);
 
   switch (valueIdx) {
     case 0:
-      return nsIAccessibleRole::ROLE_COLUMNHEADER;
+      return roles::COLUMNHEADER;
     case 1:
-      return nsIAccessibleRole::ROLE_ROWHEADER;
+      return roles::ROWHEADER;
   }
 
   // Assume it's columnheader if there are headers in siblings, oterwise
   // rowheader.
   nsIContent* parentContent = mContent->GetParent();
   if (!parentContent) {
     NS_ERROR("Deattached content on alive accessible?");
-    return nsIAccessibleRole::ROLE_NOTHING;
+    return roles::NOTHING;
   }
 
   for (nsIContent* siblingContent = mContent->GetPreviousSibling(); siblingContent;
        siblingContent = siblingContent->GetPreviousSibling()) {
     if (siblingContent->IsElement()) {
-      if (nsCoreUtils::IsHTMLTableHeader(siblingContent))
-        return nsIAccessibleRole::ROLE_COLUMNHEADER;
-      return nsIAccessibleRole::ROLE_ROWHEADER;
+      return nsCoreUtils::IsHTMLTableHeader(siblingContent) ? 
+	     roles::COLUMNHEADER : roles::ROWHEADER;
     }
   }
 
   for (nsIContent* siblingContent = mContent->GetNextSibling(); siblingContent;
        siblingContent = siblingContent->GetNextSibling()) {
     if (siblingContent->IsElement()) {
-      if (nsCoreUtils::IsHTMLTableHeader(siblingContent))
-        return nsIAccessibleRole::ROLE_COLUMNHEADER;
-      return nsIAccessibleRole::ROLE_ROWHEADER;
+      return nsCoreUtils::IsHTMLTableHeader(siblingContent) ? 
+	     roles::COLUMNHEADER : roles::ROWHEADER;
     }
   }
 
   // No elements in siblings what means the table has one column only. Therefore
   // it should be column header.
-  return nsIAccessibleRole::ROLE_COLUMNHEADER;
+  return roles::COLUMNHEADER;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLTableAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsHTMLTableAccessible::
   nsHTMLTableAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
@@ -459,29 +457,29 @@ nsHTMLTableAccessible::CacheChildren()
   // Move caption accessible so that it's the first child. Check for the first
   // caption only, because nsAccessibilityService ensures we don't create
   // accessibles for the other captions, since only the first is actually
   // visible.
   nsAccTreeWalker walker(mWeakShell, mContent, GetAllowsAnonChildAccessibles());
 
   nsAccessible* child = nsnull;
   while ((child = walker.NextChild())) {
-    if (child->Role() == nsIAccessibleRole::ROLE_CAPTION) {
+    if (child->Role() == roles::CAPTION) {
       InsertChildAt(0, child);
       while ((child = walker.NextChild()) && AppendChild(child));
       break;
     }
     AppendChild(child);
   }
 }
 
-PRUint32
+role
 nsHTMLTableAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_TABLE;
+  return roles::TABLE;
 }
 
 PRUint64
 nsHTMLTableAccessible::NativeState()
 {
   return nsAccessible::NativeState() | states::READONLY;
 }
 
@@ -1392,20 +1390,18 @@ nsHTMLTableAccessible::IsProbablyForLayo
     PRUint64 docState = docAccessible->State();
     if (docState & states::EDITABLE) {  // Need to see all elements while document is being edited
       RETURN_LAYOUT_ANSWER(false, "In editable document");
     }
   }
 
   // Check to see if an ARIA role overrides the role from native markup,
   // but for which we still expose table semantics (treegrid, for example).
-  bool hasNonTableRole = (Role() != nsIAccessibleRole::ROLE_TABLE);
-  if (hasNonTableRole) {
+  if (Role() != roles::TABLE) 
     RETURN_LAYOUT_ANSWER(false, "Has role attribute");
-  }
 
   if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::role)) {
     // Role attribute is present, but overridden roles have already been dealt with.
     // Only landmarks and other roles that don't override the role from native
     // markup are left to deal with here.
     RETURN_LAYOUT_ANSWER(false, "Has role attribute, weak role, and role is table");
   }
 
@@ -1421,21 +1417,18 @@ nsHTMLTableAccessible::IsProbablyForLayo
   // Check for legitimate data table attributes.
   nsAutoString summary;
   if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::summary, summary) &&
       !summary.IsEmpty())
     RETURN_LAYOUT_ANSWER(false, "Has summary -- legitimate table structures");
 
   // Check for legitimate data table elements.
   nsAccessible* caption = FirstChild();
-  if (caption && caption->Role() == nsIAccessibleRole::ROLE_CAPTION &&
-      caption->HasChildren()) {
-    RETURN_LAYOUT_ANSWER(false,
-                               "Not empty caption -- legitimate table structures");
-  }
+  if (caption && caption->Role() == roles::CAPTION && caption->HasChildren()) 
+    RETURN_LAYOUT_ANSWER(false, "Not empty caption -- legitimate table structures");
 
   for (nsIContent* childElm = mContent->GetFirstChild(); childElm;
        childElm = childElm->GetNextSibling()) {
     if (!childElm->IsHTML())
       continue;
 
     if (childElm->Tag() == nsGkAtoms::col ||
         childElm->Tag() == nsGkAtoms::colgroup ||
@@ -1459,33 +1452,33 @@ nsHTMLTableAccessible::IsProbablyForLayo
         }
       }
     }
   }
 
   if (HasDescendant(NS_LITERAL_STRING("table"))) {
     RETURN_LAYOUT_ANSWER(true, "Has a nested table within it");
   }
-  
+
   // If only 1 column or only 1 row, it's for layout
   PRInt32 columns, rows;
   GetColumnCount(&columns);
   if (columns <=1) {
     RETURN_LAYOUT_ANSWER(true, "Has only 1 column");
   }
   GetRowCount(&rows);
   if (rows <=1) {
     RETURN_LAYOUT_ANSWER(true, "Has only 1 row");
   }
 
   // Check for many columns
   if (columns >= 5) {
     RETURN_LAYOUT_ANSWER(false, ">=5 columns");
   }
-  
+
   // Now we know there are 2-4 columns and 2 or more rows
   // Check to see if there are visible borders on the cells
   // XXX currently, we just check the first cell -- do we really need to do more?
   nsCOMPtr<nsIDOMElement> cellElement;
   nsresult rv = GetCellAt(0, 0, *getter_AddRefs(cellElement));
   NS_ENSURE_SUCCESS(rv, NS_ERROR_FAILURE);
 
   nsCOMPtr<nsIContent> cellContent(do_QueryInterface(cellElement));
@@ -1587,13 +1580,13 @@ nsHTMLCaptionAccessible::RelationByType(
 {
   Relation rel = nsHyperTextAccessible::RelationByType(aType);
   if (aType == nsIAccessibleRelation::RELATION_LABEL_FOR)
     rel.AppendTarget(Parent());
 
   return rel;
 }
 
-PRUint32
+role
 nsHTMLCaptionAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_CAPTION;
+  return roles::CAPTION;
 }
--- a/accessible/src/html/nsHTMLTableAccessible.h
+++ b/accessible/src/html/nsHTMLTableAccessible.h
@@ -56,17 +56,17 @@ public:
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessibleTableCell
   NS_DECL_NSIACCESSIBLETABLECELL
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
 
 protected:
   /**
    * Return host table accessible.
    */
   already_AddRefed<nsIAccessibleTable> GetTableAccessible();
@@ -94,17 +94,17 @@ protected:
  */
 class nsHTMLTableHeaderCellAccessible : public nsHTMLTableCellAccessible
 {
 public:
   nsHTMLTableHeaderCellAccessible(nsIContent *aContent,
                                   nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
 };
 
 
 /**
  * HTML table accessible (html:table).
  */
 
 // To turn on table debugging descriptions define SHOW_LAYOUT_HEURISTIC
@@ -128,27 +128,26 @@ public:
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIACCESSIBLETABLE
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_TABLEACCESSIBLE_IMPL_CID)
 
   // nsAccessible
   virtual void Description(nsString& aDescription);
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
   virtual Relation RelationByType(PRUint32 aRelationType);
 
   // TableAccessible
   inline nsAccessible* Caption() const
   {
     nsAccessible* child = mChildren.SafeElementAt(0, nsnull);
-    return child && child->Role() == nsIAccessibleRole::ROLE_CAPTION ?
-      child : nsnull;
+    return child && child->Role() == mozilla::a11y::roles::CAPTION ? child : nsnull;
   }
 
   // nsHTMLTableAccessible
 
   /**
    * Retun cell element at the given row and column index.
    */
   nsresult GetCellAt(PRInt32 aRowIndex, PRInt32 aColIndex,
@@ -213,13 +212,13 @@ class nsHTMLCaptionAccessible : public n
 {
 public:
   nsHTMLCaptionAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
     nsHyperTextAccessibleWrap(aContent, aShell) { }
 
   // nsIAccessible
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual Relation RelationByType(PRUint32 aRelationType);
 };
 
 #endif  
--- a/accessible/src/html/nsHTMLTextAccessible.cpp
+++ b/accessible/src/html/nsHTMLTextAccessible.cpp
@@ -38,16 +38,17 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsHTMLTextAccessible.h"
 
 #include "nsDocAccessible.h"
 #include "nsAccUtils.h"
 #include "nsTextEquivUtils.h"
 #include "Relation.h"
+#include "Role.h"
 #include "States.h"
 
 #include "nsIAccessibleRelation.h"
 #include "nsIFrame.h"
 #include "nsPresContext.h"
 #include "nsBlockFrame.h"
 #include "nsISelection.h"
 #include "nsISelectionController.h"
@@ -70,25 +71,24 @@ NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLTextA
 NS_IMETHODIMP
 nsHTMLTextAccessible::GetName(nsAString& aName)
 {
   // Text node, ARIA can't be used.
   aName = mText;
   return NS_OK;
 }
 
-PRUint32
+role
 nsHTMLTextAccessible::NativeRole()
 {
   nsIFrame *frame = GetFrame();
   // Don't return on null frame -- we still return a role
   // after accessible is shutdown/DEFUNCT
-  if (frame && frame->IsGeneratedContentFrame()) {
-    return nsIAccessibleRole::ROLE_STATICTEXT;
-  }
+  if (frame && frame->IsGeneratedContentFrame()) 
+    return roles::STATICTEXT;
 
   return nsTextAccessible::NativeRole();
 }
 
 PRUint64
 nsHTMLTextAccessible::NativeState()
 {
   PRUint64 state = nsTextAccessible::NativeState();
@@ -102,17 +102,17 @@ nsHTMLTextAccessible::NativeState()
   }
 
   return state;
 }
 
 nsresult
 nsHTMLTextAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
 {
-  if (NativeRole() == nsIAccessibleRole::ROLE_STATICTEXT) {
+  if (NativeRole() == roles::STATICTEXT) {
     nsAutoString oldValueUnused;
     aAttributes->SetStringProperty(NS_LITERAL_CSTRING("auto-generated"),
                                   NS_LITERAL_STRING("true"), oldValueUnused);
   }
 
   return NS_OK;
 }
 
@@ -122,37 +122,37 @@ nsHTMLTextAccessible::GetAttributesInter
 ////////////////////////////////////////////////////////////////////////////////
 
 nsHTMLHRAccessible::
   nsHTMLHRAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsLeafAccessible(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsHTMLHRAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_SEPARATOR;
+  return roles::SEPARATOR;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLBRAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsHTMLBRAccessible::
   nsHTMLBRAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsLeafAccessible(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsHTMLBRAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_WHITESPACE;
+  return roles::WHITESPACE;
 }
 
 PRUint64
 nsHTMLBRAccessible::NativeState()
 {
   return states::READONLY;
 }
 
@@ -176,20 +176,20 @@ nsHTMLLabelAccessible::
 NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLLabelAccessible, nsHyperTextAccessible)
 
 nsresult
 nsHTMLLabelAccessible::GetNameInternal(nsAString& aName)
 {
   return nsTextEquivUtils::GetNameFromSubtree(this, aName);
 }
 
-PRUint32
+role
 nsHTMLLabelAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_LABEL;
+  return roles::LABEL;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLOuputAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsHTMLOutputAccessible::
   nsHTMLOutputAccessible(nsIContent* aContent, nsIWeakReference* aShell) :
@@ -204,20 +204,20 @@ nsHTMLOutputAccessible::RelationByType(P
 {
   Relation rel = nsAccessibleWrap::RelationByType(aType);
   if (aType == nsIAccessibleRelation::RELATION_CONTROLLED_BY)
     rel.AppendIter(new IDRefsIterator(mContent, nsGkAtoms::_for));
 
   return rel;
 }
 
-PRUint32
+role
 nsHTMLOutputAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_SECTION;
+  return roles::SECTION;
 }
 
 nsresult
 nsHTMLOutputAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
 {
   nsresult rv = nsAccessibleWrap::GetAttributesInternal(aAttributes);
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -251,20 +251,20 @@ NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLLIAcc
 void
 nsHTMLLIAccessible::Shutdown()
 {
   mBullet = nsnull;
 
   nsHyperTextAccessibleWrap::Shutdown();
 }
 
-PRUint32
+role
 nsHTMLLIAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_LISTITEM;
+  return roles::LISTITEM;
 }
 
 PRUint64
 nsHTMLLIAccessible::NativeState()
 {
   return nsHyperTextAccessibleWrap::NativeState() | states::READONLY;
 }
 
@@ -361,20 +361,20 @@ nsHTMLListBulletAccessible::GetName(nsAS
 
     // Append space otherwise bullets are jammed up against list text.
     aName.Append(' ');
   }
 
   return NS_OK;
 }
 
-PRUint32
+role
 nsHTMLListBulletAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_STATICTEXT;
+  return roles::STATICTEXT;
 }
 
 PRUint64
 nsHTMLListBulletAccessible::NativeState()
 {
   PRUint64 state = nsLeafAccessible::NativeState();
 
   state &= ~states::FOCUSABLE;
@@ -402,20 +402,20 @@ nsHTMLListBulletAccessible::AppendTextTo
 nsHTMLListAccessible::
   nsHTMLListAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsHyperTextAccessibleWrap(aContent, aShell)
 {
 }
 
 NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLListAccessible, nsHyperTextAccessible)
 
-PRUint32
+role
 nsHTMLListAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_LIST;
+  return roles::LIST;
 }
 
 PRUint64
 nsHTMLListAccessible::NativeState()
 {
   return nsHyperTextAccessibleWrap::NativeState() | states::READONLY;
 }
 
--- a/accessible/src/html/nsHTMLTextAccessible.h
+++ b/accessible/src/html/nsHTMLTextAccessible.h
@@ -55,73 +55,73 @@ public:
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
   NS_IMETHOD GetName(nsAString& aName);
 
   // nsAccessible
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 };
 
 /**
  * Used for HTML hr element.
  */
 class nsHTMLHRAccessible : public nsLeafAccessible
 {
 public:
   nsHTMLHRAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
 };
 
 /**
  * Used for HTML br element.
  */
 class nsHTMLBRAccessible : public nsLeafAccessible
 {
 public:
   nsHTMLBRAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 };
 
 /**
  * Used for HTML label element.
  */
 class nsHTMLLabelAccessible : public nsHyperTextAccessibleWrap
 {
 public:
   nsHTMLLabelAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
 };
 
 /**
  * Used for HTML output element.
  */
 class nsHTMLOutputAccessible : public nsHyperTextAccessibleWrap
 {
 public:
   nsHTMLOutputAccessible(nsIContent* aContent, nsIWeakReference* aShell);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual nsresult GetAttributesInternal(nsIPersistentProperties* aAttributes);
   virtual Relation RelationByType(PRUint32 aType);
 };
 
 /**
  * Used for bullet of HTML list item element (for example, HTML li).
  */
 class nsHTMLListBulletAccessible : public nsLeafAccessible
@@ -131,17 +131,17 @@ public:
 
   // nsIAccessible
   NS_IMETHOD GetName(nsAString& aName);
 
   // nsAccessNode
   virtual bool IsPrimaryForNode() const;
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
   virtual void AppendTextTo(nsAString& aText, PRUint32 aStartOffset = 0,
                             PRUint32 aLength = PR_UINT32_MAX);
 };
 
 /**
  * Used for HTML list (like HTML ul).
  */
@@ -149,17 +149,17 @@ class nsHTMLListAccessible : public nsHy
 {
 public:
   nsHTMLListAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 };
 
 /**
  * Used for HTML list item (e.g. HTML li).
  */
 class nsHTMLLIAccessible : public nsHyperTextAccessibleWrap
 {
@@ -171,17 +171,17 @@ public:
 
   // nsAccessNode
   virtual void Shutdown();
 
   // nsIAccessible
   NS_IMETHOD GetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // nsHTMLLIAccessible
   void UpdateBullet(bool aHasBullet);
 
 protected:
   // nsAccessible
   virtual void CacheChildren();
--- a/accessible/src/html/nsHyperTextAccessible.cpp
+++ b/accessible/src/html/nsHyperTextAccessible.cpp
@@ -34,20 +34,21 @@
  * 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 "nsHyperTextAccessible.h"
 
-#include "States.h"
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "nsTextAttrs.h"
+#include "Role.h"
+#include "States.h"
 
 #include "nsIClipboard.h"
 #include "nsFocusManager.h"
 #include "nsIDOMCharacterData.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMRange.h"
 #include "nsIDOMXULDocument.h"
 #include "nsIEditingSession.h"
@@ -85,21 +86,21 @@ nsresult nsHyperTextAccessible::QueryInt
 
   if (aIID.Equals(NS_GET_IID(nsHyperTextAccessible))) {
     *aInstancePtr = static_cast<nsHyperTextAccessible*>(this);
     NS_ADDREF_THIS();
     return NS_OK;
   }
 
   if (mRoleMapEntry &&
-      (mRoleMapEntry->role == nsIAccessibleRole::ROLE_GRAPHIC ||
-       mRoleMapEntry->role == nsIAccessibleRole::ROLE_IMAGE_MAP ||
-       mRoleMapEntry->role == nsIAccessibleRole::ROLE_SLIDER ||
-       mRoleMapEntry->role == nsIAccessibleRole::ROLE_PROGRESSBAR ||
-       mRoleMapEntry->role == nsIAccessibleRole::ROLE_SEPARATOR)) {
+      (mRoleMapEntry->role == roles::GRAPHIC ||
+       mRoleMapEntry->role == roles::IMAGE_MAP ||
+       mRoleMapEntry->role == roles::SLIDER ||
+       mRoleMapEntry->role == roles::PROGRESSBAR ||
+       mRoleMapEntry->role == roles::SEPARATOR)) {
     // ARIA roles that these interfaces are not appropriate for
     return nsAccessible::QueryInterface(aIID, aInstancePtr);
   }
 
   if (aIID.Equals(NS_GET_IID(nsIAccessibleText))) {
     *aInstancePtr = static_cast<nsIAccessibleText*>(this);
     NS_ADDREF_THIS();
     return NS_OK;
@@ -115,56 +116,52 @@ nsresult nsHyperTextAccessible::QueryInt
     *aInstancePtr = static_cast<nsIAccessibleEditableText*>(this);
     NS_ADDREF_THIS();
     return NS_OK;
   }
 
   return nsAccessible::QueryInterface(aIID, aInstancePtr);
 }
 
-PRUint32
+role
 nsHyperTextAccessible::NativeRole()
 {
   nsIAtom *tag = mContent->Tag();
 
   if (tag == nsGkAtoms::form)
-    return nsIAccessibleRole::ROLE_FORM;
-
-  if (tag == nsGkAtoms::blockquote ||
-      tag == nsGkAtoms::div ||
-      tag == nsGkAtoms::nav)
-    return nsIAccessibleRole::ROLE_SECTION;
+    return roles::FORM;
 
-  if (tag == nsGkAtoms::h1 ||
-      tag == nsGkAtoms::h2 ||
-      tag == nsGkAtoms::h3 ||
-      tag == nsGkAtoms::h4 ||
-      tag == nsGkAtoms::h5 ||
-      tag == nsGkAtoms::h6)
-    return nsIAccessibleRole::ROLE_HEADING;
+  if (tag == nsGkAtoms::blockquote || tag == nsGkAtoms::div ||
+      tag == nsGkAtoms::nav)
+    return roles::SECTION;
+
+  if (tag == nsGkAtoms::h1 || tag == nsGkAtoms::h2 ||
+      tag == nsGkAtoms::h3 || tag == nsGkAtoms::h4 ||
+      tag == nsGkAtoms::h5 || tag == nsGkAtoms::h6)
+    return roles::HEADING;
 
   if (tag == nsGkAtoms::article)
-    return nsIAccessibleRole::ROLE_DOCUMENT;
+    return roles::DOCUMENT;
         
   // Deal with html landmark elements
   if (tag == nsGkAtoms::header)
-    return nsIAccessibleRole::ROLE_HEADER;
+    return roles::HEADER;
 
   if (tag == nsGkAtoms::footer)
-    return nsIAccessibleRole::ROLE_FOOTER;
+    return roles::FOOTER;
 
   if (tag == nsGkAtoms::aside)
-    return nsIAccessibleRole::ROLE_NOTE;
+    return roles::NOTE;
 
   // Treat block frames as paragraphs
   nsIFrame *frame = GetFrame();
   if (frame && frame->GetType() == nsGkAtoms::blockFrame)
-    return nsIAccessibleRole::ROLE_PARAGRAPH;
+    return roles::PARAGRAPH;
 
-  return nsIAccessibleRole::ROLE_TEXT_CONTAINER; // In ATK this works
+  return roles::TEXT_CONTAINER; // In ATK this works
 }
 
 PRUint64
 nsHyperTextAccessible::NativeState()
 {
   PRUint64 states = nsAccessibleWrap::NativeState();
 
   nsCOMPtr<nsIEditor> editor;
@@ -275,17 +272,17 @@ nsHyperTextAccessible::GetPosAndText(PRI
   }
   if (aEndOffset == nsIAccessibleText::TEXT_OFFSET_CARET) {
     GetCaretOffset(&aEndOffset);
   }
 
   PRInt32 startOffset = aStartOffset;
   PRInt32 endOffset = aEndOffset;
   // XXX this prevents text interface usage on <input type="password">
-  bool isPassword = (Role() == nsIAccessibleRole::ROLE_PASSWORD_TEXT);
+  bool isPassword = (Role() == roles::PASSWORD_TEXT);
 
   // Clear out parameters and set up loop
   if (aText) {
     aText->Truncate();
   }
   if (endOffset < 0) {
     const PRInt32 kMaxTextLength = 32767;
     endOffset = kMaxTextLength; // Max end offset
@@ -833,29 +830,29 @@ nsHyperTextAccessible::GetRelativeOffset
     // If we reached the end during search, this means we didn't find the DOM point
     // and we're actually at the start of the paragraph
     hyperTextOffset = 0;
   }  
   else if (aAmount == eSelectBeginLine) {
     nsAccessible *firstChild = mChildren.SafeElementAt(0, nsnull);
     // For line selection with needsStart, set start of line exactly to line break
     if (pos.mContentOffset == 0 && firstChild &&
-        firstChild->Role() == nsIAccessibleRole::ROLE_STATICTEXT &&
+        firstChild->Role() == roles::STATICTEXT &&
         static_cast<PRInt32>(nsAccUtils::TextLength(firstChild)) == hyperTextOffset) {
       // XXX Bullet hack -- we should remove this once list bullets use anonymous content
       hyperTextOffset = 0;
     }
     if (!aNeedsStart && hyperTextOffset > 0) {
       -- hyperTextOffset;
     }
   }
   else if (aAmount == eSelectEndLine && finalAccessible) { 
     // If not at very end of hypertext, we may need change the end of line offset by 1, 
     // to make sure we are in the right place relative to the line ending
-    if (finalAccessible->Role() == nsIAccessibleRole::ROLE_WHITESPACE) {  // Landed on <br> hard line break
+    if (finalAccessible->Role() == roles::WHITESPACE) {  // Landed on <br> hard line break
       // if aNeedsStart, set end of line exactly 1 character past line break
       // XXX It would be cleaner if we did not have to have the hard line break check,
       // and just got the correct results from PeekOffset() for the <br> case -- the returned offset should
       // come after the new line, as it does in other cases.
       ++ hyperTextOffset;  // Get past hard line break
     }
     // We are now 1 character past the line break
     if (!aNeedsStart) {
@@ -1003,17 +1000,17 @@ nsresult nsHyperTextAccessible::GetTextH
     // Start moving forward from the start so that we don't get 
     // 2 words/lines if the offset occurred on whitespace boundary
     // Careful, startOffset and endOffset are passed by reference to GetPosAndText() and changed
     // For BOUNDARY_LINE_END, make sure we start of this line
     startOffset = endOffset = finalStartOffset + (aBoundaryType == BOUNDARY_LINE_END);
     nsRefPtr<nsAccessible> endAcc;
     nsIFrame *endFrame = GetPosAndText(startOffset, endOffset, nsnull, nsnull,
                                        nsnull, getter_AddRefs(endAcc));
-    if (endAcc && endAcc->Role() == nsIAccessibleRole::ROLE_STATICTEXT) {
+    if (endAcc && endAcc->Role() == roles::STATICTEXT) {
       // Static text like list bullets will ruin our forward calculation,
       // since the caret cannot be in the static text. Start just after the static text.
       startOffset = endOffset = finalStartOffset +
                                 (aBoundaryType == BOUNDARY_LINE_END) +
                                 nsAccUtils::TextLength(endAcc);
 
       endFrame = GetPosAndText(startOffset, endOffset, nsnull, nsnull,
                                nsnull, getter_AddRefs(endAcc));
--- a/accessible/src/html/nsHyperTextAccessible.h
+++ b/accessible/src/html/nsHyperTextAccessible.h
@@ -82,17 +82,17 @@ public:
   NS_DECL_NSIACCESSIBLEHYPERTEXT
   NS_DECL_NSIACCESSIBLEEDITABLETEXT
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_HYPERTEXTACCESSIBLE_IMPL_CID)
 
   // nsAccessible
   virtual PRInt32 GetLevelInternal();
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   virtual void InvalidateChildren();
   virtual bool RemoveChild(nsAccessible* aAccessible);
 
   // nsHyperTextAccessible (static helper method)
 
   // Convert content offset to rendered text offset  
--- a/accessible/src/mac/mozAccessible.mm
+++ b/accessible/src/mac/mozAccessible.mm
@@ -47,16 +47,17 @@
 #include "nsCoord.h"
 #include "nsObjCExceptions.h"
 
 #include "nsIAccessible.h"
 #include "nsIAccessibleRelation.h"
 #include "nsIAccessibleText.h"
 #include "nsIAccessibleEditableText.h"
 #include "Relation.h"
+#include "Role.h"
 
 #include "nsAccessNode.h"
 #include "nsRootAccessible.h"
 
 #include "mozilla/Services.h"
 
 using namespace mozilla;
 using namespace mozilla::a11y;
@@ -154,17 +155,17 @@ GetLocalizedString(const nsString& aStri
 
   if ((self = [super init])) {
     mGeckoAccessible = geckoAccessible;
     mIsExpired = NO;
     mRole = geckoAccessible->Role();
     
     // Check for OS X "role skew"; the role constants in nsIAccessible.idl need to match the ones
     // in nsRoleMap.h.
-    NS_ASSERTION([AXRoles[nsIAccessibleRole::ROLE_LAST_ENTRY] isEqualToString:@"ROLE_LAST_ENTRY"], "Role skew in the role map!");
+    NS_ASSERTION([AXRoles[roles::LAST_ENTRY] isEqualToString:@"ROLE_LAST_ENTRY"], "Role skew in the role map!");
   }
    
   return self;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
 - (void)dealloc
--- a/accessible/src/mac/nsAccessibleWrap.mm
+++ b/accessible/src/mac/nsAccessibleWrap.mm
@@ -36,20 +36,24 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsDocAccessible.h"
 #include "nsObjCExceptions.h"
 
 #import "nsRoleMap.h"
 
+#include "Role.h"
+
 #import "mozAccessible.h"
 #import "mozActionElements.h"
 #import "mozTextAccessible.h"
 
+using namespace mozilla::a11y;
+
 nsAccessibleWrap::
   nsAccessibleWrap(nsIContent *aContent, nsIWeakReference *aShell) :
   nsAccessible(aContent, aShell), mNativeObject(nil),
   mNativeInited(false)
 {
 }
 
 nsAccessibleWrap::~nsAccessibleWrap()
@@ -83,47 +87,44 @@ nsAccessibleWrap::GetNativeInterface (vo
 
 // overridden in subclasses to create the right kind of object. by default we create a generic
 // 'mozAccessible' node.
 Class
 nsAccessibleWrap::GetNativeType () 
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
-  PRUint32 role = Role();
+  roles::Role role = Role();
   switch (role) {
-    case nsIAccessibleRole::ROLE_PUSHBUTTON:
-    case nsIAccessibleRole::ROLE_SPLITBUTTON:
-    case nsIAccessibleRole::ROLE_TOGGLE_BUTTON:
+    case roles::PUSHBUTTON:
+    case roles::SPLITBUTTON:
+    case roles::TOGGLE_BUTTON:
     {
       // if this button may show a popup, let's make it of the popupbutton type.
-      if (HasPopup())
-        return [mozPopupButtonAccessible class];
-        
-      // regular button
-      return [mozButtonAccessible class];
+      return HasPopup() ? [mozPopupButtonAccessible class] : 
+             [mozButtonAccessible class];
     }
     
-    case nsIAccessibleRole::ROLE_CHECKBUTTON:
+    case roles::CHECKBUTTON:
       return [mozCheckboxAccessible class];
       
-    case nsIAccessibleRole::ROLE_AUTOCOMPLETE:
+    case roles::AUTOCOMPLETE:
       return [mozComboboxAccessible class];
       
-    case nsIAccessibleRole::ROLE_ENTRY:
-    case nsIAccessibleRole::ROLE_STATICTEXT:
-    case nsIAccessibleRole::ROLE_HEADING:
-    case nsIAccessibleRole::ROLE_LABEL:
-    case nsIAccessibleRole::ROLE_CAPTION:
-    case nsIAccessibleRole::ROLE_ACCEL_LABEL:
-    case nsIAccessibleRole::ROLE_TEXT_LEAF:
+    case roles::ENTRY:
+    case roles::STATICTEXT:
+    case roles::HEADING:
+    case roles::LABEL:
+    case roles::CAPTION:
+    case roles::ACCEL_LABEL:
+    case roles::TEXT_LEAF:
       // normal textfield (static or editable)
       return [mozTextAccessible class]; 
       
-    case nsIAccessibleRole::ROLE_COMBOBOX:
+    case roles::COMBOBOX:
       return [mozPopupButtonAccessible class];
       
     default:
       return [mozAccessible class];
   }
   
   return nil;
 
--- a/accessible/src/msaa/nsAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsAccessibleWrap.cpp
@@ -38,16 +38,17 @@
 
 #include "nsAccessibleWrap.h"
 
 #include "Compatibility.h"
 #include "nsAccUtils.h"
 #include "nsCoreUtils.h"
 #include "nsWinUtils.h"
 #include "Relation.h"
+#include "Role.h"
 #include "States.h"
 
 #include "ia2AccessibleRelation.h"
 
 #include "nsIAccessibleDocument.h"
 #include "nsIAccessibleEvent.h"
 #include "nsIAccessibleRelation.h"
 #include "nsIAccessibleWin32Object.h"
@@ -372,27 +373,27 @@ STDMETHODIMP nsAccessibleWrap::get_accRo
   if (!xpAccessible)
     return E_FAIL;
 
 #ifdef DEBUG_A11Y
   NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(xpAccessible),
                "Does not support nsIAccessibleText when it should");
 #endif
 
-  PRUint32 xpRole = xpAccessible->Role();
-  PRUint32 msaaRole = gWindowsRoleMap[xpRole].msaaRole;
-  NS_ASSERTION(gWindowsRoleMap[nsIAccessibleRole::ROLE_LAST_ENTRY].msaaRole == ROLE_WINDOWS_LAST_ENTRY,
+  roles::Role role = xpAccessible->Role();
+  PRUint32 msaaRole = gWindowsRoleMap[role].msaaRole;
+  NS_ASSERTION(gWindowsRoleMap[roles::LAST_ENTRY].msaaRole == ROLE_WINDOWS_LAST_ENTRY,
                "MSAA role map skewed");
 
   // Special case, if there is a ROLE_ROW inside of a ROLE_TREE_TABLE, then call the MSAA role
   // a ROLE_OUTLINEITEM for consistency and compatibility.
   // We need this because ARIA has a role of "row" for both grid and treegrid
-  if (xpRole == nsIAccessibleRole::ROLE_ROW) {
+  if (role == roles::ROW) {
     nsAccessible* xpParent = Parent();
-    if (xpParent && xpParent->Role() == nsIAccessibleRole::ROLE_TREE_TABLE)
+    if (xpParent && xpParent->Role() == roles::TREE_TABLE)
       msaaRole = ROLE_SYSTEM_OUTLINEITEM;
   }
   
   // -- Try enumerated role
   if (msaaRole != USE_ROLE_STRING) {
     pvarRole->vt = VT_I4;
     pvarRole->lVal = msaaRole;  // Normal enumerated role
     return S_OK;
@@ -1148,27 +1149,27 @@ STDMETHODIMP
 nsAccessibleWrap::role(long *aRole)
 {
 __try {
   *aRole = 0;
 
   if (IsDefunct())
     return E_FAIL;
 
-  NS_ASSERTION(gWindowsRoleMap[nsIAccessibleRole::ROLE_LAST_ENTRY].ia2Role == ROLE_WINDOWS_LAST_ENTRY,
+  NS_ASSERTION(gWindowsRoleMap[roles::LAST_ENTRY].ia2Role == ROLE_WINDOWS_LAST_ENTRY,
                "MSAA role map skewed");
 
-  PRUint32 xpRole = Role();
-  *aRole = gWindowsRoleMap[xpRole].ia2Role;
+  roles::Role role = Role();
+  *aRole = gWindowsRoleMap[role].ia2Role;
 
   // Special case, if there is a ROLE_ROW inside of a ROLE_TREE_TABLE, then call
   // the IA2 role a ROLE_OUTLINEITEM.
-  if (xpRole == nsIAccessibleRole::ROLE_ROW) {
+  if (role == roles::ROW) {
     nsAccessible* xpParent = Parent();
-    if (xpParent && xpParent->Role() == nsIAccessibleRole::ROLE_TREE_TABLE)
+    if (xpParent && xpParent->Role() == roles::TREE_TABLE)
       *aRole = ROLE_SYSTEM_OUTLINEITEM;
   }
 
   return S_OK;
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
@@ -1590,17 +1591,17 @@ nsAccessibleWrap::FirePlatformEvent(AccE
 #endif
 
   // Fire MSAA event for client area window.
   NotifyWinEvent(winEvent, hWnd, OBJID_CLIENT, childID);
 
   // JAWS announces collapsed combobox navigation based on focus events.
   if (Compatibility::IsJAWS()) {
     if (eventType == nsIAccessibleEvent::EVENT_SELECTION &&
-      accessible->Role() == nsIAccessibleRole::ROLE_COMBOBOX_OPTION) {
+      accessible->Role() == roles::COMBOBOX_OPTION) {
       NotifyWinEvent(EVENT_OBJECT_FOCUS, hWnd, OBJID_CLIENT, childID);
     }
   }
 
   return NS_OK;
 }
 
 //------- Helper methods ---------
@@ -1769,17 +1770,17 @@ nsAccessibleWrap::GetXPAccessibleFor(con
     // Convert child ID to unique ID.
     void* uniqueID = reinterpret_cast<void*>(-aVarChild.lVal);
 
     // Document.
     if (IsDoc())
       return AsDoc()->GetAccessibleByUniqueIDInSubtree(uniqueID);
 
     // ARIA document.
-    if (ARIARole() == nsIAccessibleRole::ROLE_DOCUMENT) {
+    if (ARIARole() == roles::DOCUMENT) {
       nsDocAccessible* document = GetDocAccessible();
       nsAccessible* child =
         document->GetAccessibleByUniqueIDInSubtree(uniqueID);
 
       // Check whether the accessible for the given ID is a child of ARIA
       // document.
       nsAccessible* parent = child ? child->Parent() : nsnull;
       while (parent && parent != document) {
--- a/accessible/src/msaa/nsDocAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsDocAccessibleWrap.cpp
@@ -39,16 +39,17 @@
 #include "mozilla/dom/TabChild.h"
 
 #include "Compatibility.h"
 #include "nsDocAccessibleWrap.h"
 #include "ISimpleDOMDocument_i.c"
 #include "nsIAccessibilityService.h"
 #include "nsRootAccessible.h"
 #include "nsWinUtils.h"
+#include "Role.h"
 #include "Statistics.h"
 
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeNode.h"
 #include "nsIFrame.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsISelectionController.h"
 #include "nsIServiceManager.h"
@@ -223,21 +224,19 @@ STDMETHODIMP nsDocAccessibleWrap::get_ac
 {
   // For backwards-compat, we still support old MSAA hack to provide URL in accValue
   *pszValue = NULL;
   // Check for real value first
   HRESULT hr = nsAccessibleWrap::get_accValue(varChild, pszValue);
   if (FAILED(hr) || *pszValue || varChild.lVal != CHILDID_SELF)
     return hr;
   // If document is being used to create a widget, don't use the URL hack
-  PRUint32 role = Role();
-  if (role != nsIAccessibleRole::ROLE_DOCUMENT &&
-      role != nsIAccessibleRole::ROLE_APPLICATION &&
-      role != nsIAccessibleRole::ROLE_DIALOG &&
-      role != nsIAccessibleRole::ROLE_ALERT)
+  roles::Role role = Role();
+  if (role != roles::DOCUMENT && role != roles::APPLICATION && 
+      role != roles::DIALOG && role != roles::ALERT) 
     return hr;
 
   return get_URL(pszValue);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessNode
 
--- a/accessible/src/msaa/nsHTMLWin32ObjectAccessible.cpp
+++ b/accessible/src/msaa/nsHTMLWin32ObjectAccessible.cpp
@@ -33,16 +33,17 @@
  * 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 "nsHTMLWin32ObjectAccessible.h"
 
+#include "Role.h"
 #include "States.h"
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLWin32ObjectOwnerAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
@@ -63,20 +64,20 @@ nsHTMLWin32ObjectOwnerAccessible::Shutdo
 {
   nsAccessibleWrap::Shutdown();
   mNativeAccessible = nsnull;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLWin32ObjectOwnerAccessible: nsAccessible implementation
 
-PRUint32
+role
 nsHTMLWin32ObjectOwnerAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_EMBEDDED_OBJECT;
+  return roles::EMBEDDED_OBJECT;
 }
 
 PRUint64
 nsHTMLWin32ObjectOwnerAccessible::NativeState()
 {
   // XXX: No HWND means this is windowless plugin which is not accessible in
   // the meantime.
   return mHwnd ? nsAccessibleWrap::NativeState() : states::UNAVAILABLE;
--- a/accessible/src/msaa/nsHTMLWin32ObjectAccessible.h
+++ b/accessible/src/msaa/nsHTMLWin32ObjectAccessible.h
@@ -56,17 +56,17 @@ public:
   nsHTMLWin32ObjectOwnerAccessible(nsIContent *aContent,
                                    nsIWeakReference *aShell, void *aHwnd);
   virtual ~nsHTMLWin32ObjectOwnerAccessible() {}
 
   // nsAccessNode
   virtual void Shutdown();
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
 protected:
 
   // nsAccessible
   virtual void CacheChildren();
 
   void* mHwnd;
--- a/accessible/src/msaa/nsRoleMap.h
+++ b/accessible/src/msaa/nsRoleMap.h
@@ -60,396 +60,396 @@ const PRUint32 ROLE_SYSTEM_OUTLINEBUTTON
 struct WindowsRoleMapItem
 {
   PRUint32 msaaRole;
   long ia2Role;
 };
 
 // Map array from cross platform roles to MSAA/IA2 roles
 static const WindowsRoleMapItem gWindowsRoleMap[] = {
-  // nsIAccessibleRole::ROLE_NOTHING
+  // roles::NOTHING
   { USE_ROLE_STRING, IA2_ROLE_UNKNOWN },
 
-  // nsIAccessibleRole::ROLE_TITLEBAR
+  // roles::TITLEBAR
   { ROLE_SYSTEM_TITLEBAR, ROLE_SYSTEM_TITLEBAR },
 
-  // nsIAccessibleRole::ROLE_MENUBAR
+  // roles::MENUBAR
   { ROLE_SYSTEM_MENUBAR, ROLE_SYSTEM_MENUBAR },
 
-  // nsIAccessibleRole::ROLE_SCROLLBAR
+  // roles::SCROLLBAR
   { ROLE_SYSTEM_SCROLLBAR, ROLE_SYSTEM_SCROLLBAR },
 
-  // nsIAccessibleRole::ROLE_GRIP
+  // roles::GRIP
   { ROLE_SYSTEM_GRIP, ROLE_SYSTEM_GRIP },
 
-  // nsIAccessibleRole::ROLE_SOUND
+  // roles::SOUND
   { ROLE_SYSTEM_SOUND, ROLE_SYSTEM_SOUND },
 
-  // nsIAccessibleRole::ROLE_CURSOR
+  // roles::CURSOR
   { ROLE_SYSTEM_CURSOR, ROLE_SYSTEM_CURSOR },
 
-  // nsIAccessibleRole::ROLE_CARET
+  // roles::CARET
   { ROLE_SYSTEM_CARET, ROLE_SYSTEM_CARET },
 
-  // nsIAccessibleRole::ROLE_ALERT
+  // roles::ALERT
   { ROLE_SYSTEM_ALERT, ROLE_SYSTEM_ALERT },
 
-  // nsIAccessibleRole::ROLE_WINDOW
+  // roles::WINDOW
   { ROLE_SYSTEM_WINDOW, ROLE_SYSTEM_WINDOW },
 
-  // nsIAccessibleRole::ROLE_INTERNAL_FRAME
+  // roles::INTERNAL_FRAME
   { USE_ROLE_STRING, IA2_ROLE_INTERNAL_FRAME},
 
-  // nsIAccessibleRole::ROLE_MENUPOPUP
+  // roles::MENUPOPUP
   { ROLE_SYSTEM_MENUPOPUP, ROLE_SYSTEM_MENUPOPUP },
 
-  // nsIAccessibleRole::ROLE_MENUITEM
+  // roles::MENUITEM
   { ROLE_SYSTEM_MENUITEM, ROLE_SYSTEM_MENUITEM },
 
-  // nsIAccessibleRole::ROLE_TOOLTIP
+  // roles::TOOLTIP
   { ROLE_SYSTEM_TOOLTIP, ROLE_SYSTEM_TOOLTIP },
 
-  // nsIAccessibleRole::ROLE_APPLICATION
+  // roles::APPLICATION
   { ROLE_SYSTEM_APPLICATION, ROLE_SYSTEM_APPLICATION },
 
-  // nsIAccessibleRole::ROLE_DOCUMENT
+  // roles::DOCUMENT
   { ROLE_SYSTEM_DOCUMENT, ROLE_SYSTEM_DOCUMENT },
 
-  // nsIAccessibleRole::ROLE_PANE
+  // roles::PANE
   // We used to map to ROLE_SYSTEM_PANE, but JAWS would
   // not read the accessible name for the contaning pane.
   // However, JAWS will read the accessible name for a groupbox.
   // By mapping a PANE to a GROUPING, we get no undesirable effects,
   // but fortunately JAWS will then read the group's label,
   // when an inner control gets focused.
   { ROLE_SYSTEM_GROUPING , ROLE_SYSTEM_GROUPING }, 
 
-  // nsIAccessibleRole::ROLE_CHART
+  // roles::CHART
   { ROLE_SYSTEM_CHART, ROLE_SYSTEM_CHART },
 
-  // nsIAccessibleRole::ROLE_DIALOG
+  // roles::DIALOG
   { ROLE_SYSTEM_DIALOG, ROLE_SYSTEM_DIALOG },
 
-  // nsIAccessibleRole::ROLE_BORDER
+  // roles::BORDER
   { ROLE_SYSTEM_BORDER, ROLE_SYSTEM_BORDER },
 
-  // nsIAccessibleRole::ROLE_GROUPING
+  // roles::GROUPING
   { ROLE_SYSTEM_GROUPING, ROLE_SYSTEM_GROUPING },
 
-  // nsIAccessibleRole::ROLE_SEPARATOR
+  // roles::SEPARATOR
   { ROLE_SYSTEM_SEPARATOR, ROLE_SYSTEM_SEPARATOR },
 
-  // nsIAccessibleRole::ROLE_TOOLBAR
+  // roles::TOOLBAR
   { ROLE_SYSTEM_TOOLBAR, ROLE_SYSTEM_TOOLBAR },
 
-  // nsIAccessibleRole::ROLE_STATUSBAR
+  // roles::STATUSBAR
   { ROLE_SYSTEM_STATUSBAR, ROLE_SYSTEM_STATUSBAR },
 
-  // nsIAccessibleRole::ROLE_TABLE
+  // roles::TABLE
   { ROLE_SYSTEM_TABLE, ROLE_SYSTEM_TABLE },
 
-  // nsIAccessibleRole::ROLE_COLUMNHEADER,
+  // roles::COLUMNHEADER,
   { ROLE_SYSTEM_COLUMNHEADER, ROLE_SYSTEM_COLUMNHEADER },
 
-  // nsIAccessibleRole::ROLE_ROWHEADER
+  // roles::ROWHEADER
   { ROLE_SYSTEM_ROWHEADER, ROLE_SYSTEM_ROWHEADER },
 
-  // nsIAccessibleRole::ROLE_COLUMN
+  // roles::COLUMN
   { ROLE_SYSTEM_COLUMN, ROLE_SYSTEM_COLUMN },
 
-  // nsIAccessibleRole::ROLE_ROW
+  // roles::ROW
   { ROLE_SYSTEM_ROW, ROLE_SYSTEM_ROW },
 
-  // nsIAccessibleRole::ROLE_CELL
+  // roles::CELL
   { ROLE_SYSTEM_CELL, ROLE_SYSTEM_CELL },
 
-  // nsIAccessibleRole::ROLE_LINK
+  // roles::LINK
   { ROLE_SYSTEM_LINK, ROLE_SYSTEM_LINK },
 
-  // nsIAccessibleRole::ROLE_HELPBALLOON
+  // roles::HELPBALLOON
   { ROLE_SYSTEM_HELPBALLOON, ROLE_SYSTEM_HELPBALLOON },
 
-  // nsIAccessibleRole::ROLE_CHARACTER
+  // roles::CHARACTER
   { ROLE_SYSTEM_CHARACTER, ROLE_SYSTEM_CHARACTER },
 
-  // nsIAccessibleRole::ROLE_LIST
+  // roles::LIST
   { ROLE_SYSTEM_LIST, ROLE_SYSTEM_LIST },
 
-  // nsIAccessibleRole::ROLE_LISTITEM
+  // roles::LISTITEM
   { ROLE_SYSTEM_LISTITEM, ROLE_SYSTEM_LISTITEM },
 
-  // nsIAccessibleRole::ROLE_OUTLINE
+  // roles::OUTLINE
   { ROLE_SYSTEM_OUTLINE, ROLE_SYSTEM_OUTLINE },
 
-  // nsIAccessibleRole::ROLE_OUTLINEITEM
+  // roles::OUTLINEITEM
   { ROLE_SYSTEM_OUTLINEITEM, ROLE_SYSTEM_OUTLINEITEM },
 
-  // nsIAccessibleRole::ROLE_PAGETAB
+  // roles::PAGETAB
   { ROLE_SYSTEM_PAGETAB, ROLE_SYSTEM_PAGETAB },
 
-  // nsIAccessibleRole::ROLE_PROPERTYPAGE
+  // roles::PROPERTYPAGE
   { ROLE_SYSTEM_PROPERTYPAGE, ROLE_SYSTEM_PROPERTYPAGE },
 
-  // nsIAccessibleRole::ROLE_INDICATOR
+  // roles::INDICATOR
   { ROLE_SYSTEM_INDICATOR, ROLE_SYSTEM_INDICATOR },
 
-  // nsIAccessibleRole::ROLE_GRAPHIC
+  // roles::GRAPHIC
   { ROLE_SYSTEM_GRAPHIC, ROLE_SYSTEM_GRAPHIC },
 
-  // nsIAccessibleRole::ROLE_STATICTEXT
+  // roles::STATICTEXT
   { ROLE_SYSTEM_STATICTEXT, ROLE_SYSTEM_STATICTEXT },
 
-  // nsIAccessibleRole::ROLE_TEXT_LEAF
+  // roles::TEXT_LEAF
   { ROLE_SYSTEM_TEXT, ROLE_SYSTEM_TEXT },
 
-  // nsIAccessibleRole::ROLE_PUSHBUTTON
+  // roles::PUSHBUTTON
   { ROLE_SYSTEM_PUSHBUTTON, ROLE_SYSTEM_PUSHBUTTON },
 
-  // nsIAccessibleRole::ROLE_CHECKBUTTON
+  // roles::CHECKBUTTON
   { ROLE_SYSTEM_CHECKBUTTON, ROLE_SYSTEM_CHECKBUTTON },
 
-  // nsIAccessibleRole::ROLE_RADIOBUTTON
+  // roles::RADIOBUTTON
   { ROLE_SYSTEM_RADIOBUTTON, ROLE_SYSTEM_RADIOBUTTON },
 
-  // nsIAccessibleRole::ROLE_COMBOBOX
+  // roles::COMBOBOX
   { ROLE_SYSTEM_COMBOBOX, ROLE_SYSTEM_COMBOBOX },
 
-  // nsIAccessibleRole::ROLE_DROPLIST
+  // roles::DROPLIST
   { ROLE_SYSTEM_DROPLIST, ROLE_SYSTEM_DROPLIST },
 
-  // nsIAccessibleRole::ROLE_PROGRESSBAR
+  // roles::PROGRESSBAR
   { ROLE_SYSTEM_PROGRESSBAR, ROLE_SYSTEM_PROGRESSBAR },
 
-  // nsIAccessibleRole::ROLE_DIAL
+  // roles::DIAL
   { ROLE_SYSTEM_DIAL, ROLE_SYSTEM_DIAL },
 
-  // nsIAccessibleRole::ROLE_HOTKEYFIELD
+  // roles::HOTKEYFIELD
   { ROLE_SYSTEM_HOTKEYFIELD, ROLE_SYSTEM_HOTKEYFIELD },
 
-  // nsIAccessibleRole::ROLE_SLIDER
+  // roles::SLIDER
   { ROLE_SYSTEM_SLIDER, ROLE_SYSTEM_SLIDER },
 
-  // nsIAccessibleRole::ROLE_SPINBUTTON
+  // roles::SPINBUTTON
   { ROLE_SYSTEM_SPINBUTTON, ROLE_SYSTEM_SPINBUTTON },
 
-  // nsIAccessibleRole::ROLE_DIAGRAM
+  // roles::DIAGRAM
   { ROLE_SYSTEM_DIAGRAM, ROLE_SYSTEM_DIAGRAM },
 
-  // nsIAccessibleRole::ROLE_ANIMATION
+  // roles::ANIMATION
   { ROLE_SYSTEM_ANIMATION, ROLE_SYSTEM_ANIMATION },
 
-  // nsIAccessibleRole::ROLE_EQUATION
+  // roles::EQUATION
   { ROLE_SYSTEM_EQUATION, ROLE_SYSTEM_EQUATION },
 
-  // nsIAccessibleRole::ROLE_BUTTONDROPDOWN
+  // roles::BUTTONDROPDOWN
   { ROLE_SYSTEM_BUTTONDROPDOWN, ROLE_SYSTEM_BUTTONDROPDOWN },
 
-  // nsIAccessibleRole::ROLE_BUTTONMENU
+  // roles::BUTTONMENU
   { ROLE_SYSTEM_BUTTONMENU, ROLE_SYSTEM_BUTTONMENU },
 
-  // nsIAccessibleRole::ROLE_BUTTONDROPDOWNGRID
+  // roles::BUTTONDROPDOWNGRID
   { ROLE_SYSTEM_BUTTONDROPDOWNGRID, ROLE_SYSTEM_BUTTONDROPDOWNGRID },
 
-  // nsIAccessibleRole::ROLE_WHITESPACE
+  // roles::WHITESPACE
   { ROLE_SYSTEM_WHITESPACE, ROLE_SYSTEM_WHITESPACE },
 
-  // nsIAccessibleRole::ROLE_PAGETABLIST
+  // roles::PAGETABLIST
   { ROLE_SYSTEM_PAGETABLIST, ROLE_SYSTEM_PAGETABLIST },
 
-  // nsIAccessibleRole::ROLE_CLOCK
+  // roles::CLOCK
   { ROLE_SYSTEM_CLOCK, ROLE_SYSTEM_CLOCK },
 
-  // nsIAccessibleRole::ROLE_SPLITBUTTON
+  // roles::SPLITBUTTON
   { ROLE_SYSTEM_SPLITBUTTON, ROLE_SYSTEM_SPLITBUTTON },
 
-  // nsIAccessibleRole::ROLE_IPADDRESS
+  // roles::IPADDRESS
   { ROLE_SYSTEM_IPADDRESS, ROLE_SYSTEM_IPADDRESS },
 
   // Make up for Gecko roles that we don't have in MSAA or IA2. When in doubt
   // map them to USE_ROLE_STRING (IA2_ROLE_UNKNOWN).
 
-  // nsIAccessibleRole::ROLE_ACCEL_LABEL
+  // roles::ACCEL_LABEL
   { ROLE_SYSTEM_STATICTEXT, ROLE_SYSTEM_STATICTEXT },
 
-  // nsIAccessibleRole::ROLE_ARROW
+  // roles::ARROW
   { ROLE_SYSTEM_INDICATOR, ROLE_SYSTEM_INDICATOR },
 
-  // nsIAccessibleRole::ROLE_CANVAS
+  // roles::CANVAS
   { USE_ROLE_STRING, IA2_ROLE_CANVAS },
 
-  // nsIAccessibleRole::ROLE_CHECK_MENU_ITEM
+  // roles::CHECK_MENU_ITEM
   { ROLE_SYSTEM_MENUITEM, IA2_ROLE_CHECK_MENU_ITEM },
 
-  // nsIAccessibleRole::ROLE_COLOR_CHOOSER
+  // roles::COLOR_CHOOSER
   { ROLE_SYSTEM_DIALOG, IA2_ROLE_COLOR_CHOOSER },
 
-  // nsIAccessibleRole::ROLE_DATE_EDITOR
+  // roles::DATE_EDITOR
   { USE_ROLE_STRING, IA2_ROLE_DATE_EDITOR },
 
-  // nsIAccessibleRole::ROLE_DESKTOP_ICON
+  // roles::DESKTOP_ICON
   { USE_ROLE_STRING, IA2_ROLE_DESKTOP_ICON },
 
-  // nsIAccessibleRole::ROLE_DESKTOP_FRAME
+  // roles::DESKTOP_FRAME
   { USE_ROLE_STRING, IA2_ROLE_DESKTOP_PANE },
 
-  // nsIAccessibleRole::ROLE_DIRECTORY_PANE
+  // roles::DIRECTORY_PANE
   { USE_ROLE_STRING, IA2_ROLE_DIRECTORY_PANE },
 
-  // nsIAccessibleRole::ROLE_FILE_CHOOSER
+  // roles::FILE_CHOOSER
   { USE_ROLE_STRING, IA2_ROLE_FILE_CHOOSER },
 
-  // nsIAccessibleRole::ROLE_FONT_CHOOSER
+  // roles::FONT_CHOOSER
   { USE_ROLE_STRING, IA2_ROLE_FONT_CHOOSER },
 
-  // nsIAccessibleRole::ROLE_CHROME_WINDOW
+  // roles::CHROME_WINDOW
   { ROLE_SYSTEM_APPLICATION, IA2_ROLE_FRAME },
 
-  // nsIAccessibleRole::ROLE_GLASS_PANE
+  // roles::GLASS_PANE
   { USE_ROLE_STRING, IA2_ROLE_GLASS_PANE },
 
-  // nsIAccessibleRole::ROLE_HTML_CONTAINER
+  // roles::HTML_CONTAINER
   { USE_ROLE_STRING, IA2_ROLE_UNKNOWN },
 
-  // nsIAccessibleRole::ROLE_ICON
+  // roles::ICON
   { ROLE_SYSTEM_PUSHBUTTON, IA2_ROLE_ICON },
 
-  // nsIAccessibleRole::ROLE_LABEL
+  // roles::LABEL
   { ROLE_SYSTEM_STATICTEXT, IA2_ROLE_LABEL },
 
-  // nsIAccessibleRole::ROLE_LAYERED_PANE
+  // roles::LAYERED_PANE
   { USE_ROLE_STRING, IA2_ROLE_LAYERED_PANE },
 
-  // nsIAccessibleRole::ROLE_OPTION_PANE
+  // roles::OPTION_PANE
   { USE_ROLE_STRING, IA2_ROLE_OPTION_PANE },
 
-  // nsIAccessibleRole::ROLE_PASSWORD_TEXT
+  // roles::PASSWORD_TEXT
   { ROLE_SYSTEM_TEXT, ROLE_SYSTEM_TEXT },
 
-  // nsIAccessibleRole::ROLE_POPUP_MENU
+  // roles::POPUP_MENU
   { ROLE_SYSTEM_MENUPOPUP, ROLE_SYSTEM_MENUPOPUP },
 
-  // nsIAccessibleRole::ROLE_RADIO_MENU_ITEM
+  // roles::RADIO_MENU_ITEM
   { ROLE_SYSTEM_MENUITEM, IA2_ROLE_RADIO_MENU_ITEM },
 
-  // nsIAccessibleRole::ROLE_ROOT_PANE
+  // roles::ROOT_PANE
   { USE_ROLE_STRING, IA2_ROLE_ROOT_PANE },
 
-  // nsIAccessibleRole::ROLE_SCROLL_PANE
+  // roles::SCROLL_PANE
   { USE_ROLE_STRING, IA2_ROLE_SCROLL_PANE },
 
-  // nsIAccessibleRole::ROLE_SPLIT_PANE
+  // roles::SPLIT_PANE
   { USE_ROLE_STRING, IA2_ROLE_SPLIT_PANE },
 
-  // nsIAccessibleRole::ROLE_TABLE_COLUMN_HEADER
+  // roles::TABLE_COLUMN_HEADER
   { ROLE_SYSTEM_COLUMNHEADER, ROLE_SYSTEM_COLUMNHEADER },
 
-  // nsIAccessibleRole::ROLE_TABLE_ROW_HEADER
+  // roles::TABLE_ROW_HEADER
   { ROLE_SYSTEM_ROWHEADER, ROLE_SYSTEM_ROWHEADER },
 
-  // nsIAccessibleRole::ROLE_TEAR_OFF_MENU_ITEM
+  // roles::TEAR_OFF_MENU_ITEM
   { ROLE_SYSTEM_MENUITEM, IA2_ROLE_TEAR_OFF_MENU },
 
-  // nsIAccessibleRole::ROLE_TERMINAL
+  // roles::TERMINAL
   { USE_ROLE_STRING, IA2_ROLE_TERMINAL },
 
-  // nsIAccessibleRole::ROLE_TEXT_CONTAINER
+  // roles::TEXT_CONTAINER
   { USE_ROLE_STRING, IA2_ROLE_TEXT_FRAME },
 
-  // nsIAccessibleRole::ROLE_TOGGLE_BUTTON
+  // roles::TOGGLE_BUTTON
   { ROLE_SYSTEM_PUSHBUTTON, IA2_ROLE_TOGGLE_BUTTON },
 
-  // nsIAccessibleRole::ROLE_TREE_TABLE
+  // roles::TREE_TABLE
   { ROLE_SYSTEM_OUTLINE, ROLE_SYSTEM_OUTLINE },
 
-  // nsIAccessibleRole::ROLE_VIEWPORT
+  // roles::VIEWPORT
   { ROLE_SYSTEM_PANE, IA2_ROLE_VIEW_PORT },
 
-  // nsIAccessibleRole::ROLE_HEADER
+  // roles::HEADER
   { USE_ROLE_STRING, IA2_ROLE_HEADER },
 
-  // nsIAccessibleRole::ROLE_FOOTER
+  // roles::FOOTER
   { USE_ROLE_STRING, IA2_ROLE_FOOTER },
 
-  // nsIAccessibleRole::ROLE_PARAGRAPH
+  // roles::PARAGRAPH
   { USE_ROLE_STRING, IA2_ROLE_PARAGRAPH },
 
-  // nsIAccessibleRole::ROLE_RULER
+  // roles::RULER
   { USE_ROLE_STRING, IA2_ROLE_RULER },
 
-  // nsIAccessibleRole::ROLE_AUTOCOMPLETE
+  // roles::AUTOCOMPLETE
   { ROLE_SYSTEM_COMBOBOX, ROLE_SYSTEM_COMBOBOX },
 
-  // nsIAccessibleRole::ROLE_EDITBAR
+  // roles::EDITBAR
   { ROLE_SYSTEM_TEXT, IA2_ROLE_EDITBAR },
 
-  // nsIAccessibleRole::ROLE_ENTRY
+  // roles::ENTRY
   { ROLE_SYSTEM_TEXT, ROLE_SYSTEM_TEXT },
 
-  // nsIAccessibleRole::ROLE_CAPTION
+  // roles::CAPTION
   { USE_ROLE_STRING, IA2_ROLE_CAPTION },
 
-  // nsIAccessibleRole::ROLE_DOCUMENT_FRAME
+  // roles::DOCUMENT_FRAME
   { USE_ROLE_STRING, IA2_ROLE_UNKNOWN },
 
-  // nsIAccessibleRole::ROLE_HEADING
+  // roles::HEADING
   { USE_ROLE_STRING, IA2_ROLE_HEADING },
 
-  // nsIAccessibleRole::ROLE_PAGE
+  // roles::PAGE
   { USE_ROLE_STRING, IA2_ROLE_PAGE },
 
-  // nsIAccessibleRole::ROLE_SECTION
+  // roles::SECTION
   { USE_ROLE_STRING, IA2_ROLE_SECTION },
 
-  // nsIAccessibleRole::ROLE_REDUNDANT_OBJECT
+  // roles::REDUNDANT_OBJECT
   { USE_ROLE_STRING, IA2_ROLE_REDUNDANT_OBJECT },
 
-  // nsIAccessibleRole::ROLE_FORM
+  // roles::FORM
   { USE_ROLE_STRING, IA2_ROLE_FORM },
 
-  // nsIAccessibleRole::ROLE_IME
+  // roles::IME
   { USE_ROLE_STRING, IA2_ROLE_INPUT_METHOD_WINDOW },
 
-  // nsIAccessibleRole::ROLE_APP_ROOT
+  // roles::APP_ROOT
   { ROLE_SYSTEM_APPLICATION, ROLE_SYSTEM_APPLICATION },
 
-  // nsIAccessibleRole::ROLE_PARENT_MENUITEM
+  // roles::PARENT_MENUITEM
   { ROLE_SYSTEM_MENUITEM, ROLE_SYSTEM_MENUITEM },
 
-  // nsIAccessibleRole::ROLE_CALENDAR
+  // roles::CALENDAR
   { ROLE_SYSTEM_CLIENT, ROLE_SYSTEM_CLIENT },
 
-  // nsIAccessibleRole::ROLE_COMBOBOX_LIST
+  // roles::COMBOBOX_LIST
   { ROLE_SYSTEM_LIST, ROLE_SYSTEM_LIST },
 
-  // nsIAccessibleRole::ROLE_COMBOBOX_OPTION
+  // roles::COMBOBOX_OPTION
   { ROLE_SYSTEM_LISTITEM, ROLE_SYSTEM_LISTITEM },
 
-  // nsIAccessibleRole::ROLE_IMAGE_MAP
+  // roles::IMAGE_MAP
   { ROLE_SYSTEM_GRAPHIC, ROLE_SYSTEM_GRAPHIC },
 
-  // nsIAccessibleRole::ROLE_OPTION 
+  // roles::OPTION 
   { ROLE_SYSTEM_LISTITEM, ROLE_SYSTEM_LISTITEM },
   
-  // nsIAccessibleRole::ROLE_RICH_OPTION
+  // roles::RICH_OPTION
   { ROLE_SYSTEM_LISTITEM, ROLE_SYSTEM_LISTITEM },
   
-  // nsIAccessibleRole::ROLE_LISTBOX
+  // roles::LISTBOX
   { ROLE_SYSTEM_LIST, ROLE_SYSTEM_LIST },
   
-  // nsIAccessibleRole::ROLE_FLAT_EQUATION
+  // roles::FLAT_EQUATION
   { ROLE_SYSTEM_EQUATION, ROLE_SYSTEM_EQUATION },
   
-  // nsIAccessibleRole::ROLE_GRID_CELL
+  // roles::GRID_CELL
   { ROLE_SYSTEM_CELL, ROLE_SYSTEM_CELL },
 
-  // nsIAccessibleRole::ROLE_EMBEDDED_OBJECT
+  // roles::EMBEDDED_OBJECT
   { USE_ROLE_STRING, IA2_ROLE_EMBEDDED_OBJECT },
 
-  // nsIAccessibleRole::ROLE_NOTE
+  // roles::NOTE
   { USE_ROLE_STRING, IA2_ROLE_NOTE },
 
-  // nsIAccessibleRole::ROLE_FIGURE
+  // roles::FIGURE
   { ROLE_SYSTEM_GROUPING, ROLE_SYSTEM_GROUPING },
 
-  // nsIAccessibleRole::ROLE_LAST_ENTRY
+  // roles::LAST_ENTRY
   { ROLE_WINDOWS_LAST_ENTRY, ROLE_WINDOWS_LAST_ENTRY }
 };
 
--- a/accessible/src/xforms/nsXFormsAccessible.cpp
+++ b/accessible/src/xforms/nsXFormsAccessible.cpp
@@ -33,20 +33,21 @@
  * 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 "nsXFormsAccessible.h"
 
-#include "States.h"
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "nsTextEquivUtils.h"
+#include "Role.h"
+#include "States.h"
 
 #include "nscore.h"
 #include "nsServiceManagerUtils.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMNodeList.h"
 #include "nsIEditor.h"
 #include "nsIMutableArray.h"
 #include "nsIXFormsUtilityService.h"
@@ -223,20 +224,20 @@ nsXFormsAccessible::GetAllowsAnonChildAc
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsContainerAccessible::
   nsXFormsContainerAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsAccessible(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsXFormsContainerAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_GROUPING;
+  return roles::GROUPING;
 }
 
 bool
 nsXFormsContainerAccessible::GetAllowsAnonChildAccessibles()
 {
   return true;
 }
 
--- a/accessible/src/xforms/nsXFormsAccessible.h
+++ b/accessible/src/xforms/nsXFormsAccessible.h
@@ -122,17 +122,17 @@ protected:
  * 'pick up file' and 'clear file' buttons.
  */
 class nsXFormsContainerAccessible : public nsXFormsAccessible
 {
 public:
   nsXFormsContainerAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
 
   // Allows accessible nodes in anonymous content of xforms element by
   // always returning true value.
   virtual bool GetAllowsAnonChildAccessibles();
 };
 
 
 /**
--- a/accessible/src/xforms/nsXFormsFormControlsAccessible.cpp
+++ b/accessible/src/xforms/nsXFormsFormControlsAccessible.cpp
@@ -33,35 +33,36 @@
  * 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 "nsXFormsFormControlsAccessible.h"
 
+#include "nsTextEquivUtils.h"
+#include "Role.h"
 #include "States.h"
-#include "nsTextEquivUtils.h"
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXFormsLabelAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsLabelAccessible::
   nsXFormsLabelAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsAccessible(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsXFormsLabelAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_LABEL;
+  return roles::LABEL;
 }
 
 nsresult
 nsXFormsLabelAccessible::GetNameInternal(nsAString& aName)
 {
   // XXX Correct name calculation for this, see bug 453594.
   return NS_OK;
 }
@@ -80,37 +81,37 @@ nsXFormsLabelAccessible::Description(nsS
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsOutputAccessible::
   nsXFormsOutputAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsAccessible(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsXFormsOutputAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_STATICTEXT;
+  return roles::STATICTEXT;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXFormsTriggerAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsTriggerAccessible::
   nsXFormsTriggerAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsAccessible(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsXFormsTriggerAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_PUSHBUTTON;
+  return roles::PUSHBUTTON;
 }
 
 NS_IMETHODIMP
 nsXFormsTriggerAccessible::GetValue(nsAString& aValue)
 {
   aValue.Truncate();
   return NS_OK;
 }
@@ -149,20 +150,20 @@ nsXFormsTriggerAccessible::DoAction(PRUi
 nsXFormsInputAccessible::
   nsXFormsInputAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsEditableAccessible(aContent, aShell)
 {
 }
 
 NS_IMPL_ISUPPORTS_INHERITED3(nsXFormsInputAccessible, nsAccessible, nsHyperTextAccessible, nsIAccessibleText, nsIAccessibleEditableText)
 
-PRUint32
+role
 nsXFormsInputAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_ENTRY;
+  return roles::ENTRY;
 }
 
 PRUint8
 nsXFormsInputAccessible::ActionCount()
 {
   return 1;
 }
 
@@ -192,20 +193,20 @@ nsXFormsInputAccessible::DoAction(PRUint
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsInputBooleanAccessible::
   nsXFormsInputBooleanAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsAccessible(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsXFormsInputBooleanAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_CHECKBUTTON;
+  return roles::CHECKBUTTON;
 }
 
 PRUint64
 nsXFormsInputBooleanAccessible::NativeState()
 {
   PRUint64 state = nsXFormsAccessible::NativeState();
 
   nsAutoString value;
@@ -260,37 +261,37 @@ nsXFormsInputBooleanAccessible::DoAction
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsInputDateAccessible::
   nsXFormsInputDateAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsContainerAccessible(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsXFormsInputDateAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_DROPLIST;
+  return roles::DROPLIST;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXFormsSecretAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsSecretAccessible::
   nsXFormsSecretAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsInputAccessible(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsXFormsSecretAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_PASSWORD_TEXT;
+  return roles::PASSWORD_TEXT;
 }
 
 PRUint64
 nsXFormsSecretAccessible::NativeState()
 {
   return nsXFormsInputAccessible::NativeState() | states::PROTECTED;
 }
 
@@ -306,20 +307,20 @@ nsXFormsSecretAccessible::GetValue(nsASt
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsRangeAccessible::
   nsXFormsRangeAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsAccessible(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsXFormsRangeAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_SLIDER;
+  return roles::SLIDER;
 }
 
 PRUint64
 nsXFormsRangeAccessible::NativeState()
 {
   PRUint64 state = nsXFormsAccessible::NativeState();
 
   PRUint32 isInRange = nsIXFormsUtilityService::STATE_NOT_A_RANGE;
@@ -426,20 +427,20 @@ nsXFormsSelectAccessible::NativeState()
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsChoicesAccessible::
   nsXFormsChoicesAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsAccessible(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsXFormsChoicesAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_GROUPING;
+  return roles::GROUPING;
 }
 
 NS_IMETHODIMP
 nsXFormsChoicesAccessible::GetValue(nsAString& aValue)
 {
   aValue.Truncate();
   return NS_OK;
 }
@@ -456,20 +457,20 @@ nsXFormsChoicesAccessible::CacheChildren
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsSelectFullAccessible::
   nsXFormsSelectFullAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsSelectableAccessible(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsXFormsSelectFullAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_GROUPING;
+  return roles::GROUPING;
 }
 
 void
 nsXFormsSelectFullAccessible::CacheChildren()
 {
   CacheSelectChildren();
 }
 
@@ -479,20 +480,20 @@ nsXFormsSelectFullAccessible::CacheChild
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsItemCheckgroupAccessible::
   nsXFormsItemCheckgroupAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsSelectableItemAccessible(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsXFormsItemCheckgroupAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_CHECKBUTTON;
+  return roles::CHECKBUTTON;
 }
 
 PRUint64
 nsXFormsItemCheckgroupAccessible::NativeState()
 {
   PRUint64 state = nsXFormsSelectableItemAccessible::NativeState();
 
   if (IsSelected())
@@ -521,20 +522,20 @@ nsXFormsItemCheckgroupAccessible::GetAct
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsItemRadiogroupAccessible::
   nsXFormsItemRadiogroupAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsSelectableItemAccessible(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsXFormsItemRadiogroupAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_RADIOBUTTON;
+  return roles::RADIOBUTTON;
 }
 
 PRUint64
 nsXFormsItemRadiogroupAccessible::NativeState()
 {
   PRUint64 state = nsXFormsSelectableItemAccessible::NativeState();
 
   if (IsSelected())
@@ -559,20 +560,20 @@ nsXFormsItemRadiogroupAccessible::GetAct
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsSelectComboboxAccessible::
   nsXFormsSelectComboboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsSelectableAccessible(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsXFormsSelectComboboxAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_COMBOBOX;
+  return roles::COMBOBOX;
 }
 
 PRUint64
 nsXFormsSelectComboboxAccessible::NativeState()
 {
   PRUint64 state = nsXFormsSelectableAccessible::NativeState();
 
   bool isOpen = false;
@@ -600,20 +601,20 @@ nsXFormsSelectComboboxAccessible::GetAll
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsItemComboboxAccessible::
   nsXFormsItemComboboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsSelectableItemAccessible(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsXFormsItemComboboxAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_LISTITEM;
+  return roles::LISTITEM;
 }
 
 PRUint64
 nsXFormsItemComboboxAccessible::NativeState()
 {
   PRUint64 state = nsXFormsSelectableItemAccessible::NativeState();
 
   if (state & states::UNAVAILABLE)
--- a/accessible/src/xforms/nsXFormsFormControlsAccessible.h
+++ b/accessible/src/xforms/nsXFormsFormControlsAccessible.h
@@ -48,30 +48,30 @@
 class nsXFormsLabelAccessible : public nsXFormsAccessible
 {
 public:
   nsXFormsLabelAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
   virtual void Description(nsString& aDescription);
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
 };
 
 /**
  * Accessible object for xforms:output.
  */
 
 class nsXFormsOutputAccessible : public nsXFormsAccessible
 {
 public:
   nsXFormsOutputAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
 };
 
 /**
  * Accessible object for xforms:trigger and xforms:submit.
  */
 
 class nsXFormsTriggerAccessible : public nsXFormsAccessible
 {
@@ -80,17 +80,17 @@ public:
 
   // nsIAccessible
   NS_IMETHOD GetValue(nsAString& aValue);
 
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 };
 
 /**
  * Accessible object for xforms:input and xforms:textarea.
  */
@@ -102,17 +102,17 @@ public:
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 };
 
 /**
  * Accessible object for xforms:input[type="xsd:boolean"].
  */
@@ -122,50 +122,50 @@ class nsXFormsInputBooleanAccessible : p
 public:
   nsXFormsInputBooleanAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 };
 
 /**
  * Accessible object for xforms:input[type="xsd:date"].
  */
 
 class nsXFormsInputDateAccessible : public nsXFormsContainerAccessible
 {
 public:
   nsXFormsInputDateAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
 };
 
 /**
  * Accessible object for xforms:secret.
  */
 
 class nsXFormsSecretAccessible : public nsXFormsInputAccessible
 {
 public:
   nsXFormsSecretAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetValue(nsAString& aValue);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 };
 
 
 /**
  * Accessible object for xforms:range.
  */
 
@@ -176,17 +176,17 @@ public:
 
   // nsIAccessibleValue
   NS_IMETHOD GetMaximumValue(double *aMaximumValue);
   NS_IMETHOD GetMinimumValue(double *aMinimumValue);
   NS_IMETHOD GetMinimumIncrement(double *aMinimumIncrement);
   NS_IMETHOD GetCurrentValue(double *aCurrentValue);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 };
 
 
 /**
  * Accessible object for xforms:select and xforms:select1 that are implemented
  * using host document's native widget.
  */
@@ -209,17 +209,17 @@ class nsXFormsChoicesAccessible : public
 {
 public:
   nsXFormsChoicesAccessible(nsIContent* aContent, nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetValue(nsAString& aValue);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
 
 protected:
   // nsAccessible
   virtual void CacheChildren();
 };
 
 
 /**
@@ -228,17 +228,17 @@ protected:
  */
 
 class nsXFormsSelectFullAccessible : public nsXFormsSelectableAccessible
 {
 public:
   nsXFormsSelectFullAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
 
 protected:
   // nsAccessible
   virtual void CacheChildren();
 };
 
 
 /**
@@ -252,17 +252,17 @@ class nsXFormsItemCheckgroupAccessible :
 public:
   nsXFormsItemCheckgroupAccessible(nsIContent *aContent,
                                    nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 };
 
 
 /**
  * Accessible object for a xforms:item when it is represented by a radiobutton.
  * This occurs when the item is contained in a xforms:select1 with full
  * appearance. Such a xforms:select1 is represented as a radiogroup.
@@ -273,34 +273,34 @@ class nsXFormsItemRadiogroupAccessible :
 public:
   nsXFormsItemRadiogroupAccessible(nsIContent *aContent,
                                    nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 };
 
 
 /**
  * Accessible object for xforms:select1 of minimal appearance that is
  * represented by combobox.
  */
 
 class nsXFormsSelectComboboxAccessible : public nsXFormsSelectableAccessible
 {
 public:
   nsXFormsSelectComboboxAccessible(nsIContent *aContent,
                                    nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
   virtual bool GetAllowsAnonChildAccessibles();
 };
 
 
 /**
  * Accessible object for xforms:item element when it is represented by a
  * listitem. This occurs when the item is contained in a xforms:select with
@@ -312,14 +312,14 @@ class nsXFormsItemComboboxAccessible : p
 public:
   nsXFormsItemComboboxAccessible(nsIContent *aContent,
                                  nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 };
 
 #endif
 
--- a/accessible/src/xforms/nsXFormsWidgetsAccessible.cpp
+++ b/accessible/src/xforms/nsXFormsWidgetsAccessible.cpp
@@ -33,35 +33,36 @@
  * 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 "nsXFormsWidgetsAccessible.h"
 
+#include "Role.h"
 #include "States.h"
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXFormsDropmarkerWidgetAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsDropmarkerWidgetAccessible::
   nsXFormsDropmarkerWidgetAccessible(nsIContent *aContent,
                                      nsIWeakReference *aShell) :
   nsLeafAccessible(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsXFormsDropmarkerWidgetAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_PUSHBUTTON;
+  return roles::PUSHBUTTON;
 }
 
 PRUint64
 nsXFormsDropmarkerWidgetAccessible::NativeState()
 {
   bool isOpen = false;
   nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
   nsresult rv = sXFormsService->IsDropmarkerOpen(DOMNode, &isOpen);
@@ -112,38 +113,38 @@ nsXFormsDropmarkerWidgetAccessible::DoAc
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsCalendarWidgetAccessible::
 nsXFormsCalendarWidgetAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsAccessibleWrap(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsXFormsCalendarWidgetAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_CALENDAR;
+  return roles::CALENDAR;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXFormsComboboxPopupWidgetAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsComboboxPopupWidgetAccessible::
   nsXFormsComboboxPopupWidgetAccessible(nsIContent *aContent,
                                         nsIWeakReference *aShell) :
   nsXFormsAccessible(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsXFormsComboboxPopupWidgetAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_LIST;
+  return roles::LIST;
 }
 
 PRUint64
 nsXFormsComboboxPopupWidgetAccessible::NativeState()
 {
   PRUint64 state = nsXFormsAccessible::NativeState();
 
   bool isOpen = false;
--- a/accessible/src/xforms/nsXFormsWidgetsAccessible.h
+++ b/accessible/src/xforms/nsXFormsWidgetsAccessible.h
@@ -54,17 +54,17 @@ public:
   nsXFormsDropmarkerWidgetAccessible(nsIContent *aContent,
                                      nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 };
 
 
 /**
@@ -72,17 +72,17 @@ public:
  */
 class nsXFormsCalendarWidgetAccessible : public nsAccessibleWrap
 {
 public:
   nsXFormsCalendarWidgetAccessible(nsIContent *aContent,
                                    nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
 };
 
 
 /**
  * Accessible object for popup menu of minimal xforms select1 element that is
  * represented by combobox.
  */
 class nsXFormsComboboxPopupWidgetAccessible : public nsXFormsAccessible
@@ -92,17 +92,17 @@ public:
                                         nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetValue(nsAString& aValue);
 
   // nsAccessible
   virtual void Description(nsString& aDescription);
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
 protected:
   // nsAccessible
   virtual void CacheChildren();
 };
 
 #endif
--- a/accessible/src/xul/nsXULAlertAccessible.cpp
+++ b/accessible/src/xul/nsXULAlertAccessible.cpp
@@ -32,36 +32,37 @@
  * 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 "nsXULAlertAccessible.h"
 
+#include "Role.h"
 #include "States.h"
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULAlertAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXULAlertAccessible::
   nsXULAlertAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsAccessibleWrap(aContent, aShell)
 {
 }
 
 NS_IMPL_ISUPPORTS_INHERITED0(nsXULAlertAccessible, nsAccessible)
 
-PRUint32
+role
 nsXULAlertAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_ALERT;
+  return roles::ALERT;
 }
 
 PRUint64
 nsXULAlertAccessible::NativeState()
 {
   return nsAccessible::NativeState() | states::ALERT;
 }
 
--- a/accessible/src/xul/nsXULAlertAccessible.h
+++ b/accessible/src/xul/nsXULAlertAccessible.h
@@ -50,17 +50,17 @@ public:
   nsXULAlertAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
   NS_IMETHOD GetName(nsAString& aName);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // Widgets
   virtual bool IsWidget() const;
   virtual nsAccessible* ContainerWidget() const;
 };
 
 #endif
--- a/accessible/src/xul/nsXULColorPickerAccessible.cpp
+++ b/accessible/src/xul/nsXULColorPickerAccessible.cpp
@@ -33,21 +33,22 @@
  * 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 "nsXULColorPickerAccessible.h"
 
-#include "States.h"
 #include "nsAccUtils.h"
 #include "nsAccTreeWalker.h"
 #include "nsCoreUtils.h"
 #include "nsDocAccessible.h"
+#include "Role.h"
+#include "States.h"
 
 #include "nsIDOMElement.h"
 #include "nsMenuPopupFrame.h"
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULColorPickerTileAccessible
@@ -72,20 +73,20 @@ nsXULColorPickerTileAccessible::GetValue
 
   mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::color, aValue);
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULColorPickerTileAccessible: nsAccessible
 
-PRUint32
+role
 nsXULColorPickerTileAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_PUSHBUTTON;
+  return roles::PUSHBUTTON;
 }
 
 PRUint64
 nsXULColorPickerTileAccessible::NativeState()
 {
   PRUint64 state = nsAccessibleWrap::NativeState();
   if (!(state & states::UNAVAILABLE))
     state |= states::FOCUSABLE | states::SELECTABLE;
@@ -133,20 +134,20 @@ nsXULColorPickerAccessible::NativeState(
   // get focus and disable status from base class
   PRUint64 states = nsAccessibleWrap::NativeState();
 
   states |= states::FOCUSABLE | states::HASPOPUP;
 
   return states;
 }
 
-PRUint32
+role
 nsXULColorPickerAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_BUTTONDROPDOWNGRID;
+  return roles::BUTTONDROPDOWNGRID;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULColorPickerAccessible: Widgets
 
 bool
 nsXULColorPickerAccessible::IsWidget() const
 {
@@ -178,17 +179,17 @@ nsXULColorPickerAccessible::CacheChildre
 {
   nsAccTreeWalker walker(mWeakShell, mContent, true);
 
   nsAccessible* child = nsnull;
   while ((child = walker.NextChild())) {
     PRUint32 role = child->Role();
 
     // Get an accessible for menupopup or panel elements.
-    if (role == nsIAccessibleRole::ROLE_ALERT) {
+    if (role == roles::ALERT) {
       AppendChild(child);
       return;
     }
 
     // Unbind rejected accessibles from the document.
     GetDocAccessible()->UnbindFromDocument(child);
   }
 }
--- a/accessible/src/xul/nsXULColorPickerAccessible.h
+++ b/accessible/src/xul/nsXULColorPickerAccessible.h
@@ -49,34 +49,34 @@ class nsXULColorPickerTileAccessible : p
 public:
   nsXULColorPickerTileAccessible(nsIContent *aContent,
                                  nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetValue(nsAString& _retval);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // Widgets
   virtual nsAccessible* ContainerWidget() const;
 };
 
 
 /**
  * Used for colorpicker button (xul:colorpicker@type="button").
  */
 class nsXULColorPickerAccessible : public nsXULColorPickerTileAccessible
 {
 public:
   nsXULColorPickerAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // Widgets
   virtual bool IsWidget() const;
   virtual bool IsActiveWidget() const;
   virtual bool AreItemsOperable() const;
 
 protected:
--- a/accessible/src/xul/nsXULComboboxAccessible.cpp
+++ b/accessible/src/xul/nsXULComboboxAccessible.cpp
@@ -35,19 +35,20 @@
  * 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 "States.h"
 #include "nsAccessibilityService.h"
 #include "nsCoreUtils.h"
+#include "Role.h"
+#include "States.h"
 
 #include "nsIAutoCompleteInput.h"
 #include "nsIDOMXULMenuListElement.h"
 #include "nsIDOMXULSelectCntrlItemEl.h"
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -60,22 +61,20 @@ nsXULComboboxAccessible::
 {
   if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                             nsGkAtoms::autocomplete, eIgnoreCase))
     mFlags |= eAutoCompleteAccessible;
   else
     mFlags |= eComboboxAccessible;
 }
 
-PRUint32
+role
 nsXULComboboxAccessible::NativeRole()
 {
-  if (IsAutoComplete())
-    return nsIAccessibleRole::ROLE_AUTOCOMPLETE;
-  return nsIAccessibleRole::ROLE_COMBOBOX;
+  return IsAutoComplete() ? roles::AUTOCOMPLETE : roles::COMBOBOX;
 }
 
 PRUint64
 nsXULComboboxAccessible::NativeState()
 {
   // As a nsComboboxAccessible we can have the following states:
   //     STATE_FOCUSED
   //     STATE_FOCUSABLE
@@ -219,17 +218,17 @@ bool
 nsXULComboboxAccessible::IsActiveWidget() const
 {
   if (IsAutoComplete() ||
      mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::editable,
                            nsGkAtoms::_true, eIgnoreCase)) {
     PRInt32 childCount = mChildren.Length();
     for (PRInt32 idx = 0; idx < childCount; idx++) {
       nsAccessible* child = mChildren[idx];
-      if (child->Role() == nsIAccessibleRole::ROLE_ENTRY)
+      if (child->Role() == roles::ENTRY)
         return FocusMgr()->HasDOMFocus(child->GetContent());
     }
     return false;
   }
 
   return FocusMgr()->HasDOMFocus(mContent);
 }
 
--- a/accessible/src/xul/nsXULComboboxAccessible.h
+++ b/accessible/src/xul/nsXULComboboxAccessible.h
@@ -54,17 +54,17 @@ public:
 
   // nsIAccessible
   NS_IMETHOD GetValue(nsAString& aValue);
   NS_IMETHOD DoAction(PRUint8 aIndex);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
 
   // nsAccessible
   virtual void Description(nsString& aDescription);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
   virtual bool GetAllowsAnonChildAccessibles();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
   // Widgets
   virtual bool IsActiveWidget() const;
--- a/accessible/src/xul/nsXULFormControlAccessible.cpp
+++ b/accessible/src/xul/nsXULFormControlAccessible.cpp
@@ -39,16 +39,17 @@
 
 #include "nsXULFormControlAccessible.h"
 
 #include "nsAccUtils.h"
 #include "nsAccTreeWalker.h"
 #include "nsCoreUtils.h"
 #include "nsDocAccessible.h"
 #include "Relation.h"
+#include "Role.h"
 #include "States.h"
 
 // NOTE: alphabetically ordered
 #include "nsHTMLFormControlAccessible.h"
 #include "nsXULMenuAccessible.h"
 #include "nsIAccessibleRelation.h"
 #include "nsIDOMHTMLInputElement.h"
 #include "nsIDOMNSEditableElement.h"
@@ -109,20 +110,20 @@ nsXULButtonAccessible::DoAction(PRUint8 
 
   DoCommand();
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULButtonAccessible: nsAccessible
 
-PRUint32
+role
 nsXULButtonAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_PUSHBUTTON;
+  return roles::PUSHBUTTON;
 }
 
 PRUint64
 nsXULButtonAccessible::NativeState()
 {
   // Possible states: focused, focusable, unavailable(disabled).
 
   // get focus and disable status from base class
@@ -230,23 +231,23 @@ nsXULButtonAccessible::CacheChildren()
 
   nsAccessible* menupopup = nsnull;
   nsAccessible* button = nsnull;
 
   nsAccTreeWalker walker(mWeakShell, mContent, true);
 
   nsAccessible* child = nsnull;
   while ((child = walker.NextChild())) {
-    PRUint32 role = child->Role();
+    roles::Role role = child->Role();
 
-    if (role == nsIAccessibleRole::ROLE_MENUPOPUP) {
+    if (role == roles::MENUPOPUP) {
       // Get an accessible for menupopup or panel elements.
       menupopup = child;
 
-    } else if (isMenuButton && role == nsIAccessibleRole::ROLE_PUSHBUTTON) {
+    } else if (isMenuButton && role == roles::PUSHBUTTON) {
       // Button type="menu-button" contains a real button. Get an accessible
       // for it. Ignore dropmarker button which is placed as a last child.
       button = child;
       break;
 
     } else {
       // Unbind rejected accessible from document.
       GetDocAccessible()->UnbindFromDocument(child);
@@ -339,20 +340,20 @@ NS_IMETHODIMP nsXULDropmarkerAccessible:
 {
   if (index == eAction_Click) {
     DropmarkerOpen(true); // Reverse the open attribute
     return NS_OK;
   }
   return NS_ERROR_INVALID_ARG;
 }
 
-PRUint32
+role
 nsXULDropmarkerAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_PUSHBUTTON;
+  return roles::PUSHBUTTON;
 }
 
 PRUint64
 nsXULDropmarkerAccessible::NativeState()
 {
   return DropmarkerOpen(false) ? states::PRESSED : 0;
 }
 
@@ -361,20 +362,20 @@ nsXULDropmarkerAccessible::NativeState()
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXULCheckboxAccessible::
   nsXULCheckboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsFormControlAccessible(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsXULCheckboxAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_CHECKBUTTON;
+  return roles::CHECKBUTTON;
 }
 
 PRUint8
 nsXULCheckboxAccessible::ActionCount()
 {
   return 1;
 }
 
@@ -441,20 +442,20 @@ nsXULCheckboxAccessible::NativeState()
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXULGroupboxAccessible::
   nsXULGroupboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsAccessibleWrap(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsXULGroupboxAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_GROUPING;
+  return roles::GROUPING;
 }
 
 nsresult
 nsXULGroupboxAccessible::GetNameInternal(nsAString& aName)
 {
   // XXX: we use the first related accessible only.
   nsAccessible* label =
     RelationByType(nsIAccessibleRelation::RELATION_LABELLED_BY).Next();
@@ -472,17 +473,17 @@ nsXULGroupboxAccessible::RelationByType(
     return rel;
 
   // The label for xul:groupbox is generated from xul:label that is
   // inside the anonymous content of the xul:caption.
   // The xul:label has an accessible object but the xul:caption does not
   PRInt32 childCount = GetChildCount();
   for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
     nsAccessible *childAcc = GetChildAt(childIdx);
-    if (childAcc->Role() == nsIAccessibleRole::ROLE_LABEL) {
+    if (childAcc->Role() == roles::LABEL) {
       // Ensure that it's our label
       Relation reverseRel =
         childAcc->RelationByType(nsIAccessibleRelation::RELATION_LABEL_FOR);
       nsAccessible* testGroupbox = nsnull;
       while ((testGroupbox = reverseRel.Next()))
         if (testGroupbox == this) {
           // The <label> points back to this groupbox
           rel.AppendTarget(childAcc);
@@ -557,20 +558,20 @@ nsXULRadioButtonAccessible::ContainerWid
   */
 
 nsXULRadioGroupAccessible::
   nsXULRadioGroupAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXULSelectableAccessible(aContent, aShell)
 { 
 }
 
-PRUint32
+role
 nsXULRadioGroupAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_GROUPING;
+  return roles::GROUPING;
 }
 
 PRUint64
 nsXULRadioGroupAccessible::NativeState()
 {
   // The radio group is not focusable. Sometimes the focus controller will
   // report that it is focused. That means that the actual selected radio button
   // should be considered focused.
@@ -604,20 +605,20 @@ nsXULRadioGroupAccessible::AreItemsOpera
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXULStatusBarAccessible::
   nsXULStatusBarAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsAccessibleWrap(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsXULStatusBarAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_STATUSBAR;
+  return roles::STATUSBAR;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULToolbarButtonAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXULToolbarButtonAccessible::
@@ -679,20 +680,20 @@ nsXULToolbarButtonAccessible::IsSeparato
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXULToolbarAccessible::
   nsXULToolbarAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsAccessibleWrap(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsXULToolbarAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_TOOLBAR;
+  return roles::TOOLBAR;
 }
 
 nsresult
 nsXULToolbarAccessible::GetNameInternal(nsAString& aName)
 {
   nsAutoString name;
   if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::toolbarname, name)) {
     name.CompressWhitespace();
@@ -709,20 +710,20 @@ nsXULToolbarAccessible::GetNameInternal(
 
 nsXULToolbarSeparatorAccessible::
   nsXULToolbarSeparatorAccessible(nsIContent *aContent,
                                   nsIWeakReference *aShell) :
   nsLeafAccessible(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsXULToolbarSeparatorAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_SEPARATOR;
+  return roles::SEPARATOR;
 }
 
 PRUint64
 nsXULToolbarSeparatorAccessible::NativeState()
 {
   return 0;
 }
 
@@ -796,23 +797,24 @@ nsXULTextFieldAccessible::NativeState()
                                nsGkAtoms::_true, eIgnoreCase)) {
       state |= states::READONLY;
     }
   }
 
   return state;
 }
 
-PRUint32
+role
 nsXULTextFieldAccessible::NativeRole()
 {
   if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                             nsGkAtoms::password, eIgnoreCase))
-    return nsIAccessibleRole::ROLE_PASSWORD_TEXT;
-  return nsIAccessibleRole::ROLE_ENTRY;
+    return roles::PASSWORD_TEXT;
+  
+  return roles::ENTRY;
 }
 
 /**
   * Only one actions available
   */
 PRUint8
 nsXULTextFieldAccessible::ActionCount()
 {
--- a/accessible/src/xul/nsXULFormControlAccessible.h
+++ b/accessible/src/xul/nsXULFormControlAccessible.h
@@ -66,17 +66,17 @@ public:
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
   // Widgets
   virtual bool IsWidget() const;
   virtual bool IsActiveWidget() const;
@@ -102,17 +102,17 @@ public:
   enum { eAction_Click = 0 };
   nsXULCheckboxAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 };
 
 /**
  * Used for XUL dropmarker element.
@@ -123,17 +123,17 @@ public:
   enum { eAction_Click = 0 };
   nsXULDropmarkerAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
 private:
   bool DropmarkerOpen(bool aToggleOpen);
 };
@@ -142,17 +142,17 @@ private:
  * Used for XUL groupbox element.
  */
 class nsXULGroupboxAccessible : public nsAccessibleWrap
 {
 public:
   nsXULGroupboxAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual nsresult GetNameInternal(nsAString& aName);
   virtual Relation RelationByType(PRUint32 aRelationType);
 };
 
 /**
  * Used for XUL radio element (radio button).
  */
 class nsXULRadioButtonAccessible : public nsRadioButtonAccessible
@@ -174,17 +174,17 @@ public:
  * Used for XUL radiogroup element.
  */
 class nsXULRadioGroupAccessible : public nsXULSelectableAccessible
 {
 public:
   nsXULRadioGroupAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // Widgets
   virtual bool IsWidget() const;
   virtual bool IsActiveWidget() const;
   virtual bool AreItemsOperable() const;
 };
 
@@ -192,17 +192,17 @@ public:
  * Used for XUL statusbar element.
  */
 class nsXULStatusBarAccessible : public nsAccessibleWrap
 {
 public:
   nsXULStatusBarAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
 };
 
 /**
  * Used for XUL toolbarbutton element.
  */
 class nsXULToolbarButtonAccessible : public nsXULButtonAccessible
 {
 public:
@@ -220,31 +220,31 @@ public:
  * Used for XUL toolbar element.
  */
 class nsXULToolbarAccessible : public nsAccessibleWrap
 {
 public:
   nsXULToolbarAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual nsresult GetNameInternal(nsAString& aName);
 };
 
 /**
  * Used for XUL toolbarseparator element.
  */
 class nsXULToolbarSeparatorAccessible : public nsLeafAccessible
 {
 public:
   nsXULToolbarSeparatorAccessible(nsIContent* aContent,
                                   nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 };
 
 /**
  * Used for XUL textbox element.
  */
 class nsXULTextFieldAccessible : public nsHyperTextAccessibleWrap
 {
@@ -260,17 +260,17 @@ public:
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsIAccessibleEditableText
   NS_IMETHOD GetAssociatedEditor(nsIEditor **aEditor);
 
   // nsAccessible
   virtual void ApplyARIAState(PRUint64* aState);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
   virtual bool GetAllowsAnonChildAccessibles();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
 protected:
   // nsAccessible
--- a/accessible/src/xul/nsXULListboxAccessible.cpp
+++ b/accessible/src/xul/nsXULListboxAccessible.cpp
@@ -35,19 +35,20 @@
  * 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 "nsXULListboxAccessible.h"
 
-#include "States.h"
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
+#include "Role.h"
+#include "States.h"
 
 #include "nsComponentManagerUtils.h"
 #include "nsIAutoCompleteInput.h"
 #include "nsIAutoCompletePopup.h"
 #include "nsIDOMXULMenuListElement.h"
 #include "nsIDOMXULMultSelectCntrlEl.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMXULPopupElement.h"
@@ -60,20 +61,20 @@ using namespace mozilla::a11y;
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXULColumnsAccessible::
   nsXULColumnsAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsAccessibleWrap(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsXULColumnsAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_LIST;
+  return roles::LIST;
 }
 
 PRUint64
 nsXULColumnsAccessible::NativeState()
 {
   return states::READONLY;
 }
 
@@ -83,20 +84,20 @@ nsXULColumnsAccessible::NativeState()
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXULColumnItemAccessible::
   nsXULColumnItemAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsLeafAccessible(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsXULColumnItemAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_COLUMNHEADER;
+  return roles::COLUMNHEADER;
 }
 
 PRUint64
 nsXULColumnItemAccessible::NativeState()
 {
   return states::READONLY;
 }
 
@@ -206,29 +207,27 @@ NS_IMETHODIMP nsXULListboxAccessible::Ge
     nsCOMPtr<nsIDOMXULSelectControlItemElement> selectedItem;
     select->GetSelectedItem(getter_AddRefs(selectedItem));
     if (selectedItem)
       return selectedItem->GetLabel(_retval);
   }
   return NS_ERROR_FAILURE;
 }
 
-PRUint32
+role
 nsXULListboxAccessible::NativeRole()
 {
   // A richlistbox is used with the new autocomplete URL bar, and has a parent
   // popup <panel>.
   nsCOMPtr<nsIDOMXULPopupElement> xulPopup =
     do_QueryInterface(mContent->GetParent());
   if (xulPopup)
-    return nsIAccessibleRole::ROLE_COMBOBOX_LIST;
+    return roles::COMBOBOX_LIST;
 
-  if (IsMulticolumn())
-    return nsIAccessibleRole::ROLE_TABLE;
-  return nsIAccessibleRole::ROLE_LISTBOX;
+  return IsMulticolumn() ? roles::TABLE : roles::LISTBOX;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULListboxAccessible. nsIAccessibleTable
 
 NS_IMETHODIMP
 nsXULListboxAccessible::GetCaption(nsIAccessible **aCaption)
 {
@@ -609,17 +608,17 @@ nsXULListboxAccessible::GetSelectedCells
     nsCOMPtr<nsIContent> itemContent(do_QueryInterface(itemNode));
     nsAccessible *item =
       GetAccService()->GetAccessibleInWeakShell(itemContent, mWeakShell);
 
     if (item) {
       PRInt32 cellCount = item->GetChildCount();
       for (PRInt32 cellIdx = 0; cellIdx < cellCount; cellIdx++) {
         nsAccessible *cell = mChildren[cellIdx];
-        if (cell->Role() == nsIAccessibleRole::ROLE_CELL)
+        if (cell->Role() == roles::CELL)
           selCells->AppendElement(static_cast<nsIAccessible*>(cell), false);
       }
     }
   }
 
   NS_ADDREF(*aCells = selCells);
   return NS_OK;
 }
@@ -958,35 +957,35 @@ nsXULListitemAccessible::GetNameInternal
                                          kNameSpaceID_XUL)) {
       childContent->GetAttr(kNameSpaceID_None, nsGkAtoms::label, aName);
       return NS_OK;
     }
   }
   return GetXULName(aName);
 }
 
-PRUint32
+role
 nsXULListitemAccessible::NativeRole()
 {
   nsAccessible *list = GetListAccessible();
   if (!list) {
     NS_ERROR("No list accessible for listitem accessible!");
-    return nsIAccessibleRole::ROLE_NOTHING;
+    return roles::NOTHING;
   }
 
-  if (list->Role() == nsIAccessibleRole::ROLE_TABLE)
-    return nsIAccessibleRole::ROLE_ROW;
+  if (list->Role() == roles::TABLE)
+    return roles::ROW;
 
   if (mIsCheckbox)
-    return nsIAccessibleRole::ROLE_CHECKBUTTON;
+    return roles::CHECKBUTTON;
 
-  if (mParent && mParent->Role() == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
-    return nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
+  if (mParent && mParent->Role() == roles::COMBOBOX_LIST)
+    return roles::COMBOBOX_OPTION;
 
-  return nsIAccessibleRole::ROLE_RICH_OPTION;
+  return roles::RICH_OPTION;
 }
 
 PRUint64
 nsXULListitemAccessible::NativeState()
 {
   if (mIsCheckbox)
     return nsXULMenuitemAccessible::NativeState();
 
@@ -1074,21 +1073,21 @@ nsXULListCellAccessible::GetTable(nsIAcc
 {
   NS_ENSURE_ARG_POINTER(aTable);
   *aTable = nsnull;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsAccessible* thisRow = Parent();
-  if (!thisRow || thisRow->Role() != nsIAccessibleRole::ROLE_ROW)
+  if (!thisRow || thisRow->Role() != roles::ROW)
     return NS_OK;
 
   nsAccessible* table = thisRow->Parent();
-  if (!table || table->Role() != nsIAccessibleRole::ROLE_TABLE)
+  if (!table || table->Role() != roles::TABLE)
     return NS_OK;
 
   CallQueryInterface(table, aTable);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXULListCellAccessible::GetColumnIndex(PRInt32 *aColumnIndex)
@@ -1103,21 +1102,19 @@ nsXULListCellAccessible::GetColumnIndex(
   if (!row)
     return NS_OK;
 
   *aColumnIndex = 0;
 
   PRInt32 indexInRow = IndexInParent();
   for (PRInt32 idx = 0; idx < indexInRow; idx++) {
     nsAccessible* cell = row->GetChildAt(idx);
-    PRUint32 role = cell->Role();
-    if (role == nsIAccessibleRole::ROLE_CELL ||
-        role == nsIAccessibleRole::ROLE_GRID_CELL ||
-        role == nsIAccessibleRole::ROLE_ROWHEADER ||
-        role == nsIAccessibleRole::ROLE_COLUMNHEADER)
+    roles::Role role = cell->Role();
+    if (role == roles::CELL || role == roles::GRID_CELL ||
+        role == roles::ROWHEADER || role == roles::COLUMNHEADER)
       (*aColumnIndex)++;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXULListCellAccessible::GetRowIndex(PRInt32 *aRowIndex)
@@ -1136,17 +1133,17 @@ nsXULListCellAccessible::GetRowIndex(PRI
   if (!table)
     return NS_OK;
 
   *aRowIndex = 0;
 
   PRInt32 indexInTable = row->IndexInParent();
   for (PRInt32 idx = 0; idx < indexInTable; idx++) {
     row = table->GetChildAt(idx);
-    if (row->Role() == nsIAccessibleRole::ROLE_ROW)
+    if (row->Role() == roles::ROW)
       (*aRowIndex)++;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXULListCellAccessible::GetColumnExtent(PRInt32 *aExtentCount)
@@ -1189,17 +1186,17 @@ nsXULListCellAccessible::GetColumnHeader
 
   // Get column header cell from XUL listhead.
   nsAccessible *list = nsnull;
 
   nsRefPtr<nsAccessible> tableAcc(do_QueryObject(table));
   PRInt32 tableChildCount = tableAcc->GetChildCount();
   for (PRInt32 childIdx = 0; childIdx < tableChildCount; childIdx++) {
     nsAccessible *child = tableAcc->GetChildAt(childIdx);
-    if (child->Role() == nsIAccessibleRole::ROLE_LIST) {
+    if (child->Role() == roles::LIST) {
       list = child;
       break;
     }
   }
 
   if (list) {
     PRInt32 colIdx = -1;
     GetColumnIndex(&colIdx);
@@ -1259,20 +1256,20 @@ nsXULListCellAccessible::IsSelected(bool
   GetRowIndex(&rowIdx);
 
   return table->IsRowSelected(rowIdx, aIsSelected);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULListCellAccessible. nsAccessible implementation
 
-PRUint32
+role
 nsXULListCellAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_CELL;
+  return roles::CELL;
 }
 
 nsresult
 nsXULListCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
 {
   NS_ENSURE_ARG_POINTER(aAttributes);
 
   if (IsDefunct())
--- a/accessible/src/xul/nsXULListboxAccessible.h
+++ b/accessible/src/xul/nsXULListboxAccessible.h
@@ -53,17 +53,17 @@ class nsIWeakReference;
  * (xul:treecols and xul:listcols).
  */
 class nsXULColumnsAccessible : public nsAccessibleWrap
 {
 public:
   nsXULColumnsAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 };
 
 /**
  * nsXULColumnAccessible are accessibles for list and tree column elements
  * (xul:listcol and xul:treecol).
  */
 class nsXULColumnItemAccessible : public nsLeafAccessible
@@ -71,17 +71,17 @@ class nsXULColumnItemAccessible : public
 public:
   nsXULColumnItemAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
   enum { eAction_Click = 0 };
 };
 
@@ -97,17 +97,17 @@ public:
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIACCESSIBLETABLE
 
   // nsIAccessible
   NS_IMETHOD GetValue(nsAString& aValue);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // Widgets
   virtual bool IsWidget() const;
   virtual bool IsActiveWidget() const;
   virtual bool AreItemsOperable() const;
 
   virtual nsAccessible* ContainerWidget() const;
@@ -131,17 +131,17 @@ public:
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 index, nsAString& aName);
   // Don't use XUL menuitems's description attribute
 
   // nsAccessible
   virtual void Description(nsString& aDesc);
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
   virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
                                           PRInt32 *aSetSize);
   virtual bool GetAllowsAnonChildAccessibles();
 
   // Widgets
   virtual nsAccessible* ContainerWidget() const;
 
@@ -167,12 +167,12 @@ public:
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessibleTableCell
   NS_DECL_NSIACCESSIBLETABLECELL
 
   // nsAccessible
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
 };
 
 #endif
--- a/accessible/src/xul/nsXULMenuAccessible.cpp
+++ b/accessible/src/xul/nsXULMenuAccessible.cpp
@@ -37,16 +37,17 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsXULMenuAccessible.h"
 
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "nsDocAccessible.h"
 #include "nsXULFormControlAccessible.h"
+#include "Role.h"
 #include "States.h"
 
 #include "nsIDOMElement.h"
 #include "nsIDOMXULElement.h"
 #include "nsIMutableArray.h"
 #include "nsIDOMXULContainerElement.h"
 #include "nsIDOMXULSelectCntrlItemEl.h"
 #include "nsIDOMXULMultSelectCntrlEl.h"
@@ -354,17 +355,17 @@ nsXULMenuitemAccessible::NativeState()
 
     // Checked?
     if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::checked,
                               nsGkAtoms::_true, eCaseMatters))
       state |= states::CHECKED;
   }
 
   // Combo box listitem
-  bool isComboboxOption = (Role() == nsIAccessibleRole::ROLE_COMBOBOX_OPTION);
+  bool isComboboxOption = (Role() == roles::COMBOBOX_OPTION);
   if (isComboboxOption) {
     // Is selected?
     bool isSelected = false;
     nsCOMPtr<nsIDOMXULSelectControlItemElement>
       item(do_QueryInterface(mContent));
     NS_ENSURE_TRUE(item, state);
     item->GetSelected(&isSelected);
 
@@ -378,17 +379,17 @@ nsXULMenuitemAccessible::NativeState()
       state |= states::SELECTED;
 
       // Selected and collapsed?
       if (isCollapsed) {
         // Set selected option offscreen/invisible according to combobox state
         nsAccessible* grandParent = parent->Parent();
         if (!grandParent)
           return state;
-        NS_ASSERTION(grandParent->Role() == nsIAccessibleRole::ROLE_COMBOBOX,
+        NS_ASSERTION(grandParent->Role() == roles::COMBOBOX,
                      "grandparent of combobox listitem is not combobox");
         PRUint64 grandParentState = grandParent->State();
         state &= ~(states::OFFSCREEN | states::INVISIBLE);
         state |= (grandParentState & states::OFFSCREEN) |
                  (grandParentState & states::INVISIBLE) |
                  (grandParentState & states::OPAQUE1);
       } // isCollapsed
     } // isSelected
@@ -441,17 +442,17 @@ nsXULMenuitemAccessible::AccessKey() con
                     accesskey);
   if (accesskey.IsEmpty())
     return KeyBinding();
 
   PRUint32 modifierKey = 0;
 
   nsAccessible* parentAcc = Parent();
   if (parentAcc) {
-    if (parentAcc->NativeRole() == nsIAccessibleRole::ROLE_MENUBAR) {
+    if (parentAcc->NativeRole() == roles::MENUBAR) {
       // If top level menu item, add Alt+ or whatever modifier text to string
       // No need to cache pref service, this happens rarely
       if (gMenuAccesskeyModifier == -1) {
         // Need to initialize cached global accesskey pref
         gMenuAccesskeyModifier = Preferences::GetInt("ui.key.menuAccessKey", 0);
       }
 
       switch (gMenuAccesskeyModifier) {
@@ -530,38 +531,36 @@ nsXULMenuitemAccessible::KeyboardShortcu
         modifierMask |= KeyBinding::kControl;
 #endif
     }
   }
 
   return KeyBinding(key, modifierMask);
 }
 
-PRUint32
+role
 nsXULMenuitemAccessible::NativeRole()
 {
   nsCOMPtr<nsIDOMXULContainerElement> xulContainer(do_QueryInterface(mContent));
   if (xulContainer)
-    return nsIAccessibleRole::ROLE_PARENT_MENUITEM;
+    return roles::PARENT_MENUITEM;
 
-  if (mParent && mParent->Role() == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
-    return nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
+  if (mParent && mParent->Role() == roles::COMBOBOX_LIST)
+    return roles::COMBOBOX_OPTION;
 
   if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
-                            nsGkAtoms::radio, eCaseMatters)) {
-    return nsIAccessibleRole::ROLE_RADIO_MENU_ITEM;
-  }
+                            nsGkAtoms::radio, eCaseMatters)) 
+    return roles::RADIO_MENU_ITEM;
 
   if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::type,
                             nsGkAtoms::checkbox,
-                            eCaseMatters)) {
-    return nsIAccessibleRole::ROLE_CHECK_MENU_ITEM;
-  }
+                            eCaseMatters)) 
+    return roles::CHECK_MENU_ITEM;
 
-  return nsIAccessibleRole::ROLE_MENUITEM;
+  return roles::MENUITEM;
 }
 
 PRInt32
 nsXULMenuitemAccessible::GetLevelInternal()
 {
   return nsAccUtils::GetLevelForXULContainerItem(mContent);
 }
 
@@ -676,20 +675,20 @@ nsXULMenuSeparatorAccessible::NativeStat
 }
 
 nsresult
 nsXULMenuSeparatorAccessible::GetNameInternal(nsAString& aName)
 {
   return NS_OK;
 }
 
-PRUint32
+role
 nsXULMenuSeparatorAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_SEPARATOR;
+  return roles::SEPARATOR;
 }
 
 NS_IMETHODIMP nsXULMenuSeparatorAccessible::DoAction(PRUint8 index)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP nsXULMenuSeparatorAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
@@ -757,38 +756,35 @@ nsXULMenupopupAccessible::GetNameInterna
   while (content && aName.IsEmpty()) {
     content->GetAttr(kNameSpaceID_None, nsGkAtoms::label, aName);
     content = content->GetParent();
   }
 
   return NS_OK;
 }
 
-PRUint32
+role
 nsXULMenupopupAccessible::NativeRole()
 {
   // If accessible is not bound to the tree (this happens while children are
   // cached) return general role.
   if (mParent) {
-    PRUint32 role = mParent->Role();
-    if (role == nsIAccessibleRole::ROLE_COMBOBOX ||
-        role == nsIAccessibleRole::ROLE_AUTOCOMPLETE) {
-      return nsIAccessibleRole::ROLE_COMBOBOX_LIST;
-    }
+    roles::Role role = mParent->Role();
+    if (role == roles::COMBOBOX || role == roles::AUTOCOMPLETE)
+      return roles::COMBOBOX_LIST;
 
-    if (role == nsIAccessibleRole::ROLE_PUSHBUTTON) {
+    if (role == roles::PUSHBUTTON) {
       // Some widgets like the search bar have several popups, owned by buttons.
       nsAccessible* grandParent = mParent->Parent();
-      if (grandParent &&
-          grandParent->Role() == nsIAccessibleRole::ROLE_AUTOCOMPLETE)
-        return nsIAccessibleRole::ROLE_COMBOBOX_LIST;
+      if (grandParent && grandParent->Role() == roles::AUTOCOMPLETE)
+        return roles::COMBOBOX_LIST;
     }
   }
 
-  return nsIAccessibleRole::ROLE_MENUPOPUP;
+  return roles::MENUPOPUP;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULMenupopupAccessible: Widgets
 
 bool
 nsXULMenupopupAccessible::IsWidget() const
 {
@@ -869,20 +865,20 @@ nsXULMenubarAccessible::NativeState()
 
 nsresult
 nsXULMenubarAccessible::GetNameInternal(nsAString& aName)
 {
   aName.AssignLiteral("Application");
   return NS_OK;
 }
 
-PRUint32
+role
 nsXULMenubarAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_MENUBAR;
+  return roles::MENUBAR;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULMenubarAccessible: Widgets
 
 bool
 nsXULMenubarAccessible::IsActiveWidget() const
 {
--- a/accessible/src/xul/nsXULMenuAccessible.h
+++ b/accessible/src/xul/nsXULMenuAccessible.h
@@ -87,17 +87,17 @@ public:
 
   // nsIAccessible
   NS_IMETHOD DoAction(PRUint8 index);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
 
   // nsAccessible
   virtual void Description(nsString& aDescription);
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
   virtual PRInt32 GetLevelInternal();
   virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
                                           PRInt32 *aSetSize);
 
   virtual bool GetAllowsAnonChildAccessibles();
 
   // ActionAccessible
@@ -120,17 +120,17 @@ public:
   nsXULMenuSeparatorAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD DoAction(PRUint8 index);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 };
 
 
 /**
@@ -138,17 +138,17 @@ public:
  */
 class nsXULMenupopupAccessible : public nsXULSelectableAccessible
 {
 public:
   nsXULMenupopupAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // Widgets
   virtual bool IsWidget() const;
   virtual bool IsActiveWidget() const;
   virtual bool AreItemsOperable() const;
 
   virtual nsAccessible* ContainerWidget() const;
@@ -159,17 +159,17 @@ public:
  */
 class nsXULMenubarAccessible : public nsAccessibleWrap
 {
 public:
   nsXULMenubarAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // Widget
   virtual bool IsActiveWidget() const;
   virtual bool AreItemsOperable() const;
   virtual nsAccessible* CurrentItem();
   virtual void SetCurrentItem(nsAccessible* aItem);
 };
--- a/accessible/src/xul/nsXULSliderAccessible.cpp
+++ b/accessible/src/xul/nsXULSliderAccessible.cpp
@@ -34,16 +34,17 @@
  * 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 "nsXULSliderAccessible.h"
 
 #include "nsAccessibilityService.h"
+#include "Role.h"
 #include "States.h"
 
 #include "nsIDOMDocument.h"
 #include "nsIDOMDocumentXBL.h"
 #include "nsIFrame.h"
 
 using namespace mozilla::a11y;
 
@@ -60,20 +61,20 @@ nsXULSliderAccessible::
 // nsISupports
 
 NS_IMPL_ISUPPORTS_INHERITED1(nsXULSliderAccessible,
                              nsAccessibleWrap,
                              nsIAccessibleValue)
 
 // nsAccessible
 
-PRUint32
+role
 nsXULSliderAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_SLIDER;
+  return roles::SLIDER;
 }
 
 PRUint64
 nsXULSliderAccessible::NativeState()
 {
   PRUint64 states = nsAccessibleWrap::NativeState();
 
   nsCOMPtr<nsIContent> sliderContent(GetSliderNode());
@@ -291,14 +292,14 @@ nsXULThumbAccessible::
   nsXULThumbAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsAccessibleWrap(aContent, aShell)
 {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULThumbAccessible: nsAccessible
 
-PRUint32
+role
 nsXULThumbAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_INDICATOR;
+  return roles::INDICATOR;
 }
 
--- a/accessible/src/xul/nsXULSliderAccessible.h
+++ b/accessible/src/xul/nsXULSliderAccessible.h
@@ -58,17 +58,17 @@ public:
   NS_IMETHOD GetValue(nsAString& aValue);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsIAccessibleValue
   NS_DECL_NSIACCESSIBLEVALUE
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
   virtual bool GetAllowsAnonChildAccessibles();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
 protected:
   already_AddRefed<nsIContent> GetSliderNode();
@@ -88,13 +88,13 @@ private:
  * Used for slider's thumb element.
  */
 class nsXULThumbAccessible : public nsAccessibleWrap
 {
 public:
   nsXULThumbAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
 };
 
 #endif
 
--- a/accessible/src/xul/nsXULTabAccessible.cpp
+++ b/accessible/src/xul/nsXULTabAccessible.cpp
@@ -35,16 +35,17 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsXULTabAccessible.h"
 
 #include "nsAccUtils.h"
 #include "Relation.h"
+#include "Role.h"
 #include "States.h"
 
 // NOTE: alphabetically ordered
 #include "nsIAccessibleRelation.h"
 #include "nsIDocument.h"
 #include "nsIFrame.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMXULSelectCntrlEl.h"
@@ -95,20 +96,20 @@ NS_IMETHODIMP nsXULTabAccessible::DoActi
     return NS_ERROR_FAILURE;
   }
   return NS_ERROR_INVALID_ARG;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULTabAccessible: nsAccessible
 
-PRUint32
+role
 nsXULTabAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_PAGETAB;
+  return roles::PAGETAB;
 }
 
 PRUint64
 nsXULTabAccessible::NativeState()
 {
   // Possible states: focused, focusable, unavailable(disabled), offscreen.
 
   // get focus and disable status from base class
@@ -177,20 +178,20 @@ nsXULTabAccessible::GetPositionAndSizeIn
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXULTabsAccessible::
   nsXULTabsAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXULSelectableAccessible(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsXULTabsAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_PAGETABLIST;
+  return roles::PAGETABLIST;
 }
 
 PRUint8
 nsXULTabsAccessible::ActionCount()
 {
   return 0;
 }
 
@@ -213,37 +214,37 @@ nsXULTabsAccessible::GetNameInternal(nsA
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXULTabpanelsAccessible::
   nsXULTabpanelsAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsAccessibleWrap(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsXULTabpanelsAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_PANE;
+  return roles::PANE;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULTabpanelAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXULTabpanelAccessible::
   nsXULTabpanelAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsAccessibleWrap(aContent, aShell)
 {
 }
 
-PRUint32
+role
 nsXULTabpanelAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_PROPERTYPAGE;
+  return roles::PROPERTYPAGE;
 }
 
 Relation
 nsXULTabpanelAccessible::RelationByType(PRUint32 aType)
 {
   Relation rel = nsAccessibleWrap::RelationByType(aType);
   if (aType != nsIAccessibleRelation::RELATION_LABELLED_BY)
     return rel;
--- a/accessible/src/xul/nsXULTabAccessible.h
+++ b/accessible/src/xul/nsXULTabAccessible.h
@@ -55,17 +55,17 @@ public:
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsAccessible
   virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
                                           PRInt32 *aSetSize);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
   virtual Relation RelationByType(PRUint32 aType);
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 };
 
 
@@ -77,33 +77,33 @@ class nsXULTabsAccessible : public nsXUL
 public:
   nsXULTabsAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetValue(nsAString& _retval);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 };
 
 
 /** 
  * A container of tab panels, xul:tabpanels element.
  */
 class nsXULTabpanelsAccessible : public nsAccessibleWrap
 {
 public:
   nsXULTabpanelsAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
 };
 
 
 /**
  * A tabpanel object, child elements of xul:tabpanels element. Note,the object
  * is created from nsAccessibilityService::GetAccessibleForDeckChildren()
  * method and we do not use nsIAccessibleProvider interface here because
  * all children of xul:tabpanels element acts as xul:tabpanel element.
@@ -113,14 +113,14 @@ public:
  * a tabpanel.
  */
 class nsXULTabpanelAccessible : public nsAccessibleWrap
 {
 public:
   nsXULTabpanelAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual Relation RelationByType(PRUint32 aType);
 };
 
 #endif
 
--- a/accessible/src/xul/nsXULTextAccessible.cpp
+++ b/accessible/src/xul/nsXULTextAccessible.cpp
@@ -40,16 +40,17 @@
 // NOTE: groups are alphabetically ordered
 #include "nsXULTextAccessible.h"
 
 #include "nsAccUtils.h"
 #include "nsBaseWidgetAccessible.h"
 #include "nsCoreUtils.h"
 #include "nsTextEquivUtils.h"
 #include "Relation.h"
+#include "Role.h"
 #include "States.h"
 
 #include "nsIAccessibleRelation.h"
 #include "nsIDOMXULDescriptionElement.h"
 #include "nsINameSpaceManager.h"
 #include "nsString.h"
 #include "nsNetUtil.h"
 
@@ -69,20 +70,20 @@ nsresult
 nsXULTextAccessible::GetNameInternal(nsAString& aName)
 {
   // if the value attr doesn't exist, the screen reader must get the accessible text
   // from the accessible text interface or from the children
   mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::value, aName);
   return NS_OK;
 }
 
-PRUint32
+role
 nsXULTextAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_LABEL;
+  return roles::LABEL;
 }
 
 PRUint64
 nsXULTextAccessible::NativeState()
 {
   // Labels and description have read only state
   // They are not focusable or selectable
   return nsHyperTextAccessibleWrap::NativeState() | states::READONLY;
@@ -92,17 +93,17 @@ Relation
 nsXULTextAccessible::RelationByType(PRUint32 aType)
 {
   Relation rel = nsHyperTextAccessibleWrap::RelationByType(aType);
   if (aType == nsIAccessibleRelation::RELATION_LABEL_FOR) {
     // Caption is the label for groupbox
     nsIContent *parent = mContent->GetParent();
     if (parent && parent->Tag() == nsGkAtoms::caption) {
       nsAccessible* parent = Parent();
-      if (parent && parent->Role() == nsIAccessibleRole::ROLE_GROUPING)
+      if (parent && parent->Role() == roles::GROUPING)
         rel.AppendTarget(parent);
     }
   }
 
   return rel;
 }
 
 
@@ -121,20 +122,20 @@ nsXULTooltipAccessible::NativeState()
 {
   PRUint64 states = nsLeafAccessible::NativeState();
 
   states &= ~states::FOCUSABLE;
   states |= states::READONLY;
   return states;
 }
 
-PRUint32
+role
 nsXULTooltipAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_TOOLTIP;
+  return roles::TOOLTIP;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULLinkAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXULLinkAccessible::
@@ -167,20 +168,20 @@ nsXULLinkAccessible::GetNameInternal(nsA
 {
   mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::value, aName);
   if (!aName.IsEmpty())
     return NS_OK;
 
   return nsTextEquivUtils::GetNameFromSubtree(this, aName);
 }
 
-PRUint32
+role
 nsXULLinkAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_LINK;
+  return roles::LINK;
 }
 
 
 PRUint64
 nsXULLinkAccessible::NativeState()
 {
   return nsHyperTextAccessible::NativeState() | states::LINKED;
 }
--- a/accessible/src/xul/nsXULTextAccessible.h
+++ b/accessible/src/xul/nsXULTextAccessible.h
@@ -48,32 +48,32 @@
  */
 class nsXULTextAccessible : public nsHyperTextAccessibleWrap
 {
 public:
   nsXULTextAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
   virtual Relation RelationByType(PRUint32 aRelationType);
 };
 
 /**
  * Used for XUL tooltip element.
  */
 class nsXULTooltipAccessible : public nsLeafAccessible
 {
 
 public:
   nsXULTooltipAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 };
 
 class nsXULLinkAccessible : public nsHyperTextAccessibleWrap
 {
 
 public:
   nsXULLinkAccessible(nsIContent *aContent, nsIWeakReference *aShell);
@@ -83,17 +83,17 @@ public:
   // nsIAccessible
   NS_IMETHOD GetValue(nsAString& aValue);
 
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
   // HyperLinkAccessible
   virtual bool IsLink();
   virtual PRUint32 StartOffset();
--- a/accessible/src/xul/nsXULTreeAccessible.cpp
+++ b/accessible/src/xul/nsXULTreeAccessible.cpp
@@ -39,16 +39,17 @@
 
 #include "nsXULTreeAccessible.h"
 
 #include "nsAccCache.h"
 #include "nsAccUtils.h"
 #include "nsCoreUtils.h"
 #include "nsDocAccessible.h"
 #include "Relation.h"
+#include "Role.h"
 #include "States.h"
 
 #include "nsComponentManagerUtils.h"
 #include "nsIAccessibleRelation.h"
 #include "nsIAutoCompleteInput.h"
 #include "nsIAutoCompletePopup.h"
 #include "nsIDOMXULElement.h"
 #include "nsIDOMXULMenuListElement.h"
@@ -187,31 +188,29 @@ nsXULTreeAccessible::Shutdown()
   mTreeView = nsnull;
 
   nsAccessibleWrap::Shutdown();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULTreeAccessible: nsAccessible implementation (put methods here)
 
-PRUint32
+role
 nsXULTreeAccessible::NativeRole()
 {
   // No primary column means we're in a list. In fact, history and mail turn off
   // the primary flag when switching to a flat view.
 
   nsCOMPtr<nsITreeColumns> cols;
   mTree->GetColumns(getter_AddRefs(cols));
   nsCOMPtr<nsITreeColumn> primaryCol;
   if (cols)
     cols->GetPrimaryColumn(getter_AddRefs(primaryCol));
 
-  return primaryCol ?
-    static_cast<PRUint32>(nsIAccessibleRole::ROLE_OUTLINE) :
-    static_cast<PRUint32>(nsIAccessibleRole::ROLE_LIST);
+  return primaryCol ? roles::OUTLINE : roles::LIST;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULTreeAccessible: nsAccessible implementation (DON'T put methods here)
 
 nsAccessible*
 nsXULTreeAccessible::ChildAtPoint(PRInt32 aX, PRInt32 aY,
                                   EWhichChildAtPoint aWhichChild)
@@ -1181,32 +1180,30 @@ nsXULTreeItemAccessible::Shutdown()
 {
   mColumn = nsnull;
   nsXULTreeItemAccessibleBase::Shutdown();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULTreeItemAccessible: nsAccessible implementation
 
-PRUint32
+role
 nsXULTreeItemAccessible::NativeRole()
 {
   nsCOMPtr<nsITreeColumns> columns;
   mTree->GetColumns(getter_AddRefs(columns));
   if (!columns) {
     NS_ERROR("No tree columns object in the tree!");
-    return nsIAccessibleRole::ROLE_NOTHING;
+    return roles::NOTHING;
   }
 
   nsCOMPtr<nsITreeColumn> primaryColumn;
   columns->GetPrimaryColumn(getter_AddRefs(primaryColumn));
 
-  return primaryColumn ?
-    static_cast<PRUint32>(nsIAccessibleRole::ROLE_OUTLINEITEM) :
-    static_cast<PRUint32>(nsIAccessibleRole::ROLE_LISTITEM);
+  return primaryColumn ? roles::OUTLINEITEM : roles::LISTITEM;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULTreeItemAccessible: nsXULTreeItemAccessibleBase implementation
 
 void
 nsXULTreeItemAccessible::RowInvalidated(PRInt32 aStartColIdx,
                                         PRInt32 aEndColIdx)
--- a/accessible/src/xul/nsXULTreeAccessible.h
+++ b/accessible/src/xul/nsXULTreeAccessible.h
@@ -77,17 +77,17 @@ public:
   // nsIAccessible
   NS_IMETHOD GetValue(nsAString& aValue);
 
   // nsAccessNode
   virtual bool IsDefunct() const;
   virtual void Shutdown();
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
   virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY,
                                      EWhichChildAtPoint aWhichChild);
 
   virtual nsAccessible* GetChildAt(PRUint32 aIndex);
   virtual PRInt32 GetChildCount();
 
   // SelectAccessible
@@ -287,17 +287,17 @@ public:
   NS_IMETHOD GetName(nsAString& aName);
 
   // nsAccessNode
   virtual bool IsDefunct() const;
   virtual bool Init();
   virtual void Shutdown();
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
 
   // nsXULTreeItemAccessibleBase
   virtual void RowInvalidated(PRInt32 aStartColIdx, PRInt32 aEndColIdx);
 
 protected:
 
   // nsAccessible
   virtual void CacheChildren();
--- a/accessible/src/xul/nsXULTreeGridAccessible.cpp
+++ b/accessible/src/xul/nsXULTreeGridAccessible.cpp
@@ -39,16 +39,17 @@
 #include "nsXULTreeGridAccessibleWrap.h"
 
 #include "nsAccCache.h"
 #include "nsAccessibilityService.h"
 #include "nsAccUtils.h"
 #include "nsDocAccessible.h"
 #include "nsEventShell.h"
 #include "Relation.h"
+#include "Role.h"
 #include "States.h"
 
 #include "nsITreeSelection.h"
 #include "nsComponentManagerUtils.h"
 
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -576,32 +577,30 @@ nsXULTreeGridAccessible::IsProbablyForLa
   *aIsProbablyForLayout = false;
 
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULTreeGridAccessible: nsAccessible implementation
 
-PRUint32
+role
 nsXULTreeGridAccessible::NativeRole()
 {
   nsCOMPtr<nsITreeColumns> treeColumns;
   mTree->GetColumns(getter_AddRefs(treeColumns));
   if (!treeColumns) {
     NS_ERROR("No treecolumns object for tree!");
-    return nsIAccessibleRole::ROLE_NOTHING;
+    return roles::NOTHING;
   }
 
   nsCOMPtr<nsITreeColumn> primaryColumn;
   treeColumns->GetPrimaryColumn(getter_AddRefs(primaryColumn));
 
-  return primaryColumn ?
-    static_cast<PRUint32>(nsIAccessibleRole::ROLE_TREE_TABLE) :
-    static_cast<PRUint32>(nsIAccessibleRole::ROLE_TABLE);
+  return primaryColumn ? roles::TREE_TABLE : roles::TABLE;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULTreeGridAccessible: nsXULTreeAccessible implementation
 
 already_AddRefed<nsAccessible>
 nsXULTreeGridAccessible::CreateTreeItemAccessible(PRInt32 aRow)
 {
@@ -658,20 +657,20 @@ nsXULTreeGridRowAccessible::Shutdown()
 {
   ClearCache(mAccessibleCache);
   nsXULTreeItemAccessibleBase::Shutdown();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULTreeGridRowAccessible: nsAccessible implementation
 
-PRUint32
+role
 nsXULTreeGridRowAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_ROW;
+  return roles::ROW;
 }
 
 NS_IMETHODIMP
 nsXULTreeGridRowAccessible::GetName(nsAString& aName)
 {
   aName.Truncate();
 
   if (IsDefunct())
@@ -1192,20 +1191,20 @@ nsXULTreeGridCellAccessible::GetAttribut
   nsresult rv = mColumn->GetCycler(&isCycler);
   if (NS_SUCCEEDED(rv) && isCycler)
     nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::cycles,
                            NS_LITERAL_STRING("true"));
 
   return NS_OK;
 }
 
-PRUint32
+role
 nsXULTreeGridCellAccessible::NativeRole()
 {
-  return nsIAccessibleRole::ROLE_GRID_CELL;
+  return roles::GRID_CELL;
 }
 
 PRUint64
 nsXULTreeGridCellAccessible::NativeState()
 {
   // selectable/selected state
   PRUint64 states = states::SELECTABLE;
 
--- a/accessible/src/xul/nsXULTreeGridAccessible.h
+++ b/accessible/src/xul/nsXULTreeGridAccessible.h
@@ -54,17 +54,17 @@ public:
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessibleTable
   NS_DECL_NSIACCESSIBLETABLE
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
 
 protected:
 
   // nsXULTreeAccessible
   virtual already_AddRefed<nsAccessible> CreateTreeItemAccessible(PRInt32 aRow);
 };
 
 
@@ -86,17 +86,17 @@ public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsXULTreeGridRowAccessible,
                                            nsXULTreeItemAccessibleBase)
 
   // nsAccessNode
   virtual void Shutdown();
 
   // nsAccessible
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   NS_IMETHOD GetName(nsAString& aName);
   virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY,
                                      EWhichChildAtPoint aWhichChild);
 
   virtual nsAccessible* GetChildAt(PRUint32 aIndex);
   virtual PRInt32 GetChildCount();
 
   // nsXULTreeItemAccessibleBase
@@ -159,17 +159,17 @@ public:
   virtual bool Init();
   virtual bool IsPrimaryForNode() const;
 
   // nsAccessible
   virtual nsAccessible* FocusedChild();
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
   virtual PRInt32 IndexInParent() const;
   virtual Relation RelationByType(PRUint32 aType);
-  virtual PRUint32 NativeRole();
+  virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
   // nsXULTreeGridCellAccessible
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_XULTREEGRIDCELLACCESSIBLE_IMPL_CID)