Bug 716644 - expandoify accessible roles, r=tbsaunde
authorAndrzej Skalski <askalski@mozilla.com>
Thu, 26 Apr 2012 20:25:33 +0200
changeset 96770 330f6adec1ecdd67d430da55539bc22a53d0dfde
parent 96769 5b2cef6c4c34eca28ed013c87f7877d94c520611
child 96771 29914c0fb85e7f0aa8189c423f80d1631c29851d
push id1116
push userlsblakk@mozilla.com
push dateMon, 16 Jul 2012 19:38:18 +0000
treeherdermozilla-beta@95f959a8b4dc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstbsaunde
bugs716644
milestone15.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 716644 - expandoify accessible roles, r=tbsaunde
accessible/public/nsIAccessibleRole.idl
accessible/src/atk/nsAccessibleWrap.cpp
accessible/src/atk/nsAccessibleWrap.h
accessible/src/atk/nsMaiInterfaceText.cpp
accessible/src/atk/nsRoleMap.h
accessible/src/base/Role.h
accessible/src/base/RoleMap.h
accessible/src/base/nsAccessibilityService.cpp
accessible/src/base/nsAccessibilityService.h
accessible/src/mac/Makefile.in
accessible/src/mac/mozAccessible.mm
accessible/src/mac/nsAccessibleWrap.h
accessible/src/mac/nsAccessibleWrap.mm
accessible/src/mac/nsRoleMap.h
accessible/src/msaa/nsAccessibleWrap.cpp
accessible/src/msaa/nsRoleMap.h
accessible/src/msaa/nsRootAccessibleWrap.cpp
--- a/accessible/public/nsIAccessibleRole.idl
+++ b/accessible/public/nsIAccessibleRole.idl
@@ -35,21 +35,18 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsISupports.idl"
 
 /**
  * Defines cross platform (Gecko) roles.
- *
- * @note - When adding a new role, be sure to also add it to nsRoleMap.h for
- *         each platform.
  */
-[scriptable, uuid(f134da65-39a8-4330-843c-5bd42780b34c)]
+[scriptable, uuid(50db5e86-9a45-4637-a5c3-4ff148c33270)]
 interface nsIAccessibleRole : nsISupports
 {
   /**
    * Used when accessible hans't strong defined role.
    */
   const unsigned long ROLE_NOTHING = 0;
 
   /**
@@ -806,16 +803,10 @@ interface nsIAccessibleRole : nsISupport
    * An HTML definition term <dt>
    */
   const unsigned long ROLE_TERM = 127;
 
   /**
    * An HTML definition <dd>
    */
   const unsigned long ROLE_DEFINITION = 128;
-
-  /**
-   * It's not role actually. This constant is important to help ensure
-   * nsRoleMap's are synchronized.
-   */
-  const unsigned long ROLE_LAST_ENTRY = 129;
 };
 
--- a/accessible/src/atk/nsAccessibleWrap.cpp
+++ b/accessible/src/atk/nsAccessibleWrap.cpp
@@ -48,17 +48,16 @@
 #include "nsRootAccessible.h"
 #include "nsDocAccessibleWrap.h"
 #include "nsIAccessibleValue.h"
 #include "nsMai.h"
 #include "nsMaiHyperlink.h"
 #include "nsString.h"
 #include "nsAutoPtr.h"
 #include "prprf.h"
-#include "nsRoleMap.h"
 #include "nsStateMap.h"
 #include "Relation.h"
 #include "States.h"
 
 #include "mozilla/Util.h"
 #include "nsXPCOMStrings.h"
 #include "nsComponentManagerUtils.h"
 
@@ -717,34 +716,30 @@ getDescriptionCB(AtkObject *aAtkObj)
                                    NS_ConvertUTF16toUTF8(uniDesc).get());
 
     return aAtkObj->description;
 }
 
 AtkRole
 getRoleCB(AtkObject *aAtkObj)
 {
-    nsAccessibleWrap *accWrap = GetAccessibleWrap(aAtkObj);
-    if (!accWrap) {
-        return ATK_ROLE_INVALID;
-    }
+  nsAccessibleWrap* accWrap = GetAccessibleWrap(aAtkObj);
+  if (!accWrap)
+    return ATK_ROLE_INVALID;
 
 #ifdef DEBUG_A11Y
-    NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(accWrap),
-                 "Does not support nsIAccessibleText when it should");
+  NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(accWrap),
+      "Does not support nsIAccessibleText when it should");
 #endif
 
-    if (aAtkObj->role == ATK_ROLE_INVALID) {
-        // map to the actual value
-        PRUint32 atkRole = atkRoleMap[accWrap->Role()];
-        NS_ASSERTION(atkRoleMap[nsIAccessibleRole::ROLE_LAST_ENTRY] ==
-                     kROLE_ATK_LAST_ENTRY, "ATK role map skewed");
-        aAtkObj->role = static_cast<AtkRole>(atkRole);
-    }
+  if (aAtkObj->role != ATK_ROLE_INVALID)
     return aAtkObj->role;
