Merge m-c to s-c
authorGregory Szorc <gps@mozilla.com>
Fri, 13 Jan 2012 14:41:44 -0800
changeset 85887 2152f7c1273e49fc2df6572e1ed61ef7bc30c2fd
parent 85886 19c77c1b12e54addce1f6cd96f364838e928c4a7 (current diff)
parent 85622 790cd9bba7f52fc8c4ef9f16e7c46363216c510e (diff)
child 85888 59ecf7d205344e3d0deaa2a43f04e9ec550ba039
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone12.0a1
Merge m-c to s-c
content/base/src/nsFileDataProtocolHandler.cpp
content/base/src/nsFileDataProtocolHandler.h
mobile/android/base/resources/drawable-hdpi-v11/ic_awesomebar_go.png
mobile/android/base/resources/drawable-hdpi-v11/ic_awesomebar_search.png
mobile/android/base/resources/drawable-hdpi-v9/ic_menu_bookmark_add.png
mobile/android/base/resources/drawable-hdpi-v9/ic_menu_bookmark_remove.png
mobile/android/base/resources/drawable-hdpi-v9/ic_menu_find_in_page.png
mobile/android/base/resources/drawable-hdpi-v9/ic_menu_forward.png
mobile/android/base/resources/drawable-hdpi-v9/ic_menu_reload.png
mobile/android/base/resources/drawable-hdpi-v9/ic_menu_save_as_pdf.png
mobile/android/base/resources/drawable-hdpi-v9/ic_menu_share.png
mobile/android/base/resources/drawable-mdpi-v11/ic_awesomebar_go.png
mobile/android/base/resources/drawable-mdpi-v11/ic_awesomebar_search.png
mobile/android/base/resources/drawable-mdpi-v9/ic_menu_bookmark_add.png
mobile/android/base/resources/drawable-mdpi-v9/ic_menu_bookmark_remove.png
mobile/android/base/resources/drawable-mdpi-v9/ic_menu_find_in_page.png
mobile/android/base/resources/drawable-mdpi-v9/ic_menu_forward.png
mobile/android/base/resources/drawable-mdpi-v9/ic_menu_reload.png
mobile/android/base/resources/drawable-mdpi-v9/ic_menu_save_as_pdf.png
mobile/android/base/resources/drawable-mdpi-v9/ic_menu_share.png
tools/profiler/sps/platform-macos.cc
--- 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/nsAccessNode.h
+++ b/accessible/src/base/nsAccessNode.h
@@ -190,16 +190,22 @@ public:
    * Return true if the accessible is primary accessible for the given DOM node.
    *
    * Accessible hierarchy may be complex for single DOM node, in this case
    * these accessibles share the same DOM node. The primary accessible "owns"
    * that DOM node in terms it gets stored in the accessible to node map.
    */
   virtual bool IsPrimaryForNode() const;
 
+  /**
+   * Return the string bundle
+   */
+  static nsIStringBundle* GetStringBundle()
+    { return gStringBundle; }
+
 protected:
     nsPresContext* GetPresContext();
 
     void LastRelease();
 
   nsCOMPtr<nsIContent> mContent;
   nsCOMPtr<nsIWeakReference> mWeakShell;
 
--- 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"
@@ -595,21 +596,19 @@ nsAccessible::VisibilityState()
 {
   PRUint64 vstates = states::INVISIBLE | states::OFFSCREEN;
 
   // We need to check the parent chain for visibility.
   nsAccessible* accessible = this;
   do {
     // We don't want background tab page content to be aggressively invisible.
     // Otherwise this foils screen reader virtual buffer caches.
-	  PRUint32 role = accessible->Role();
-    if (role == nsIAccessibleRole::ROLE_PROPERTYPAGE ||
-        role == nsIAccessibleRole::ROLE_PANE) {
+    roles::Role role = accessible->Role();
+    if (role == roles::PROPERTYPAGE || role == roles::PANE)
       break;
-    }
 
     nsIFrame* frame = accessible->GetFrame();
     if (!frame)
       return vstates;
 
     const nsIView* view = frame->GetView();
     if (view && view->GetVisibility() == nsViewVisibility_kHide)
       return vstates;
@@ -1470,31 +1469,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 +1556,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 +1733,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 +1986,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 +3130,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
@@ -204,19 +204,19 @@ public:
    */
   nsresult FireDelayedAccessibleEvent(AccEvent* aEvent);
 
   /**
    * Fire value change event on the given accessible if applicable.
    */
   inline void MaybeNotifyOfValueChange(nsAccessible* aAccessible)
   {
-    PRUint32 role = aAccessible->Role();
-    if (role == nsIAccessibleRole::ROLE_ENTRY ||
-        role == nsIAccessibleRole::ROLE_COMBOBOX) {
+    mozilla::a11y::role role = aAccessible->Role();
+    if (role == mozilla::a11y::roles::ENTRY ||
+        role == mozilla::a11y::roles::COMBOBOX) {
       nsRefPtr<AccEvent> valueChangeEvent =
         new AccEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, aAccessible,
                      eAutoDetect, AccEvent::eRemoveDupes);
       FireDelayedAccessibleEvent(valueChangeEvent);
     }
   }
 
   /**
--- 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.h
+++ b/accessible/src/mac/mozAccessible.h
@@ -67,17 +67,17 @@
    * in |expire|, and prevent any potential harm that could come from someone using us
    * after this point.
    */
   BOOL mIsExpired;
   
   /**
    * The nsIAccessible role of our gecko accessible.
    */
-  PRUint32        mRole;
+  mozilla::a11y::role        mRole;
 }
 
 // inits with the gecko owner.
 - (id)initWithAccessible:(nsAccessibleWrap*)geckoParent;
 
 // our accessible parent (AXParent)
 - (id <mozAccessible>)parent;
 
--- a/accessible/src/mac/mozAccessible.mm
+++ b/accessible/src/mac/mozAccessible.mm
@@ -38,27 +38,33 @@
  
 #import "mozAccessible.h"
 
 // to get the mozView formal protocol, that all gecko's ChildViews implement.
 #import "mozView.h"
 #import "nsRoleMap.h"
 
 #include "nsRect.h"
+#include "nsCocoaUtils.h"
 #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;
 
 // converts a screen-global point in the cocoa coordinate system (with origo in the bottom-left corner
 // of the screen), into a top-left screen point, that gecko can use.
 static inline void
 ConvertCocoaToGeckoPoint(NSPoint &aInPoint, nsPoint &aOutPoint)
 {
   float mainScreenHeight = [(NSView*)[[NSScreen screens] objectAtIndex:0] frame].size.height;
@@ -116,32 +122,50 @@ GetNativeFromGeckoAccessible(nsIAccessib
 
   mozAccessible *native = nil;
   anAccessible->GetNativeInterface ((void**)&native);
   return native;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NSNULL;
 }
 
+/**
+ * Get a localized string from the string bundle.
+ * Return nil is not found.
+ */
+static NSString* 
+GetLocalizedString(const nsString& aString)
+{
+  if (!nsAccessNode::GetStringBundle())
+    return nil;
+
+  nsXPIDLString text;
+  nsresult rv = nsAccessNode::GetStringBundle()->GetStringFromName(aString.get(),
+                                 getter_Copies(text));
+  NS_ENSURE_SUCCESS(rv, nil);
+
+  return !text.IsEmpty() ? nsCocoaUtils::ToNSString(text) : nil;
+}
+
 #pragma mark -
- 
+
 @implementation mozAccessible
  
 - (id)initWithAccessible:(nsAccessibleWrap*)geckoAccessible
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   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
@@ -224,18 +248,23 @@ GetNativeFromGeckoAccessible(nsIAccessib
   if ([attribute isEqualToString:NSAccessibilityPositionAttribute]) 
     return [self position];
   if ([attribute isEqualToString:NSAccessibilitySubroleAttribute])
     return [self subrole];
   if ([attribute isEqualToString:NSAccessibilityEnabledAttribute])
     return [NSNumber numberWithBool:[self isEnabled]];
   if ([attribute isEqualToString:NSAccessibilityValueAttribute])
     return [self value];
-  if ([attribute isEqualToString:NSAccessibilityRoleDescriptionAttribute])
+  if ([attribute isEqualToString:NSAccessibilityRoleDescriptionAttribute]) {
+    if (mRole == roles::INTERNAL_FRAME || mRole == roles::DOCUMENT_FRAME)
+      return GetLocalizedString(NS_LITERAL_STRING("htmlContent")) ? : @"HTML Content";
+
     return NSAccessibilityRoleDescription([self role], nil);
+  }
+  
   if ([attribute isEqualToString:NSAccessibilityDescriptionAttribute])
     return [self customDescription];
   if ([attribute isEqualToString:NSAccessibilityFocusedAttribute])
     return [NSNumber numberWithBool:[self isFocused]];
   if ([attribute isEqualToString:NSAccessibilitySizeAttribute])
     return [self size];
   if ([attribute isEqualToString:NSAccessibilityWindowAttribute])
     return [self window];
--- 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)
 
--- a/b2g/app/b2g.js
+++ b/b2g/app/b2g.js
@@ -394,8 +394,17 @@ pref("layers.acceleration.force-enabled"
 pref("dom.screenEnabledProperty.enabled", true);
 pref("dom.screenBrightnessProperty.enabled", true);
 
 // Temporary permission hack for WebSMS
 pref("dom.sms.enabled", true);
 pref("dom.sms.whitelist", "file://,http://localhost:6666");
 // Ignore X-Frame-Options headers.
 pref("b2g.ignoreXFrameOptions", true);
+
+// "Preview" landing of bug 710563, which is bogged down in analysis
+// of talos regression.  This is a needed change for higher-framerate
+// CSS animations, and incidentally works around an apparent bug in
+// our handling of requestAnimationFrame() listeners, which are
+// supposed to enable this REPEATING_PRECISE_CAN_SKIP behavior.  The
+// secondary bug isn't really worth investigating since it's obseleted
+// by bug 710563.
+pref("layout.frame_rate.precise", true);
--- a/browser/app/profile/firefox.js
+++ b/browser/app/profile/firefox.js
@@ -867,17 +867,17 @@ pref("browser.zoom.siteSpecific", true);
 
 // Whether or not to update background tabs to the current zoom level.
 pref("browser.zoom.updateBackgroundTabs", true);
 
 // The breakpad report server to link to in about:crashes
 pref("breakpad.reportURL", "http://crash-stats.mozilla.com/report/index/");
 
 // base URL for web-based support pages
-pref("app.support.baseURL", "http://support.mozilla.com/1/firefox/%VERSION%/%OS%/%LOCALE%/");
+pref("app.support.baseURL", "http://support.mozilla.org/1/firefox/%VERSION%/%OS%/%LOCALE%/");
 
 // Name of alternate about: page for certificate errors (when undefined, defaults to about:neterror)
 pref("security.alternate_certificate_error_page", "certerror");
 
 // Whether to start the private browsing mode at application startup
 pref("browser.privatebrowsing.autostart", false);
 
 // Whether we should skip prompting before starting the private browsing mode
--- a/browser/base/content/browser-appmenu.inc
+++ b/browser/base/content/browser-appmenu.inc
@@ -174,17 +174,18 @@
           </menupopup>
       </splitmenu>
       <menuseparator class="appmenu-menuseparator"/>
       <menu id="appmenu_webDeveloper"
             label="&appMenuWebDeveloper.label;">
         <menupopup id="appmenu_webDeveloper_popup">
           <menuitem id="appmenu_webConsole"
                     label="&webConsoleCmd.label;"
-                    oncommand="HUDConsoleUI.toggleHUD();"
+                    type="checkbox"
+                    command="Tools:WebConsole"
                     key="key_webConsole"/>
           <menuitem id="appmenu_pageInspect"
                     hidden="true"
                     label="&inspectMenu.label;"
                     type="checkbox"
                     command="Tools:Inspect"
                     key="key_inspect"/>
           <menuitem id="appmenu_scratchpad"
--- a/browser/base/content/browser-menubar.inc
+++ b/browser/base/content/browser-menubar.inc
@@ -528,20 +528,21 @@
                         oncommand="gSyncUI.doSync(event);"/>
 #endif
               <menuseparator id="devToolsSeparator"/>
               <menu id="webDeveloperMenu"
                     label="&webDeveloperMenu.label;"
                     accesskey="&webDeveloperMenu.accesskey;">
                 <menupopup id="menuWebDeveloperPopup">
                   <menuitem id="webConsole"
+                            type="checkbox"
                             label="&webConsoleCmd.label;"
                             accesskey="&webConsoleCmd.accesskey;"
                             key="key_webConsole"
-                            oncommand="HUDConsoleUI.toggleHUD();"/>
+                            command="Tools:WebConsole"/>
                   <menuitem id="menu_pageinspect"
                             type="checkbox"
                             hidden="true"
                             label="&inspectMenu.label;"
                             accesskey="&inspectMenu.accesskey;"
                             key="key_inspect"
                             command="Tools:Inspect"/>
                   <menuitem id="menu_scratchpad"
--- a/browser/base/content/browser-sets.inc
+++ b/browser/base/content/browser-sets.inc
@@ -120,16 +120,17 @@
     <command id="cmd_fullZoomReduce"  oncommand="FullZoom.reduce()"/>
     <command id="cmd_fullZoomEnlarge" oncommand="FullZoom.enlarge()"/>
     <command id="cmd_fullZoomReset"   oncommand="FullZoom.reset()"/>
     <command id="cmd_fullZoomToggle"  oncommand="ZoomManager.toggleZoom();"/>
     <command id="Browser:OpenLocation" oncommand="openLocation();"/>
 
     <command id="Tools:Search" oncommand="BrowserSearch.webSearch();"/>
     <command id="Tools:Downloads" oncommand="BrowserDownloadsUI();"/>
+    <command id="Tools:WebConsole" oncommand="HUDConsoleUI.toggleHUD();"/>
     <command id="Tools:Inspect" oncommand="InspectorUI.toggleInspectorUI();" disabled="true"/>
     <command id="Tools:Scratchpad" oncommand="Scratchpad.openScratchpad();" disabled="true"/>
     <command id="Tools:StyleEditor" oncommand="StyleEditor.openChrome();" disabled="true"/>
     <command id="Tools:Addons" oncommand="BrowserOpenAddonsMgr();"/>
     <command id="Tools:Sanitize"
      oncommand="Cc['@mozilla.org/browser/browserglue;1'].getService(Ci.nsIBrowserGlue).sanitize(window);"/>
     <command id="Tools:PrivateBrowsing" oncommand="gPrivateBrowsingUI.toggleMode();"/>
     <command id="History:UndoCloseTab" oncommand="undoCloseTab();"/>
--- a/browser/base/content/browser.css
+++ b/browser/base/content/browser.css
@@ -474,16 +474,17 @@ browser[tabmodalPromptShowing] {
 /* Status panel */
 
 statuspanel {
   -moz-binding: url("chrome://browser/content/tabbrowser.xml#statuspanel");
   position: fixed;
   margin-top: -3em;
   left: 0;
   max-width: 50%;
+  pointer-events: none;
 }
 
 statuspanel:-moz-locale-dir(ltr)[mirror],
 statuspanel:-moz-locale-dir(rtl):not([mirror]) {
   left: auto;
   right: 0;
 }
 
@@ -500,17 +501,16 @@ statuspanel[type=status] {
 statuspanel[type=overLink] {
   -moz-transition: opacity 120ms ease-out;
   direction: ltr;
 }
 
 statuspanel[inactive] {
   -moz-transition: none;
   opacity: 0;
-  pointer-events: none;
 }
 
 statuspanel[inactive][previoustype=overLink] {
   -moz-transition: opacity 200ms ease-out;
 }
 
 .statuspanel-inner {
   height: 3em;
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1696,16 +1696,22 @@ function delayedStartup(isLoadingBlank, 
 
 #ifdef MOZ_SERVICES_SYNC
   // initialize the sync UI
   gSyncUI.init();
 #endif
 
   TabView.init();
 
+  setUrlAndSearchBarWidthForConditionalForwardButton();
+  window.addEventListener("resize", function resizeHandler(event) {
+    if (event.target == window)
+      setUrlAndSearchBarWidthForConditionalForwardButton();
+  });
+
   // Enable Inspector?
   let enabled = gPrefService.getBoolPref("devtools.inspector.enabled");
   if (enabled) {
     document.getElementById("menu_pageinspect").hidden = false;
     document.getElementById("Tools:Inspect").removeAttribute("disabled");
 #ifdef MENUBAR_CAN_AUTOHIDE
     document.getElementById("appmenu_pageInspect").hidden = false;
 #endif
@@ -1746,16 +1752,19 @@ function delayedStartup(isLoadingBlank, 
   // If the user (or the locale) hasn't enabled the top-level "Character
   // Encoding" menu via the "browser.menu.showCharacterEncoding" preference,
   // hide it.
   if ("true" != gPrefService.getComplexValue("browser.menu.showCharacterEncoding",
                                              Ci.nsIPrefLocalizedString).data)
     document.getElementById("appmenu_charsetMenu").hidden = true;
 #endif
 
+  window.addEventListener("mousemove", MousePosTracker, false);
+  window.addEventListener("dragover", MousePosTracker, false);
+
   Services.obs.notifyObservers(window, "browser-delayed-startup-finished", "");
 }
 
 function BrowserShutdown() {
   // In certain scenarios it's possible for unload to be fired before onload,
   // (e.g. if the window is being closed after browser.js loads but before the
   // load completes). In that case, there's nothing to do here.
   if (!gStartupRan)
@@ -2602,16 +2611,34 @@ function UpdateUrlbarSearchSplitterState
       splitter.setAttribute("resizeafter", "flex");
       splitter.className = "chromeclass-toolbar-additional";
     }
     urlbar.parentNode.insertBefore(splitter, ibefore);
   } else if (splitter)
     splitter.parentNode.removeChild(splitter);
 }
 
+function setUrlAndSearchBarWidthForConditionalForwardButton() {
+  // Woraround for bug 694084: Showing/hiding the conditional forward button resizes
+  // the search bar when the url/search bar splitter hasn't been used.
+  var urlbarContainer = document.getElementById("urlbar-container");
+  var searchbarContainer = document.getElementById("search-container");
+  if (!urlbarContainer ||
+      !searchbarContainer ||
+      urlbarContainer.hasAttribute("width") ||
+      searchbarContainer.hasAttribute("width") ||
+      urlbarContainer.parentNode != searchbarContainer.parentNode)
+    return;
+  urlbarContainer.style.width = searchbarContainer.style.width = "";
+  var urlbarWidth = urlbarContainer.clientWidth;
+  var searchbarWidth = searchbarContainer.clientWidth;
+  urlbarContainer.style.width = urlbarWidth + "px";
+  searchbarContainer.style.width = searchbarWidth + "px";
+}
+
 function UpdatePageProxyState()
 {
   if (gURLBar && gURLBar.value != gLastValidURLStr)
     SetPageProxyState("invalid");
 }
 
 function SetPageProxyState(aState)
 {
@@ -3727,16 +3754,17 @@ function BrowserToolboxCustomizeDone(aTo
 
   PlacesToolbarHelper.customizeDone();
   BookmarksMenuButton.customizeDone();
 
   // The url bar splitter state is dependent on whether stop/reload
   // and the location bar are combined, so we need this ordering
   CombinedStopReload.init();
   UpdateUrlbarSearchSplitterState();
+  setUrlAndSearchBarWidthForConditionalForwardButton();
 
   // Update the urlbar
   if (gURLBar) {
     URLBarSetURI();
     XULBrowserWindow.asyncUpdateUI();
     PlacesStarButton.updateState();
   }
 
@@ -3902,23 +3930,20 @@ var FullScreen = {
       this._shouldAnimate = !document.mozFullScreen;
       this.mouseoverToggle(false);
 
       // Autohide prefs
       gPrefService.addObserver("browser.fullscreen", this, false);
     }
     else {
       // The user may quit fullscreen during an animation
-      window.mozCancelAnimationFrame(this._animationHandle);
-      this._animationHandle = 0;
-      clearTimeout(this._animationTimeout);
+      this._cancelAnimation();
       gNavToolbox.style.marginTop = "";
       if (this._isChromeCollapsed)
         this.mouseoverToggle(true);
-      this._isAnimating = false;
       // This is needed if they use the context menu to quit fullscreen
       this._isPopupOpen = false;
 
       this.cleanup();
     }
   },
 
   exitDomFullScreen : function(e) {
@@ -3969,20 +3994,17 @@ var FullScreen = {
     gBrowser.tabContainer.addEventListener("TabClose", this.exitDomFullScreen);
     gBrowser.tabContainer.addEventListener("TabSelect", this.exitDomFullScreen);
 
     // Exit DOM full-screen mode when the browser window loses focus (ALT+TAB, etc).
     window.addEventListener("deactivate", this.exitDomFullScreen, true);
 
     // Cancel any "hide the toolbar" animation which is in progress, and make
     // the toolbar hide immediately.
-    clearInterval(this._animationInterval);
-    clearTimeout(this._animationTimeout);
-    this._isAnimating = false;
-    this._shouldAnimate = false;
+    this._cancelAnimation();
     this.mouseoverToggle(false);
 
     // If there's a full-screen toggler, remove its listeners, so that mouseover
     // the top of the screen will not cause the toolbar to re-appear.
     let fullScrToggler = document.getElementById("fullscr-toggler");
     if (fullScrToggler) {
       fullScrToggler.removeEventListener("mouseover", this._expandCallback, false);
       fullScrToggler.removeEventListener("dragenter", this._expandCallback, false);
@@ -4117,29 +4139,34 @@ var FullScreen = {
   sample: function (timeStamp) {
     const duration = 1500;
     const timePassed = timeStamp - this._animateStartTime;
     const pos = timePassed >= duration ? 1 :
                 1 - Math.pow(1 - timePassed / duration, 4);
 
     if (pos >= 1) {
       // We've animated enough
-      window.mozCancelAnimationFrame(this._animationHandle);
+      this._cancelAnimation();
       gNavToolbox.style.marginTop = "";
-      this._animationHandle = 0;
-      this._isAnimating = false;
-      this._shouldAnimate = false; // Just to make sure
       this.mouseoverToggle(false);
       return;
     }
 
     gNavToolbox.style.marginTop = (gNavToolbox.boxObject.height * pos * -1) + "px";
     this._animationHandle = window.mozRequestAnimationFrame(this);
   },
 
+  _cancelAnimation: function() {
+    window.mozCancelAnimationFrame(this._animationHandle);
+    this._animationHandle = 0;
+    clearTimeout(this._animationTimeout);
+    this._isAnimating = false;
+    this._shouldAnimate = false;
+  },
+
   cancelWarning: function(event) {
     if (!this.warningBox) {
       return;
     }
     if (this.onWarningHidden) {
       this.warningBox.removeEventListener("transitionend", this.onWarningHidden, false);
       this.onWarningHidden = null;
     }
@@ -9051,15 +9078,78 @@ XPCOMUtils.defineLazyGetter(window, "gSh
   let sysInfo = Components.classes["@mozilla.org/system-info;1"]
                           .getService(Components.interfaces.nsIPropertyBag2);
   return parseFloat(sysInfo.getProperty("version")) < 6;
 #else
   return false;
 #endif
 });
 
+
+var MousePosTracker = {
+  _listeners: [],
+  _x: 0,
+  _y: 0,
+  get _windowUtils() {
+    delete this._windowUtils;
+    return this._windowUtils = window.getInterface(Ci.nsIDOMWindowUtils);
+  },
+
+  addListener: function (listener) {
+    if (this._listeners.indexOf(listener) >= 0)
+      return;
+
+    listener._hover = false;
+    this._listeners.push(listener);
+
+    this._callListener(listener);
+  },
+
+  removeListener: function (listener) {
+    var index = this._listeners.indexOf(listener);
+    if (index < 0)
+      return;
+
+    this._listeners.splice(index, 1);
+  },
+
+  handleEvent: function (event) {
+    var screenPixelsPerCSSPixel = this._windowUtils.screenPixelsPerCSSPixel;
+    this._x = event.screenX / screenPixelsPerCSSPixel - window.mozInnerScreenX;
+    this._y = event.screenY / screenPixelsPerCSSPixel - window.mozInnerScreenY;
+
+    this._listeners.forEach(function (listener) {
+      try {
+        this._callListener(listener);
+      } catch (e) {
+        Cu.reportError(e);
+      }
+    }, this);
+  },
+
+  _callListener: function (listener) {
+    let rect = listener.getMouseTargetRect();
+    let hover = this._x >= rect.left &&
+                this._x <= rect.right &&
+                this._y >= rect.top &&
+                this._y <= rect.bottom;
+
+    if (hover == listener._hover)
+      return;
+
+    listener._hover = hover;
+
+    if (hover) {
+      if (listener.onMouseEnter)
+        listener.onMouseEnter();
+    } else {
+      if (listener.onMouseLeave)
+        listener.onMouseLeave();
+    }
+  }
+};
 function focusNextFrame(event) {
   let fm = Cc["@mozilla.org/focus-manager;1"].getService(Ci.nsIFocusManager);
   let dir = event.shiftKey ? fm.MOVEFOCUS_BACKWARDDOC : fm.MOVEFOCUS_FORWARDDOC;
   let element = fm.moveFocus(window, null, dir, fm.FLAG_BYKEY);
   if (element.ownerDocument == document)
     focusAndSelectUrlBar();
 }
--- a/browser/base/content/tabbrowser.xml
+++ b/browser/base/content/tabbrowser.xml
@@ -4002,20 +4002,23 @@
                    flex="1"
                    crop="end"/>
       </xul:hbox>
     </content>
 
     <implementation implements="nsIDOMEventListener">
       <constructor><![CDATA[
         window.addEventListener("findbaropen", this, false);
+        window.addEventListener("resize", this, false);
       ]]></constructor>
 
       <destructor><![CDATA[
         window.removeEventListener("findbaropen", this, false);
+        window.removeEventListener("resize", this, false);
+        MousePosTracker.removeListener(this);
       ]]></destructor>
 
       <property name="label">
         <setter><![CDATA[
           if (!this.label) {
             if (window.gFindBarInitialized && !window.gFindBar.hidden)
               this.setAttribute("mirror", "true");
             else
@@ -4024,45 +4027,87 @@
 
           this.style.minWidth = this.getAttribute("type") == "status" &&
                                 this.getAttribute("previoustype") == "status"
                                   ? getComputedStyle(this).width : "";
 
           if (val) {
             this.setAttribute("label", val);
             this.removeAttribute("inactive");
+            this._calcMouseTargetRect();
+            MousePosTracker.addListener(this);
           } else {
             this.setAttribute("inactive", "true");
+            MousePosTracker.removeListener(this);
           }
 
           return val;
         ]]></setter>
         <getter>
           return this.hasAttribute("inactive") ? "" : this.getAttribute("label");
         </getter>
       </property>
 
+      <method name="getMouseTargetRect">
+        <body><![CDATA[
+          return this._mouseTargetRect;
+        ]]></body>
+      </method>
+
+      <method name="onMouseEnter">
+        <body>
+          this._mirror();
+        </body>
+      </method>
+
+      <method name="onMouseLeave">
+        <body>
+          this._mirror();
+        </body>
+      </method>
+
       <method name="handleEvent">
         <parameter name="event"/>
         <body><![CDATA[
-          if (event.type == "findbaropen" &&
-              this.label)
-            this.setAttribute("mirror", "true");
+          if (!this.label)
+            return;
+
+          switch (event.type) {
+            case "findbaropen":
+              this.setAttribute("mirror", "true");
+              this._calcMouseTargetRect();
+              break;
+            case "resize":
+              this._calcMouseTargetRect();
+              break;
+          }
+        ]]></body>
+      </method>
+
+      <method name="_calcMouseTargetRect">
+        <body><![CDATA[
+          let alignRight = (window.gFindBarInitialized && !window.gFindBar.hidden);
+
+          if (getComputedStyle(document.documentElement).direction == "rtl")
+            alighRight = !alignRight;
+
+          let rect = this.getBoundingClientRect();
+          this._mouseTargetRect = {
+            top:    rect.top,
+            bottom: rect.bottom,
+            left:   alignRight ? window.innerWidth - rect.width : 0,
+            right:  alignRight ? window.innerWidth : rect.width
+          };
         ]]></body>
       </method>
 
       <method name="_mirror">
         <body>
           if (this.hasAttribute("mirror"))
             this.removeAttribute("mirror");
           else
             this.setAttribute("mirror", "true");
         </body>
       </method>
     </implementation>
-
-    <handlers>
-      <handler event="mouseover" action="this._mirror();"/>
-      <handler event="dragover" action="this._mirror();"/>
-    </handlers>
   </binding>
 
 </bindings>
--- a/browser/config/mozconfigs/macosx32/debug
+++ b/browser/config/mozconfigs/macosx32/debug
@@ -4,11 +4,8 @@ ac_add_options --enable-trace-malloc
 
 # Enable parallel compiling
 mk_add_options MOZ_MAKE_FLAGS="-j4"
 
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
 
 ac_add_options --with-macbundlename-prefix=Firefox
-
-# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
-ac_add_options --enable-warnings-as-errors
--- a/browser/devtools/scratchpad/test/browser_scratchpad_bug690552_display_outputs_errors.js
+++ b/browser/devtools/scratchpad/test/browser_scratchpad_bug690552_display_outputs_errors.js
@@ -13,17 +13,17 @@ function test()
   }, true);
 
   content.location = "data:text/html,<p>test that exceptions our output as " +
       "comments for 'display' and not sent to the console in Scratchpad";
 }
 
 function runTests()
 {
-  scratchpad = gScratchpadWindow.Scratchpad;
+  var scratchpad = gScratchpadWindow.Scratchpad;
 
   var message = "\"Hello World!\""
   var openComment = "/*\n";
   var closeComment = "\n*/";
   var error = "throw new Error(\"Ouch!\")";
   let messageArray = {};
   let count = {};
 
--- a/browser/devtools/webconsole/HUDService.jsm
+++ b/browser/devtools/webconsole/HUDService.jsm
@@ -114,22 +114,39 @@ XPCOMUtils.defineLazyGetter(this, "Autoc
     Cu.import("resource:///modules/AutocompletePopup.jsm", obj);
   }
   catch (err) {
     Cu.reportError(err);
   }
   return obj.AutocompletePopup;
 });
 
+XPCOMUtils.defineLazyGetter(this, "ScratchpadManager", function () {
+  var obj = {};
+  try {
+    Cu.import("resource:///modules/devtools/scratchpad-manager.jsm", obj);
+  }
+  catch (err) {
+    Cu.reportError(err);
+  }
+  return obj.ScratchpadManager;
+});
+
 XPCOMUtils.defineLazyGetter(this, "namesAndValuesOf", function () {
   var obj = {};
   Cu.import("resource:///modules/PropertyPanel.jsm", obj);
   return obj.namesAndValuesOf;
 });
 
+XPCOMUtils.defineLazyGetter(this, "gConsoleStorage", function () {
+  let obj = {};
+  Cu.import("resource://gre/modules/ConsoleAPIStorage.jsm", obj);
+  return obj.ConsoleAPIStorage;
+});
+
 function LogFactory(aMessagePrefix)
 {
   function log(aMessage) {
     var _msg = aMessagePrefix + " " + aMessage + "\n";
     dump(_msg);
   }
   return log;
 }
@@ -1410,16 +1427,28 @@ HUD_SERVICE.prototype =
    * @returns integer
    */
   getWindowId: function HS_getWindowId(aWindow)
   {
     return aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowUtils).outerWindowID;
   },
 
   /**
+   * Gets the ID of the inner window of this DOM window
+   *
+   * @param nsIDOMWindow aWindow
+   * @returns integer
+   */
+  getInnerWindowId: function HS_getInnerWindowId(aWindow)
+  {
+    return aWindow.QueryInterface(Ci.nsIInterfaceRequestor).
+           getInterface(Ci.nsIDOMWindowUtils).currentInnerWindowID;
+  },
+
+  /**
    * Gets the top level content window that has an outer window with
    * the given ID or returns null if no such content window exists
    *
    * @param integer aId
    * @returns nsIDOMWindow
    */
   getWindowByWindowId: function HS_getWindowByWindowId(aId)
   {
@@ -1506,28 +1535,30 @@ HUD_SERVICE.prototype =
    * @param boolean aAnimated animate opening the Web Console?
    * @returns void
    */
   activateHUDForContext: function HS_activateHUDForContext(aContext, aAnimated)
   {
     this.wakeup();
 
     let window = aContext.linkedBrowser.contentWindow;
-    let nBox = aContext.ownerDocument.defaultView.
-      getNotificationBox(window);
+    let chromeDocument = aContext.ownerDocument;
+    let nBox = chromeDocument.defaultView.getNotificationBox(window);
     this.registerActiveContext(nBox.id);
     this.windowInitializer(window);
 
     let hudId = "hud_" + nBox.id;
     let hudRef = this.hudReferences[hudId];
 
     if (!aAnimated || hudRef.consolePanel) {
       this.disableAnimation(hudId);
     }
 
+    chromeDocument.getElementById("Tools:WebConsole").setAttribute("checked", "true");
+
     // Create a processing instruction for GCLIs CSS stylesheet, but only if
     // we don't have one for this document. Also record the context we're
     // adding this for so we know when to remove it.
     let procInstr = aContext.ownerDocument.gcliCssProcInstr;
     if (!procInstr) {
       procInstr = aContext.ownerDocument.createProcessingInstruction(
               "xml-stylesheet",
               "href='chrome://browser/skin/devtools/gcli.css' type='text/css'");
@@ -1567,16 +1598,18 @@ HUD_SERVICE.prototype =
       browser.webProgress.removeProgressListener(hud.progressListener);
       delete hud.progressListener;
 
       this.unregisterDisplay(hudId);
 
       window.focus();
     }
 
+    chromeDocument.getElementById("Tools:WebConsole").setAttribute("checked", "false");
+
     // Remove this context from the list of contexts that need the GCLI CSS
     // processing instruction and then remove the processing instruction if it
     // isn't needed any more.
     let procInstr = aContext.ownerDocument.gcliCssProcInstr;
     if (procInstr) {
       procInstr.contexts = procInstr.contexts.filter(function(id) {
         return id !== hudId;
       });
@@ -2136,17 +2169,18 @@ HUD_SERVICE.prototype =
     let node = ConsoleUtils.createMessageNode(hud.outputNode.ownerDocument,
                                               CATEGORY_WEBDEV,
                                               LEVELS[level],
                                               body,
                                               aHUDId,
                                               sourceURL,
                                               sourceLine,
                                               clipboardText,
-                                              level);
+                                              level,
+                                              aMessage.timeStamp);
 
     // Make the node bring up the property panel, to allow the user to inspect
     // the stack trace.
     if (level == "trace") {
       node._stacktrace = args;
 
       let linkNode = node.querySelector(".webconsole-msg-body");
       linkNode.classList.add("hud-clickable");
@@ -2203,28 +2237,48 @@ HUD_SERVICE.prototype =
                                               SEVERITY_WARNING, message,
                                               aHUDId);
     ConsoleUtils.outputMessageNode(node, aHUDId);
   },
 
   /**
    * Reports an error in the page source, either JavaScript or CSS.
    *
-   * @param number aCategory
-   *        The category of the message; either CATEGORY_CSS or CATEGORY_JS.
    * @param nsIScriptError aScriptError
    *        The error message to report.
    * @return void
    */
-  reportPageError: function HS_reportPageError(aCategory, aScriptError)
-  {
-    if (aCategory != CATEGORY_CSS && aCategory != CATEGORY_JS) {
-      throw Components.Exception("Unsupported category (must be one of CSS " +
-                                 "or JS)", Cr.NS_ERROR_INVALID_ARG,
-                                 Components.stack.caller);
+  reportPageError: function HS_reportPageError(aScriptError)
+  {
+    if (!aScriptError.outerWindowID) {
+      return;
+    }
+
+    let category;
+
+    switch (aScriptError.category) {
+      // We ignore chrome-originating errors as we only care about content.
+      case "XPConnect JavaScript":
+      case "component javascript":
+      case "chrome javascript":
+      case "chrome registration":
+      case "XBL":
+      case "XBL Prototype Handler":
+      case "XBL Content Sink":
+      case "xbl javascript":
+        return;
+
+      case "CSS Parser":
+      case "CSS Loader":
+        category = CATEGORY_CSS;
+        break;
+
+      default:
+        category = CATEGORY_JS;
+        break;
     }
 
     // Warnings and legacy strict errors become warnings; other types become
     // errors.
     let severity = SEVERITY_ERROR;
     if ((aScriptError.flags & aScriptError.warningFlag) ||
         (aScriptError.flags & aScriptError.strictFlag)) {
       severity = SEVERITY_WARNING;
@@ -2233,22 +2287,24 @@ HUD_SERVICE.prototype =
     let window = HUDService.getWindowByWindowId(aScriptError.outerWindowID);
     if (window) {
       let hudId = HUDService.getHudIdByWindow(window.top);
       if (hudId) {
         let outputNode = this.hudReferences[hudId].outputNode;
         let chromeDocument = outputNode.ownerDocument;
 
         let node = ConsoleUtils.createMessageNode(chromeDocument,
-                                                  aCategory,
+                                                  category,
                                                   severity,
                                                   aScriptError.errorMessage,
                                                   hudId,
                                                   aScriptError.sourceName,
-                                                  aScriptError.lineNumber);
+                                                  aScriptError.lineNumber,
+                                                  null, null,
+                                                  aScriptError.timeStamp);
 
         ConsoleUtils.outputMessageNode(node, hudId);
       }
     }
   },
 
   /**
    * Register a Gecko app's specialized ApplicationHooks object
@@ -2886,29 +2942,31 @@ HUD_SERVICE.prototype =
       }
     }
 
     let hud;
     // If there is no HUD for this tab create a new one.
     if (!hudNode) {
       // get nBox object and call new HUD
       let config = { parentNode: nBox,
-                     contentWindow: aContentWindow
+                     contentWindow: aContentWindow.top
                    };
 
       hud = new HeadsUpDisplay(config);
 
       HUDService.registerHUDReference(hud);
       let windowId = this.getWindowId(aContentWindow.top);
       this.windowIds[windowId] = hudId;
 
       hud.progressListener = new ConsoleProgressListener(hudId);
 
       _browser.webProgress.addProgressListener(hud.progressListener,
         Ci.nsIWebProgress.NOTIFY_STATE_ALL);
+
+      hud.displayCachedConsoleMessages();
     }
     else {
       hud = this.hudReferences[hudId];
       if (aContentWindow == aContentWindow.top) {
         // TODO: name change?? doesn't actually re-attach the console
         hud.reattachConsole(aContentWindow);
       }
     }
@@ -3568,16 +3626,68 @@ HeadsUpDisplay.prototype = {
       }
     }
     else {
       throw new Error("Unsupported Gecko Application");
     }
   },
 
   /**
+   * Display cached messages that may have been collected before the UI is
+   * displayed.
+   *
+   * @returns void
+   */
+  displayCachedConsoleMessages: function HUD_displayCachedConsoleMessages()
+  {
+    let innerWindowId = HUDService.getInnerWindowId(this.contentWindow);
+
+    let messages = gConsoleStorage.getEvents(innerWindowId);
+
+    let errors = {};
+    Services.console.getMessageArray(errors, {});
+
+    // Filter the errors to find only those we should display.
+    let filteredErrors = (errors.value || []).filter(function(aError) {
+      return aError instanceof Ci.nsIScriptError &&
+             aError.innerWindowID == innerWindowId;
+    }, this);
+
+    messages.push.apply(messages, filteredErrors);
+    messages.sort(function(a, b) { return a.timeStamp - b.timeStamp; });
+
+    // Turn off scrolling for the moment.
+    ConsoleUtils.scroll = false;
+    this.outputNode.hidden = true;
+
+    // Display all messages.
+    messages.forEach(function(aMessage) {
+      if (aMessage instanceof Ci.nsIScriptError) {
+        HUDService.reportPageError(aMessage);
+      }
+      else {
+        // In this case the cached message is a console message generated
+        // by the ConsoleAPI, not an nsIScriptError
+        HUDService.logConsoleAPIMessage(this.hudId, aMessage);
+      }
+    }, this);
+
+    this.outputNode.hidden = false;
+    ConsoleUtils.scroll = true;
+
+    // Scroll to bottom.
+    let numChildren = this.outputNode.childNodes.length;
+    if (numChildren && this.outputNode.clientHeight) {
+      // We also check the clientHeight to force a reflow, otherwise
+      // ensureIndexIsVisible() does not work after outputNode.hidden = false.
+      this.outputNode.ensureIndexIsVisible(numChildren - 1);
+    }
+  },
+
+  /**
    * Re-attaches a console when the contentWindow is recreated
    *
    * @param nsIDOMWindow aContentWindow
    * @returns void
    */
   reattachConsole: function HUD_reattachConsole(aContentWindow)
   {
     this.contentWindow = aContentWindow;
@@ -3999,17 +4109,17 @@ HeadsUpDisplay.prototype = {
    * @return void
    */
   makeClearConsoleButton: function HUD_makeClearConsoleButton(aToolbar)
   {
     let hudId = this.hudId;
     function HUD_clearButton_onCommand() {
       let hud = HUDService.getHudReferenceById(hudId);
       if (hud.jsterm) {
-        hud.jsterm.clearOutput();
+        hud.jsterm.clearOutput(true);
       }
       if (hud.gcliterm) {
         hud.gcliterm.clearOutput();
       }
     }
 
     let clearButton = this.makeXULNode("toolbarbutton");
     clearButton.setAttribute("label", this.getStr("btnClear"));
@@ -4517,17 +4627,17 @@ function JSTermHelper(aJSTerm)
   });
 
   /**
    * Clears the output of the JSTerm.
    */
   aJSTerm.sandbox.clear = function JSTH_clear()
   {
     aJSTerm.helperEvaluated = true;
-    aJSTerm.clearOutput();
+    aJSTerm.clearOutput(true);
   };
 
   /**
    * Returns the result of Object.keys(aObject).
    *
    * @param object aObject
    *        Object to return the property names from.
    * @returns array of string
@@ -5109,17 +5219,24 @@ JSTerm.prototype = {
     let type = aResult === null ? "null" : typeof aResult;
     if (type == "object" && aResult.constructor && aResult.constructor.name) {
       type = aResult.constructor.name;
     }
 
     return type.toLowerCase();
   },
 
-  clearOutput: function JST_clearOutput()
+  /**
+   * Clear the Web Console output.
+   *
+   * @param boolean aClearStorage
+   *        True if you want to clear the console messages storage associated to
+   *        this Web Console.
+   */
+  clearOutput: function JST_clearOutput(aClearStorage)
   {
     let hud = HUDService.getHudReferenceById(this.hudId);
     hud.cssNodes = {};
 
     let node = hud.outputNode;
     while (node.firstChild) {
       if (node.firstChild.classList &&
           node.firstChild.classList.contains("webconsole-msg-inspector")) {
@@ -5127,16 +5244,21 @@ JSTerm.prototype = {
       }
       else {
         hud.outputNode.removeChild(node.firstChild);
       }
     }
 
     hud.HUDBox.lastTimestamp = 0;
     hud.groupDepth = 0;
+
+    if (aClearStorage) {
+      let windowId = HUDService.getInnerWindowId(hud.contentWindow);
+      gConsoleStorage.clearEvents(windowId);
+    }
   },
 
   /**
    * Updates the size of the input field (command line) to fit its contents.
    *
    * @returns void
    */
   resizeInput: function JST_resizeInput()
@@ -5657,16 +5779,21 @@ FirefoxApplicationHooks.prototype = {
 //////////////////////////////////////////////////////////////////////////////
 
 /**
  * ConsoleUtils: a collection of globally used functions
  *
  */
 
 ConsoleUtils = {
+  /**
+   * Flag to turn on and off scrolling.
+   */
+  scroll: true,
+
   supString: function ConsoleUtils_supString(aString)
   {
     let str = Cc["@mozilla.org/supports-string;1"].
       createInstance(Ci.nsISupportsString);
     str.data = aString;
     return str;
   },
 
@@ -5700,16 +5827,20 @@ ConsoleUtils = {
    * Scrolls a node so that it's visible in its containing XUL "scrollbox"
    * element.
    *
    * @param nsIDOMNode aNode
    *        The node to make visible.
    * @returns void
    */
   scrollToVisible: function ConsoleUtils_scrollToVisible(aNode) {
+    if (!this.scroll) {
+      return;
+    }
+
     // Find the enclosing richlistbox node.
     let richListBoxNode = aNode.parentNode;
     while (richListBoxNode.tagName != "richlistbox") {
       richListBoxNode = richListBoxNode.parentNode;
     }
 
     // Use the scroll box object interface to ensure the element is visible.
     let boxObject = richListBoxNode.scrollBoxObject;
@@ -5737,24 +5868,28 @@ ConsoleUtils = {
    *        The line number on which the error occurred. If zero or omitted,
    *        there is no line number associated with this message.
    * @param string aClipboardText [optional]
    *        The text that should be copied to the clipboard when this node is
    *        copied. If omitted, defaults to the body text. If `aBody` is not
    *        a string, then the clipboard text must be supplied.
    * @param number aLevel [optional]
    *        The level of the console API message.
+   * @param number aTimeStamp [optional]
+   *        The timestamp to use for this message node. If omitted, the current
+   *        date and time is used.
    * @return nsIDOMNode
    *         The message node: a XUL richlistitem ready to be inserted into
    *         the Web Console output node.
    */
   createMessageNode:
   function ConsoleUtils_createMessageNode(aDocument, aCategory, aSeverity,
                                           aBody, aHUDId, aSourceURL,
-                                          aSourceLine, aClipboardText, aLevel) {
+                                          aSourceLine, aClipboardText, aLevel,
+                                          aTimeStamp) {
     if (typeof aBody != "string" && aClipboardText == null && aBody.innerText) {
       aClipboardText = aBody.innerText;
     }
 
     // Make the icon container, which is a vertical box. Its purpose is to
     // ensure that the icon stays anchored at the top of the message even for
     // long multi-line messages.
     let iconContainer = aDocument.createElementNS(XUL_NS, "vbox");
@@ -5804,17 +5939,17 @@ ConsoleUtils = {
     let repeatNode = aDocument.createElementNS(XUL_NS, "label");
     repeatNode.setAttribute("value", "1");
     repeatNode.classList.add("webconsole-msg-repeat");
     repeatContainer.appendChild(repeatNode);
 
     // Create the timestamp.
     let timestampNode = aDocument.createElementNS(XUL_NS, "label");
     timestampNode.classList.add("webconsole-timestamp");
-    let timestamp = ConsoleUtils.timestamp();
+    let timestamp = aTimeStamp || ConsoleUtils.timestamp();
     let timestampString = ConsoleUtils.timestampString(timestamp);
     timestampNode.setAttribute("value", timestampString);
 
     // Create the source location (e.g. www.example.com:6) that sits on the
     // right side of the message, if applicable.
     let locationNode;
     if (aSourceURL) {
       locationNode = this.createLocationNode(aDocument, aSourceURL,
@@ -6510,58 +6645,32 @@ CommandController.prototype = {
 HUDConsoleObserver = {
   QueryInterface: XPCOMUtils.generateQI(
     [Ci.nsIObserver]
   ),
 
   init: function HCO_init()
   {
     Services.console.registerListener(this);
-    Services.obs.addObserver(this, "xpcom-shutdown", false);
+    Services.obs.addObserver(this, "quit-application-granted", false);
   },
 
   uninit: function HCO_uninit()
   {
     Services.console.unregisterListener(this);
-    Services.obs.removeObserver(this, "xpcom-shutdown");
+    Services.obs.removeObserver(this, "quit-application-granted");
   },
 
   observe: function HCO_observe(aSubject, aTopic, aData)
   {
-    if (aTopic == "xpcom-shutdown") {
+    if (aTopic == "quit-application-granted") {
       this.uninit();
-      return;
-    }
-
-    if (!(aSubject instanceof Ci.nsIScriptError) ||
-        !aSubject.outerWindowID) {
-      return;
-    }
-
-    switch (aSubject.category) {
-      // We ignore chrome-originating errors as we only
-      // care about content.
-      case "XPConnect JavaScript":
-      case "component javascript":
-      case "chrome javascript":
-      case "chrome registration":
-      case "XBL":
-      case "XBL Prototype Handler":
-      case "XBL Content Sink":
-      case "xbl javascript":
-        return;
-
-      case "CSS Parser":
-      case "CSS Loader":
-        HUDService.reportPageError(CATEGORY_CSS, aSubject);
-        return;
-
-      default:
-        HUDService.reportPageError(CATEGORY_JS, aSubject);
-        return;
+    }
+    else if (aSubject instanceof Ci.nsIScriptError) {
+      HUDService.reportPageError(aSubject);
     }
   }
 };
 
 /**
  * A WebProgressListener that listens for location changes, to update HUDService
  * state information on page navigation.
  *
@@ -6666,31 +6775,24 @@ function appName()
   let name = APP_ID_TABLE[APP_ID];
 
   if (name){
     return name;
   }
   throw new Error("appName: UNSUPPORTED APPLICATION UUID");
 }
 
-///////////////////////////////////////////////////////////////////////////
-// HUDService (exported symbol)
-///////////////////////////////////////////////////////////////////////////
-
-try {
-  // start the HUDService
-  // This is in a try block because we want to kill everything if
-  // *any* of this fails
-  var HUDService = new HUD_SERVICE();
-}
-catch (ex) {
-  Cu.reportError("HUDService failed initialization.\n" + ex);
-  // TODO: kill anything that may have started up
-  // see bug 568665
-}
+XPCOMUtils.defineLazyGetter(this, "HUDService", function () {
+  try {
+    return new HUD_SERVICE();
+  }
+  catch (ex) {
+    Cu.reportError(ex);
+  }
+});
 
 ///////////////////////////////////////////////////////////////////////////
 // GcliTerm
 ///////////////////////////////////////////////////////////////////////////
 
 /**
  * Some commands need customization - this is how we get at them.
  */
@@ -6723,29 +6825,44 @@ function GcliTerm(aContentWindow, aHudId
   this.hintNode = aHintNode;
 
   this.createUI();
   this.createSandbox();
 
   this.show = this.show.bind(this);
   this.hide = this.hide.bind(this);
 
+  // Allow GCLI:Inputter to decide how and when to open a scratchpad window
+  let scratchpad = {
+    shouldActivate: function Scratchpad_shouldActivate(aEvent) {
+      return aEvent.shiftKey &&
+          aEvent.keyCode === Ci.nsIDOMKeyEvent.DOM_VK_RETURN;
+    },
+    activate: function Scratchpad_activate(aValue) {
+      aValue = aValue.replace(/^\s*{\s*/, '');
+      ScratchpadManager.openScratchpad({ text: aValue });
+      return true;
+    },
+    linkText: stringBundle.GetStringFromName('scratchpad.linkText')
+  };
+
   this.opts = {
     environment: { hudId: this.hudId },
     chromeDocument: this.document,
     contentDocument: aContentWindow.document,
     jsEnvironment: {
       globalObject: unwrap(aContentWindow),
       evalFunction: this.evalInSandbox.bind(this)
     },
     inputElement: this.inputNode,
     completeElement: this.completeNode,
     inputBackgroundElement: this.inputStack,
     hintElement: this.hintNode,
     consoleWrap: aConsoleWrap,
+    scratchpad: scratchpad,
     gcliTerm: this
   };
 
   gcli._internal.commandOutputManager.addListener(this.onCommandOutput, this);
   gcli._internal.createView(this.opts);
 
   if (!commandExports) {
     commandExports = loadCommands();
--- a/browser/devtools/webconsole/gcli.jsm
+++ b/browser/devtools/webconsole/gcli.jsm
@@ -5319,17 +5319,18 @@ function getManTemplateData(command, con
 
 define('gcli/ui/domtemplate', ['require', 'exports', 'module' ], function(require, exports, module) {
 
   var obj = {};
   Components.utils.import('resource:///modules/devtools/Templater.jsm', obj);
   exports.template = obj.template;
 
 });
-define("text!gcli/commands/help.css", [], void 0);
+define("text!gcli/commands/help.css", [], "");
+
 define("text!gcli/commands/help_intro.html", [], "\n" +
   "<h2>${l10n.introHeader}</h2>\n" +
   "\n" +
   "<p>\n" +
   "</p>\n" +
   "");
 
 define("text!gcli/commands/help_list.html", [], "\n" +
@@ -5410,17 +5411,18 @@ function Console(options) {
 
   this.inputter = new Inputter({
     document: options.chromeDocument,
     requisition: options.requisition,
     inputElement: options.inputElement,
     completeElement: options.completeElement,
     completionPrompt: '',
     backgroundElement: options.backgroundElement,
-    focusManager: this.focusManager
+    focusManager: this.focusManager,
+    scratchpad: options.scratchpad
   });
 
   this.menu = new CommandMenu({
     document: options.chromeDocument,
     requisition: options.requisition,
     menuClass: 'gcliterm-menu'
   });
   this.hintElement.appendChild(this.menu.element);
@@ -5561,34 +5563,36 @@ exports.Console = Console;
 
 });
 /*
  * Copyright 2009-2011 Mozilla Foundation and contributors
  * Licensed under the New BSD license. See LICENSE.txt or:
  * http://opensource.org/licenses/BSD-3-Clause
  */
 
-define('gcli/ui/inputter', ['require', 'exports', 'module' , 'gcli/util', 'gcli/types', 'gcli/history', 'text!gcli/ui/inputter.css'], function(require, exports, module) {
+define('gcli/ui/inputter', ['require', 'exports', 'module' , 'gcli/util', 'gcli/l10n', 'gcli/types', 'gcli/history', 'text!gcli/ui/inputter.css'], function(require, exports, module) {
 var cliView = exports;
 
 
 var KeyEvent = require('gcli/util').event.KeyEvent;
 var dom = require('gcli/util').dom;
+var l10n = require('gcli/l10n');
 
 var Status = require('gcli/types').Status;
 var History = require('gcli/history').History;
 
 var inputterCss = require('text!gcli/ui/inputter.css');
 
 
 /**
  * A wrapper to take care of the functions concerning an input element
  */
 function Inputter(options) {
   this.requisition = options.requisition;
+  this.scratchpad = options.scratchpad;
 
   // Suss out where the input element is
   this.element = options.inputElement || 'gcli-input';
   if (typeof this.element === 'string') {
     this.document = options.document || document;
     var name = this.element;
     this.element = this.document.getElementById(name);
     if (!this.element) {
@@ -5860,16 +5864,24 @@ Inputter.prototype.onKeyDown = function(
     }
   }
 };
 
 /**
  * The main keyboard processing loop
  */
 Inputter.prototype.onKeyUp = function(ev) {
+  // Give the scratchpad (if enabled) a chance to activate
+  if (this.scratchpad && this.scratchpad.shouldActivate(ev)) {
+    if (this.scratchpad.activate(this.element.value)) {
+      this._setInputInternal('', true);
+    }
+    return;
+  }
+
   // RETURN does a special exec/highlight thing
   if (ev.keyCode === KeyEvent.DOM_VK_RETURN) {
     var worst = this.requisition.getStatus();
     // Deny RETURN unless the command might work
     if (worst === Status.VALID) {
       this._scrollingThroughHistory = false;
       this.history.add(this.element.value);
       this.requisition.exec();
@@ -5958,16 +5970,21 @@ Inputter.prototype.getInputState = funct
 
   // Workaround for potential XUL bug 676520 where textbox gives incorrect
   // values for its content
   if (input.typed == null) {
     input = { typed: '', cursor: { start: 0, end: 0 } };
     console.log('fixing input.typed=""', input);
   }
 
+  // Workaround for a Bug 717268 (which is really a jsdom bug)
+  if (input.cursor.start == null) {
+    input.cursor.start = 0;
+  }
+
   return input;
 };
 
 cliView.Inputter = Inputter;
 
 
 /**
  * Completer is an 'input-like' element that sits  an input element annotating
@@ -5981,16 +5998,17 @@ cliView.Inputter = Inputter;
  * - completionPrompt (optional) The prompt - defaults to '\u00bb'
  *   (double greater-than, a.k.a right guillemet). The prompt is used directly
  *   in a TextNode, so HTML entities are not allowed.
  */
 function Completer(options) {
   this.document = options.document || document;
   this.requisition = options.requisition;
   this.elementCreated = false;
+  this.scratchpad = options.scratchpad;
 
   this.element = options.completeElement || 'gcli-row-complete';
   if (typeof this.element === 'string') {
     var name = this.element;
     this.element = this.document.getElementById(name);
 
     if (!this.element) {
       this.elementCreated = true;
@@ -6074,16 +6092,21 @@ Completer.prototype.decorate = function(
     this.resizer();
   }
 };
 
 /**
  * Ensure that the completion element is the same size and the inputter element
  */
 Completer.prototype.resizer = function() {
+  // Remove this when jsdom does getBoundingClientRect(). See Bug 717269
+  if (!this.inputter.element.getBoundingClientRect) {
+    return;
+  }
+
   var rect = this.inputter.element.getBoundingClientRect();
   // -4 to line up with 1px of padding and border, top and bottom
   var height = rect.bottom - rect.top - 4;
 
   this.element.style.top = rect.top + 'px';
   this.element.style.height = height + 'px';
   this.element.style.lineHeight = height + 'px';
   this.element.style.left = rect.left + 'px';
@@ -6118,16 +6141,17 @@ Completer.prototype.update = function(in
   // which is complex due to a need to merge spans.
   // Bug 707131 questions if we couldn't simplify this to use a template.
   //
   // <span class="gcli-prompt">${completionPrompt}</span>
   // ${appendMarkupStatus()}
   // ${prefix}
   // <span class="gcli-in-ontab">${contents}</span>
   // <span class="gcli-in-closebrace" if="${unclosedJs}">}<span>
+  // <div class="gcli-in-scratchlink">${scratchLink}</div>
 
   var document = this.element.ownerDocument;
   var prompt = dom.createElement(document, 'span');
   prompt.classList.add('gcli-prompt');
   prompt.appendChild(document.createTextNode(this.completionPrompt + ' '));
   this.element.appendChild(prompt);
 
   if (input.typed.length > 0) {
@@ -6161,24 +6185,34 @@ Completer.prototype.update = function(in
     suffix.classList.add('gcli-in-ontab');
     suffix.appendChild(document.createTextNode(contents));
     this.element.appendChild(suffix);
   }
 
   // Add a grey '}' to the end of the command line when we've opened
   // with a { but haven't closed it
   var command = this.requisition.commandAssignment.getValue();
-  var unclosedJs = command && command.name === '{' &&
+  var isJsCommand = (command && command.name === '{');
+  var isUnclosedJs = isJsCommand &&
           this.requisition.getAssignment(0).getArg().suffix.indexOf('}') === -1;
-  if (unclosedJs) {
+  if (isUnclosedJs) {
     var close = dom.createElement(document, 'span');
     close.classList.add('gcli-in-closebrace');
     close.appendChild(document.createTextNode(' }'));
     this.element.appendChild(close);
   }
+
+  // Create a scratchpad link if it's a JS command and we have a function to
+  // actually perform the request
+  if (isJsCommand && this.scratchpad) {
+    var hint = dom.createElement(document, 'div');
+    hint.classList.add('gcli-in-scratchlink');
+    hint.appendChild(document.createTextNode(this.scratchpad.linkText));
+    this.element.appendChild(hint);
+  }
 };
 
 /**
  * Mark-up an array of Status values with spans
  */
 Completer.prototype.appendMarkupStatus = function(element, scores, input) {
   if (scores.length === 0) {
     return;
@@ -6281,17 +6315,18 @@ History.prototype.backward = function() 
   if (this._current < this._buffer.length - 1) {
     this._current++;
   }
   return this._buffer[this._current];
 };
 
 exports.History = History;
 
-});define("text!gcli/ui/inputter.css", [], void 0);
+});define("text!gcli/ui/inputter.css", [], "");
+
 /*
  * Copyright 2009-2011 Mozilla Foundation and contributors
  * Licensed under the New BSD license. See LICENSE.txt or:
  * http://opensource.org/licenses/BSD-3-Clause
  */
 
 define('gcli/ui/arg_fetch', ['require', 'exports', 'module' , 'gcli/util', 'gcli/types', 'gcli/ui/field', 'gcli/ui/domtemplate', 'text!gcli/ui/arg_fetch.css', 'text!gcli/ui/arg_fetch.html'], function(require, exports, module) {
 var argFetch = exports;
@@ -7414,31 +7449,33 @@ CommandMenu.prototype.onCommandChange = 
     this.hide();
   }
 };
 
 exports.CommandMenu = CommandMenu;
 
 
 });
-define("text!gcli/ui/menu.css", [], void 0);
+define("text!gcli/ui/menu.css", [], "");
+
 define("text!gcli/ui/menu.html", [], "\n" +
   "<table class=\"gcli-menu-template\" aria-live=\"polite\">\n" +
   "  <tr class=\"gcli-menu-option\" foreach=\"item in ${items}\"\n" +
   "      onclick=\"${onItemClick}\" title=\"${item.manual || ''}\">\n" +
   "    <td class=\"gcli-menu-name\">${item.name}</td>\n" +
   "    <td class=\"gcli-menu-desc\">${item.description}</td>\n" +
   "  </tr>\n" +
   "  <tr if=\"${error}\">\n" +
   "    <td class=\"gcli-menu-error\" colspan=\"2\">${error}</td>\n" +
   "  </tr>\n" +
   "</table>\n" +
   "");
 
-define("text!gcli/ui/arg_fetch.css", [], void 0);
+define("text!gcli/ui/arg_fetch.css", [], "");
+
 define("text!gcli/ui/arg_fetch.html", [], "\n" +
   "<!--\n" +
   "Template for an Assignment.\n" +
   "Evaluated each time the commandAssignment changes\n" +
   "-->\n" +
   "<div class=\"gcli-af-template\" aria-live=\"polite\">\n" +
   "  <div>\n" +
   "    <div class=\"gcli-af-cmddesc\">\n" +
--- a/browser/devtools/webconsole/test/Makefile.in
+++ b/browser/devtools/webconsole/test/Makefile.in
@@ -145,16 +145,17 @@ include $(topsrcdir)/config/rules.mk
 	browser_webconsole_bug_704295.js \
 	browser_gcli_inspect.js \
 	browser_gcli_integrate.js \
 	browser_gcli_require.js \
 	browser_gcli_web.js \
 	browser_webconsole_bug_658368_time_methods.js \
 	browser_webconsole_bug_622303_persistent_filters.js \
 	browser_webconsole_window_zombie.js \
+	browser_cached_messages.js \
 	head.js \
 	$(NULL)
 
 _BROWSER_TEST_PAGES = \
 	test-console.html \
 	test-network.html \
 	test-network-request.html \
 	test-mutation.html \
@@ -217,15 +218,16 @@ include $(topsrcdir)/config/rules.mk
 	test-bug-585956-console-trace.html \
 	test-bug-644419-log-limits.html \
 	test-bug-632275-getters.html \
 	test-bug-646025-console-file-location.html \
 	test-bug-678816-content.js \
 	test-file-location.js \
 	browser_gcli_inspect.html \
 	test-bug-658368-time-methods.html \
+	test-webconsole-error-observer.html \
 	$(NULL)
 
 libs:: $(_BROWSER_TEST_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
 
 libs:: $(_BROWSER_TEST_PAGES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/browser/$(relativesrcdir)
new file mode 100644
--- /dev/null
+++ b/browser/devtools/webconsole/test/browser_cached_messages.js
@@ -0,0 +1,83 @@
+/* vim:set ts=2 sw=2 sts=2 et: */
+/* ***** 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 DevTools test code.
+ *
+ * The Initial Developer of the Original Code is Mozilla Foundation.
+ * Portions created by the Initial Developer are Copyright (C) 2010
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   David Dahl <ddahl@mozilla.com>
+ *   Mihai Sucan <mihai.sucan@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 ***** */
+
+const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-webconsole-error-observer.html";
+
+function test()
+{
+  waitForExplicitFinish();
+
+  expectUncaughtException();
+
+  gBrowser.selectedTab = gBrowser.addTab(TEST_URI);
+
+  gBrowser.selectedBrowser.addEventListener("load", function onLoad() {
+    gBrowser.selectedBrowser.removeEventListener("load", onLoad, true);
+    testOpenUI(true);
+  }, true);
+}
+
+function testOpenUI(aTestReopen)
+{
+  // test to see if the messages are
+  // displayed when the console UI is opened
+
+  HUDService.activateHUDForContext(gBrowser.selectedTab);
+  let hudId = HUDService.getHudIdByWindow(content);
+  let hud = HUDService.getHudReferenceById(hudId);
+
+  testLogEntry(hud.outputNode, "log Bazzle",
+               "Find a console log entry from before console UI is opened",
+               false, null);
+
+  testLogEntry(hud.outputNode, "error Bazzle",
+               "Find a console error entry from before console UI is opened",
+               false, null);
+
+  testLogEntry(hud.outputNode, "bazBug611032", "Found the JavaScript error");
+  testLogEntry(hud.outputNode, "cssColorBug611032", "Found the CSS error");
+
+  HUDService.deactivateHUDForContext(gBrowser.selectedTab);
+
+  if (aTestReopen) {
+    HUDService.deactivateHUDForContext(gBrowser.selectedTab);
+    executeSoon(testOpenUI);
+  } else {
+    executeSoon(finish);
+  }
+}
--- a/browser/devtools/webconsole/test/browser_gcli_web.js
+++ b/browser/devtools/webconsole/test/browser_gcli_web.js
@@ -49,39 +49,83 @@ var define = obj.gcli._internal.define;
 var console = obj.gcli._internal.console;
 var Node = Components.interfaces.nsIDOMNode;
 /*
  * Copyright 2009-2011 Mozilla Foundation and contributors
  * Licensed under the New BSD license. See LICENSE.txt or:
  * http://opensource.org/licenses/BSD-3-Clause
  */
 
-define('gclitest/suite', ['require', 'exports', 'module' , 'gcli/index', 'test/examiner', 'gclitest/testTokenize', 'gclitest/testSplit', 'gclitest/testCli', 'gclitest/testExec', 'gclitest/testKeyboard', 'gclitest/testHistory', 'gclitest/testRequire', 'gclitest/testJs'], function(require, exports, module) {
+define('gclitest/index', ['require', 'exports', 'module' , 'gclitest/suite', 'gcli/types/javascript'], function(require, exports, module) {
+
+  var examiner = require('gclitest/suite').examiner;
+  var javascript = require('gcli/types/javascript');
+
+  /**
+   * Run the tests defined in the test suite
+   * @param options How the tests are run. Properties include:
+   * - window: The browser window object to run the tests against
+   * - useFakeWindow: Use a test subset and a fake DOM to avoid a real document
+   * - detailedResultLog: console.log test passes and failures in more detail
+   */
+  exports.run = function(options) {
+    options = options || {};
+
+    if (options.useFakeWindow) {
+      // A minimum fake dom to get us through the JS tests
+      var doc = { title: 'Fake DOM' };
+      var fakeWindow = {
+        window: { document: doc },
+        document: doc
+      };
+
+      options.window = fakeWindow;
+    }
+
+    if (options.window) {
+      javascript.setGlobalObject(options.window);
+    }
+
+    examiner.run(options);
+
+    if (options.detailedResultLog) {
+      examiner.log();
+    }
+    else {
+      console.log('Completed test suite');
+    }
+  };
+});
+/*
+ * Copyright 2009-2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE.txt or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+
+define('gclitest/suite', ['require', 'exports', 'module' , 'gcli/index', 'test/examiner', 'gclitest/testTokenize', 'gclitest/testSplit', 'gclitest/testCli', 'gclitest/testExec', 'gclitest/testKeyboard', 'gclitest/testScratchpad', 'gclitest/testHistory', 'gclitest/testRequire', 'gclitest/testJs'], function(require, exports, module) {
 
   // We need to make sure GCLI is initialized before we begin testing it
   require('gcli/index');
 
   var examiner = require('test/examiner');
 
   // It's tempting to want to unify these strings and make addSuite() do the
   // call to require(), however that breaks the build system which looks for
   // the strings passed to require
   examiner.addSuite('gclitest/testTokenize', require('gclitest/testTokenize'));
   examiner.addSuite('gclitest/testSplit', require('gclitest/testSplit'));
   examiner.addSuite('gclitest/testCli', require('gclitest/testCli'));
   examiner.addSuite('gclitest/testExec', require('gclitest/testExec'));
   examiner.addSuite('gclitest/testKeyboard', require('gclitest/testKeyboard'));
+  examiner.addSuite('gclitest/testScratchpad', require('gclitest/testScratchpad'));
   examiner.addSuite('gclitest/testHistory', require('gclitest/testHistory'));
   examiner.addSuite('gclitest/testRequire', require('gclitest/testRequire'));
   examiner.addSuite('gclitest/testJs', require('gclitest/testJs'));
 
-  examiner.run();
-  console.log('Completed test suite');
-  // examiner.log();
-
+  exports.examiner = examiner;
 });
 /*
  * Copyright 2009-2011 Mozilla Foundation and contributors
  * Licensed under the New BSD license. See LICENSE.txt or:
  * http://opensource.org/licenses/BSD-3-Clause
  */
 
 define('test/examiner', ['require', 'exports', 'module' ], function(require, exports, module) {
@@ -114,46 +158,46 @@ var stati = {
  */
 examiner.addSuite = function(name, suite) {
   examiner.suites[name] = new Suite(name, suite);
 };
 
 /**
  * Run all the tests synchronously
  */
-examiner.run = function() {
+examiner.run = function(options) {
   Object.keys(examiner.suites).forEach(function(suiteName) {
     var suite = examiner.suites[suiteName];
-    suite.run();
+    suite.run(options);
   }.bind(this));
   return examiner.suites;
 };
 
 /**
  * Run all the tests asynchronously
  */
-examiner.runAsync = function(callback) {
-  this.runAsyncInternal(0, callback);
+examiner.runAsync = function(options, callback) {
+  this.runAsyncInternal(0, options, callback);
 };
 
 /**
  * Run all the test suits asynchronously
  */
-examiner.runAsyncInternal = function(i, callback) {
+examiner.runAsyncInternal = function(i, options, callback) {
   if (i >= Object.keys(examiner.suites).length) {
     if (typeof callback === 'function') {
       callback();
     }
     return;
   }
 
   var suiteName = Object.keys(examiner.suites)[i];
-  examiner.suites[suiteName].runAsync(function() {
+  examiner.suites[suiteName].runAsync(options, function() {
     setTimeout(function() {
-      examiner.runAsyncInternal(i + 1, callback);
+      examiner.runAsyncInternal(i + 1, options, callback);
     }.bind(this), delay);
   }.bind(this));
 };
 
 /**
  *
  */
 examiner.reportToText = function() {
@@ -217,65 +261,65 @@ function Suite(suiteName, suite) {
       this.tests[testName] = test;
     }
   }.bind(this));
 }
 
 /**
  * Run all the tests in this suite synchronously
  */
-Suite.prototype.run = function() {
+Suite.prototype.run = function(options) {
   if (typeof this.suite.setup == "function") {
-    this.suite.setup();
+    this.suite.setup(options);
   }
 
   Object.keys(this.tests).forEach(function(testName) {
     var test = this.tests[testName];
-    test.run();
+    test.run(options);
   }.bind(this));
 
   if (typeof this.suite.shutdown == "function") {
-    this.suite.shutdown();
+    this.suite.shutdown(options);
   }
 };
 
 /**
  * Run all the tests in this suite asynchronously
  */
-Suite.prototype.runAsync = function(callback) {
+Suite.prototype.runAsync = function(options, callback) {
   if (typeof this.suite.setup == "function") {
     this.suite.setup();
   }
 
-  this.runAsyncInternal(0, function() {
+  this.runAsyncInternal(0, options, function() {
     if (typeof this.suite.shutdown == "function") {
       this.suite.shutdown();
     }
 
     if (typeof callback === 'function') {
       callback();
     }
   }.bind(this));
 };
 
 /**
  * Function used by the async runners that can handle async recursion.
  */
-Suite.prototype.runAsyncInternal = function(i, callback) {
+Suite.prototype.runAsyncInternal = function(i, options, callback) {
   if (i >= Object.keys(this.tests).length) {
     if (typeof callback === 'function') {
       callback();
     }
     return;
   }
 
   var testName = Object.keys(this.tests)[i];
-  this.tests[testName].runAsync(function() {
+  this.tests[testName].runAsync(options, function() {
     setTimeout(function() {
-      this.runAsyncInternal(i + 1, callback);
+      this.runAsyncInternal(i + 1, options, callback);
     }.bind(this), delay);
   }.bind(this));
 };
 
 /**
  * Create a JSON object suitable for serialization
  */
 Suite.prototype.toRemote = function() {
@@ -299,23 +343,23 @@ function Test(suite, name, func) {
 
   this.messages = [];
   this.status = stati.notrun;
 }
 
 /**
  * Run just a single test
  */
-Test.prototype.run = function() {
+Test.prototype.run = function(options) {
   currentTest = this;
   this.status = stati.executing;
   this.messages = [];
 
   try {
-    this.func.apply(this.suite);
+    this.func.apply(this.suite, [ options ]);
   }
   catch (ex) {
     this.status = stati.fail;
     this.messages.push('' + ex);
     console.error(ex);
     if (ex.stack) {
       console.error(ex.stack);
     }
@@ -326,17 +370,17 @@ Test.prototype.run = function() {
   }
 
   currentTest = null;
 };
 
 /**
  * Run all the tests in this suite asynchronously
  */
-Test.prototype.runAsync = function(callback) {
+Test.prototype.runAsync = function(options, callback) {
   setTimeout(function() {
     this.run();
     if (typeof callback === 'function') {
       callback();
     }
   }.bind(this), delay);
 };
 
@@ -1505,24 +1549,28 @@ function check(initial, action, after) {
     case KEY_DOWNS_TO:
       assignment.decrement();
       break;
   }
 
   test.is(after, requisition.toString(), initial + ' + ' + action + ' -> ' + after);
 }
 
-exports.testComplete = function() {
+exports.testComplete = function(options) {
   check('tsela', COMPLETES_TO, 'tselarr ');
   check('tsn di', COMPLETES_TO, 'tsn dif ');
   check('tsg a', COMPLETES_TO, 'tsg aaa ');
 
   check('{ wind', COMPLETES_TO, '{ window');
   check('{ window.docum', COMPLETES_TO, '{ window.document');
-  check('{ window.document.titl', COMPLETES_TO, '{ window.document.title ');
+
+  // Bug 717228: This fails under node
+  if (!options.isNode) {
+    check('{ window.document.titl', COMPLETES_TO, '{ window.document.title ');
+  }
 };
 
 exports.testIncrDecr = function() {
   check('tsu -70', KEY_UPS_TO, 'tsu -5');
   check('tsu -7', KEY_UPS_TO, 'tsu -5');
   check('tsu -6', KEY_UPS_TO, 'tsu -5');
   check('tsu -5', KEY_UPS_TO, 'tsu -3');
   check('tsu -4', KEY_UPS_TO, 'tsu -3');
@@ -1574,16 +1622,69 @@ exports.testIncrDecr = function() {
 
 });
 /*
  * Copyright 2009-2011 Mozilla Foundation and contributors
  * Licensed under the New BSD license. See LICENSE.txt or:
  * http://opensource.org/licenses/BSD-3-Clause
  */
 
+define('gclitest/testScratchpad', ['require', 'exports', 'module' , 'test/assert'], function(require, exports, module) {
+
+
+var test = require('test/assert');
+
+var origScratchpad;
+
+exports.setup = function(options) {
+  if (options.inputter) {
+    origScratchpad = options.inputter.scratchpad;
+    options.inputter.scratchpad = stubScratchpad;
+  }
+};
+
+exports.shutdown = function(options) {
+  if (options.inputter) {
+    options.inputter.scratchpad = origScratchpad;
+  }
+};
+
+var stubScratchpad = {
+  shouldActivate: function(ev) {
+    return true;
+  },
+  activatedCount: 0,
+  linkText: 'scratchpad.linkText'
+};
+stubScratchpad.activate = function(value) {
+  stubScratchpad.activatedCount++;
+  return true;
+};
+
+
+exports.testActivate = function(options) {
+  if (options.inputter) {
+    var ev = {};
+    stubScratchpad.activatedCount = 0;
+    options.inputter.onKeyUp(ev);
+    test.is(1, stubScratchpad.activatedCount, 'scratchpad is activated');
+  }
+  else {
+    console.log('Skipping scratchpad tests');
+  }
+};
+
+
+});
+/*
+ * Copyright 2009-2011 Mozilla Foundation and contributors
+ * Licensed under the New BSD license. See LICENSE.txt or:
+ * http://opensource.org/licenses/BSD-3-Clause
+ */
+
 define('gclitest/testHistory', ['require', 'exports', 'module' , 'test/assert', 'gcli/history'], function(require, exports, module) {
 
 var test = require('test/assert');
 var History = require('gcli/history').History;
 
 exports.setup = function() {
 };
 
@@ -1823,16 +1924,21 @@ function check(expStatuses, expStatus, e
       expPredict.forEach(function(p) {
         contains = predictionsHas(p);
         test.ok(contains, 'missing prediction ' + p);
       });
     }
     else if (typeof expPredict === 'number') {
       contains = true;
       test.is(assign.getPredictions().length, expPredict, 'prediction count');
+      if (assign.getPredictions().length !== expPredict) {
+        assign.getPredictions().forEach(function(prediction) {
+          console.log('actual prediction: ', prediction);
+        });
+      }
     }
     else {
       contains = predictionsHas(expPredict);
       test.ok(contains, 'missing prediction ' + expPredict);
     }
 
     if (!contains) {
       console.log('Predictions: ' + assign.getPredictions().map(function(p) {
@@ -1851,17 +1957,17 @@ exports.testBasic = function() {
 
   input('{ w');
   check('VVI', Status.ERROR, 'w', 'window');
 
   input('{ windo');
   check('VVIIIII', Status.ERROR, 'windo', 'window');
 
   input('{ window');
-  check('VVVVVVVV', Status.VALID, 'window', 0);
+  check('VVVVVVVV', Status.VALID, 'window');
 
   input('{ window.d');
   check('VVIIIIIIII', Status.ERROR, 'window.d', 'window.docume