+
+  return aAtkObj->role =
+    static_cast<AtkRole>(nsAccessibleWrap::AtkRoleFor(accWrap->Role()));
 }
 
 AtkAttributeSet*
 ConvertToAtkAttributeSet(nsIPersistentProperties* aAttributes)
 {
     if (!aAttributes)
         return nsnull;
 
@@ -1395,8 +1390,24 @@ nsAccessibleWrap::FireAtkShowHideEvent(A
     char *signal_name = g_strconcat(aIsAdded ? "children_changed::add" :  "children_changed::remove",
                                     isFromUserInput ? "" : kNonUserInputEvent, NULL);
     g_signal_emit_by_name(parentObject, signal_name, indexInParent, aObject, NULL);
     g_free(signal_name);
 
     return NS_OK;
 }
 
+PRUint32
+nsAccessibleWrap::AtkRoleFor(role aRole)
+{
+#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role) \
+  case roles::geckoRole: \
+    return atkRole;
+
+  switch (aRole) {
+#include "RoleMap.h"
+    default:
+      MOZ_NOT_REACHED("Unknown role.");
+      return ATK_ROLE_UNKNOWN;
+  }
+
+#undef ROLE
+}
--- a/accessible/src/atk/nsAccessibleWrap.h
+++ b/accessible/src/atk/nsAccessibleWrap.h
@@ -111,16 +111,21 @@ public:
     void SetMaiHyperlink(MaiHyperlink* aMaiHyperlink);
 
     static const char * ReturnString(nsAString &aString) {
       static nsCString returnedString;
       returnedString = NS_ConvertUTF16toUTF8(aString);
       return returnedString.get();
     }
 
+  /**
+   * Function mapping from cross platform roles to ATK roles.
+   */
+  inline static PRUint32 AtkRoleFor(mozilla::a11y::role aRole);
+
 protected:
     virtual nsresult FirePlatformEvent(AccEvent* aEvent);
 
     nsresult FireAtkStateChangeEvent(AccEvent* aEvent, AtkObject *aObject);
     nsresult FireAtkTextChangedEvent(AccEvent* aEvent, AtkObject *aObject);
     nsresult FireAtkShowHideEvent(AccEvent* aEvent, AtkObject *aObject,
                                   bool aIsAdded);
 
--- a/accessible/src/atk/nsMaiInterfaceText.cpp
+++ b/accessible/src/atk/nsMaiInterfaceText.cpp
@@ -37,27 +37,26 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "InterfaceInitFuncs.h"
 
 #include "nsHyperTextAccessible.h"
 #include "nsMai.h"
-#include "nsRoleMap.h"
 
 #include "nsIPersistentProperties2.h"
 
 AtkAttributeSet* ConvertToAtkAttributeSet(nsIPersistentProperties* aAttributes);
 
 static void
 ConvertTexttoAsterisks(nsAccessibleWrap* accWrap, nsAString& aString)
 {
     // convert each char to "*" when it's "password text" 
-    PRUint32 atkRole = atkRoleMap[accWrap->NativeRole()];
+    PRUint32 atkRole = nsAccessibleWrap::AtkRoleFor(accWrap->NativeRole());
     if (atkRole == ATK_ROLE_PASSWORD_TEXT) {
         for (PRUint32 i = 0; i < aString.Length(); i++)
             aString.Replace(i, 1, NS_LITERAL_STRING("*"));
     }
 }
 
 extern "C" {
 
@@ -156,17 +155,17 @@ getCharacterAtOffsetCB(AtkText *aText, g
 
     /* PRUnichar is unsigned short in Mozilla */
     /* gnuichar is guint32 in glib */
     PRUnichar uniChar;
     nsresult rv =
         accText->GetCharacterAtOffset(aOffset, &uniChar);
 
     // convert char to "*" when it's "password text" 
-    PRUint32 atkRole = atkRoleMap[accWrap->NativeRole()];
+    PRUint32 atkRole = nsAccessibleWrap::AtkRoleFor(accWrap->NativeRole());
     if (atkRole == ATK_ROLE_PASSWORD_TEXT)
         uniChar = '*';
 
     return (NS_FAILED(rv)) ? 0 : static_cast<gunichar>(uniChar);
 }
 
 static gchar*
 getTextBeforeOffsetCB(AtkText *aText, gint aOffset,
deleted file mode 100644
--- a/accessible/src/atk/nsRoleMap.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/* -*- 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 IBM Corporation
- * Portions created by the Initial Developer are Copyright (C) 2006
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Gao, Ming (gaoming@cn.ibm.com)
- *   Aaron Leventhal (aleventh@us.ibm.com)
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
-#include <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,             // 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
-    ATK_ROLE_CHECK_BOX,           // roles::CHECK_RICH_OPTION    125
-    ATK_ROLE_LIST,                // roles::DEFINITION_LIST      126
-    ATK_ROLE_LIST_ITEM,           // roles::TERM                 127
-    ATK_ROLE_PARAGRAPH,           // roles::DEFINITION           128
-    kROLE_ATK_LAST_ENTRY          // roles::LAST_ENTRY
-};
-
--- a/accessible/src/base/Role.h
+++ b/accessible/src/base/Role.h
@@ -36,23 +36,26 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef _role_h_
 #define _role_h_
 
 /**
- * Note: Make sure to update the localized role names when changing the list.
+ * @note Make sure to update the localized role names when changing the list.
+ * @note When adding a new role, be sure to also add it to base/RoleMap.h and
+ *       update nsIAccessibleRole.
  */
 
 namespace mozilla {
 namespace a11y {
 namespace roles {
-  enum Role {
+
+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.
@@ -807,21 +810,18 @@ namespace roles {
    * Represent a term in a definition list (dt in HTML).
    */
   TERM = 127,
 
   /**
    * Represent a definition in a definition list (dd in HTML)
    */
   DEFINITION = 128,
+};
 
-  /**
-   * It's not role actually. This constant is important to help ensure
-   * nsRoleMap's are synchronized.
-   */
-  LAST_ENTRY = 129
-  };
 } // namespace role
+
 typedef enum mozilla::a11y::roles::Role role;
+
 } // namespace a11y
 } // namespace mozilla
 
 #endif
new file mode 100644
--- /dev/null
+++ b/accessible/src/base/RoleMap.h
@@ -0,0 +1,920 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+/**
+ * Usage: declare the macro ROLE()with the following arguments:
+ * ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role)
+ */
+
+ROLE(NOTHING,
+     "nothing",
+     ATK_ROLE_UNKNOWN,
+     NSAccessibilityUnknownRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_UNKNOWN)
+
+ROLE(TITLEBAR,
+     "titlebar",
+     ATK_ROLE_UNKNOWN,
+     NSAccessibilityUnknownRole,  //Irrelevant on OS X; windows are always native.
+     ROLE_SYSTEM_TITLEBAR,
+     ROLE_SYSTEM_TITLEBAR)
+
+ROLE(MENUBAR,
+     "menubar",
+     ATK_ROLE_MENU_BAR,
+     NSAccessibilityMenuBarRole,  //Irrelevant on OS X; the menubar will always be native and on the top of the screen.
+     ROLE_SYSTEM_MENUBAR,
+     ROLE_SYSTEM_MENUBAR)
+
+ROLE(SCROLLBAR,
+     "scrollbar",
+     ATK_ROLE_SCROLL_BAR,
+     NSAccessibilityScrollBarRole,  //We might need to make this its own mozAccessible, to support the children objects (valueindicator, down/up buttons).
+     ROLE_SYSTEM_SCROLLBAR,
+     ROLE_SYSTEM_SCROLLBAR)
+
+ROLE(GRIP,
+     "grip",
+     ATK_ROLE_UNKNOWN,
+     NSAccessibilitySplitterRole,
+     ROLE_SYSTEM_GRIP,
+     ROLE_SYSTEM_GRIP)
+
+ROLE(SOUND,
+     "sound",
+     ATK_ROLE_UNKNOWN,
+     NSAccessibilityUnknownRole,  //Unused on OS X.
+     ROLE_SYSTEM_SOUND,
+     ROLE_SYSTEM_SOUND)
+
+ROLE(CURSOR,
+     "cursor",
+     ATK_ROLE_UNKNOWN,
+     NSAccessibilityUnknownRole,  //Unused on OS X.
+     ROLE_SYSTEM_CURSOR,
+     ROLE_SYSTEM_CURSOR)
+
+ROLE(CARET,
+     "caret",
+     ATK_ROLE_UNKNOWN,
+     NSAccessibilityUnknownRole,  //Unused on OS X.
+     ROLE_SYSTEM_CARET,
+     ROLE_SYSTEM_CARET)
+
+ROLE(ALERT,
+     "alert",
+     ATK_ROLE_ALERT,
+     NSAccessibilityWindowRole,
+     ROLE_SYSTEM_ALERT,
+     ROLE_SYSTEM_ALERT)
+
+ROLE(WINDOW,
+     "window",
+     ATK_ROLE_WINDOW,
+     NSAccessibilityWindowRole,  //Irrelevant on OS X; all window a11y is handled by the system.
+     ROLE_SYSTEM_WINDOW,
+     ROLE_SYSTEM_WINDOW)
+
+ROLE(INTERNAL_FRAME,
+     "internal frame",
+     ATK_ROLE_INTERNAL_FRAME,
+     NSAccessibilityScrollAreaRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_INTERNAL_FRAME)
+
+ROLE(MENUPOPUP,
+     "menupopup",
+     ATK_ROLE_MENU,
+     NSAccessibilityMenuRole,  //The parent of menuitems.
+     ROLE_SYSTEM_MENUPOPUP,
+     ROLE_SYSTEM_MENUPOPUP)
+
+ROLE(MENUITEM,
+     "menuitem",
+     ATK_ROLE_MENU_ITEM,
+     NSAccessibilityMenuItemRole,
+     ROLE_SYSTEM_MENUITEM,
+     ROLE_SYSTEM_MENUITEM)
+
+ROLE(TOOLTIP,
+     "tooltip",
+     ATK_ROLE_TOOL_TIP,
+     @"AXHelpTag",  //10.4+ only, so we re-define the constant.
+     ROLE_SYSTEM_TOOLTIP,
+     ROLE_SYSTEM_TOOLTIP)
+
+ROLE(APPLICATION,
+     "application",
+     ATK_ROLE_EMBEDDED,
+     NSAccessibilityGroupRole,  //Unused on OS X. the system will take care of this.
+     ROLE_SYSTEM_APPLICATION,
+     ROLE_SYSTEM_APPLICATION)
+
+ROLE(DOCUMENT,
+     "document",
+     ATK_ROLE_DOCUMENT_FRAME,
+     @"AXWebArea",
+     ROLE_SYSTEM_DOCUMENT,
+     ROLE_SYSTEM_DOCUMENT)
+
+/**
+ *  msaa comment:
+ *   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(PANE,
+     "pane",
+     ATK_ROLE_PANEL,
+     NSAccessibilityGroupRole,
+     ROLE_SYSTEM_GROUPING,
+     ROLE_SYSTEM_GROUPING)
+
+ROLE(CHART,
+     "chart",
+     ATK_ROLE_CHART,
+     NSAccessibilityUnknownRole,
+     ROLE_SYSTEM_CHART,
+     ROLE_SYSTEM_CHART)
+
+ROLE(DIALOG,
+     "dialog",
+     ATK_ROLE_DIALOG,
+     NSAccessibilityWindowRole,  //There's a dialog subrole.
+     ROLE_SYSTEM_DIALOG,
+     ROLE_SYSTEM_DIALOG)
+
+ROLE(BORDER,
+     "border",
+     ATK_ROLE_UNKNOWN,
+     NSAccessibilityUnknownRole,  //Unused on OS X.
+     ROLE_SYSTEM_BORDER,
+     ROLE_SYSTEM_BORDER)
+
+ROLE(GROUPING,
+     "grouping",
+     ATK_ROLE_PANEL,
+     NSAccessibilityGroupRole,
+     ROLE_SYSTEM_GROUPING,
+     ROLE_SYSTEM_GROUPING)
+
+ROLE(SEPARATOR,
+     "separator",
+     ATK_ROLE_SEPARATOR,
+     NSAccessibilityUnknownRole,
+     ROLE_SYSTEM_SEPARATOR,
+     ROLE_SYSTEM_SEPARATOR)
+
+ROLE(TOOLBAR,
+     "toolbar",
+     ATK_ROLE_TOOL_BAR,
+     NSAccessibilityToolbarRole,
+     ROLE_SYSTEM_TOOLBAR,
+     ROLE_SYSTEM_TOOLBAR)
+
+ROLE(STATUSBAR,
+     "statusbar",
+     ATK_ROLE_STATUSBAR,
+     NSAccessibilityUnknownRole,  //Doesn't exist on OS X (a status bar is its parts; a progressbar, a label, etc.)
+     ROLE_SYSTEM_STATUSBAR,
+     ROLE_SYSTEM_STATUSBAR)
+
+ROLE(TABLE,
+     "table",
+     ATK_ROLE_TABLE,
+     NSAccessibilityGroupRole,
+     ROLE_SYSTEM_TABLE,
+     ROLE_SYSTEM_TABLE)
+
+ROLE(COLUMNHEADER,
+     "columnheader",
+     ATK_ROLE_COLUMN_HEADER,
+     NSAccessibilityGroupRole,
+     ROLE_SYSTEM_COLUMNHEADER,
+     ROLE_SYSTEM_COLUMNHEADER)
+
+ROLE(ROWHEADER,
+     "rowheader",
+     ATK_ROLE_ROW_HEADER,
+     NSAccessibilityGroupRole,
+     ROLE_SYSTEM_ROWHEADER,
+     ROLE_SYSTEM_ROWHEADER)
+
+ROLE(COLUMN,
+     "column",
+     ATK_ROLE_UNKNOWN,
+     NSAccessibilityColumnRole,
+     ROLE_SYSTEM_COLUMN,
+     ROLE_SYSTEM_COLUMN)
+
+ROLE(ROW,
+     "row",
+     ATK_ROLE_LIST_ITEM,
+     NSAccessibilityRowRole,
+     ROLE_SYSTEM_ROW,
+     ROLE_SYSTEM_ROW)
+
+ROLE(CELL,
+     "cell",
+     ATK_ROLE_TABLE_CELL,
+     NSAccessibilityGroupRole,
+     ROLE_SYSTEM_CELL,
+     ROLE_SYSTEM_CELL)
+
+ROLE(LINK,
+     "link",
+     ATK_ROLE_LINK,
+     @"AXLink",  //10.4+ the attr first define in SDK 10.4, so we define it here too. ROLE_LINK
+     ROLE_SYSTEM_LINK,
+     ROLE_SYSTEM_LINK)
+
+ROLE(HELPBALLOON,
+     "helpballoon",
+     ATK_ROLE_UNKNOWN,
+     @"AXHelpTag",
+     ROLE_SYSTEM_HELPBALLOON,
+     ROLE_SYSTEM_HELPBALLOON)
+
+ROLE(CHARACTER,
+     "character",
+     ATK_ROLE_IMAGE,
+     NSAccessibilityUnknownRole,  //Unused on OS X.
+     ROLE_SYSTEM_CHARACTER,
+     ROLE_SYSTEM_CHARACTER)
+
+ROLE(LIST,
+     "list",
+     ATK_ROLE_LIST,
+     NSAccessibilityListRole,
+     ROLE_SYSTEM_LIST,
+     ROLE_SYSTEM_LIST)
+
+ROLE(LISTITEM,
+     "listitem",
+     ATK_ROLE_LIST_ITEM,
+     NSAccessibilityGroupRole,
+     ROLE_SYSTEM_LISTITEM,
+     ROLE_SYSTEM_LISTITEM)
+
+ROLE(OUTLINE,
+     "outline",
+     ATK_ROLE_TREE,
+     NSAccessibilityOutlineRole,
+     ROLE_SYSTEM_OUTLINE,
+     ROLE_SYSTEM_OUTLINE)
+
+ROLE(OUTLINEITEM,
+     "outlineitem",
+     ATK_ROLE_LIST_ITEM,
+     NSAccessibilityRowRole,  //XXX: use OutlineRow as subrole.
+     ROLE_SYSTEM_OUTLINEITEM,
+     ROLE_SYSTEM_OUTLINEITEM)
+
+ROLE(PAGETAB,
+     "pagetab",
+     ATK_ROLE_PAGE_TAB,
+     NSAccessibilityRadioButtonRole,
+     ROLE_SYSTEM_PAGETAB,
+     ROLE_SYSTEM_PAGETAB)
+
+ROLE(PROPERTYPAGE,
+     "propertypage",
+     ATK_ROLE_SCROLL_PANE,
+     NSAccessibilityGroupRole,
+     ROLE_SYSTEM_PROPERTYPAGE,
+     ROLE_SYSTEM_PROPERTYPAGE)
+
+ROLE(INDICATOR,
+     "indicator",
+     ATK_ROLE_UNKNOWN,
+     NSAccessibilityUnknownRole,
+     ROLE_SYSTEM_INDICATOR,
+     ROLE_SYSTEM_INDICATOR)
+
+ROLE(GRAPHIC,
+     "graphic",
+     ATK_ROLE_IMAGE,
+     NSAccessibilityImageRole,
+     ROLE_SYSTEM_GRAPHIC,
+     ROLE_SYSTEM_GRAPHIC)
+
+ROLE(STATICTEXT,
+     "statictext",
+     ATK_ROLE_UNKNOWN,
+     NSAccessibilityStaticTextRole,
+     ROLE_SYSTEM_STATICTEXT,
+     ROLE_SYSTEM_STATICTEXT)
+
+ROLE(TEXT_LEAF,
+     "text leaf",
+     ATK_ROLE_UNKNOWN,
+     NSAccessibilityStaticTextRole,
+     ROLE_SYSTEM_TEXT,
+     ROLE_SYSTEM_TEXT)
+
+ROLE(PUSHBUTTON,
+     "pushbutton",
+     ATK_ROLE_PUSH_BUTTON,
+     NSAccessibilityButtonRole,
+     ROLE_SYSTEM_PUSHBUTTON,
+     ROLE_SYSTEM_PUSHBUTTON)
+
+ROLE(CHECKBUTTON,
+     "checkbutton",
+     ATK_ROLE_CHECK_BOX,
+     NSAccessibilityCheckBoxRole,
+     ROLE_SYSTEM_CHECKBUTTON,
+     ROLE_SYSTEM_CHECKBUTTON)
+
+ROLE(RADIOBUTTON,
+     "radiobutton",
+     ATK_ROLE_RADIO_BUTTON,
+     NSAccessibilityRadioButtonRole,
+     ROLE_SYSTEM_RADIOBUTTON,
+     ROLE_SYSTEM_RADIOBUTTON)
+
+ROLE(COMBOBOX,
+     "combobox",
+     ATK_ROLE_COMBO_BOX,
+     NSAccessibilityPopUpButtonRole,
+     ROLE_SYSTEM_COMBOBOX,
+     ROLE_SYSTEM_COMBOBOX)
+
+ROLE(DROPLIST,
+     "droplist",
+     ATK_ROLE_COMBO_BOX,
+     NSAccessibilityPopUpButtonRole,
+     ROLE_SYSTEM_DROPLIST,
+     ROLE_SYSTEM_DROPLIST)
+
+ROLE(PROGRESSBAR,
+     "progressbar",
+     ATK_ROLE_PROGRESS_BAR,
+     NSAccessibilityProgressIndicatorRole,
+     ROLE_SYSTEM_PROGRESSBAR,
+     ROLE_SYSTEM_PROGRESSBAR)
+
+ROLE(DIAL,
+     "dial",
+     ATK_ROLE_DIAL,
+     NSAccessibilityUnknownRole,
+     ROLE_SYSTEM_DIAL,
+     ROLE_SYSTEM_DIAL)
+
+ROLE(HOTKEYFIELD,
+     "hotkeyfield",
+     ATK_ROLE_UNKNOWN,
+     NSAccessibilityUnknownRole,
+     ROLE_SYSTEM_HOTKEYFIELD,
+     ROLE_SYSTEM_HOTKEYFIELD)
+
+ROLE(SLIDER,
+     "slider",
+     ATK_ROLE_SLIDER,
+     NSAccessibilitySliderRole,
+     ROLE_SYSTEM_SLIDER,
+     ROLE_SYSTEM_SLIDER)
+
+ROLE(SPINBUTTON,
+     "spinbutton",
+     ATK_ROLE_SPIN_BUTTON,
+     NSAccessibilityIncrementorRole,  //Subroles: Increment/Decrement.
+     ROLE_SYSTEM_SPINBUTTON,
+     ROLE_SYSTEM_SPINBUTTON)
+
+ROLE(DIAGRAM,
+     "diagram",
+     ATK_ROLE_IMAGE,
+     NSAccessibilityUnknownRole,
+     ROLE_SYSTEM_DIAGRAM,
+     ROLE_SYSTEM_DIAGRAM)
+
+ROLE(ANIMATION,
+     "animation",
+     ATK_ROLE_ANIMATION,
+     NSAccessibilityUnknownRole,
+     ROLE_SYSTEM_ANIMATION,
+     ROLE_SYSTEM_ANIMATION)
+
+ROLE(EQUATION,
+     "equation",
+     ATK_ROLE_UNKNOWN,
+     NSAccessibilityUnknownRole,
+     ROLE_SYSTEM_EQUATION,
+     ROLE_SYSTEM_EQUATION)
+
+ROLE(BUTTONDROPDOWN,
+     "buttondropdown",
+     ATK_ROLE_PUSH_BUTTON,
+     NSAccessibilityPopUpButtonRole,
+     ROLE_SYSTEM_BUTTONDROPDOWN,
+     ROLE_SYSTEM_BUTTONDROPDOWN)
+
+ROLE(BUTTONMENU,
+     "buttonmenu",
+     ATK_ROLE_PUSH_BUTTON,
+     NSAccessibilityMenuButtonRole,
+     ROLE_SYSTEM_BUTTONMENU,
+     ROLE_SYSTEM_BUTTONMENU)
+
+ROLE(BUTTONDROPDOWNGRID,
+     "buttondropdowngrid",
+     ATK_ROLE_UNKNOWN,
+     NSAccessibilityGroupRole,
+     ROLE_SYSTEM_BUTTONDROPDOWNGRID,
+     ROLE_SYSTEM_BUTTONDROPDOWNGRID)
+
+ROLE(WHITESPACE,
+     "whitespace",
+     ATK_ROLE_UNKNOWN,
+     NSAccessibilityUnknownRole,
+     ROLE_SYSTEM_WHITESPACE,
+     ROLE_SYSTEM_WHITESPACE)
+
+ROLE(PAGETABLIST,
+     "pagetablist",
+     ATK_ROLE_PAGE_TAB_LIST,
+     NSAccessibilityTabGroupRole,
+     ROLE_SYSTEM_PAGETABLIST,
+     ROLE_SYSTEM_PAGETABLIST)
+
+ROLE(CLOCK,
+     "clock",
+     ATK_ROLE_UNKNOWN,
+     NSAccessibilityUnknownRole,  //Unused on OS X
+     ROLE_SYSTEM_CLOCK,
+     ROLE_SYSTEM_CLOCK)
+
+ROLE(SPLITBUTTON,
+     "splitbutton",
+     ATK_ROLE_PUSH_BUTTON,
+     NSAccessibilityButtonRole,
+     ROLE_SYSTEM_SPLITBUTTON,
+     ROLE_SYSTEM_SPLITBUTTON)
+
+ROLE(IPADDRESS,
+     "ipaddress",
+     ATK_ROLE_UNKNOWN,
+     NSAccessibilityUnknownRole,
+     ROLE_SYSTEM_IPADDRESS,
+     ROLE_SYSTEM_IPADDRESS)
+
+ROLE(ACCEL_LABEL,
+     "accel label",
+     ATK_ROLE_ACCEL_LABEL,
+     NSAccessibilityStaticTextRole,
+     ROLE_SYSTEM_STATICTEXT,
+     ROLE_SYSTEM_STATICTEXT)
+
+ROLE(ARROW,
+     "arrow",
+     ATK_ROLE_ARROW,
+     NSAccessibilityUnknownRole,
+     ROLE_SYSTEM_INDICATOR,
+     ROLE_SYSTEM_INDICATOR)
+
+ROLE(CANVAS,
+     "canvas",
+     ATK_ROLE_CANVAS,
+     NSAccessibilityImageRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_CANVAS)
+
+ROLE(CHECK_MENU_ITEM,
+     "check menu item",
+     ATK_ROLE_CHECK_MENU_ITEM,
+     NSAccessibilityMenuItemRole,
+     ROLE_SYSTEM_MENUITEM,
+     IA2_ROLE_CHECK_MENU_ITEM)
+
+ROLE(COLOR_CHOOSER,
+     "color chooser",
+     ATK_ROLE_COLOR_CHOOSER,
+     NSAccessibilityColorWellRole,
+     ROLE_SYSTEM_DIALOG,
+     IA2_ROLE_COLOR_CHOOSER)
+
+ROLE(DATE_EDITOR,
+     "date editor",
+     ATK_ROLE_DATE_EDITOR,
+     NSAccessibilityUnknownRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_DATE_EDITOR)
+
+ROLE(DESKTOP_ICON,
+     "desktop icon",
+     ATK_ROLE_DESKTOP_ICON,
+     NSAccessibilityImageRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_DESKTOP_ICON)
+
+ROLE(DESKTOP_FRAME,
+     "desktop frame",
+     ATK_ROLE_DESKTOP_FRAME,
+     NSAccessibilityUnknownRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_DESKTOP_PANE)
+
+ROLE(DIRECTORY_PANE,
+     "directory pane",
+     ATK_ROLE_DIRECTORY_PANE,
+     NSAccessibilityBrowserRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_DIRECTORY_PANE)
+
+ROLE(FILE_CHOOSER,
+     "file chooser",
+     ATK_ROLE_FILE_CHOOSER,
+     NSAccessibilityUnknownRole,  //Unused on OS X
+     USE_ROLE_STRING,
+     IA2_ROLE_FILE_CHOOSER)
+
+ROLE(FONT_CHOOSER,
+     "font chooser",
+     ATK_ROLE_FONT_CHOOSER,
+     NSAccessibilityUnknownRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_FONT_CHOOSER)
+
+ROLE(CHROME_WINDOW,
+     "chrome window",
+     ATK_ROLE_FRAME,
+     NSAccessibilityUnknownRole,  //Unused on OS X
+     ROLE_SYSTEM_APPLICATION,
+     IA2_ROLE_FRAME)
+
+ROLE(GLASS_PANE,
+     "glass pane",
+     ATK_ROLE_GLASS_PANE,
+     NSAccessibilityGroupRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_GLASS_PANE)
+
+ROLE(HTML_CONTAINER,
+     "html container",
+     ATK_ROLE_HTML_CONTAINER,
+     NSAccessibilityUnknownRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_UNKNOWN)
+
+ROLE(ICON,
+     "icon",
+     ATK_ROLE_ICON,
+     NSAccessibilityImageRole,
+     ROLE_SYSTEM_PUSHBUTTON,
+     IA2_ROLE_ICON)
+
+ROLE(LABEL,
+     "label",
+     ATK_ROLE_LABEL,
+     NSAccessibilityGroupRole,
+     ROLE_SYSTEM_STATICTEXT,
+     IA2_ROLE_LABEL)
+
+ROLE(LAYERED_PANE,
+     "layered pane",
+     ATK_ROLE_LAYERED_PANE,
+     NSAccessibilityGroupRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_LAYERED_PANE)
+
+ROLE(OPTION_PANE,
+     "option pane",
+     ATK_ROLE_OPTION_PANE,
+     NSAccessibilityGroupRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_OPTION_PANE)
+
+ROLE(PASSWORD_TEXT,
+     "password text",
+     ATK_ROLE_PASSWORD_TEXT,
+     NSAccessibilityTextFieldRole,
+     ROLE_SYSTEM_TEXT,
+     ROLE_SYSTEM_TEXT)
+
+ROLE(POPUP_MENU,
+     "popup menu",
+     ATK_ROLE_POPUP_MENU,
+     NSAccessibilityUnknownRole,  //Unused
+     ROLE_SYSTEM_MENUPOPUP,
+     ROLE_SYSTEM_MENUPOPUP)
+
+ROLE(RADIO_MENU_ITEM,
+     "radio menu item",
+     ATK_ROLE_RADIO_MENU_ITEM,
+     NSAccessibilityMenuItemRole,
+     ROLE_SYSTEM_MENUITEM,
+     IA2_ROLE_RADIO_MENU_ITEM)
+
+ROLE(ROOT_PANE,
+     "root pane",
+     ATK_ROLE_ROOT_PANE,
+     NSAccessibilityGroupRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_ROOT_PANE)
+
+ROLE(SCROLL_PANE,
+     "scroll pane",
+     ATK_ROLE_SCROLL_PANE,
+     NSAccessibilityScrollAreaRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_SCROLL_PANE)
+
+ROLE(SPLIT_PANE,
+     "split pane",
+     ATK_ROLE_SPLIT_PANE,
+     NSAccessibilitySplitGroupRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_SPLIT_PANE)
+
+ROLE(TABLE_COLUMN_HEADER,
+     "table column header",
+     ATK_ROLE_TABLE_COLUMN_HEADER,
+     NSAccessibilityUnknownRole,
+     ROLE_SYSTEM_COLUMNHEADER,
+     ROLE_SYSTEM_COLUMNHEADER)
+
+ROLE(TABLE_ROW_HEADER,
+     "table row header",
+     ATK_ROLE_TABLE_ROW_HEADER,
+     NSAccessibilityUnknownRole,
+     ROLE_SYSTEM_ROWHEADER,
+     ROLE_SYSTEM_ROWHEADER)
+
+ROLE(TEAR_OFF_MENU_ITEM,
+     "tear off menu item",
+     ATK_ROLE_TEAR_OFF_MENU_ITEM,
+     NSAccessibilityMenuItemRole,
+     ROLE_SYSTEM_MENUITEM,
+     IA2_ROLE_TEAR_OFF_MENU)
+
+ROLE(TERMINAL,
+     "terminal",
+     ATK_ROLE_TERMINAL,
+     NSAccessibilityUnknownRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_TERMINAL)
+
+ROLE(TEXT_CONTAINER,
+     "text container",
+     ATK_ROLE_TEXT,
+     NSAccessibilityGroupRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_TEXT_FRAME)
+
+ROLE(TOGGLE_BUTTON,
+     "toggle button",
+     ATK_ROLE_TOGGLE_BUTTON,
+     NSAccessibilityButtonRole,
+     ROLE_SYSTEM_PUSHBUTTON,
+     IA2_ROLE_TOGGLE_BUTTON)
+
+ROLE(TREE_TABLE,
+     "tree table",
+     ATK_ROLE_TREE_TABLE,
+     NSAccessibilityTableRole,
+     ROLE_SYSTEM_OUTLINE,
+     ROLE_SYSTEM_OUTLINE)
+
+ROLE(VIEWPORT,
+     "viewport",
+     ATK_ROLE_VIEWPORT,
+     NSAccessibilityUnknownRole,
+     ROLE_SYSTEM_PANE,
+     IA2_ROLE_VIEW_PORT)
+
+ROLE(HEADER,
+     "header",
+     ATK_ROLE_HEADER,
+     NSAccessibilityGroupRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_HEADER)
+
+ROLE(FOOTER,
+     "footer",
+     ATK_ROLE_FOOTER,
+     NSAccessibilityGroupRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_FOOTER)
+
+ROLE(PARAGRAPH,
+     "paragraph",
+     ATK_ROLE_PARAGRAPH,
+     NSAccessibilityGroupRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_PARAGRAPH)
+
+ROLE(RULER,
+     "ruler",
+     ATK_ROLE_RULER,
+     @"AXRuler",  //10.4+ only, so we re-define the constant.
+     USE_ROLE_STRING,
+     IA2_ROLE_RULER)
+
+ROLE(AUTOCOMPLETE,
+     "autocomplete",
+     ATK_ROLE_AUTOCOMPLETE,
+     NSAccessibilityUnknownRole,
+     ROLE_SYSTEM_COMBOBOX,
+     ROLE_SYSTEM_COMBOBOX)
+
+ROLE(EDITBAR,
+     "editbar",
+     ATK_ROLE_EDITBAR,
+     NSAccessibilityTextFieldRole,
+     ROLE_SYSTEM_TEXT,
+     IA2_ROLE_EDITBAR)
+
+ROLE(ENTRY,
+     "entry",
+     ATK_ROLE_ENTRY,
+     NSAccessibilityTextFieldRole,
+     ROLE_SYSTEM_TEXT,
+     ROLE_SYSTEM_TEXT)
+
+ROLE(CAPTION,
+     "caption",
+     ATK_ROLE_CAPTION,
+     NSAccessibilityStaticTextRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_CAPTION)
+
+ROLE(DOCUMENT_FRAME,
+     "document frame",
+     ATK_ROLE_DOCUMENT_FRAME,
+     NSAccessibilityScrollAreaRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_UNKNOWN)
+
+ROLE(HEADING,
+     "heading",
+     ATK_ROLE_HEADING,
+     @"AXHeading",
+     USE_ROLE_STRING,
+     IA2_ROLE_HEADING)
+
+ROLE(PAGE,
+     "page",
+     ATK_ROLE_PAGE,
+     NSAccessibilityGroupRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_PAGE)
+
+ROLE(SECTION,
+     "section",
+     ATK_ROLE_SECTION,
+     NSAccessibilityGroupRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_SECTION)
+
+ROLE(REDUNDANT_OBJECT,
+     "redundant object",
+     ATK_ROLE_REDUNDANT_OBJECT,
+     NSAccessibilityUnknownRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_REDUNDANT_OBJECT)
+
+ROLE(FORM,
+     "form",
+     ATK_ROLE_FORM,
+     NSAccessibilityGroupRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_FORM)
+
+ROLE(IME,
+     "ime",
+     ATK_ROLE_INPUT_METHOD_WINDOW,
+     NSAccessibilityUnknownRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_INPUT_METHOD_WINDOW)
+
+ROLE(APP_ROOT,
+     "app root",
+     ATK_ROLE_APPLICATION,
+     NSAccessibilityUnknownRole,  //Unused on OS X
+     ROLE_SYSTEM_APPLICATION,
+     ROLE_SYSTEM_APPLICATION)
+
+ROLE(PARENT_MENUITEM,
+     "parent menuitem",
+     ATK_ROLE_MENU,
+     NSAccessibilityMenuItemRole,
+     ROLE_SYSTEM_MENUITEM,
+     ROLE_SYSTEM_MENUITEM)
+
+ROLE(CALENDAR,
+     "calendar",
+     ATK_ROLE_CALENDAR,
+     NSAccessibilityGroupRole,
+     ROLE_SYSTEM_CLIENT,
+     ROLE_SYSTEM_CLIENT)
+
+ROLE(COMBOBOX_LIST,
+     "combobox list",
+     ATK_ROLE_MENU,
+     NSAccessibilityMenuRole,
+     ROLE_SYSTEM_LIST,
+     ROLE_SYSTEM_LIST)
+
+ROLE(COMBOBOX_OPTION,
+     "combobox option",
+     ATK_ROLE_MENU_ITEM,
+     NSAccessibilityMenuItemRole,
+     ROLE_SYSTEM_LISTITEM,
+     ROLE_SYSTEM_LISTITEM)
+
+ROLE(IMAGE_MAP,
+     "image map",
+     ATK_ROLE_IMAGE,
+     NSAccessibilityImageRole,
+     ROLE_SYSTEM_GRAPHIC,
+     ROLE_SYSTEM_GRAPHIC)
+
+ROLE(OPTION,
+     "listbox option",
+     ATK_ROLE_LIST_ITEM,
+     NSAccessibilityRowRole,
+     ROLE_SYSTEM_LISTITEM,
+     ROLE_SYSTEM_LISTITEM)
+
+ROLE(RICH_OPTION,
+     "listbox rich option",
+     ATK_ROLE_LIST_ITEM,
+     NSAccessibilityRowRole,
+     ROLE_SYSTEM_LISTITEM,
+     ROLE_SYSTEM_LISTITEM)
+
+ROLE(LISTBOX,
+     "listbox",
+     ATK_ROLE_LIST,
+     NSAccessibilityListRole,
+     ROLE_SYSTEM_LIST,
+     ROLE_SYSTEM_LIST)
+
+ROLE(FLAT_EQUATION,
+     "flat equation",
+     ATK_ROLE_UNKNOWN,
+     NSAccessibilityUnknownRole,
+     ROLE_SYSTEM_EQUATION,
+     ROLE_SYSTEM_EQUATION)
+
+ROLE(GRID_CELL,
+     "gridcell",
+     ATK_ROLE_TABLE_CELL,
+     NSAccessibilityGroupRole,
+     ROLE_SYSTEM_CELL,
+     ROLE_SYSTEM_CELL)
+
+ROLE(EMBEDDED_OBJECT,
+     "embedded object",
+     ATK_ROLE_PANEL,
+     NSAccessibilityGroupRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_EMBEDDED_OBJECT)
+
+ROLE(NOTE,
+     "note",
+     ATK_ROLE_SECTION,
+     NSAccessibilityGroupRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_NOTE)
+
+ROLE(FIGURE,
+     "figure",
+     ATK_ROLE_PANEL,
+     NSAccessibilityGroupRole,
+     ROLE_SYSTEM_GROUPING,
+     ROLE_SYSTEM_GROUPING)
+
+ROLE(CHECK_RICH_OPTION,
+     "check rich option",
+     ATK_ROLE_CHECK_BOX,
+     NSAccessibilityCheckBoxRole,
+     ROLE_SYSTEM_CHECKBUTTON,
+     ROLE_SYSTEM_CHECKBUTTON)
+
+ROLE(DEFINITION_LIST,
+     "definitionlist",
+     ATK_ROLE_LIST,
+     NSAccessibilityListRole,
+     ROLE_SYSTEM_LIST,
+     ROLE_SYSTEM_LIST)
+
+ROLE(TERM,
+     "term",
+     ATK_ROLE_LIST_ITEM,
+     NSAccessibilityGroupRole,
+     ROLE_SYSTEM_LISTITEM,
+     ROLE_SYSTEM_LISTITEM)
+
+ROLE(DEFINITION,
+     "definition",
+     ATK_ROLE_PARAGRAPH,
+     NSAccessibilityGroupRole,
+     USE_ROLE_STRING,
+     IA2_ROLE_PARAGRAPH)
--- a/accessible/src/base/nsAccessibilityService.cpp
+++ b/accessible/src/base/nsAccessibilityService.cpp
@@ -701,23 +701,29 @@ nsAccessibilityService::GetAccessibleFor
 
   NS_IF_ADDREF(*aAccessible = GetAccessible(node, nsnull));
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAccessibilityService::GetStringRole(PRUint32 aRole, nsAString& aString)
 {
-  if ( aRole >= ArrayLength(kRoleNames)) {
-    aString.AssignLiteral("unknown");
+#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role) \
+  case roles::geckoRole: \
+    CopyUTF8toUTF16(stringRole, aString); \
     return NS_OK;
+
+  switch (aRole) {
+#include "RoleMap.h"
+    default:
+      aString.AssignLiteral("unknown");
+      return NS_OK;
   }
 
-  CopyUTF8toUTF16(kRoleNames[aRole], aString);
-  return NS_OK;
+#undef ROLE
 }
 
 NS_IMETHODIMP
 nsAccessibilityService::GetStringStates(PRUint32 aState, PRUint32 aExtraState,
                                         nsIDOMDOMStringList **aStringStates)
 {
   nsAccessibleDOMStringList *stringStates = new nsAccessibleDOMStringList();
   NS_ENSURE_TRUE(stringStates, NS_ERROR_OUT_OF_MEMORY);
--- a/accessible/src/base/nsAccessibilityService.h
+++ b/accessible/src/base/nsAccessibilityService.h
@@ -291,152 +291,16 @@ private:
  */
 inline nsAccessibilityService*
 GetAccService()
 {
   return nsAccessibilityService::gAccessibilityService;
 }
 
 /**
- * Map nsIAccessibleRole constants to strings. Used by
- * nsIAccessibleRetrieval::getStringRole() method.
- */
-static const char kRoleNames[][20] = {
-  "nothing",             //ROLE_NOTHING
-  "titlebar",            //ROLE_TITLEBAR
-  "menubar",             //ROLE_MENUBAR
-  "scrollbar",           //ROLE_SCROLLBAR
-  "grip",                //ROLE_GRIP
-  "sound",               //ROLE_SOUND
-  "cursor",              //ROLE_CURSOR
-  "caret",               //ROLE_CARET
-  "alert",               //ROLE_ALERT
-  "window",              //ROLE_WINDOW
-  "internal frame",      //ROLE_INTERNAL_FRAME
-  "menupopup",           //ROLE_MENUPOPUP
-  "menuitem",            //ROLE_MENUITEM
-  "tooltip",             //ROLE_TOOLTIP
-  "application",         //ROLE_APPLICATION
-  "document",            //ROLE_DOCUMENT
-  "pane",                //ROLE_PANE
-  "chart",               //ROLE_CHART
-  "dialog",              //ROLE_DIALOG
-  "border",              //ROLE_BORDER
-  "grouping",            //ROLE_GROUPING
-  "separator",           //ROLE_SEPARATOR
-  "toolbar",             //ROLE_TOOLBAR
-  "statusbar",           //ROLE_STATUSBAR
-  "table",               //ROLE_TABLE
-  "columnheader",        //ROLE_COLUMNHEADER
-  "rowheader",           //ROLE_ROWHEADER
-  "column",              //ROLE_COLUMN
-  "row",                 //ROLE_ROW
-  "cell",                //ROLE_CELL
-  "link",                //ROLE_LINK
-  "helpballoon",         //ROLE_HELPBALLOON
-  "character",           //ROLE_CHARACTER
-  "list",                //ROLE_LIST
-  "listitem",            //ROLE_LISTITEM
-  "outline",             //ROLE_OUTLINE
-  "outlineitem",         //ROLE_OUTLINEITEM
-  "pagetab",             //ROLE_PAGETAB
-  "propertypage",        //ROLE_PROPERTYPAGE
-  "indicator",           //ROLE_INDICATOR
-  "graphic",             //ROLE_GRAPHIC
-  "statictext",          //ROLE_STATICTEXT
-  "text leaf",           //ROLE_TEXT_LEAF
-  "pushbutton",          //ROLE_PUSHBUTTON
-  "checkbutton",         //ROLE_CHECKBUTTON
-  "radiobutton",         //ROLE_RADIOBUTTON
-  "combobox",            //ROLE_COMBOBOX
-  "droplist",            //ROLE_DROPLIST
-  "progressbar",         //ROLE_PROGRESSBAR
-  "dial",                //ROLE_DIAL
-  "hotkeyfield",         //ROLE_HOTKEYFIELD
-  "slider",              //ROLE_SLIDER
-  "spinbutton",          //ROLE_SPINBUTTON
-  "diagram",             //ROLE_DIAGRAM
-  "animation",           //ROLE_ANIMATION
-  "equation",            //ROLE_EQUATION
-  "buttondropdown",      //ROLE_BUTTONDROPDOWN
-  "buttonmenu",          //ROLE_BUTTONMENU
-  "buttondropdowngrid",  //ROLE_BUTTONDROPDOWNGRID
-  "whitespace",          //ROLE_WHITESPACE
-  "pagetablist",         //ROLE_PAGETABLIST
-  "clock",               //ROLE_CLOCK
-  "splitbutton",         //ROLE_SPLITBUTTON
-  "ipaddress",           //ROLE_IPADDRESS
-  "accel label",         //ROLE_ACCEL_LABEL
-  "arrow",               //ROLE_ARROW
-  "canvas",              //ROLE_CANVAS
-  "check menu item",     //ROLE_CHECK_MENU_ITEM
-  "color chooser",       //ROLE_COLOR_CHOOSER
-  "date editor",         //ROLE_DATE_EDITOR
-  "desktop icon",        //ROLE_DESKTOP_ICON
-  "desktop frame",       //ROLE_DESKTOP_FRAME
-  "directory pane",      //ROLE_DIRECTORY_PANE
-  "file chooser",        //ROLE_FILE_CHOOSER
-  "font chooser",        //ROLE_FONT_CHOOSER
-  "chrome window",       //ROLE_CHROME_WINDOW
-  "glass pane",          //ROLE_GLASS_PANE
-  "html container",      //ROLE_HTML_CONTAINER
-  "icon",                //ROLE_ICON
-  "label",               //ROLE_LABEL
-  "layered pane",        //ROLE_LAYERED_PANE
-  "option pane",         //ROLE_OPTION_PANE
-  "password text",       //ROLE_PASSWORD_TEXT
-  "popup menu",          //ROLE_POPUP_MENU
-  "radio menu item",     //ROLE_RADIO_MENU_ITEM
-  "root pane",           //ROLE_ROOT_PANE
-  "scroll pane",         //ROLE_SCROLL_PANE
-  "split pane",          //ROLE_SPLIT_PANE
-  "table column header", //ROLE_TABLE_COLUMN_HEADER
-  "table row header",    //ROLE_TABLE_ROW_HEADER
-  "tear off menu item",  //ROLE_TEAR_OFF_MENU_ITEM
-  "terminal",            //ROLE_TERMINAL
-  "text container",      //ROLE_TEXT_CONTAINER
-  "toggle button",       //ROLE_TOGGLE_BUTTON
-  "tree table",          //ROLE_TREE_TABLE
-  "viewport",            //ROLE_VIEWPORT
-  "header",              //ROLE_HEADER
-  "footer",              //ROLE_FOOTER
-  "paragraph",           //ROLE_PARAGRAPH
-  "ruler",               //ROLE_RULER
-  "autocomplete",        //ROLE_AUTOCOMPLETE
-  "editbar",             //ROLE_EDITBAR
-  "entry",               //ROLE_ENTRY
-  "caption",             //ROLE_CAPTION
-  "document frame",      //ROLE_DOCUMENT_FRAME
-  "heading",             //ROLE_HEADING
-  "page",                //ROLE_PAGE
-  "section",             //ROLE_SECTION
-  "redundant object",    //ROLE_REDUNDANT_OBJECT
-  "form",                //ROLE_FORM
-  "ime",                 //ROLE_IME
-  "app root",            //ROLE_APP_ROOT
-  "parent menuitem",     //ROLE_PARENT_MENUITEM
-  "calendar",            //ROLE_CALENDAR
-  "combobox list",       //ROLE_COMBOBOX_LIST
-  "combobox option",     //ROLE_COMBOBOX_OPTION
-  "image map",           //ROLE_IMAGE_MAP
-  "listbox option",      //ROLE_OPTION
-  "listbox rich option", //ROLE_RICH_OPTION
-  "listbox",             //ROLE_LISTBOX
-  "flat equation",       //ROLE_FLAT_EQUATION
-  "gridcell",            //ROLE_GRID_CELL
-  "embedded object",     //ROLE_EMBEDDED_OBJECT
-  "note",                //ROLE_NOTE
-  "figure",              //ROLE_FIGURE
-  "check rich option",   //ROLE_CHECK_RICH_OPTION
-  "definitionlist",      //ROLE_DEFINITION_LIST
-  "term",                //ROLE_TERM
-  "definition"           //ROLE_DEFINITION
-};
-
-/**
  * Map nsIAccessibleEvents constants to strings. Used by
  * nsIAccessibleRetrieval::getStringEventType() method.
  */
 static const char kEventTypeNames[][40] = {
   "unknown",                                 //
   "show",                                    // EVENT_SHOW
   "hide",                                    // EVENT_HIDE
   "reorder",                                 // EVENT_REORDER
--- a/accessible/src/mac/Makefile.in
+++ b/accessible/src/mac/Makefile.in
@@ -75,17 +75,16 @@ EXPORTS = \
   nsHyperTextAccessibleWrap.h \
   nsHTMLImageAccessibleWrap.h \
   nsHTMLTableAccessibleWrap.h \
   mozDocAccessible.h \
   mozAccessible.h \
   mozAccessibleProtocol.h \
   mozActionElements.h \
   mozTextAccessible.h \
-  nsRoleMap.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/mac/mozAccessible.mm
+++ b/accessible/src/mac/mozAccessible.mm
@@ -35,17 +35,16 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
  
 #import "mozAccessible.h"
 
 #import "MacUtils.h"
 #import "mozView.h"
-#import "nsRoleMap.h"
 
 #include "Accessible-inl.h"
 #include "nsIAccessibleRelation.h"
 #include "nsIAccessibleText.h"
 #include "nsIAccessibleEditableText.h"
 #include "nsRootAccessible.h"
 #include "Relation.h"
 #include "Role.h"
@@ -116,20 +115,16 @@ GetNativeFromGeckoAccessible(nsIAccessib
 - (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[roles::LAST_ENTRY] isEqualToString:@"ROLE_LAST_ENTRY"], "Role skew in the role map!");
   }
    
   return self;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
 - (void)dealloc
@@ -457,17 +452,29 @@ GetNativeFromGeckoAccessible(nsIAccessib
 }
 
 - (NSString*)role
 {
 #ifdef DEBUG_A11Y
   NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(mGeckoAccessible),
                "Does not support nsIAccessibleText when it should");
 #endif
-  return (NSString*) AXRoles[mRole];
+
+#define ROLE(geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role) \
+  case roles::geckoRole: \
+    return macRole;
+
+  switch (mRole) {
+#include "RoleMap.h"
+    default:
+      NS_NOTREACHED("Unknown role.");
+      return NSAccessibilityUnknownRole;
+  }
+
+#undef ROLE
 }
 
 - (NSString*)subrole
 {
   switch (mRole) {
     case roles::LIST:
       return NSAccessibilityContentListSubrole;
 
--- a/accessible/src/mac/nsAccessibleWrap.h
+++ b/accessible/src/mac/nsAccessibleWrap.h
@@ -96,17 +96,17 @@ public: // construction, destruction
     { return (NativeState() & mozilla::a11y::states::HASPOPUP); }
   
   /**
    * Returns this accessible's all children, adhering to "flat" accessibles by 
    * not returning their children.
    */
   void GetUnignoredChildren(nsTArray<nsAccessible*>* aChildrenArray);
   nsAccessible* GetUnignoredParent() const;
-    
+
 protected:
 
   virtual nsresult FirePlatformEvent(AccEvent* aEvent);
 
   /**
    * Return true if the parent doesn't have children to expose to AT.
    */
   bool AncestorIsFlat();
--- a/accessible/src/mac/nsAccessibleWrap.mm
+++ b/accessible/src/mac/nsAccessibleWrap.mm
@@ -34,18 +34,16 @@
  * 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 "nsDocAccessible.h"
 #include "nsObjCExceptions.h"
 
-#import "nsRoleMap.h"
-
 #include "Accessible-inl.h"
 #include "Role.h"
 
 #import "mozAccessible.h"
 #import "mozActionElements.h"
 #import "mozHTMLAccessible.h"
 #import "mozTextAccessible.h"
 
deleted file mode 100644
--- a/accessible/src/mac/nsRoleMap.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/* -*- Mode: Objective-C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2:
- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is Mozilla Foundation
- * Portions created by the Initial Developer are Copyright (C) 2006
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   HÃ¥kan Waara <hwaara@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 ***** */
-
-#import <Cocoa/Cocoa.h>
-
-#include "nsIAccessible.h"
-
-static const NSString* AXRoles [] = {
-  NSAccessibilityUnknownRole,                   // roles::NOTHING              0
-  NSAccessibilityUnknownRole,                   // roles::TITLEBAR             1      Irrelevant on OS X; windows are always native.
-  NSAccessibilityScrollBarRole,                 // roles::SCROLLBAR            3      We might need to make this its own mozAccessible, to support the children objects (valueindicator, down/up buttons).
-  NSAccessibilityMenuBarRole,                   // roles::MENUBAR              2      Irrelevant on OS X; the menubar will always be native and on the top of the screen.
-  NSAccessibilitySplitterRole,                  // roles::GRIP                 4
-  NSAccessibilityUnknownRole,                   // roles::SOUND                5      Unused on OS X.
-  NSAccessibilityUnknownRole,                   // roles::CURSOR               6      Unused on OS X.
-  NSAccessibilityUnknownRole,                   // roles::CARET                7      Unused on OS X.
-  NSAccessibilityWindowRole,                    // roles::ALERT                8
-  NSAccessibilityWindowRole,                    // roles::WINDOW               9      Irrelevant on OS X; all window a11y is handled by the system.
-  NSAccessibilityScrollAreaRole,                // roles::INTERNAL_FRAME       10
-  NSAccessibilityMenuRole,                      // roles::MENUPOPUP            11     The parent of menuitems.
-  NSAccessibilityMenuItemRole,                  // roles::MENUITEM             12
-  @"AXHelpTag",                                 // roles::TOOLTIP              13     10.4+ only, so we re-define the constant.
-  NSAccessibilityGroupRole,                     // roles::APPLICATION          14     Unused on OS X. the system will take care of this.
-  @"AXWebArea",                                 // roles::DOCUMENT             15
-  NSAccessibilityGroupRole,                     // roles::PANE                 16
-  NSAccessibilityUnknownRole,                   // roles::CHART                17
-  NSAccessibilityWindowRole,                    // roles::DIALOG               18     There's a dialog subrole.
-  NSAccessibilityUnknownRole,                   // roles::BORDER               19     Unused on OS X.
-  NSAccessibilityGroupRole,                     // roles::GROUPING             20
-  NSAccessibilityUnknownRole,                   // roles::SEPARATOR            21
-  NSAccessibilityToolbarRole,                   // roles::TOOLBAR              22
-  NSAccessibilityUnknownRole,                   // roles::STATUSBAR            23     Doesn't exist on OS X (a status bar is its parts; a progressbar, a label, etc.)
-  NSAccessibilityGroupRole,                     // roles::TABLE                24
-  NSAccessibilityGroupRole,                     // roles::COLUMNHEADER         25
-  NSAccessibilityGroupRole,                     // roles::ROWHEADER            26
-  NSAccessibilityColumnRole,                    // roles::COLUMN               27
-  NSAccessibilityRowRole,                       // roles::ROW                  28
-  NSAccessibilityGroupRole,                     // roles::CELL                 29
-  @"AXLink",                                    // roles::LINK                 30     10.4+ the attr first define in SDK 10.4, so we define it here too. ROLE_LINK
-  @"AXHelpTag",                                 // roles::HELPBALLOON          31
-  NSAccessibilityUnknownRole,                   // roles::CHARACTER            32     Unused on OS X.
-  NSAccessibilityListRole,                      // roles::LIST                 33
-  NSAccessibilityGroupRole,                     // roles::LISTITEM             34
-  NSAccessibilityOutlineRole,                   // roles::OUTLINE              35
-  NSAccessibilityRowRole,                       // roles::OUTLINEITEM          36     XXX: use OutlineRow as subrole.
-  NSAccessibilityRadioButtonRole,               // roles::PAGETAB              37
-  NSAccessibilityGroupRole,                     // roles::PROPERTYPAGE         38
-  NSAccessibilityUnknownRole,                   // roles::INDICATOR            39
-  NSAccessibilityImageRole,                     // roles::GRAPHIC              40
-  NSAccessibilityStaticTextRole,                // roles::STATICTEXT           41
-  NSAccessibilityStaticTextRole,                // roles::TEXT_LEAF            42
-  NSAccessibilityButtonRole,                    // roles::PUSHBUTTON           43
-  NSAccessibilityCheckBoxRole,                  // roles::CHECKBUTTON          44
-  NSAccessibilityRadioButtonRole,               // roles::RADIOBUTTON          45
-  NSAccessibilityPopUpButtonRole,               // roles::COMBOBOX             46
-  NSAccessibilityPopUpButtonRole,               // roles::DROPLIST             47
-  NSAccessibilityProgressIndicatorRole,         // roles::PROGRESSBAR          48
-  NSAccessibilityUnknownRole,                   // roles::DIAL                 49
-  NSAccessibilityUnknownRole,                   // roles::HOTKEYFIELD          50
-  NSAccessibilitySliderRole,                    // roles::SLIDER               51
-  NSAccessibilityIncrementorRole,               // roles::SPINBUTTON           52     Subroles: Increment/Decrement.
-  NSAccessibilityUnknownRole,                   // roles::DIAGRAM              53
-  NSAccessibilityUnknownRole,                   // roles::ANIMATION            54
-  NSAccessibilityUnknownRole,                   // roles::EQUATION             55
-  NSAccessibilityPopUpButtonRole,               // roles::BUTTONDROPDOWN       56
-  NSAccessibilityMenuButtonRole,                // roles::BUTTONMENU           57
-  NSAccessibilityGroupRole,                     // roles::BUTTONDROPDOWNGRID   58
-  NSAccessibilityUnknownRole,                   // roles::WHITESPACE           59
-  NSAccessibilityTabGroupRole,                  // roles::PAGETABLIST          60
-  NSAccessibilityUnknownRole,                   // roles::CLOCK                61     Unused on OS X
-  NSAccessibilityButtonRole,                    // roles::SPLITBUTTON          62
-  NSAccessibilityUnknownRole,                   // roles::IPADDRESS            63
-  NSAccessibilityStaticTextRole,                // roles::ACCEL_LABEL          64
-  NSAccessibilityUnknownRole,                   // roles::ARROW                65
-  NSAccessibilityImageRole,                     // roles::CANVAS               66
-  NSAccessibilityMenuItemRole,                  // roles::CHECK_MENU_ITEM      67
-  NSAccessibilityColorWellRole,                 // roles::COLOR_CHOOSER        68
-  NSAccessibilityUnknownRole,                   // roles::DATE_EDITOR          69 
-  NSAccessibilityImageRole,                     // roles::DESKTOP_ICON         70
-  NSAccessibilityUnknownRole,                   // roles::DESKTOP_FRAME        71
-  NSAccessibilityBrowserRole,                   // roles::DIRECTORY_PANE       72
-  NSAccessibilityUnknownRole,                   // roles::FILE_CHOOSER         73     Unused on OS X
-  NSAccessibilityUnknownRole,                   // roles::FONT_CHOOSER         74
-  NSAccessibilityUnknownRole,                   // roles::CHROME_WINDOW        75     Unused on OS X
-  NSAccessibilityGroupRole,                     // roles::GLASS_PANE           76
-  NSAccessibilityUnknownRole,                   // roles::HTML_CONTAINER       77
-  NSAccessibilityImageRole,                     // roles::ICON                 78
-  NSAccessibilityGroupRole,                     // roles::LABEL                79
-  NSAccessibilityGroupRole,                     // roles::LAYERED_PANE         80
-  NSAccessibilityGroupRole,                     // roles::OPTION_PANE          81
-  NSAccessibilityTextFieldRole,                 // roles::PASSWORD_TEXT        82
-  NSAccessibilityUnknownRole,                   // roles::POPUP_MENU           83     Unused
-  NSAccessibilityMenuItemRole,                  // roles::RADIO_MENU_ITEM      84
-  NSAccessibilityGroupRole,                     // roles::ROOT_PANE            85
-  NSAccessibilityScrollAreaRole,                // roles::SCROLL_PANE          86
-  NSAccessibilitySplitGroupRole,                // roles::SPLIT_PANE           87
-  NSAccessibilityUnknownRole,                   // roles::TABLE_COLUMN_HEADER  88
-  NSAccessibilityUnknownRole,                   // roles::TABLE_ROW_HEADER     89
-  NSAccessibilityMenuItemRole,                  // roles::TEAR_OFF_MENU_ITEM   90
-  NSAccessibilityUnknownRole,                   // roles::TERMINAL             91
-  NSAccessibilityGroupRole,                     // roles::TEXT_CONTAINER       92
-  NSAccessibilityButtonRole,                    // roles::TOGGLE_BUTTON        93
-  NSAccessibilityTableRole,                     // roles::TREE_TABLE           94
-  NSAccessibilityUnknownRole,                   // roles::VIEWPORT             95
-  NSAccessibilityGroupRole,                     // roles::HEADER               96
-  NSAccessibilityGroupRole,                     // roles::FOOTER               97
-  NSAccessibilityGroupRole,                     // roles::PARAGRAPH            98
-  @"AXRuler",                                   // roles::RULER                99     10.4+ only, so we re-define the constant.
-  NSAccessibilityUnknownRole,                   // roles::AUTOCOMPLETE         100
-  NSAccessibilityTextFieldRole,                 // roles::EDITBAR              101
-  NSAccessibilityTextFieldRole,                 // roles::ENTRY                102
-  NSAccessibilityStaticTextRole,                // roles::CAPTION              103
-  NSAccessibilityScrollAreaRole,                // roles::DOCUMENT_FRAME       104
-  @"AXHeading",                                 // roles::HEADING              105
-  NSAccessibilityGroupRole,                     // roles::PAGE                 106
-  NSAccessibilityGroupRole,                     // roles::SECTION              107
-  NSAccessibilityUnknownRole,                   // roles::REDUNDANT_OBJECT     108
-  NSAccessibilityGroupRole,                     // roles::FORM                 109
-  NSAccessibilityUnknownRole,                   // roles::IME                  110
-  NSAccessibilityUnknownRole,                   // roles::APP_ROOT             111    Unused on OS X
-  NSAccessibilityMenuItemRole,                  // roles::PARENT_MENUITEM      112
-  NSAccessibilityGroupRole,                     // roles::CALENDAR             113
-  NSAccessibilityMenuRole,                      // roles::COMBOBOX_LIST        114
-  NSAccessibilityMenuItemRole,                  // roles::COMBOBOX_OPTION      115
-  NSAccessibilityImageRole,                     // roles::IMAGE_MAP            116
-  NSAccessibilityRowRole,                       // roles::OPTION               117
-  NSAccessibilityRowRole,                       // roles::RICH_OPTION          118
-  NSAccessibilityListRole,                      // roles::LISTBOX              119
-  NSAccessibilityUnknownRole,                   // roles::FLAT_EQUATION        120
-  NSAccessibilityGroupRole,                     // roles::GRID_CELL            121
-  NSAccessibilityGroupRole,                     // roles::EMBEDDED_OBJECT      122
-  NSAccessibilityGroupRole,                     // roles::NOTE                 123
-  NSAccessibilityGroupRole,                     // roles::FIGURE               124
-  NSAccessibilityCheckBoxRole,                  // roles::CHECK_RICH_OPTION    125
-  NSAccessibilityListRole,                      // roles::DEFINITION_LIST      126
-  NSAccessibilityGroupRole,                     // roles::TERM                 127
-  NSAccessibilityGroupRole,                     // roles::DEFINITION           128
-  @"ROLE_LAST_ENTRY"                            // roles::LAST_ENTRY                  Bogus role that will never be shown (just marks the end of this array)!
-};
--- a/accessible/src/msaa/nsAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsAccessibleWrap.cpp
@@ -47,35 +47,53 @@
 #include "States.h"
 
 #include "ia2AccessibleRelation.h"
 
 #include "nsIAccessibleEvent.h"
 #include "nsIAccessibleRelation.h"
 
 #include "Accessible2_i.c"
+#include "AccessibleRole.h"
 #include "AccessibleStates.h"
 
 #include "nsIMutableArray.h"
 #include "nsIDOMDocument.h"
 #include "nsIFrame.h"
 #include "nsIScrollableFrame.h"
 #include "nsINameSpaceManager.h"
 #include "nsINodeInfo.h"
 #include "nsRootAccessible.h"
 #include "nsIServiceManager.h"
 #include "nsTextFormatter.h"
 #include "nsIView.h"
 #include "nsIViewManager.h"
-#include "nsRoleMap.h"
 #include "nsEventMap.h"
 #include "nsArrayUtils.h"
 
+#include "OLEACC.H"
+
+using namespace mozilla;
 using namespace mozilla::a11y;
 
+const PRUint32 USE_ROLE_STRING = 0;
+
+#ifndef ROLE_SYSTEM_SPLITBUTTON
+const PRUint32 ROLE_SYSTEM_SPLITBUTTON  = 0x3e; // Not defined in all oleacc.h versions
+#endif
+
+#ifndef ROLE_SYSTEM_IPADDRESS
+const PRUint32 ROLE_SYSTEM_IPADDRESS = 0x3f; // Not defined in all oleacc.h versions
+#endif
+
+#ifndef ROLE_SYSTEM_OUTLINEBUTTON
+const PRUint32 ROLE_SYSTEM_OUTLINEBUTTON = 0x40; // Not defined in all oleacc.h versions
+#endif
+
+
 /* For documentation of the accessibility architecture,
  * see http://lxr.mozilla.org/seamonkey/source/accessible/accessible-docs.html
  */
 
 //#define DEBUG_LEAKS
 
 #ifdef DEBUG_LEAKS
 static gAccessibles = 0;
@@ -369,25 +387,36 @@ STDMETHODIMP nsAccessibleWrap::get_accRo
   if (xpAccessible->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
 #ifdef DEBUG_A11Y
   NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(xpAccessible),
                "Does not support nsIAccessibleText when it should");
 #endif
 
-  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");
+  a11y::role geckoRole = xpAccessible->Role();
+  PRUint32 msaaRole = 0;
+
+#define ROLE(_geckoRole, stringRole, atkRole, macRole, _msaaRole, ia2Role) \
+  case roles::_geckoRole: \
+    msaaRole = _msaaRole; \
+    break;
+
+  switch (geckoRole) {
+#include "RoleMap.h"
+    default:
+      MOZ_NOT_REACHED("Unknown role.");
+  };
+
+#undef ROLE
 
   // 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 (role == roles::ROW) {
+  if (geckoRole == roles::ROW) {
     nsAccessible* xpParent = Parent();
     if (xpParent && xpParent->Role() == roles::TREE_TABLE)
       msaaRole = ROLE_SYSTEM_OUTLINEITEM;
   }
   
   // -- Try enumerated role
   if (msaaRole != USE_ROLE_STRING) {
     pvarRole->vt = VT_I4;
@@ -1197,25 +1226,33 @@ STDMETHODIMP
 nsAccessibleWrap::role(long *aRole)
 {
 __try {
   *aRole = 0;
 
   if (IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
-  NS_ASSERTION(gWindowsRoleMap[roles::LAST_ENTRY].ia2Role == ROLE_WINDOWS_LAST_ENTRY,
-               "MSAA role map skewed");
+#define ROLE(_geckoRole, stringRole, atkRole, macRole, msaaRole, ia2Role) \
+  case roles::_geckoRole: \
+    *aRole = ia2Role; \
+    break;
 
-  roles::Role role = Role();
-  *aRole = gWindowsRoleMap[role].ia2Role;
+  a11y::role geckoRole = Role();
+  switch (geckoRole) {
+#include "RoleMap.h"
+    default:
+      MOZ_NOT_REACHED("Unknown role.");
+  };
+
+#undef ROLE
 
   // Special case, if there is a ROLE_ROW inside of a ROLE_TREE_TABLE, then call
   // the IA2 role a ROLE_OUTLINEITEM.
-  if (role == roles::ROW) {
+  if (geckoRole == roles::ROW) {
     nsAccessible* xpParent = Parent();
     if (xpParent && xpParent->Role() == roles::TREE_TABLE)
       *aRole = ROLE_SYSTEM_OUTLINEITEM;
   }
 
   return S_OK;
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
deleted file mode 100644
--- a/accessible/src/msaa/nsRoleMap.h
+++ /dev/null
@@ -1,467 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim:expandtab:shiftwidth=2:tabstop=2:
- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is IBM Corporation
- * Portions created by the Initial Developer are Copyright (C) 2006
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Gao, Ming <gaoming@cn.ibm.com>
- *   Aaron Leventhal <aleventh@us.ibm.com>
- *   Alexander Surkov <surkov.alexander@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 ***** */
-
-#include "OLEACC.H"
-#include "AccessibleRole.h"
-
-const PRUint32 USE_ROLE_STRING = 0;
-const PRUint32 ROLE_WINDOWS_LAST_ENTRY = 0xffffffff;
-
-#ifndef ROLE_SYSTEM_SPLITBUTTON
-const PRUint32 ROLE_SYSTEM_SPLITBUTTON  = 0x3e; // Not defined in all oleacc.h versions
-#endif
-
-#ifndef ROLE_SYSTEM_IPADDRESS
-const PRUint32 ROLE_SYSTEM_IPADDRESS = 0x3f; // Not defined in all oleacc.h versions
-#endif
-
-#ifndef ROLE_SYSTEM_OUTLINEBUTTON
-const PRUint32 ROLE_SYSTEM_OUTLINEBUTTON = 0x40; // Not defined in all oleacc.h versions
-#endif
-
-struct WindowsRoleMapItem
-{
-  PRUint32 msaaRole;
-  long ia2Role;
-};
-
-// Map array from cross platform roles to MSAA/IA2 roles
-static const WindowsRoleMapItem gWindowsRoleMap[] = {
-  // roles::NOTHING
-  { USE_ROLE_STRING, IA2_ROLE_UNKNOWN },
-
-  // roles::TITLEBAR
-  { ROLE_SYSTEM_TITLEBAR, ROLE_SYSTEM_TITLEBAR },
-
-  // roles::MENUBAR
-  { ROLE_SYSTEM_MENUBAR, ROLE_SYSTEM_MENUBAR },
-
-  // roles::SCROLLBAR
-  { ROLE_SYSTEM_SCROLLBAR, ROLE_SYSTEM_SCROLLBAR },
-
-  // roles::GRIP
-  { ROLE_SYSTEM_GRIP, ROLE_SYSTEM_GRIP },
-
-  // roles::SOUND
-  { ROLE_SYSTEM_SOUND, ROLE_SYSTEM_SOUND },
-
-  // roles::CURSOR
-  { ROLE_SYSTEM_CURSOR, ROLE_SYSTEM_CURSOR },
-
-  // roles::CARET
-  { ROLE_SYSTEM_CARET, ROLE_SYSTEM_CARET },
-
-  // roles::ALERT
-  { ROLE_SYSTEM_ALERT, ROLE_SYSTEM_ALERT },
-
-  // roles::WINDOW
-  { ROLE_SYSTEM_WINDOW, ROLE_SYSTEM_WINDOW },
-
-  // roles::INTERNAL_FRAME
-  { USE_ROLE_STRING, IA2_ROLE_INTERNAL_FRAME},
-
-  // roles::MENUPOPUP
-  { ROLE_SYSTEM_MENUPOPUP, ROLE_SYSTEM_MENUPOPUP },
-
-  // roles::MENUITEM
-  { ROLE_SYSTEM_MENUITEM, ROLE_SYSTEM_MENUITEM },
-
-  // roles::TOOLTIP
-  { ROLE_SYSTEM_TOOLTIP, ROLE_SYSTEM_TOOLTIP },
-
-  // roles::APPLICATION
-  { ROLE_SYSTEM_APPLICATION, ROLE_SYSTEM_APPLICATION },
-
-  // roles::DOCUMENT
-  { ROLE_SYSTEM_DOCUMENT, ROLE_SYSTEM_DOCUMENT },
-
-  // 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 }, 
-
-  // roles::CHART
-  { ROLE_SYSTEM_CHART, ROLE_SYSTEM_CHART },
-
-  // roles::DIALOG
-  { ROLE_SYSTEM_DIALOG, ROLE_SYSTEM_DIALOG },
-
-  // roles::BORDER
-  { ROLE_SYSTEM_BORDER, ROLE_SYSTEM_BORDER },
-
-  // roles::GROUPING
-  { ROLE_SYSTEM_GROUPING, ROLE_SYSTEM_GROUPING },
-
-  // roles::SEPARATOR
-  { ROLE_SYSTEM_SEPARATOR, ROLE_SYSTEM_SEPARATOR },
-
-  // roles::TOOLBAR
-  { ROLE_SYSTEM_TOOLBAR, ROLE_SYSTEM_TOOLBAR },
-
-  // roles::STATUSBAR
-  { ROLE_SYSTEM_STATUSBAR, ROLE_SYSTEM_STATUSBAR },
-
-  // roles::TABLE
-  { ROLE_SYSTEM_TABLE, ROLE_SYSTEM_TABLE },
-
-  // roles::COLUMNHEADER,
-  { ROLE_SYSTEM_COLUMNHEADER, ROLE_SYSTEM_COLUMNHEADER },
-
-  // roles::ROWHEADER
-  { ROLE_SYSTEM_ROWHEADER, ROLE_SYSTEM_ROWHEADER },
-
-  // roles::COLUMN
-  { ROLE_SYSTEM_COLUMN, ROLE_SYSTEM_COLUMN },
-
-  // roles::ROW
-  { ROLE_SYSTEM_ROW, ROLE_SYSTEM_ROW },
-
-  // roles::CELL
-  { ROLE_SYSTEM_CELL, ROLE_SYSTEM_CELL },
-
-  // roles::LINK
-  { ROLE_SYSTEM_LINK, ROLE_SYSTEM_LINK },
-
-  // roles::HELPBALLOON
-  { ROLE_SYSTEM_HELPBALLOON, ROLE_SYSTEM_HELPBALLOON },
-
-  // roles::CHARACTER
-  { ROLE_SYSTEM_CHARACTER, ROLE_SYSTEM_CHARACTER },
-
-  // roles::LIST
-  { ROLE_SYSTEM_LIST, ROLE_SYSTEM_LIST },
-
-  // roles::LISTITEM
-  { ROLE_SYSTEM_LISTITEM, ROLE_SYSTEM_LISTITEM },
-
-  // roles::OUTLINE
-  { ROLE_SYSTEM_OUTLINE, ROLE_SYSTEM_OUTLINE },
-
-  // roles::OUTLINEITEM
-  { ROLE_SYSTEM_OUTLINEITEM, ROLE_SYSTEM_OUTLINEITEM },
-
-  // roles::PAGETAB
-  { ROLE_SYSTEM_PAGETAB, ROLE_SYSTEM_PAGETAB },
-
-  // roles::PROPERTYPAGE
-  { ROLE_SYSTEM_PROPERTYPAGE, ROLE_SYSTEM_PROPERTYPAGE },
-
-  // roles::INDICATOR
-  { ROLE_SYSTEM_INDICATOR, ROLE_SYSTEM_INDICATOR },
-
-  // roles::GRAPHIC
-  { ROLE_SYSTEM_GRAPHIC, ROLE_SYSTEM_GRAPHIC },
-
-  // roles::STATICTEXT
-  { ROLE_SYSTEM_STATICTEXT, ROLE_SYSTEM_STATICTEXT },
-
-  // roles::TEXT_LEAF
-  { ROLE_SYSTEM_TEXT, ROLE_SYSTEM_TEXT },
-
-  // roles::PUSHBUTTON
-  { ROLE_SYSTEM_PUSHBUTTON, ROLE_SYSTEM_PUSHBUTTON },
-
-  // roles::CHECKBUTTON
-  { ROLE_SYSTEM_CHECKBUTTON, ROLE_SYSTEM_CHECKBUTTON },
-
-  // roles::RADIOBUTTON
-  { ROLE_SYSTEM_RADIOBUTTON, ROLE_SYSTEM_RADIOBUTTON },
-
-  // roles::COMBOBOX
-  { ROLE_SYSTEM_COMBOBOX, ROLE_SYSTEM_COMBOBOX },
-
-  // roles::DROPLIST
-  { ROLE_SYSTEM_DROPLIST, ROLE_SYSTEM_DROPLIST },
-
-  // roles::PROGRESSBAR
-  { ROLE_SYSTEM_PROGRESSBAR, ROLE_SYSTEM_PROGRESSBAR },
-
-  // roles::DIAL
-  { ROLE_SYSTEM_DIAL, ROLE_SYSTEM_DIAL },
-
-  // roles::HOTKEYFIELD
-  { ROLE_SYSTEM_HOTKEYFIELD, ROLE_SYSTEM_HOTKEYFIELD },
-
-  // roles::SLIDER
-  { ROLE_SYSTEM_SLIDER, ROLE_SYSTEM_SLIDER },
-
-  // roles::SPINBUTTON
-  { ROLE_SYSTEM_SPINBUTTON, ROLE_SYSTEM_SPINBUTTON },
-
-  // roles::DIAGRAM
-  { ROLE_SYSTEM_DIAGRAM, ROLE_SYSTEM_DIAGRAM },
-
-  // roles::ANIMATION
-  { ROLE_SYSTEM_ANIMATION, ROLE_SYSTEM_ANIMATION },
-
-  // roles::EQUATION
-  { ROLE_SYSTEM_EQUATION, ROLE_SYSTEM_EQUATION },
-
-  // roles::BUTTONDROPDOWN
-  { ROLE_SYSTEM_BUTTONDROPDOWN, ROLE_SYSTEM_BUTTONDROPDOWN },
-
-  // roles::BUTTONMENU
-  { ROLE_SYSTEM_BUTTONMENU, ROLE_SYSTEM_BUTTONMENU },
-
-  // roles::BUTTONDROPDOWNGRID
-  { ROLE_SYSTEM_BUTTONDROPDOWNGRID, ROLE_SYSTEM_BUTTONDROPDOWNGRID },
-
-  // roles::WHITESPACE
-  { ROLE_SYSTEM_WHITESPACE, ROLE_SYSTEM_WHITESPACE },
-
-  // roles::PAGETABLIST
-  { ROLE_SYSTEM_PAGETABLIST, ROLE_SYSTEM_PAGETABLIST },
-
-  // roles::CLOCK
-  { ROLE_SYSTEM_CLOCK, ROLE_SYSTEM_CLOCK },
-
-  // roles::SPLITBUTTON
-  { ROLE_SYSTEM_SPLITBUTTON, ROLE_SYSTEM_SPLITBUTTON },
-
-  // 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).
-
-  // roles::ACCEL_LABEL
-  { ROLE_SYSTEM_STATICTEXT, ROLE_SYSTEM_STATICTEXT },
-
-  // roles::ARROW
-  { ROLE_SYSTEM_INDICATOR, ROLE_SYSTEM_INDICATOR },
-
-  // roles::CANVAS
-  { USE_ROLE_STRING, IA2_ROLE_CANVAS },
-
-  // roles::CHECK_MENU_ITEM
-  { ROLE_SYSTEM_MENUITEM, IA2_ROLE_CHECK_MENU_ITEM },
-
-  // roles::COLOR_CHOOSER
-  { ROLE_SYSTEM_DIALOG, IA2_ROLE_COLOR_CHOOSER },
-
-  // roles::DATE_EDITOR
-  { USE_ROLE_STRING, IA2_ROLE_DATE_EDITOR },
-
-  // roles::DESKTOP_ICON
-  { USE_ROLE_STRING, IA2_ROLE_DESKTOP_ICON },
-
-  // roles::DESKTOP_FRAME
-  { USE_ROLE_STRING, IA2_ROLE_DESKTOP_PANE },
-
-  // roles::DIRECTORY_PANE
-  { USE_ROLE_STRING, IA2_ROLE_DIRECTORY_PANE },
-
-  // roles::FILE_CHOOSER
-  { USE_ROLE_STRING, IA2_ROLE_FILE_CHOOSER },
-
-  // roles::FONT_CHOOSER
-  { USE_ROLE_STRING, IA2_ROLE_FONT_CHOOSER },
-
-  // roles::CHROME_WINDOW
-  { ROLE_SYSTEM_APPLICATION, IA2_ROLE_FRAME },
-
-  // roles::GLASS_PANE
-  { USE_ROLE_STRING, IA2_ROLE_GLASS_PANE },
-
-  // roles::HTML_CONTAINER
-  { USE_ROLE_STRING, IA2_ROLE_UNKNOWN },
-
-  // roles::ICON
-  { ROLE_SYSTEM_PUSHBUTTON, IA2_ROLE_ICON },
-
-  // roles::LABEL
-  { ROLE_SYSTEM_STATICTEXT, IA2_ROLE_LABEL },
-
-  // roles::LAYERED_PANE
-  { USE_ROLE_STRING, IA2_ROLE_LAYERED_PANE },
-
-  // roles::OPTION_PANE
-  { USE_ROLE_STRING, IA2_ROLE_OPTION_PANE },
-
-  // roles::PASSWORD_TEXT
-  { ROLE_SYSTEM_TEXT, ROLE_SYSTEM_TEXT },
-
-  // roles::POPUP_MENU
-  { ROLE_SYSTEM_MENUPOPUP, ROLE_SYSTEM_MENUPOPUP },
-
-  // roles::RADIO_MENU_ITEM
-  { ROLE_SYSTEM_MENUITEM, IA2_ROLE_RADIO_MENU_ITEM },
-
-  // roles::ROOT_PANE
-  { USE_ROLE_STRING, IA2_ROLE_ROOT_PANE },
-
-  // roles::SCROLL_PANE
-  { USE_ROLE_STRING, IA2_ROLE_SCROLL_PANE },
-
-  // roles::SPLIT_PANE
-  { USE_ROLE_STRING, IA2_ROLE_SPLIT_PANE },
-
-  // roles::TABLE_COLUMN_HEADER
-  { ROLE_SYSTEM_COLUMNHEADER, ROLE_SYSTEM_COLUMNHEADER },
-
-  // roles::TABLE_ROW_HEADER
-  { ROLE_SYSTEM_ROWHEADER, ROLE_SYSTEM_ROWHEADER },
-
-  // roles::TEAR_OFF_MENU_ITEM
-  { ROLE_SYSTEM_MENUITEM, IA2_ROLE_TEAR_OFF_MENU },
-
-  // roles::TERMINAL
-  { USE_ROLE_STRING, IA2_ROLE_TERMINAL },
-
-  // roles::TEXT_CONTAINER
-  { USE_ROLE_STRING, IA2_ROLE_TEXT_FRAME },
-
-  // roles::TOGGLE_BUTTON
-  { ROLE_SYSTEM_PUSHBUTTON, IA2_ROLE_TOGGLE_BUTTON },
-
-  // roles::TREE_TABLE
-  { ROLE_SYSTEM_OUTLINE, ROLE_SYSTEM_OUTLINE },
-
-  // roles::VIEWPORT
-  { ROLE_SYSTEM_PANE, IA2_ROLE_VIEW_PORT },
-
-  // roles::HEADER
-  { USE_ROLE_STRING, IA2_ROLE_HEADER },
-
-  // roles::FOOTER
-  { USE_ROLE_STRING, IA2_ROLE_FOOTER },
-
-  // roles::PARAGRAPH
-  { USE_ROLE_STRING, IA2_ROLE_PARAGRAPH },
-
-  // roles::RULER
-  { USE_ROLE_STRING, IA2_ROLE_RULER },
-
-  // roles::AUTOCOMPLETE
-  { ROLE_SYSTEM_COMBOBOX, ROLE_SYSTEM_COMBOBOX },
-
-  // roles::EDITBAR
-  { ROLE_SYSTEM_TEXT, IA2_ROLE_EDITBAR },
-
-  // roles::ENTRY
-  { ROLE_SYSTEM_TEXT, ROLE_SYSTEM_TEXT },
-
-  // roles::CAPTION
-  { USE_ROLE_STRING, IA2_ROLE_CAPTION },
-
-  // roles::DOCUMENT_FRAME
-  { USE_ROLE_STRING, IA2_ROLE_UNKNOWN },
-
-  // roles::HEADING
-  { USE_ROLE_STRING, IA2_ROLE_HEADING },
-
-  // roles::PAGE
-  { USE_ROLE_STRING, IA2_ROLE_PAGE },
-
-  // roles::SECTION
-  { USE_ROLE_STRING, IA2_ROLE_SECTION },
-
-  // roles::REDUNDANT_OBJECT
-  { USE_ROLE_STRING, IA2_ROLE_REDUNDANT_OBJECT },
-
-  // roles::FORM
-  { USE_ROLE_STRING, IA2_ROLE_FORM },
-
-  // roles::IME
-  { USE_ROLE_STRING, IA2_ROLE_INPUT_METHOD_WINDOW },
-
-  // roles::APP_ROOT
-  { ROLE_SYSTEM_APPLICATION, ROLE_SYSTEM_APPLICATION },
-
-  // roles::PARENT_MENUITEM
-  { ROLE_SYSTEM_MENUITEM, ROLE_SYSTEM_MENUITEM },
-
-  // roles::CALENDAR
-  { ROLE_SYSTEM_CLIENT, ROLE_SYSTEM_CLIENT },
-
-  // roles::COMBOBOX_LIST
-  { ROLE_SYSTEM_LIST, ROLE_SYSTEM_LIST },
-
-  // roles::COMBOBOX_OPTION
-  { ROLE_SYSTEM_LISTITEM, ROLE_SYSTEM_LISTITEM },
-
-  // roles::IMAGE_MAP
-  { ROLE_SYSTEM_GRAPHIC, ROLE_SYSTEM_GRAPHIC },
-
-  // roles::OPTION 
-  { ROLE_SYSTEM_LISTITEM, ROLE_SYSTEM_LISTITEM },
-  
-  // roles::RICH_OPTION
-  { ROLE_SYSTEM_LISTITEM, ROLE_SYSTEM_LISTITEM },
-  
-  // roles::LISTBOX
-  { ROLE_SYSTEM_LIST, ROLE_SYSTEM_LIST },
-  
-  // roles::FLAT_EQUATION
-  { ROLE_SYSTEM_EQUATION, ROLE_SYSTEM_EQUATION },
-  
-  // roles::GRID_CELL
-  { ROLE_SYSTEM_CELL, ROLE_SYSTEM_CELL },
-
-  // roles::EMBEDDED_OBJECT
-  { USE_ROLE_STRING, IA2_ROLE_EMBEDDED_OBJECT },
-
-  // roles::NOTE
-  { USE_ROLE_STRING, IA2_ROLE_NOTE },
-
-  // roles::FIGURE
-  { ROLE_SYSTEM_GROUPING, ROLE_SYSTEM_GROUPING },
-
-  // roles::CHECK_RICH_OPTION
-  { ROLE_SYSTEM_CHECKBUTTON, ROLE_SYSTEM_CHECKBUTTON },
-
-  // roles::DEFINITION_LIST
-  { ROLE_SYSTEM_LIST, ROLE_SYSTEM_LIST },
-
-  // roles::TERM
-  { ROLE_SYSTEM_LISTITEM, ROLE_SYSTEM_LISTITEM },
-
-  // roles::DEFINITION
-  { USE_ROLE_STRING, IA2_ROLE_PARAGRAPH },
-
-  // roles::LAST_ENTRY
-  { ROLE_WINDOWS_LAST_ENTRY, ROLE_WINDOWS_LAST_ENTRY }
-};
-
--- a/accessible/src/msaa/nsRootAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsRootAccessibleWrap.cpp
@@ -15,17 +15,17 @@
  * 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):
- *   Alexander Surkov <surkov.alexander@gmail.com> (origianl author)
+ *   Alexander Surkov <surkov.alexander@gmail.com> (original author)
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either of 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