Bug 481357 - rename finalRole to role, r=davidb
authorAlexander Surkov <surkov.alexander@gmail.com>
Sat, 07 Mar 2009 23:38:58 +0800
changeset 25822 977faa9e0afa08b63d595f0e79862e4e26028390
parent 25821 5d202f0c69e9d402fe8b048fdd3d399f585f398f
child 25823 77a7aa432a4e1a794a09ad9cde9953cc98f90abd
push idunknown
push userunknown
push dateunknown
reviewersdavidb
bugs481357
milestone1.9.2a1pre
Bug 481357 - rename finalRole to role, r=davidb
accessible/public/nsIAccessible.idl
accessible/src/atk/nsAccessibleWrap.cpp
accessible/src/atk/nsMaiInterfaceAction.cpp
accessible/src/atk/nsMaiInterfaceText.cpp
accessible/src/base/nsAccUtils.cpp
accessible/src/base/nsAccUtils.h
accessible/src/base/nsAccessible.cpp
accessible/src/base/nsAccessible.h
accessible/src/base/nsApplicationAccessible.cpp
accessible/src/base/nsApplicationAccessible.h
accessible/src/base/nsBaseWidgetAccessible.cpp
accessible/src/base/nsBaseWidgetAccessible.h
accessible/src/base/nsDocAccessible.cpp
accessible/src/base/nsDocAccessible.h
accessible/src/base/nsFormControlAccessible.cpp
accessible/src/base/nsFormControlAccessible.h
accessible/src/base/nsOuterDocAccessible.cpp
accessible/src/base/nsOuterDocAccessible.h
accessible/src/base/nsRootAccessible.cpp
accessible/src/base/nsRootAccessible.h
accessible/src/base/nsTextAccessible.cpp
accessible/src/base/nsTextAccessible.h
accessible/src/html/nsHTMLFormControlAccessible.cpp
accessible/src/html/nsHTMLFormControlAccessible.h
accessible/src/html/nsHTMLImageAccessible.cpp
accessible/src/html/nsHTMLImageAccessible.h
accessible/src/html/nsHTMLLinkAccessible.cpp
accessible/src/html/nsHTMLLinkAccessible.h
accessible/src/html/nsHTMLSelectAccessible.cpp
accessible/src/html/nsHTMLSelectAccessible.h
accessible/src/html/nsHTMLTableAccessible.cpp
accessible/src/html/nsHTMLTableAccessible.h
accessible/src/html/nsHTMLTextAccessible.cpp
accessible/src/html/nsHTMLTextAccessible.h
accessible/src/html/nsHyperTextAccessible.cpp
accessible/src/html/nsHyperTextAccessible.h
accessible/src/mac/mozAccessible.mm
accessible/src/msaa/nsAccessibleWrap.cpp
accessible/src/msaa/nsXULTreeAccessibleWrap.cpp
accessible/src/msaa/nsXULTreeAccessibleWrap.h
accessible/src/xforms/nsXFormsAccessible.cpp
accessible/src/xforms/nsXFormsAccessible.h
accessible/src/xforms/nsXFormsFormControlsAccessible.cpp
accessible/src/xforms/nsXFormsFormControlsAccessible.h
accessible/src/xforms/nsXFormsWidgetsAccessible.cpp
accessible/src/xforms/nsXFormsWidgetsAccessible.h
accessible/src/xul/nsXULAlertAccessible.cpp
accessible/src/xul/nsXULAlertAccessible.h
accessible/src/xul/nsXULColorPickerAccessible.cpp
accessible/src/xul/nsXULColorPickerAccessible.h
accessible/src/xul/nsXULFormControlAccessible.cpp
accessible/src/xul/nsXULFormControlAccessible.h
accessible/src/xul/nsXULMenuAccessible.cpp
accessible/src/xul/nsXULMenuAccessible.h
accessible/src/xul/nsXULSelectAccessible.cpp
accessible/src/xul/nsXULSelectAccessible.h
accessible/src/xul/nsXULSliderAccessible.cpp
accessible/src/xul/nsXULSliderAccessible.h
accessible/src/xul/nsXULTabAccessible.cpp
accessible/src/xul/nsXULTabAccessible.h
accessible/src/xul/nsXULTextAccessible.cpp
accessible/src/xul/nsXULTextAccessible.h
accessible/src/xul/nsXULTreeAccessible.cpp
accessible/src/xul/nsXULTreeAccessible.h
accessible/tests/mochitest/role.js
--- a/accessible/public/nsIAccessible.idl
+++ b/accessible/public/nsIAccessible.idl
@@ -53,17 +53,17 @@ interface nsIAccessibleRelation;
  * Can also be used by in-process accessibility clients to get information
  * about objects in the accessible tree. The accessible tree is a subset of 
  * nodes in the DOM tree -- such as documents, focusable elements and text.
  * Mozilla creates the implementations of nsIAccessible on demand.
  * See http://www.mozilla.org/projects/ui/accessibility for more information.
  *
  * @status UNDER_REVIEW
  */
-[scriptable, uuid(76c72c70-2c4b-4fce-8e75-b121db024333)]
+[scriptable, uuid(c81d8f8c-8585-4094-bc7c-71dd01494906)]
 interface nsIAccessible : nsISupports
 {
   /**
    * Parent node in accessible tree.
    */
   readonly attribute nsIAccessible parent;
 
   /**
@@ -142,31 +142,24 @@ interface nsIAccessible : nsISupports
    * Provides array of localized string of global keyboard accelerator for
    * the given action index supported by accessible.
    *
    * @param aActionIndex - index of the given action
    */
   nsIDOMDOMStringList getKeyBindings(in PRUint8 aActionIndex);
 
   /**
-   * Natural enumerated accessible role for the associated element.
-   * The values depend on platform because of variations.
-   * See the ROLE_* constants defined in nsIAccessibleRole.
-   * This does not take into account role attribute as the finalRole does.
+   * Enumerated accessible role (see the constants defined in nsIAccessibleRole).
+   *
+   * @note  The values might depend on platform because of variations. Widgets
+   *        can use ARIA role attribute to force the final role.
    */
   readonly attribute unsigned long role;
 
   /**
-   * Enumerated accessible role. The values depend on platform because of variations.
-   * See the ROLE_* constants defined in nsIAccessibleRole.
-   * Widgets can use role attribute to force the final role
-   */
-  readonly attribute unsigned long finalRole;
-
-  /**
    * Accessible states -- bit fields which describe boolean properties of node.
    * Many states are only valid given a certain role attribute that supports
    * them.
    *
    * @param aState - the first bit field (see nsIAccessibleStates::STATE_*
    *                 constants)
    * @param aExtraState - the second bit field
    *                      (see nsIAccessibleStates::EXT_STATE_* constants)
--- a/accessible/src/atk/nsAccessibleWrap.cpp
+++ b/accessible/src/atk/nsAccessibleWrap.cpp
@@ -772,17 +772,17 @@ getRoleCB(AtkObject *aAtkObj)
 
 #ifdef DEBUG_A11Y
     NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(accWrap),
                  "Does not support nsIAccessibleText when it should");
 #endif
 
     if (aAtkObj->role == ATK_ROLE_INVALID) {
         PRUint32 accRole, atkRole;
-        nsresult rv = accWrap->GetFinalRole(&accRole);
+        nsresult rv = accWrap->GetRole(&accRole);
         NS_ENSURE_SUCCESS(rv, ATK_ROLE_INVALID);
 
         atkRole = atkRoleMap[accRole]; // map to the actual value
         NS_ASSERTION(atkRoleMap[nsIAccessibleRole::ROLE_LAST_ENTRY] ==
                      kROLE_ATK_LAST_ENTRY, "ATK role map skewed");
         aAtkObj->role = static_cast<AtkRole>(atkRole);
     }
     return aAtkObj->role;
--- a/accessible/src/atk/nsMaiInterfaceAction.cpp
+++ b/accessible/src/atk/nsMaiInterfaceAction.cpp
@@ -117,18 +117,17 @@ getKeyBindingCB(AtkAction *aAction, gint
     //get accesskey
     nsAutoString accessKey;
     nsresult rv = accWrap->GetKeyboardShortcut(accessKey);
 
     if (NS_SUCCEEDED(rv) && !accessKey.IsEmpty()) {
         nsCOMPtr<nsIAccessible> parentAccessible;
         accWrap->GetParent(getter_AddRefs(parentAccessible));
         if (parentAccessible) {
-            PRUint32 role;
-            parentAccessible->GetRole(&role);
+          PRUint32 role = nsAccUtils::RoleInternal(parentAccessible);
 
             if (role == ATK_ROLE_MENU_BAR) {
                 //it is topmenu, change from "Alt+f" to "f;<Alt>f"
                 nsAutoString rightChar;
                 accessKey.Right(rightChar, 1);
                 allKeyBinding = rightChar + NS_LITERAL_STRING(";<Alt>") +
                                 rightChar;
             }
@@ -144,18 +143,17 @@ getKeyBindingCB(AtkAction *aAction, gint
                     if (!grandParentKey.IsEmpty()) {
                         nsAutoString rightChar;
                         grandParentKey.Right(rightChar, 1);
                         allKey = rightChar + NS_LITERAL_STRING(":") + allKey;
                     }
 
                     nsCOMPtr<nsIAccessible> tempAcc = grandParentAcc;
                     tempAcc->GetParent(getter_AddRefs(grandParentAcc));
-                    if (grandParentAcc)
-                        grandParentAcc->GetRole(&role);
+                  role = nsAccUtils::RoleInternal(grandParentAcc);
                 }
                 allKeyBinding = accessKey + NS_LITERAL_STRING(";<Alt>") +
                                 allKey;
             }
         }
         else {
             //default process, rarely happens.
             nsAutoString rightChar;
--- a/accessible/src/atk/nsMaiInterfaceText.cpp
+++ b/accessible/src/atk/nsMaiInterfaceText.cpp
@@ -74,17 +74,17 @@ textInterfaceInitCB(AtkTextIface *aIface
     aIface->set_caret_offset = setCaretOffsetCB;
 }
 
 
 void ConvertTexttoAsterisks(nsAccessibleWrap* accWrap, nsAString& aString)
 {
     // convert each char to "*" when it's "password text" 
     PRUint32 accRole;
-    accWrap->GetRole(&accRole);
+    accWrap->GetRoleInternal(&accRole);
     if (static_cast<AtkRole>(accRole) == ATK_ROLE_PASSWORD_TEXT) {
         for (PRUint32 i = 0; i < aString.Length(); i++)
             aString.Replace(i, 1, NS_LITERAL_STRING("*"));
     }
 }
 
 gchar *
 getTextCB(AtkText *aText, gint aStartOffset, gint aEndOffset)
@@ -182,17 +182,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 accRole;
-    accWrap->GetRole(&accRole);
+    accWrap->GetRoleInternal(&accRole);
     if (static_cast<AtkRole>(accRole) == ATK_ROLE_PASSWORD_TEXT) {
         uniChar = '*';
     }
 
     return (NS_FAILED(rv)) ? 0 : static_cast<gunichar>(uniChar);
 }
 
 gchar *
--- a/accessible/src/base/nsAccUtils.cpp
+++ b/accessible/src/base/nsAccUtils.cpp
@@ -375,18 +375,17 @@ nsAccUtils::HasAccessibleChildren(nsIDOM
 }
 
 already_AddRefed<nsIAccessible>
 nsAccUtils::GetAncestorWithRole(nsIAccessible *aDescendant, PRUint32 aRole)
 {
   nsCOMPtr<nsIAccessible> parentAccessible = aDescendant, testRoleAccessible;
   while (NS_SUCCEEDED(parentAccessible->GetParent(getter_AddRefs(testRoleAccessible))) &&
          testRoleAccessible) {
-    PRUint32 testRole;
-    testRoleAccessible->GetFinalRole(&testRole);
+    PRUint32 testRole = nsAccUtils::Role(testRoleAccessible);
     if (testRole == aRole) {
       nsIAccessible *returnAccessible = testRoleAccessible;
       NS_ADDREF(returnAccessible);
       return returnAccessible;
     }
     nsCOMPtr<nsIAccessibleDocument> docAccessible = do_QueryInterface(testRoleAccessible);
     if (docAccessible) {
       break;
@@ -414,18 +413,17 @@ nsAccUtils::GetARIATreeItemParent(nsIAcc
       nsCOMPtr<nsIAccessible> currentAccessible = aStartTreeItem, prevAccessible;
       while (PR_TRUE) {
         currentAccessible->GetPreviousSibling(getter_AddRefs(prevAccessible));
         currentAccessible.swap(prevAccessible);
         nsCOMPtr<nsIAccessNode> accessNode = do_QueryInterface(currentAccessible);
         if (!accessNode) {
           break; // Reached top of tree, no higher level found
         }
-        PRUint32 role;
-        currentAccessible->GetFinalRole(&role);
+        PRUint32 role = nsAccUtils::Role(currentAccessible);
         if (role != nsIAccessibleRole::ROLE_OUTLINEITEM)
           continue;
         nsCOMPtr<nsIDOMNode> treeItemNode;
         accessNode->GetDOMNode(getter_AddRefs(treeItemNode));
         nsCOMPtr<nsIContent> treeItemContent = do_QueryInterface(treeItemNode);
         if (treeItemContent &&
             nsAccUtils::HasDefinedARIAToken(treeItemContent,
                                      nsAccessibilityAtoms::aria_level) &&
@@ -443,36 +441,35 @@ nsAccUtils::GetARIATreeItemParent(nsIAcc
   // Possibly a tree arranged by using role="group" to organize levels
   // In this case the parent of the tree item will be a group and the
   // previous sibling of that should be the tree item parent.
   // Or, if the parent is something other than a tree we will return that.
   nsCOMPtr<nsIAccessible> parentAccessible;
   aStartTreeItem->GetParent(getter_AddRefs(parentAccessible));
   if (!parentAccessible)
     return;
-  PRUint32 role;
-  parentAccessible->GetFinalRole(&role);
+  PRUint32 role = nsAccUtils::Role(parentAccessible);
   if (role != nsIAccessibleRole::ROLE_GROUPING) {
     NS_ADDREF(*aTreeItemParentResult = parentAccessible);
     return; // The container for the tree items
   }
   nsCOMPtr<nsIAccessible> prevAccessible;
   parentAccessible->GetPreviousSibling(getter_AddRefs(prevAccessible));
   if (!prevAccessible)
     return;
-  prevAccessible->GetFinalRole(&role);
+  role = nsAccUtils::Role(prevAccessible);
   if (role == nsIAccessibleRole::ROLE_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
     nsCOMPtr<nsIAccessible> tempAccessible = prevAccessible;
     tempAccessible->GetPreviousSibling(getter_AddRefs(prevAccessible));
     if (!prevAccessible)
       return;
-    prevAccessible->GetFinalRole(&role);
+    role = nsAccUtils::Role(prevAccessible);
   }
   if (role == nsIAccessibleRole::ROLE_OUTLINEITEM) {
     // Previous sibling of parent group is a tree item -- this is the conceptual tree item parent
     NS_ADDREF(*aTreeItemParentResult = prevAccessible);
   }
 }
 
 already_AddRefed<nsIAccessibleText>
@@ -671,16 +668,31 @@ nsAccUtils::GetRoleMapEntry(nsIDOMNode *
     }
   }
 
   // Always use some entry if there is a role string
   // To ensure an accessible object is created
   return &nsARIAMap::gLandmarkRoleMap;
 }
 
+PRUint32
+nsAccUtils::RoleInternal(nsIAccessible *aAcc)
+{
+  PRUint32 role = nsIAccessibleRole::ROLE_NOTHING;
+  if (aAcc) {
+    nsAccessible* accessible = nsnull;
+    CallQueryInterface(aAcc, &accessible);
+
+    if (accessible)
+      accessible->GetRoleInternal(&role);
+  }
+
+  return role;
+}
+
 PRUint8
 nsAccUtils::GetAttributeCharacteristics(nsIAtom* aAtom)
 {
     for (PRUint32 i = 0; i < nsARIAMap::gWAIUnivAttrMapLength; i++)
       if (*nsARIAMap::gWAIUnivAttrMap[i].attributeName == aAtom)
         return nsARIAMap::gWAIUnivAttrMap[i].characteristics;
 
     return 0;
@@ -810,18 +822,18 @@ nsAccUtils::GetMultiSelectFor(nsIDOMNode
   PRUint32 state = State(accessible);
   if (0 == (state & nsIAccessibleStates::STATE_SELECTABLE))
     return nsnull;
 
   PRUint32 containerRole;
   while (0 == (state & nsIAccessibleStates::STATE_MULTISELECTABLE)) {
     nsIAccessible *current = accessible;
     current->GetParent(getter_AddRefs(accessible));
-    if (!accessible || (NS_SUCCEEDED(accessible->GetFinalRole(&containerRole)) &&
-                        containerRole == nsIAccessibleRole::ROLE_PANE)) {
+    if (!accessible ||
+        nsAccUtils::Role(accessible) == nsIAccessibleRole::ROLE_PANE) {
       return nsnull;
     }
     state = State(accessible);
   }
 
   nsIAccessible *returnAccessible = nsnull;
   accessible.swap(returnAccessible);
   return returnAccessible;
--- a/accessible/src/base/nsAccUtils.h
+++ b/accessible/src/base/nsAccUtils.h
@@ -239,22 +239,27 @@ public:
 
   /**
    * Return the role of the given accessible.
    */
   static PRUint32 Role(nsIAccessible *aAcc)
   {
     PRUint32 role = nsIAccessibleRole::ROLE_NOTHING;
     if (aAcc)
-      aAcc->GetFinalRole(&role);
+      aAcc->GetRole(&role);
 
     return role;
   }
 
   /**
+   * Return the role from native markup of the given accessible.
+   */
+  static PRUint32 RoleInternal(nsIAccessible *aAcc);
+
+  /**
    * Return the state for the given accessible.
    */
   static PRUint32 State(nsIAccessible *aAcc)
   {
     PRUint32 state = 0;
     if (aAcc)
       aAcc->GetState(&state, nsnull);
 
--- a/accessible/src/base/nsAccessible.cpp
+++ b/accessible/src/base/nsAccessible.cpp
@@ -1583,17 +1583,18 @@ nsAccessible::FireAccessibleEvent(nsIAcc
 
   nsCOMPtr<nsIObserverService> obsService =
     do_GetService("@mozilla.org/observer-service;1");
   NS_ENSURE_TRUE(obsService, NS_ERROR_FAILURE);
 
   return obsService->NotifyObservers(aEvent, NS_ACCESSIBLE_EVENT_TOPIC, nsnull);
 }
 
-NS_IMETHODIMP nsAccessible::GetFinalRole(PRUint32 *aRole)
+NS_IMETHODIMP
+nsAccessible::GetRole(PRUint32 *aRole)
 {
   NS_ENSURE_ARG_POINTER(aRole);
   *aRole = nsIAccessibleRole::ROLE_NOTHING;
 
   if (mRoleMapEntry) {
     *aRole = mRoleMapEntry->role;
 
     // These unfortunate exceptions don't fit into the ARIA table
@@ -1640,17 +1641,20 @@ NS_IMETHODIMP nsAccessible::GetFinalRole
       // We can now expose ROLE_NOTHING when there is a role map entry or used
       // role is nothing, which
       // will cause ATK to use ROLE_UNKNOWN and MSAA to use a BSTR role with
       // the ARIA role or element's tag. In either case the AT can also use
       // the object attributes tag and xml-roles to find out more.
       return NS_OK;
     }
   }
-  return mDOMNode ? GetRole(aRole) : NS_ERROR_FAILURE;  // Node already shut down
+
+  return mDOMNode ?
+    GetRoleInternal(aRole) :
+    NS_ERROR_FAILURE;  // Node already shut down
 }
 
 NS_IMETHODIMP
 nsAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
 {
   NS_ENSURE_ARG_POINTER(aAttributes);  // In/out param. Created if necessary.
   
   if (IsDefunct())
@@ -1984,17 +1988,17 @@ nsAccessible::GetState(PRUint32 *aState,
           }
           break;
         }
       }
     }
   }
 
   PRUint32 role;
-  rv = GetFinalRole(&role);
+  rv = GetRole(&role);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (role == nsIAccessibleRole::ROLE_ENTRY ||
       role == nsIAccessibleRole::ROLE_COMBOBOX) {
 
     nsCOMPtr<nsIContent> content = nsCoreUtils::GetRoleContent(mDOMNode);
     NS_ENSURE_STATE(content);
 
@@ -2241,19 +2245,19 @@ nsAccessible::GetKeyBindings(PRUint8 aAc
   if (!defaultKey.IsEmpty())
     keyBindings->Add(defaultKey);
 
   NS_ADDREF(*aKeyBindings = keyBindings);
   return NS_OK;
 }
 
 /* unsigned long getRole (); */
-NS_IMETHODIMP nsAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  NS_ENSURE_ARG_POINTER(aRole);
   *aRole = nsIAccessibleRole::ROLE_NOTHING;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
   if (nsCoreUtils::IsXLink(content))
     *aRole = nsIAccessibleRole::ROLE_LINK;
--- a/accessible/src/base/nsAccessible.h
+++ b/accessible/src/base/nsAccessible.h
@@ -153,16 +153,24 @@ 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);
 
   /**
+   * Returns enumerated accessible role from native markup (see constants in
+   * nsIAccessibleRole). Doesn't take into account ARIA roles.
+   *
+   * @param aRole  [out] accessible role.
+   */
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+
+  /**
    * Return the state of accessible that doesn't take into account ARIA states.
    * Use nsIAccessible::state to get all states for accessible. If
    * second argument is omitted then second bit field of accessible state won't
    * be calculated.
    */
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
   /**
--- a/accessible/src/base/nsApplicationAccessible.cpp
+++ b/accessible/src/base/nsApplicationAccessible.cpp
@@ -125,27 +125,27 @@ nsApplicationAccessible::GetName(nsAStri
     NS_WARNING("brandShortName not found, using default app name");
     appName.AssignLiteral("Gecko based application");
   }
 
   aName.Assign(appName);
   return NS_OK;
 }
 
-NS_IMETHODIMP
-nsApplicationAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsApplicationAccessible::GetRoleInternal(PRUint32 *aRole)
 {
   *aRole = nsIAccessibleRole::ROLE_APP_ROOT;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsApplicationAccessible::GetFinalRole(PRUint32 *aFinalRole)
+nsApplicationAccessible::GetRole(PRUint32 *aRole)
 {
-  return GetRole(aFinalRole);
+  return GetRoleInternal(aRole);
 }
 
 nsresult
 nsApplicationAccessible::GetStateInternal(PRUint32 *aState,
                                           PRUint32 *aExtraState)
 {
   *aState = 0;
   if (aExtraState)
--- a/accessible/src/base/nsApplicationAccessible.h
+++ b/accessible/src/base/nsApplicationAccessible.h
@@ -67,24 +67,24 @@ public:
                                            nsAccessible)
 
   // nsAccessNode
   virtual nsresult Init();
 
   // nsIAccessible
   NS_IMETHOD GetName(nsAString & aName);
   NS_IMETHOD GetRole(PRUint32 *aRole);
-  NS_IMETHOD GetFinalRole(PRUint32 *aFinalRole);
   NS_IMETHOD GetParent(nsIAccessible * *aParent);
   NS_IMETHOD GetNextSibling(nsIAccessible * *aNextSibling);
   NS_IMETHOD GetPreviousSibling(nsIAccessible **aPreviousSibling);
   NS_IMETHOD GetIndexInParent(PRInt32 *aIndexInParent);
   NS_IMETHOD GetChildAt(PRInt32 aChildNum, nsIAccessible **aChild);
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
   // nsApplicationAccessible
   virtual nsresult AddRootAccessible(nsIAccessible *aRootAccWrap);
   virtual nsresult RemoveRootAccessible(nsIAccessible *aRootAccWrap);
 
 protected:
   // nsAccessible
--- a/accessible/src/base/nsBaseWidgetAccessible.cpp
+++ b/accessible/src/base/nsBaseWidgetAccessible.cpp
@@ -314,8 +314,15 @@ nsLinkableAccessible::GetActionAccessibl
 
 nsEnumRoleAccessible::nsEnumRoleAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell, PRUint32 aRole) :
   nsAccessibleWrap(aNode, aShell),
   mRole(aRole)
 {
 }
 
 NS_IMPL_ISUPPORTS_INHERITED0(nsEnumRoleAccessible, nsAccessible)
+
+nsresult
+nsEnumRoleAccessible::GetRoleInternal(PRUint32 *aRole)
+{
+  *aRole = mRole;
+  return NS_OK;
+}
--- a/accessible/src/base/nsBaseWidgetAccessible.h
+++ b/accessible/src/base/nsBaseWidgetAccessible.h
@@ -118,16 +118,19 @@ protected:
 /**
  * A simple accessible that gets its enumerated role passed into constructor.
  */ 
 class nsEnumRoleAccessible : public nsAccessibleWrap
 {
 public:
   nsEnumRoleAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell, PRUint32 aRole);
   virtual ~nsEnumRoleAccessible() { }
+
   NS_DECL_ISUPPORTS_INHERITED
-  NS_IMETHODIMP GetRole(PRUint32 *aRole) { *aRole = mRole; return NS_OK; }
+
+  // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
 
 protected:
   PRUint32 mRole;
 };
 
 #endif  
--- a/accessible/src/base/nsDocAccessible.cpp
+++ b/accessible/src/base/nsDocAccessible.cpp
@@ -193,17 +193,18 @@ nsDocAccessible::GetName(nsAString& aNam
   }
   if (aName.IsEmpty()) {   // Last resort: use URL
     rv = GetURL(aName);
   }
 
   return rv;
 }
 
-NS_IMETHODIMP nsDocAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsDocAccessible::GetRoleInternal(PRUint32 *aRole)
 {
   *aRole = nsIAccessibleRole::ROLE_PANE; // Fall back
 
   nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
     nsCoreUtils::GetDocShellTreeItemFor(mDOMNode);
   if (docShellTreeItem) {
     nsCOMPtr<nsIDocShellTreeItem> sameTypeRoot;
     docShellTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(sameTypeRoot));
--- a/accessible/src/base/nsDocAccessible.h
+++ b/accessible/src/base/nsDocAccessible.h
@@ -70,17 +70,17 @@ class nsDocAccessible : public nsHyperTe
   NS_DECL_NSIACCESSIBLEDOCUMENT
   NS_DECL_NSPIACCESSIBLEDOCUMENT
   NS_DECL_NSIOBSERVER
 
   public:
     nsDocAccessible(nsIDOMNode *aNode, nsIWeakReference* aShell);
     virtual ~nsDocAccessible();
 
-    NS_IMETHOD GetRole(PRUint32 *aRole);
+    // nsIAccessible
     NS_IMETHOD SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry);
     NS_IMETHOD GetName(nsAString& aName);
     NS_IMETHOD GetDescription(nsAString& aDescription);
     NS_IMETHOD GetARIAState(PRUint32 *aState);
     NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
     NS_IMETHOD GetFocusedChild(nsIAccessible **aFocusedChild);
     NS_IMETHOD GetParent(nsIAccessible **aParent);
     NS_IMETHOD TakeFocus(void);
@@ -96,16 +96,17 @@ class nsDocAccessible : public nsHyperTe
     static void FlushEventsCallback(nsITimer *aTimer, void *aClosure);
 
     // nsAccessNode
     virtual nsresult Init();
     virtual nsresult Shutdown();
     virtual nsIFrame* GetFrame();
 
     // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
     // nsIAccessibleText
     NS_IMETHOD GetAssociatedEditor(nsIEditor **aEditor);
 
     /**
       * Non-virtual method to fire a delayed event after a 0 length timeout
       *
--- a/accessible/src/base/nsFormControlAccessible.cpp
+++ b/accessible/src/base/nsFormControlAccessible.cpp
@@ -78,18 +78,15 @@ NS_IMETHODIMP nsRadioButtonAccessible::G
 NS_IMETHODIMP nsRadioButtonAccessible::DoAction(PRUint8 aIndex)
 {
   if (aIndex == eAction_Click) {
     return DoCommand();
   }
   return NS_ERROR_INVALID_ARG;
 }
 
-/**
-  *
-  */
-NS_IMETHODIMP nsRadioButtonAccessible::GetRole(PRUint32 *_retval)
+nsresult
+nsRadioButtonAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  *_retval = nsIAccessibleRole::ROLE_RADIOBUTTON;
-
+  *aRole = nsIAccessibleRole::ROLE_RADIOBUTTON;
   return NS_OK;
 }
 
--- a/accessible/src/base/nsFormControlAccessible.h
+++ b/accessible/src/base/nsFormControlAccessible.h
@@ -46,18 +46,23 @@ typedef nsLeafAccessible nsFormControlAc
 /**
   * nsRadioButtonAccessible
   */
 class nsRadioButtonAccessible : public nsFormControlAccessible
 {
 
 public:
   nsRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
-  NS_IMETHOD GetRole(PRUint32 *_retval); 
+
+  // nsIAccessible
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
+
+  // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+
   enum { eAction_Click = 0 };
 };
 
 
 #endif
 
--- a/accessible/src/base/nsOuterDocAccessible.cpp
+++ b/accessible/src/base/nsOuterDocAccessible.cpp
@@ -48,17 +48,18 @@ NS_IMPL_ISUPPORTS_INHERITED0(nsOuterDocA
 
 nsOuterDocAccessible::nsOuterDocAccessible(nsIDOMNode* aNode, 
                                            nsIWeakReference* aShell):
   nsAccessibleWrap(aNode, aShell)
 {
 }
 
 /* unsigned long getRole (); */
-NS_IMETHODIMP nsOuterDocAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsOuterDocAccessible::GetRoleInternal(PRUint32 *aRole)
 {
   *aRole = nsIAccessibleRole::ROLE_INTERNAL_FRAME;
   return NS_OK;
 }
 
 nsresult
 nsOuterDocAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
 {
--- a/accessible/src/base/nsOuterDocAccessible.h
+++ b/accessible/src/base/nsOuterDocAccessible.h
@@ -50,29 +50,28 @@ class nsOuterDocAccessible : public nsAc
   // CVS comment: <aaronl@netscape.com> 2003-04-01 14:15 Fixing bustage
   NS_DECL_ISUPPORTS_INHERITED
 
 public:
   nsOuterDocAccessible(nsIDOMNode* aNode, 
                        nsIWeakReference* aShell);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
-
   NS_IMETHOD GetChildAtPoint(PRInt32 aX, PRInt32 aY,
                              nsIAccessible **aAccessible);
   NS_IMETHOD GetDeepestChildAtPoint(PRInt32 aX, PRInt32 aY,
                                     nsIAccessible **aAccessible);
 
   NS_IMETHOD GetNumActions(PRUint8 *aNumActions);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD GetActionDescription(PRUint8 aIndex, nsAString& aDescription);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
 
 protected:
   // nsAccessible
   void CacheChildren();
 };
 
--- a/accessible/src/base/nsRootAccessible.cpp
+++ b/accessible/src/base/nsRootAccessible.cpp
@@ -159,17 +159,18 @@ NS_IMETHODIMP nsRootAccessible::GetParen
 
   nsRefPtr<nsApplicationAccessibleWrap> root = GetApplicationAccessible();
   NS_IF_ADDREF(*aParent = root);
 
   return NS_OK;
 }
 
 /* readonly attribute unsigned long accRole; */
-NS_IMETHODIMP nsRootAccessible::GetRole(PRUint32 *aRole) 
+nsresult
+nsRootAccessible::GetRoleInternal(PRUint32 *aRole) 
 { 
   if (!mDocument) {
     return NS_ERROR_FAILURE;
   }
 
   // If it's a <dialog> or <wizard>, use nsIAccessibleRole::ROLE_DIALOG instead
   nsIContent *rootContent = mDocument->GetRootContent();
   if (rootContent) {
@@ -179,17 +180,17 @@ NS_IMETHODIMP nsRootAccessible::GetRole(
       rootElement->GetLocalName(name);
       if (name.EqualsLiteral("dialog") || name.EqualsLiteral("wizard")) {
         *aRole = nsIAccessibleRole::ROLE_DIALOG; // Always at the root
         return NS_OK;
       }
     }
   }
 
-  return nsDocAccessibleWrap::GetRole(aRole);
+  return nsDocAccessibleWrap::GetRoleInternal(aRole);
 }
 
 #ifdef MOZ_XUL
 PRUint32 nsRootAccessible::GetChromeFlags()
 {
   // Return the flag set for the top level window as defined 
   // by nsIWebBrowserChrome::CHROME_WINDOW_[FLAGNAME]
   // Not simple: nsIXULWindow is not just a QI from nsIDOMWindow
@@ -488,18 +489,18 @@ PRBool nsRootAccessible::FireAccessibleF
       return PR_FALSE;
     }
   }
 
   gLastFocusedAccessiblesState = nsAccUtils::State(finalFocusAccessible);
   PRUint32 role = nsAccUtils::Role(finalFocusAccessible);
   if (role == nsIAccessibleRole::ROLE_MENUITEM) {
     if (!mCurrentARIAMenubar) {  // Entering menus
-      PRUint32 naturalRole; // The natural role is the role that this type of element normally has
-      finalFocusAccessible->GetRole(&naturalRole);
+      // The natural role is the role that this type of element normally has
+      PRUint32 naturalRole = nsAccUtils::RoleInternal(finalFocusAccessible);
       if (role != naturalRole) { // Must be a DHTML menuitem
         nsCOMPtr<nsIAccessible> menuBarAccessible =
           nsAccUtils::GetAncestorWithRole(finalFocusAccessible,
                                           nsIAccessibleRole::ROLE_MENUBAR);
         nsCOMPtr<nsIAccessNode> menuBarAccessNode = do_QueryInterface(menuBarAccessible);
         if (menuBarAccessNode) {
           menuBarAccessNode->GetDOMNode(getter_AddRefs(mCurrentARIAMenubar));
           if (mCurrentARIAMenubar) {
--- a/accessible/src/base/nsRootAccessible.h
+++ b/accessible/src/base/nsRootAccessible.h
@@ -71,31 +71,31 @@ class nsRootAccessible : public nsDocAcc
 
   public:
     nsRootAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell);
     virtual ~nsRootAccessible();
 
     // nsIAccessible
     NS_IMETHOD GetName(nsAString& aName);
     NS_IMETHOD GetParent(nsIAccessible * *aParent);
-    NS_IMETHOD GetRole(PRUint32 *aRole);
     NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
                                  nsIAccessibleRelation **aRelation);
 
     // ----- nsPIAccessibleDocument -----------------------
     NS_IMETHOD FireDocLoadEvents(PRUint32 aEventType);
 
     // ----- nsIDOMEventListener --------------------------
     NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
 
     // nsAccessNode
     virtual nsresult Init();
     virtual nsresult Shutdown();
 
     // nsAccessible
+    virtual nsresult GetRoleInternal(PRUint32 *aRole);
     virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
     void ShutdownAll();
     
     NS_DECLARE_STATIC_IID_ACCESSOR(NS_ROOTACCESSIBLE_IMPL_CID)
 
     /**
       * Fire an accessible focus event for the current focusAccssible
--- a/accessible/src/base/nsTextAccessible.cpp
+++ b/accessible/src/base/nsTextAccessible.cpp
@@ -54,19 +54,20 @@ nsLinkableAccessible(aDOMNode, aShell)
 // We have nsLinkableAccessible in our inheritance chain as a convenience in order to
 // get link actions and states on the text accessibles. Windows screen readers expect that.
 NS_IMPL_ISUPPORTS_INHERITED3(nsTextAccessible, nsAccessNode,
                              nsAccessible, nsIAccessible, nsPIAccessible)
 
 /**
   * We are text
   */
-NS_IMETHODIMP nsTextAccessible::GetRole(PRUint32 *_retval)
+nsresult
+nsTextAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  *_retval = nsIAccessibleRole::ROLE_TEXT_LEAF;
+  *aRole = nsIAccessibleRole::ROLE_TEXT_LEAF;
   return NS_OK;
 }
 
 /**
   * No Children
   */
 NS_IMETHODIMP nsTextAccessible::GetFirstChild(nsIAccessible **_retval)
 {
--- a/accessible/src/base/nsTextAccessible.h
+++ b/accessible/src/base/nsTextAccessible.h
@@ -49,20 +49,22 @@
 class nsTextAccessible : public nsLinkableAccessible
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
 
   nsTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *_retval); 
   NS_IMETHOD GetFirstChild(nsIAccessible **_retval);
   NS_IMETHOD GetLastChild(nsIAccessible **_retval);
   NS_IMETHOD GetChildCount(PRInt32 *_retval);
 
   // nsPIAccessible
   NS_IMETHOD AppendTextTo(nsAString& aText, PRUint32 aStartOffset, PRUint32 aLength);
+
+  // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
 };
 
 
 #endif
 
--- a/accessible/src/html/nsHTMLFormControlAccessible.cpp
+++ b/accessible/src/html/nsHTMLFormControlAccessible.cpp
@@ -60,19 +60,20 @@
 
 // --- checkbox -----
 
 nsHTMLCheckboxAccessible::nsHTMLCheckboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
 nsFormControlAccessible(aNode, aShell)
 { 
 }
 
-NS_IMETHODIMP nsHTMLCheckboxAccessible::GetRole(PRUint32 *_retval)
+nsresult
+nsHTMLCheckboxAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  *_retval = nsIAccessibleRole::ROLE_CHECKBUTTON;
+  *aRole = nsIAccessibleRole::ROLE_CHECKBUTTON;
   return NS_OK;
 }
 
 NS_IMETHODIMP nsHTMLCheckboxAccessible::GetNumActions(PRUint8 *_retval)
 {
   *_retval = 1;
   return NS_OK;
 }
@@ -278,19 +279,20 @@ nsHTMLButtonAccessible::GetStateInternal
   nsAutoString buttonType;
   element->GetAttribute(NS_LITERAL_STRING("type"), buttonType);
   if (buttonType.LowerCaseEqualsLiteral("submit"))
     *aState |= nsIAccessibleStates::STATE_DEFAULT;
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsHTMLButtonAccessible::GetRole(PRUint32 *_retval)
+nsresult
+nsHTMLButtonAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  *_retval = nsIAccessibleRole::ROLE_PUSHBUTTON;
+  *aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
   return NS_OK;
 }
 
 nsresult
 nsHTMLButtonAccessible::GetNameInternal(nsAString& aName)
 {
   nsresult rv = nsAccessible::GetNameInternal(aName);
   if (!aName.IsEmpty())
@@ -351,19 +353,20 @@ NS_IMETHODIMP nsHTML4ButtonAccessible::G
 NS_IMETHODIMP nsHTML4ButtonAccessible::DoAction(PRUint8 index)
 {
   if (index == 0) {
     return DoCommand();
   }
   return NS_ERROR_INVALID_ARG;
 }
 
-NS_IMETHODIMP nsHTML4ButtonAccessible::GetRole(PRUint32 *_retval)
+nsresult
+nsHTML4ButtonAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  *_retval = nsIAccessibleRole::ROLE_PUSHBUTTON;
+  *aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
   return NS_OK;
 }
 
 nsresult
 nsHTML4ButtonAccessible::GetStateInternal(PRUint32 *aState,
                                           PRUint32 *aExtraState)
 {
   nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState,
@@ -387,17 +390,18 @@ nsHTML4ButtonAccessible::GetStateInterna
 
 nsHTMLTextFieldAccessible::nsHTMLTextFieldAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
 nsHyperTextAccessibleWrap(aNode, aShell)
 {
 }
 
 NS_IMPL_ISUPPORTS_INHERITED3(nsHTMLTextFieldAccessible, nsAccessible, nsHyperTextAccessible, nsIAccessibleText, nsIAccessibleEditableText)
 
-NS_IMETHODIMP nsHTMLTextFieldAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsHTMLTextFieldAccessible::GetRoleInternal(PRUint32 *aRole)
 {
   *aRole = nsIAccessibleRole::ROLE_ENTRY;
   nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
   if (content &&
       content->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
                            nsAccessibilityAtoms::password, eIgnoreCase)) {
     *aRole = nsIAccessibleRole::ROLE_PASSWORD_TEXT;
   }
@@ -587,19 +591,20 @@ NS_IMETHODIMP nsHTMLTextFieldAccessible:
  * The HTML for this is <fieldset> <legend>box-title</legend> form elements </fieldset> 
  */
 
 nsHTMLGroupboxAccessible::nsHTMLGroupboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
 nsHyperTextAccessibleWrap(aNode, aShell)
 { 
 }
 
-NS_IMETHODIMP nsHTMLGroupboxAccessible::GetRole(PRUint32 *_retval)
+nsresult
+nsHTMLGroupboxAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  *_retval = nsIAccessibleRole::ROLE_GROUPING;
+  *aRole = nsIAccessibleRole::ROLE_GROUPING;
   return NS_OK;
 }
 
 nsIContent* nsHTMLGroupboxAccessible::GetLegend()
 {
   nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode);
   NS_ENSURE_TRUE(content, nsnull);
 
@@ -646,16 +651,19 @@ nsHTMLGroupboxAccessible::GetRelationByT
     // No override for label, so use <legend> for this <fieldset>
     return nsRelUtils::
       AddTargetFromContent(aRelationType, aRelation, GetLegend());
   }
 
   return NS_OK;
 }
 
+////////////////////////////////////////////////////////////////////////////////
+// nsHTMLLegendAccessible
+
 nsHTMLLegendAccessible::nsHTMLLegendAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
 nsHyperTextAccessibleWrap(aNode, aShell)
 { 
 }
 
 NS_IMETHODIMP
 nsHTMLLegendAccessible::GetRelationByType(PRUint32 aRelationType,
                                           nsIAccessibleRelation **aRelation)
@@ -680,8 +688,15 @@ nsHTMLLegendAccessible::GetRelationByTyp
         return nsRelUtils::
           AddTarget(aRelationType, aRelation, groupboxAccessible);
       }
     }
   }
 
   return NS_OK;
 }
+
+nsresult
+nsHTMLLegendAccessible::GetRoleInternal(PRUint32 *aRole)
+{
+  *aRole = nsIAccessibleRole::ROLE_LABEL;
+  return NS_OK;
+}
--- a/accessible/src/html/nsHTMLFormControlAccessible.h
+++ b/accessible/src/html/nsHTMLFormControlAccessible.h
@@ -46,22 +46,22 @@ class nsHTMLCheckboxAccessible : public 
 {
 
 public:
   enum { eAction_Click = 0 };
 
   nsHTMLCheckboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *_retval); 
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 class nsHTMLRadioButtonAccessible : public nsRadioButtonAccessible
 {
 
 public:
   nsHTMLRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
@@ -75,91 +75,92 @@ class nsHTMLButtonAccessible : public ns
 {
 
 public:
   enum { eAction_Click = 0 };
 
   nsHTMLButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *_retval); 
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 class nsHTML4ButtonAccessible : public nsHyperTextAccessibleWrap
 {
 
 public:
   enum { eAction_Click = 0 };
 
   nsHTML4ButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *_retval); 
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 class nsHTMLTextFieldAccessible : public nsHyperTextAccessibleWrap
 {
 
 public:
   enum { eAction_Click = 0 };
 
   nsHTMLTextFieldAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *_retval); 
   NS_IMETHOD GetValue(nsAString& _retval); 
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsIAccessibleEditableText
   NS_IMETHOD GetAssociatedEditor(nsIEditor **aEditor);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 class nsHTMLGroupboxAccessible : public nsHyperTextAccessibleWrap
 {
 public:
   nsHTMLGroupboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole); 
   NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
                                nsIAccessibleRelation **aRelation);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
 
 protected:
   nsIContent* GetLegend();
 };
 
 class nsHTMLLegendAccessible : public nsHyperTextAccessibleWrap
 {
 public:
   nsHTMLLegendAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole) { *aRole = nsIAccessibleRole::ROLE_LABEL; return NS_OK; }
-
   NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
                                nsIAccessibleRelation **aRelation);
+
+  // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
 };
 
 #endif  
--- a/accessible/src/html/nsHTMLImageAccessible.cpp
+++ b/accessible/src/html/nsHTMLImageAccessible.cpp
@@ -142,21 +142,21 @@ 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;
 }
 
-/* wstring getRole (); */
-NS_IMETHODIMP nsHTMLImageAccessible::GetRole(PRUint32 *_retval)
+nsresult
+nsHTMLImageAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  *_retval = mMapElement ? nsIAccessibleRole::ROLE_IMAGE_MAP :
-                           nsIAccessibleRole::ROLE_GRAPHIC;
+  *aRole = mMapElement ? nsIAccessibleRole::ROLE_IMAGE_MAP :
+                         nsIAccessibleRole::ROLE_GRAPHIC;
   return NS_OK;
 }
 
 void nsHTMLImageAccessible::CacheChildren()
 {
   if (!mWeakShell) {
     // This node has been shut down
     mAccChildCount = eChildCountUninitialized;
--- a/accessible/src/html/nsHTMLImageAccessible.h
+++ b/accessible/src/html/nsHTMLImageAccessible.h
@@ -53,17 +53,16 @@ class nsHTMLImageAccessible : public nsL
 {
 
   NS_DECL_ISUPPORTS_INHERITED
 
 public:
   nsHTMLImageAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *_retval);
   NS_IMETHOD GetNumActions(PRUint8 *aNumActions);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsIAccessibleHyperLink
   NS_IMETHOD GetAnchorCount(PRInt32 *aAnchorCount);
   NS_IMETHOD GetURI(PRInt32 aIndex, nsIURI **aURI);
   NS_IMETHOD GetAnchor(PRInt32 aIndex, nsIAccessible **aAccessible);
@@ -71,16 +70,17 @@ public:
   // nsIAccessibleImage
   NS_DECL_NSIACCESSIBLEIMAGE
 
   // nsAccessNode
   virtual nsresult Shutdown();
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
 
 protected:
   // nsAccessible
   virtual void CacheChildren();
 
   already_AddRefed<nsIDOMHTMLCollection> GetAreaCollection();
--- a/accessible/src/html/nsHTMLLinkAccessible.cpp
+++ b/accessible/src/html/nsHTMLLinkAccessible.cpp
@@ -52,21 +52,19 @@ nsHTMLLinkAccessible::nsHTMLLinkAccessib
 
 // Expose nsIAccessibleHyperLink unconditionally
 NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLLinkAccessible, nsHyperTextAccessibleWrap,
                              nsIAccessibleHyperLink)
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessible
 
-NS_IMETHODIMP
-nsHTMLLinkAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsHTMLLinkAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  NS_ENSURE_ARG_POINTER(aRole);
-
   *aRole = nsIAccessibleRole::ROLE_LINK;
   return NS_OK;
 }
 
 nsresult
 nsHTMLLinkAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
 {
   nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState,
--- a/accessible/src/html/nsHTMLLinkAccessible.h
+++ b/accessible/src/html/nsHTMLLinkAccessible.h
@@ -45,27 +45,27 @@
 class nsHTMLLinkAccessible : public nsHyperTextAccessibleWrap
 {
 public:
   nsHTMLLinkAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
  
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole); 
   NS_IMETHOD GetValue(nsAString& aValue);
 
   NS_IMETHOD GetNumActions(PRUint8 *aNumActions);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsIAccessibleHyperLink
   NS_IMETHOD GetURI(PRInt32 aIndex, nsIURI **aURI);
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
 protected:
   enum { eAction_Jump = 0 };
 
   /**
    * Returns true if the link has href attribute.
    */
--- a/accessible/src/html/nsHTMLSelectAccessible.cpp
+++ b/accessible/src/html/nsHTMLSelectAccessible.cpp
@@ -350,17 +350,18 @@ nsHTMLSelectListAccessible::GetStateInte
     if ( multiple )
       *aState |= nsIAccessibleStates::STATE_MULTISELECTABLE |
                  nsIAccessibleStates::STATE_EXTSELECTABLE;
   }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsHTMLSelectListAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsHTMLSelectListAccessible::GetRoleInternal(PRUint32 *aRole)
 {
   if (nsAccUtils::Role(mParent) == nsIAccessibleRole::ROLE_COMBOBOX)
     *aRole = nsIAccessibleRole::ROLE_COMBOBOX_LIST;
   else
     *aRole = nsIAccessibleRole::ROLE_LISTBOX;
 
   return NS_OK;
 }
@@ -481,29 +482,29 @@ nsHyperTextAccessibleWrap(aDOMNode, aShe
   if (parentNode) {
     // If the parent node is a Combobox, then the option's accessible parent
     // is nsHTMLComboboxListAccessible, not the nsHTMLComboboxAccessible that
     // GetParent would normally return. This is because the 
     // nsHTMLComboboxListAccessible is inserted into the accessible hierarchy
     // where there is no DOM node for it.
     accService->GetAccessibleInWeakShell(parentNode, mWeakShell, getter_AddRefs(parentAccessible));
     if (parentAccessible) {
-      PRUint32 role;
-      parentAccessible->GetRole(&role);
-      if (role == nsIAccessibleRole::ROLE_COMBOBOX) {
+      if (nsAccUtils::RoleInternal(parentAccessible) ==
+          nsIAccessibleRole::ROLE_COMBOBOX) {
         nsCOMPtr<nsIAccessible> comboAccessible(parentAccessible);
         comboAccessible->GetLastChild(getter_AddRefs(parentAccessible));
       }
     }
   }
   SetParent(parentAccessible);
 }
 
 /** We are a ListItem */
-NS_IMETHODIMP nsHTMLSelectOptionAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsHTMLSelectOptionAccessible::GetRoleInternal(PRUint32 *aRole)
 {
   if (nsAccUtils::Role(mParent) == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
     *aRole = nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
   else
     *aRole = nsIAccessibleRole::ROLE_OPTION;
 
   return NS_OK;
 }
@@ -898,18 +899,18 @@ nsIContent* nsHTMLSelectOptionAccessible
 /** ----- nsHTMLSelectOptGroupAccessible ----- */
 
 /** Default Constructor */
 nsHTMLSelectOptGroupAccessible::nsHTMLSelectOptGroupAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
 nsHTMLSelectOptionAccessible(aDOMNode, aShell)
 {
 }
 
-NS_IMETHODIMP
-nsHTMLSelectOptGroupAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsHTMLSelectOptGroupAccessible::GetRoleInternal(PRUint32 *aRole)
 {
   *aRole = nsIAccessibleRole::ROLE_HEADING;
   return NS_OK;
 }
 
 nsresult
 nsHTMLSelectOptGroupAccessible::GetStateInternal(PRUint32 *aState,
                                                  PRUint32 *aExtraState)
@@ -964,19 +965,20 @@ void nsHTMLSelectOptGroupAccessible::Cac
 /** ----- nsHTMLComboboxAccessible ----- */
 
 nsHTMLComboboxAccessible::nsHTMLComboboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
 nsAccessibleWrap(aDOMNode, aShell)
 {
 }
 
 /** We are a combobox */
-NS_IMETHODIMP nsHTMLComboboxAccessible::GetRole(PRUint32 *_retval)
+nsresult
+nsHTMLComboboxAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  *_retval = nsIAccessibleRole::ROLE_COMBOBOX;
+  *aRole = nsIAccessibleRole::ROLE_COMBOBOX;
   return NS_OK;
 }
 
 void nsHTMLComboboxAccessible::CacheChildren()
 {
   if (!mWeakShell) {
     // This node has been shut down
     mAccChildCount = eChildCountUninitialized;
@@ -1344,19 +1346,20 @@ void nsHTMLComboboxButtonAccessible::Get
   if (!frame || !context)
     return;
 
   aBounds = frame->GetFirstChild(nsnull)->GetNextSibling()->GetRect();
     // sibling frame is for the button
 }
 
 /** We are a button. */
-NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetRole(PRUint32 *_retval)
+nsresult
+nsHTMLComboboxButtonAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  *_retval = nsIAccessibleRole::ROLE_PUSHBUTTON;
+  *aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
   return NS_OK;
 }
 
 /** Return our cached parent */
 NS_IMETHODIMP nsHTMLComboboxButtonAccessible::GetParent(nsIAccessible **aParent)
 {   
   NS_IF_ADDREF(*aParent = mParent);
   return NS_OK;
--- a/accessible/src/html/nsHTMLSelectAccessible.h
+++ b/accessible/src/html/nsHTMLSelectAccessible.h
@@ -120,20 +120,18 @@ protected:
  */
 class nsHTMLSelectListAccessible : public nsHTMLSelectableAccessible
 {
 public:
   
   nsHTMLSelectListAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
   virtual ~nsHTMLSelectListAccessible() {}
 
-  // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
-
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
 protected:
   void CacheChildren();
 
   already_AddRefed<nsIAccessible>
     AccessibleForOption(nsIAccessibilityService *aAccService,
                         nsIContent *aContent,
@@ -156,20 +154,20 @@ public:
   
   nsHTMLSelectOptionAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
   virtual ~nsHTMLSelectOptionAccessible() {}
 
   // nsIAccessible
   NS_IMETHOD DoAction(PRUint8 index);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
-  NS_IMETHOD GetRole(PRUint32 *aRole);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
 
   nsIFrame*  GetBoundsFrame();
   static nsresult GetFocusedOptionNode(nsIDOMNode *aListNode, nsIDOMNode **aFocusedOptionNode);
   static void SelectionChangedIfOption(nsIContent *aPossibleOption);
 
 private:
@@ -189,22 +187,22 @@ private:
 class nsHTMLSelectOptGroupAccessible : public nsHTMLSelectOptionAccessible
 {
 public:
 
   nsHTMLSelectOptGroupAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
   virtual ~nsHTMLSelectOptGroupAccessible() {}
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
   NS_IMETHOD DoAction(PRUint8 index);  
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
 protected:
   void CacheChildren();
 };
 
 /** ------------------------------------------------------ */
 /**  Finally, the Combobox widgets                         */
@@ -219,27 +217,27 @@ class nsHTMLComboboxAccessible : public 
 {
 public:
   enum { eAction_Click = 0 };
 
   nsHTMLComboboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
   virtual ~nsHTMLComboboxAccessible() {}
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *_retval);
   NS_IMETHOD GetValue(nsAString& _retval);
   NS_IMETHOD GetDescription(nsAString& aDescription);
   NS_IMETHOD DoAction(PRUint8 index);
   NS_IMETHOD GetNumActions(PRUint8 *aNumActions);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
 
   // nsAccessNode
   virtual nsresult Shutdown();
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
 protected:
   void CacheChildren();
 
   already_AddRefed<nsIAccessible> GetFocusedOptionAccessible();
 
 private:
@@ -279,23 +277,23 @@ public:
   nsHTMLComboboxButtonAccessible(nsIAccessible* aParent, nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
   virtual ~nsHTMLComboboxButtonAccessible() {}
 
   // nsIAccessible
   NS_IMETHOD DoAction(PRUint8 index);
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD GetParent(nsIAccessible **_retval);
-  NS_IMETHOD GetRole(PRUint32 *_retval);
   NS_IMETHOD GetName(nsAString& aName);
 
   // nsIAccessNode
   NS_IMETHOD GetUniqueID(void **aUniqueID);
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
   
 protected:
   virtual void GetBoundsRect(nsRect& aBounds, nsIFrame** aBoundingFrame);
 };
 
 #endif
 
--- a/accessible/src/html/nsHTMLTableAccessible.cpp
+++ b/accessible/src/html/nsHTMLTableAccessible.cpp
@@ -66,17 +66,18 @@
 NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLTableCellAccessible, nsHyperTextAccessible)
 
 nsHTMLTableCellAccessible::nsHTMLTableCellAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
 nsHyperTextAccessibleWrap(aDomNode, aShell)
 { 
 }
 
 /* unsigned long getRole (); */
-NS_IMETHODIMP nsHTMLTableCellAccessible::GetRole(PRUint32 *aResult)
+nsresult
+nsHTMLTableCellAccessible::GetRoleInternal(PRUint32 *aResult)
 {
   *aResult = nsIAccessibleRole::ROLE_CELL;
   return NS_OK;
 }
 
 nsresult
 nsHTMLTableCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
 {
@@ -183,17 +184,18 @@ void nsHTMLTableAccessible::CacheChildre
         // first is actually visible
         break;
       }
     }
   }
 }
 
 /* unsigned long getRole (); */
-NS_IMETHODIMP nsHTMLTableAccessible::GetRole(PRUint32 *aResult)
+nsresult
+nsHTMLTableAccessible::GetRoleInternal(PRUint32 *aResult)
 {
   *aResult = nsIAccessibleRole::ROLE_TABLE;
   return NS_OK;
 }
 
 nsresult
 nsHTMLTableAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
 {
@@ -1202,20 +1204,20 @@ NS_IMETHODIMP nsHTMLTableAccessible::IsP
 // --------------------------------------------------------
 NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLTableHeadAccessible, nsHTMLTableAccessible)
 
 nsHTMLTableHeadAccessible::nsHTMLTableHeadAccessible(nsIDOMNode *aDomNode, nsIWeakReference *aShell):
 nsHTMLTableAccessible(aDomNode, aShell)
 {
 }
 
-NS_IMETHODIMP
-nsHTMLTableHeadAccessible::GetRole(PRUint32 *aResult)
+nsresult
+nsHTMLTableHeadAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  *aResult = nsIAccessibleRole::ROLE_COLUMNHEADER;
+  *aRole = nsIAccessibleRole::ROLE_COLUMNHEADER;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHTMLTableHeadAccessible::GetCaption(nsIAccessible **aCaption)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
@@ -1242,16 +1244,19 @@ nsHTMLTableHeadAccessible::GetRows(PRInt
 
   nsCOMPtr<nsIDOMHTMLCollection> rows;
   rv = head->GetRows(getter_AddRefs(rows));
   NS_ENSURE_SUCCESS(rv, rv);
 
   return rows->GetLength((PRUint32 *)aRows);
 }
 
+////////////////////////////////////////////////////////////////////////////////
+// nsHTMLCaptionAccessible
+
 NS_IMETHODIMP
 nsHTMLCaptionAccessible::GetRelationByType(PRUint32 aRelationType,
                                            nsIAccessibleRelation **aRelation)
 {
   nsresult rv = nsHyperTextAccessible::GetRelationByType(aRelationType,
                                                          aRelation);
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -1259,10 +1264,14 @@ nsHTMLCaptionAccessible::GetRelationByTy
     nsCOMPtr<nsIAccessible> accParent;
     GetParent(getter_AddRefs(accParent));
     return nsRelUtils::AddTarget(aRelationType, aRelation, accParent);
   }
 
   return NS_OK;
 }
 
-
-
+nsresult
+nsHTMLCaptionAccessible::GetRoleInternal(PRUint32 *aRole)
+{
+  *aRole = nsIAccessibleRole::ROLE_CAPTION;
+  return NS_OK;
+}
--- a/accessible/src/html/nsHTMLTableAccessible.h
+++ b/accessible/src/html/nsHTMLTableAccessible.h
@@ -44,20 +44,18 @@
 
 class nsHTMLTableCellAccessible : public nsHyperTextAccessibleWrap
 {
 public:
   nsHTMLTableCellAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
 
   NS_DECL_ISUPPORTS_INHERITED
 
-  // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
-
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
 };
 
 class nsITableLayout;
 
 // To turn on table debugging descriptions define SHOW_LAYOUT_HEURISTIC
 // This allow release trunk builds to be used by testers to refine the
 // data vs. layout heuristic
@@ -68,23 +66,23 @@ class nsHTMLTableAccessible : public nsA
 {
 public:
   nsHTMLTableAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIACCESSIBLETABLE
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aResult); 
   NS_IMETHOD GetDescription(nsAString& aDescription);
   NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
                                nsIAccessibleRelation **aRelation);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
 
   // nsHTMLTableAccessible
 
   /**
     * Returns true if the column index is in the valid column range.
     *
@@ -137,33 +135,33 @@ protected:
 
 class nsHTMLTableHeadAccessible : public nsHTMLTableAccessible
 {
 public:
   NS_DECL_ISUPPORTS_INHERITED
 
   nsHTMLTableHeadAccessible(nsIDOMNode *aDomNode, nsIWeakReference *aShell);
 
-  /* nsIAccessible */
-  NS_IMETHOD GetRole(PRUint32 *aResult);
-
   /* nsIAccessibleTable */
   NS_IMETHOD GetCaption(nsIAccessible **aCaption);
   NS_IMETHOD GetSummary(nsAString &aSummary);
   NS_IMETHOD GetColumnHeader(nsIAccessibleTable **aColumnHeader);
   NS_IMETHOD GetRows(PRInt32 *aRows);
+
+  // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
 };
 
 class nsHTMLCaptionAccessible : public nsHyperTextAccessibleWrap
 {
 public:
   nsHTMLCaptionAccessible(nsIDOMNode *aDomNode, nsIWeakReference *aShell) :
     nsHyperTextAccessibleWrap(aDomNode, aShell) { }
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole)
-    { *aRole = nsIAccessibleRole::ROLE_CAPTION; return NS_OK; }
-
   NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
                                nsIAccessibleRelation **aRelation);
+
+  // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
 };
 
 #endif  
--- a/accessible/src/html/nsHTMLTextAccessible.cpp
+++ b/accessible/src/html/nsHTMLTextAccessible.cpp
@@ -56,27 +56,28 @@ nsTextAccessibleWrap(aDomNode, aShell)
 NS_IMETHODIMP
 nsHTMLTextAccessible::GetName(nsAString& aName)
 {
   // Text node, ARIA can't be used.
   aName.Truncate();
   return AppendTextTo(aName, 0, PR_UINT32_MAX);
 }
 
-NS_IMETHODIMP nsHTMLTextAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsHTMLTextAccessible::GetRoleInternal(PRUint32 *aRole)
 {
   nsIFrame *frame = GetFrame();
   // Don't return on null frame -- we still return a role
   // after accessible is shutdown/DEFUNCT
   if (frame && frame->IsGeneratedContentFrame()) {
     *aRole = nsIAccessibleRole::ROLE_STATICTEXT;
     return NS_OK;
   }
 
-  return nsTextAccessible::GetRole(aRole);
+  return nsTextAccessible::GetRoleInternal(aRole);
 }
 
 nsresult
 nsHTMLTextAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
 {
   nsresult rv = nsTextAccessible::GetStateInternal(aState, aExtraState);
   NS_ENSURE_A11Y_SUCCESS(rv, rv);
 
@@ -96,43 +97,45 @@ nsHTMLTextAccessible::GetStateInternal(P
 nsresult
 nsHTMLTextAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
 {
   if (!mDOMNode) {
     return NS_ERROR_FAILURE;  // Node already shut down
   }
 
   PRUint32 role;
-  GetRole(&role);
+  GetRoleInternal(&role);
   if (role == nsIAccessibleRole::ROLE_STATICTEXT) {
     nsAutoString oldValueUnused;
     aAttributes->SetStringProperty(NS_LITERAL_CSTRING("auto-generated"),
                                   NS_LITERAL_STRING("true"), oldValueUnused);
   }
 
   return NS_OK;
 }
 
 nsHTMLHRAccessible::nsHTMLHRAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
 nsLeafAccessible(aDomNode, aShell)
 { 
 }
 
-NS_IMETHODIMP nsHTMLHRAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsHTMLHRAccessible::GetRoleInternal(PRUint32 *aRole)
 {
   *aRole = nsIAccessibleRole::ROLE_SEPARATOR;
   return NS_OK;
 }
 
 nsHTMLBRAccessible::nsHTMLBRAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
 nsLeafAccessible(aDomNode, aShell)
 { 
 }
 
-NS_IMETHODIMP nsHTMLBRAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsHTMLBRAccessible::GetRoleInternal(PRUint32 *aRole)
 {
   *aRole = nsIAccessibleRole::ROLE_WHITESPACE;
   return NS_OK;
 }
 
 nsresult
 nsHTMLBRAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
 {
@@ -169,17 +172,18 @@ nsTextAccessible(aDomNode, aShell)
 }
 
 nsresult
 nsHTMLLabelAccessible::GetNameInternal(nsAString& aName)
 {
   return nsTextEquivUtils::GetNameFromSubtree(this, aName);
 }
 
-NS_IMETHODIMP nsHTMLLabelAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsHTMLLabelAccessible::GetRoleInternal(PRUint32 *aRole)
 {
   *aRole = nsIAccessibleRole::ROLE_LABEL;
   return NS_OK;
 }
 
 nsresult
 nsHTMLLabelAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
 {
@@ -232,16 +236,23 @@ nsHTMLLIAccessible::Shutdown()
     mBulletAccessible->Shutdown();
   }
   nsresult rv = nsLinkableAccessible::Shutdown();
   mBulletAccessible = nsnull;
   return rv;
 }
 
 nsresult
+nsHTMLLIAccessible::GetRoleInternal(PRUint32 *aRole)
+{
+  *aRole = nsIAccessibleRole::ROLE_LISTITEM;
+  return NS_OK;
+}
+
+nsresult
 nsHTMLLIAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
 {
   nsresult rv = nsAccessibleWrap::GetStateInternal(aState, aExtraState);
   NS_ENSURE_A11Y_SUCCESS(rv, rv);
 
   *aState |= nsIAccessibleStates::STATE_READONLY;
   return NS_OK;
 }
@@ -309,18 +320,18 @@ nsHTMLListBulletAccessible::Shutdown()
 NS_IMETHODIMP
 nsHTMLListBulletAccessible::GetName(nsAString &aName)
 {
   // Native anonymous content, ARIA can't be used.
   aName = mBulletText;
   return NS_OK;
 }
 
-NS_IMETHODIMP
-nsHTMLListBulletAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsHTMLListBulletAccessible::GetRoleInternal(PRUint32 *aRole)
 {
   *aRole = nsIAccessibleRole::ROLE_STATICTEXT;
   return NS_OK;
 }
 
 nsresult
 nsHTMLListBulletAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
 {
@@ -354,19 +365,27 @@ nsHTMLListBulletAccessible::AppendTextTo
   PRUint32 maxLength = mBulletText.Length() - aStartOffset;
   if (aLength > maxLength) {
     aLength = maxLength;
   }
   aText += nsDependentSubstring(mBulletText, aStartOffset, aLength);
   return NS_OK;
 }
 
+////////////////////////////////////////////////////////////////////////////////
 // nsHTMLListAccessible
 
 nsresult
+nsHTMLListAccessible::GetRoleInternal(PRUint32 *aRole)
+{
+  *aRole = nsIAccessibleRole::ROLE_LIST;
+  return NS_OK;
+}
+
+nsresult
 nsHTMLListAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
 {
   nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState,
                                                             aExtraState);
   NS_ENSURE_A11Y_SUCCESS(rv, rv);
 
   *aState |= nsIAccessibleStates::STATE_READONLY;
   return NS_OK;
--- a/accessible/src/html/nsHTMLTextAccessible.h
+++ b/accessible/src/html/nsHTMLTextAccessible.h
@@ -48,84 +48,84 @@ class nsIWeakReference;
 
 class nsHTMLTextAccessible : public nsTextAccessibleWrap
 {
 public:
   nsHTMLTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
   
   // nsIAccessible
   NS_IMETHOD GetName(nsAString& aName);
-  NS_IMETHOD GetRole(PRUint32 *aRole);
 
   // nsAccessible
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 class nsHTMLHRAccessible : public nsLeafAccessible
 {
 public:
   nsHTMLHRAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
-  NS_IMETHOD GetRole(PRUint32 *aRole); 
+
+  // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
 };
 
 class nsHTMLBRAccessible : public nsLeafAccessible
 {
 public:
   nsHTMLBRAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
 
-  // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
-
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 class nsHTMLLabelAccessible : public nsTextAccessible 
 {
 public:
   nsHTMLLabelAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *_retval); 
   NS_IMETHOD GetFirstChild(nsIAccessible **aFirstChild);
   NS_IMETHOD GetLastChild(nsIAccessible **aLastChild);
   NS_IMETHOD GetChildCount(PRInt32 *aAccChildCount);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 class nsHTMLListBulletAccessible : public nsLeafAccessible
 {
 public:
   nsHTMLListBulletAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell,
                              const nsAString& aBulletText);
 
   // nsIAccessNode
   NS_IMETHOD GetUniqueID(void **aUniqueID);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
   NS_IMETHOD GetName(nsAString& aName);
 
   // Don't cache via unique ID -- bullet accessible shares the same dom node as
   // this LI accessible. Also, don't cache via mParent/SetParent(), prevent
   // circular reference since li holds onto us.
   NS_IMETHOD SetParent(nsIAccessible *aParentAccessible);
   NS_IMETHOD GetParent(nsIAccessible **aParentAccessible);
 
   // nsAccessNode
   virtual nsresult Shutdown();
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
   // nsPIAccessible
   NS_IMETHOD AppendTextTo(nsAString& aText, PRUint32 aStartOffset, PRUint32 aLength);
 
 protected:
   // XXX: Ideally we'd get the bullet text directly from the bullet frame via
   // nsBulletFrame::GetListItemText(), but we'd need an interface for getting
@@ -138,37 +138,35 @@ protected:
 };
 
 class nsHTMLListAccessible : public nsHyperTextAccessibleWrap
 {
 public:
   nsHTMLListAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell):
     nsHyperTextAccessibleWrap(aDOMNode, aShell) { }
 
-  // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole) { *aRole = nsIAccessibleRole::ROLE_LIST; return NS_OK; }
-
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 class nsHTMLLIAccessible : public nsLinkableAccessible
 {
 public:
   nsHTMLLIAccessible(nsIDOMNode *aDOMNode, nsIWeakReference* aShell, 
                      const nsAString& aBulletText);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole) { *aRole = nsIAccessibleRole::ROLE_LISTITEM; return NS_OK; }
   NS_IMETHOD GetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
 
   // nsAccessNode
   virtual nsresult Shutdown();
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
 protected:
   void CacheChildren();  // Include bullet accessible
 
   nsRefPtr<nsHTMLListBulletAccessible> mBulletAccessible;
 };
 
--- a/accessible/src/html/nsHyperTextAccessible.cpp
+++ b/accessible/src/html/nsHyperTextAccessible.cpp
@@ -128,17 +128,18 @@ nsresult nsHyperTextAccessible::QueryInt
   return nsAccessible::QueryInterface(aIID, aInstancePtr);
 }
 
 nsHyperTextAccessible::nsHyperTextAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
 nsAccessibleWrap(aNode, aShell)
 {
 }
 
-NS_IMETHODIMP nsHyperTextAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsHyperTextAccessible::GetRoleInternal(PRUint32 *aRole)
 {
   nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode);
   if (!content) {
     return NS_ERROR_FAILURE;
   }
 
   nsIAtom *tag = content->Tag();
 
@@ -206,17 +207,17 @@ void nsHyperTextAccessible::CacheChildre
     // This node has been shut down
     mAccChildCount = eChildCountUninitialized;
     return;
   }
 
   // Special case for text entry fields, go directly to editor's root for children
   if (mAccChildCount == eChildCountUninitialized) {
     PRUint32 role;
-    GetRole(&role);
+    GetRoleInternal(&role);
     if (role != nsIAccessibleRole::ROLE_ENTRY && role != nsIAccessibleRole::ROLE_PASSWORD_TEXT) {
       nsAccessible::CacheChildren();
       return;
     }
     nsCOMPtr<nsIEditor> editor;
     GetAssociatedEditor(getter_AddRefs(editor));
     if (!editor) {
       nsAccessible::CacheChildren();
--- a/accessible/src/html/nsHyperTextAccessible.h
+++ b/accessible/src/html/nsHyperTextAccessible.h
@@ -77,21 +77,19 @@ class nsHyperTextAccessible : public nsA
 public:
   nsHyperTextAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIACCESSIBLETEXT
   NS_DECL_NSIACCESSIBLEHYPERTEXT
   NS_DECL_NSIACCESSIBLEEDITABLETEXT
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_HYPERTEXTACCESSIBLE_IMPL_CID)
 
-  // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
-
   // nsAccessible
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
   void CacheChildren();
 
   // Convert content offset to rendered text offset  
   static nsresult ContentToRenderedOffset(nsIFrame *aFrame, PRInt32 aContentOffset,
                                           PRUint32 *aRenderedOffset);
   
   // Convert rendered text offset to content offset
--- a/accessible/src/mac/mozAccessible.mm
+++ b/accessible/src/mac/mozAccessible.mm
@@ -130,17 +130,17 @@ GetNativeFromGeckoAccessible(nsIAccessib
  
 - (id)initWithAccessible:(nsAccessibleWrap*)geckoAccessible
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   if ((self = [super init])) {
     mGeckoAccessible = geckoAccessible;
     mIsExpired = NO;
-    geckoAccessible->GetFinalRole(&mRole);
+    geckoAccessible->GetRole(&mRole);
     
     // 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!");
   }
    
   return self;
 
--- a/accessible/src/msaa/nsAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsAccessibleWrap.cpp
@@ -382,29 +382,27 @@ nsAccessibleWrap::get_accDescription(VAR
 
   if (positionInGroup > 0) {
     if (groupLevel > 0) {
       // XXX: How do we calculate the number of children? Now we append
       // " with [numChildren]c" for tree item. In the future we may need to
       // use the ARIA owns property to calculate that if it's present.
       PRInt32 numChildren = 0;
 
-      PRUint32 currentRole = 0;
-      rv = xpAccessible->GetFinalRole(&currentRole);
-      if (NS_SUCCEEDED(rv) &&
-          currentRole == nsIAccessibleRole::ROLE_OUTLINEITEM) {
+      PRUint32 currentRole = nsAccUtils::Role(xpAccessible);
+      if (currentRole == nsIAccessibleRole::ROLE_OUTLINEITEM) {
         nsCOMPtr<nsIAccessible> child;
         xpAccessible->GetFirstChild(getter_AddRefs(child));
         while (child) {
-          child->GetFinalRole(&currentRole);
+          currentRole = nsAccUtils::Role(child);
           if (currentRole == nsIAccessibleRole::ROLE_GROUPING) {
             nsCOMPtr<nsIAccessible> groupChild;
             child->GetFirstChild(getter_AddRefs(groupChild));
             while (groupChild) {
-              groupChild->GetFinalRole(&currentRole);
+              currentRole = nsAccUtils::Role(groupChild);
               numChildren +=
                 (currentRole == nsIAccessibleRole::ROLE_OUTLINEITEM);
               nsCOMPtr<nsIAccessible> nextGroupChild;
               groupChild->GetNextSibling(getter_AddRefs(nextGroupChild));
               groupChild.swap(nextGroupChild);
             }
             break;
           }
@@ -471,17 +469,17 @@ STDMETHODIMP nsAccessibleWrap::get_accRo
     return E_FAIL;
 
 #ifdef DEBUG_A11Y
   NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(xpAccessible),
                "Does not support nsIAccessibleText when it should");
 #endif
 
   PRUint32 xpRole = 0, msaaRole = 0;
-  if (NS_FAILED(xpAccessible->GetFinalRole(&xpRole)))
+  if (NS_FAILED(xpAccessible->GetRole(&xpRole)))
     return E_FAIL;
 
   msaaRole = gWindowsRoleMap[xpRole].msaaRole;
   NS_ASSERTION(gWindowsRoleMap[nsIAccessibleRole::ROLE_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.
@@ -1272,17 +1270,17 @@ nsAccessibleWrap::get_relations(long aMa
 
 STDMETHODIMP
 nsAccessibleWrap::role(long *aRole)
 {
 __try {
   *aRole = 0;
 
   PRUint32 xpRole = 0;
-  nsresult rv = GetFinalRole(&xpRole);
+  nsresult rv = GetRole(&xpRole);
   if (NS_FAILED(rv))
     return GetHRESULT(rv);
 
   NS_ASSERTION(gWindowsRoleMap[nsIAccessibleRole::ROLE_LAST_ENTRY].ia2Role == ROLE_WINDOWS_LAST_ENTRY,
                "MSAA role map skewed");
 
   *aRole = gWindowsRoleMap[xpRole].ia2Role;
   return S_OK;
--- a/accessible/src/msaa/nsXULTreeAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsXULTreeAccessibleWrap.cpp
@@ -44,17 +44,18 @@
 // nsXULTreeAccessibleWrap
 // --------------------------------------------------------
 
 nsXULTreeAccessibleWrap::nsXULTreeAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell):
 nsXULTreeAccessible(aDOMNode, aShell)
 {
 }
 
-NS_IMETHODIMP nsXULTreeAccessibleWrap::GetRole(PRUint32 *aRole)
+nsresult
+nsXULTreeAccessibleWrap::GetRoleInternal(PRUint32 *aRole)
 {
   NS_ENSURE_STATE(mTree);
 
   nsCOMPtr<nsITreeColumns> cols;
   mTree->GetColumns(getter_AddRefs(cols));
   nsCOMPtr<nsITreeColumn> primaryCol;
   if (cols) {
     cols->GetPrimaryColumn(getter_AddRefs(primaryCol));
@@ -75,17 +76,18 @@ nsXULTreeitemAccessibleWrap::nsXULTreeit
                                                          nsIDOMNode *aDOMNode, 
                                                          nsIWeakReference *aShell, 
                                                          PRInt32 aRow, 
                                                          nsITreeColumn* aColumn) :
 nsXULTreeitemAccessible(aParent, aDOMNode, aShell, aRow, aColumn)
 {
 }
 
-NS_IMETHODIMP nsXULTreeitemAccessibleWrap::GetRole(PRUint32 *aRole)
+nsresult
+nsXULTreeitemAccessibleWrap::GetRoleInternal(PRUint32 *aRole)
 {
   // 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
   NS_ENSURE_STATE(mColumn);
   PRBool isPrimary = PR_FALSE;
   mColumn->GetPrimary(&isPrimary);
   *aRole = isPrimary ? nsIAccessibleRole::ROLE_OUTLINEITEM :
                        nsIAccessibleRole::ROLE_LISTITEM;
--- a/accessible/src/msaa/nsXULTreeAccessibleWrap.h
+++ b/accessible/src/msaa/nsXULTreeAccessibleWrap.h
@@ -43,24 +43,29 @@
 
 typedef class nsXULTreeColumnsAccessible   nsXULTreeColumnsAccessibleWrap;
 
 class nsXULTreeAccessibleWrap : public nsXULTreeAccessible
 {
 public:
   nsXULTreeAccessibleWrap(nsIDOMNode *aDOMNode, nsIWeakReference *aShell);
   virtual ~nsXULTreeAccessibleWrap() {}
-  NS_IMETHOD GetRole(PRUint32 *aRole);
+
+  // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
 };
 
 class nsXULTreeitemAccessibleWrap : public nsXULTreeitemAccessible
 {
 public:
   nsXULTreeitemAccessibleWrap(nsIAccessible *aParent, nsIDOMNode *aDOMNode, nsIWeakReference *aShell, 
     PRInt32 aRow, nsITreeColumn* aColumn);
   virtual ~nsXULTreeitemAccessibleWrap() {}
 
+  // nsIAccessible
   NS_IMETHOD GetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
-  NS_IMETHOD GetRole(PRUint32 *aRole);
   NS_IMETHOD GetName(nsAString &aName);
+
+  // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
 };
 
 #endif
--- a/accessible/src/xforms/nsXFormsAccessible.cpp
+++ b/accessible/src/xforms/nsXFormsAccessible.cpp
@@ -259,21 +259,19 @@ nsXFormsAccessible::GetAllowsAnonChildAc
 // nsXFormsContainerAccessible
 
 nsXFormsContainerAccessible::
 nsXFormsContainerAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
   nsXFormsAccessible(aNode, aShell)
 {
 }
 
-NS_IMETHODIMP
-nsXFormsContainerAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXFormsContainerAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  NS_ENSURE_ARG_POINTER(aRole);
-
   *aRole = nsIAccessibleRole::ROLE_GROUPING;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXFormsContainerAccessible::GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren)
 {
   NS_ENSURE_ARG_POINTER(aAllowsAnonChildren);
--- a/accessible/src/xforms/nsXFormsAccessible.h
+++ b/accessible/src/xforms/nsXFormsAccessible.h
@@ -122,22 +122,22 @@ protected:
  * an XForms upload element since it is constructed from textfield and
  * 'pick up file' and 'clear file' buttons.
  */
 class nsXFormsContainerAccessible : public nsXFormsAccessible
 {
 public:
   nsXFormsContainerAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
-  // Returns ROLE_GROUP.
-  NS_IMETHOD GetRole(PRUint32 *aRole);
-
   // Allows accessible nodes in anonymous content of xforms element by
   // always returning PR_TRUE value.
   NS_IMETHOD GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren);
+
+  // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
 };
 
 
 /**
  * The class is base for accessible objects for XForms elements that have
  * editable area.
  */
 class nsXFormsEditableAccessible : public nsXFormsAccessible
--- a/accessible/src/xforms/nsXFormsFormControlsAccessible.cpp
+++ b/accessible/src/xforms/nsXFormsFormControlsAccessible.cpp
@@ -41,21 +41,19 @@
 // nsXFormsLabelAccessible
 
 nsXFormsLabelAccessible::
   nsXFormsLabelAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell):
   nsXFormsAccessible(aNode, aShell)
 {
 }
 
-NS_IMETHODIMP
-nsXFormsLabelAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXFormsLabelAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  NS_ENSURE_ARG_POINTER(aRole);
-
   *aRole = nsIAccessibleRole::ROLE_LABEL;
   return NS_OK;
 }
 
 nsresult
 nsXFormsLabelAccessible::GetNameInternal(nsAString& aName)
 {
   // XXX Correct name calculation for this, see bug 453594.
@@ -76,38 +74,34 @@ nsXFormsLabelAccessible::GetDescription(
 // nsXFormsOutputAccessible
 
 nsXFormsOutputAccessible::
   nsXFormsOutputAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell):
   nsXFormsAccessible(aNode, aShell)
 {
 }
 
-NS_IMETHODIMP
-nsXFormsOutputAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXFormsOutputAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  NS_ENSURE_ARG_POINTER(aRole);
-
   *aRole = nsIAccessibleRole::ROLE_STATICTEXT;
   return NS_OK;
 }
 
 // nsXFormsTriggerAccessible
 
 nsXFormsTriggerAccessible::
   nsXFormsTriggerAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell):
   nsXFormsAccessible(aNode, aShell)
 {
 }
 
-NS_IMETHODIMP
-nsXFormsTriggerAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXFormsTriggerAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  NS_ENSURE_ARG_POINTER(aRole);
-
   *aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXFormsTriggerAccessible::GetValue(nsAString& aValue)
 {
   aValue.Truncate();
@@ -147,21 +141,19 @@ nsXFormsTriggerAccessible::DoAction(PRUi
 nsXFormsInputAccessible::
   nsXFormsInputAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell):
   nsXFormsEditableAccessible(aNode, aShell)
 {
 }
 
 NS_IMPL_ISUPPORTS_INHERITED3(nsXFormsInputAccessible, nsAccessible, nsHyperTextAccessible, nsIAccessibleText, nsIAccessibleEditableText)
 
-NS_IMETHODIMP
-nsXFormsInputAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXFormsInputAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  NS_ENSURE_ARG_POINTER(aRole);
-
   *aRole = nsIAccessibleRole::ROLE_ENTRY;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXFormsInputAccessible::GetNumActions(PRUint8* aCount)
 {
   NS_ENSURE_ARG_POINTER(aCount);
@@ -192,21 +184,19 @@ nsXFormsInputAccessible::DoAction(PRUint
 // nsXFormsInputBooleanAccessible
 
 nsXFormsInputBooleanAccessible::
   nsXFormsInputBooleanAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell):
   nsXFormsAccessible(aNode, aShell)
 {
 }
 
-NS_IMETHODIMP
-nsXFormsInputBooleanAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXFormsInputBooleanAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  NS_ENSURE_ARG_POINTER(aRole);
-
   *aRole = nsIAccessibleRole::ROLE_CHECKBUTTON;
   return NS_OK;
 }
 
 nsresult
 nsXFormsInputBooleanAccessible::GetStateInternal(PRUint32 *aState,
                                                  PRUint32 *aExtraState)
 {
@@ -262,38 +252,34 @@ nsXFormsInputBooleanAccessible::DoAction
 // nsXFormsInputDateAccessible
 
 nsXFormsInputDateAccessible::
   nsXFormsInputDateAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell):
   nsXFormsContainerAccessible(aNode, aShell)
 {
 }
 
-NS_IMETHODIMP
-nsXFormsInputDateAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXFormsInputDateAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  NS_ENSURE_ARG_POINTER(aRole);
-
   *aRole = nsIAccessibleRole::ROLE_DROPLIST;
   return NS_OK;
 }
 
 // nsXFormsSecretAccessible
 
 nsXFormsSecretAccessible::
   nsXFormsSecretAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell):
   nsXFormsInputAccessible(aNode, aShell)
 {
 }
 
-NS_IMETHODIMP
-nsXFormsSecretAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXFormsSecretAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  NS_ENSURE_ARG_POINTER(aRole);
-
   *aRole = nsIAccessibleRole::ROLE_PASSWORD_TEXT;
   return NS_OK;
 }
 
 nsresult
 nsXFormsSecretAccessible::GetStateInternal(PRUint32 *aState,
                                            PRUint32 *aExtraState)
 {
@@ -314,21 +300,19 @@ nsXFormsSecretAccessible::GetValue(nsASt
 // nsXFormsRangeAccessible
 
 nsXFormsRangeAccessible::
   nsXFormsRangeAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell):
   nsXFormsAccessible(aNode, aShell)
 {
 }
 
-NS_IMETHODIMP
-nsXFormsRangeAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXFormsRangeAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  NS_ENSURE_ARG_POINTER(aRole);
-
   *aRole = nsIAccessibleRole::ROLE_SLIDER;
   return NS_OK;
 }
 
 nsresult
 nsXFormsRangeAccessible::GetStateInternal(PRUint32 *aState,
                                           PRUint32 *aExtraState)
 {
@@ -433,21 +417,19 @@ nsXFormsSelectAccessible::GetStateIntern
 // nsXFormsChoicesAccessible
 
 nsXFormsChoicesAccessible::
   nsXFormsChoicesAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell):
   nsXFormsAccessible(aNode, aShell)
 {
 }
 
-NS_IMETHODIMP
-nsXFormsChoicesAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXFormsChoicesAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  NS_ENSURE_ARG_POINTER(aRole);
-
   *aRole = nsIAccessibleRole::ROLE_GROUPING;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXFormsChoicesAccessible::GetValue(nsAString& aValue)
 {
   aValue.Truncate();
@@ -464,21 +446,19 @@ nsXFormsChoicesAccessible::CacheChildren
 // nsXFormsSelectFullAccessible
 
 nsXFormsSelectFullAccessible::
   nsXFormsSelectFullAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell):
   nsXFormsSelectableAccessible(aNode, aShell)
 {
 }
 
-NS_IMETHODIMP
-nsXFormsSelectFullAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXFormsSelectFullAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  NS_ENSURE_ARG_POINTER(aRole);
-
   *aRole = nsIAccessibleRole::ROLE_GROUPING;
   return NS_OK;
 }
 
 void
 nsXFormsSelectFullAccessible::CacheChildren()
 {
   CacheSelectChildren();
@@ -488,21 +468,19 @@ nsXFormsSelectFullAccessible::CacheChild
 // nsXFormsItemCheckgroupAccessible
 
 nsXFormsItemCheckgroupAccessible::
   nsXFormsItemCheckgroupAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell):
   nsXFormsSelectableItemAccessible(aNode, aShell)
 {
 }
 
-NS_IMETHODIMP
-nsXFormsItemCheckgroupAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXFormsItemCheckgroupAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  NS_ENSURE_ARG_POINTER(aRole);
-
   *aRole = nsIAccessibleRole::ROLE_CHECKBUTTON;
   return NS_OK;
 }
 
 nsresult
 nsXFormsItemCheckgroupAccessible::GetStateInternal(PRUint32 *aState,
                                                    PRUint32 *aExtraState)
 {
@@ -534,21 +512,19 @@ nsXFormsItemCheckgroupAccessible::GetAct
 // nsXFormsItemRadiogroupAccessible
 
 nsXFormsItemRadiogroupAccessible::
   nsXFormsItemRadiogroupAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell):
   nsXFormsSelectableItemAccessible(aNode, aShell)
 {
 }
 
-NS_IMETHODIMP
-nsXFormsItemRadiogroupAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXFormsItemRadiogroupAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  NS_ENSURE_ARG_POINTER(aRole);
-
   *aRole = nsIAccessibleRole::ROLE_RADIOBUTTON;
   return NS_OK;
 }
 
 nsresult
 nsXFormsItemRadiogroupAccessible::GetStateInternal(PRUint32 *aState,
                                                    PRUint32 *aExtraState)
 {
@@ -576,21 +552,19 @@ nsXFormsItemRadiogroupAccessible::GetAct
 // nsXFormsSelectComboboxAccessible
 
 nsXFormsSelectComboboxAccessible::
   nsXFormsSelectComboboxAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell):
   nsXFormsSelectableAccessible(aNode, aShell)
 {
 }
 
-NS_IMETHODIMP
-nsXFormsSelectComboboxAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXFormsSelectComboboxAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  NS_ENSURE_ARG_POINTER(aRole);
-
   *aRole = nsIAccessibleRole::ROLE_COMBOBOX;
   return NS_OK;
 }
 
 nsresult
 nsXFormsSelectComboboxAccessible::GetStateInternal(PRUint32 *aState,
                                                    PRUint32 *aExtraState)
 {
@@ -625,21 +599,19 @@ nsXFormsSelectComboboxAccessible::GetAll
 // nsXFormsItemComboboxAccessible
 
 nsXFormsItemComboboxAccessible::
   nsXFormsItemComboboxAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell):
   nsXFormsSelectableItemAccessible(aNode, aShell)
 {
 }
 
-NS_IMETHODIMP
-nsXFormsItemComboboxAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXFormsItemComboboxAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  NS_ENSURE_ARG_POINTER(aRole);
-
   *aRole = nsIAccessibleRole::ROLE_LISTITEM;
   return NS_OK;
 }
 
 nsresult
 nsXFormsItemComboboxAccessible::GetStateInternal(PRUint32 *aState,
                                                  PRUint32 *aExtraState)
 {
--- a/accessible/src/xforms/nsXFormsFormControlsAccessible.h
+++ b/accessible/src/xforms/nsXFormsFormControlsAccessible.h
@@ -46,137 +46,143 @@
  */
 
 class nsXFormsLabelAccessible : public nsXFormsAccessible
 {
 public:
   nsXFormsLabelAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
   NS_IMETHOD GetDescription(nsAString& aDescription);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
 };
 
 /**
  * Accessible object for xforms:output.
  */
 
 class nsXFormsOutputAccessible : public nsXFormsAccessible
 {
 public:
   nsXFormsOutputAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell);
 
-  NS_IMETHOD GetRole(PRUint32 *aRole);
+  // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
 };
 
 /**
  * Accessible object for xforms:trigger and xforms:submit.
  */
 
 class nsXFormsTriggerAccessible : public nsXFormsAccessible
 {
 public:
   nsXFormsTriggerAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell);
 
-  NS_IMETHOD GetRole(PRUint32 *aRole);
+  // nsIAccessible
   NS_IMETHOD GetValue(nsAString& aValue);
 
   NS_IMETHOD GetNumActions(PRUint8 *aCount);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
+
+  // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
 };
 
 /**
  * Accessible object for xforms:input and xforms:textarea.
  */
 
 class nsXFormsInputAccessible : public nsXFormsEditableAccessible
 {
 public:
   nsXFormsInputAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell);
 
   NS_DECL_ISUPPORTS_INHERITED
 
-  NS_IMETHOD GetRole(PRUint32 *aRole);
+  // nsIAccessible
   NS_IMETHOD GetNumActions(PRUint8 *aCount);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
+
+  // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
 };
 
 /**
  * Accessible object for xforms:input[type="xsd:boolean"].
  */
 
 class nsXFormsInputBooleanAccessible : public nsXFormsAccessible
 {
 public:
   nsXFormsInputBooleanAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
   NS_IMETHOD GetNumActions(PRUint8 *aCount);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 /**
  * Accessible object for xforms:input[type="xsd:date"].
  */
 
 class nsXFormsInputDateAccessible : public nsXFormsContainerAccessible
 {
 public:
   nsXFormsInputDateAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell);
 
-  NS_IMETHOD GetRole(PRUint32 *aRole);
+  // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
 };
 
 /**
  * Accessible object for xforms:secret.
  */
 
 class nsXFormsSecretAccessible : public nsXFormsInputAccessible
 {
 public:
   nsXFormsSecretAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
   NS_IMETHOD GetValue(nsAString& aValue);
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 
 /**
  * Accessible object for xforms:range.
  */
 
 class nsXFormsRangeAccessible : public nsXFormsAccessible
 {
 public:
   nsXFormsRangeAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell);
 
-  // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
-
   // nsIAccessibleValue
   NS_IMETHOD GetMaximumValue(double *aMaximumValue);
   NS_IMETHOD GetMinimumValue(double *aMinimumValue);
   NS_IMETHOD GetMinimumIncrement(double *aMinimumIncrement);
   NS_IMETHOD GetCurrentValue(double *aCurrentValue);
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 
 /**
  * Accessible object for xforms:select and xforms:select1 that are implemented
  * using host document's native widget.
  */
@@ -195,114 +201,114 @@ public:
  * Accessible object for xforms:choices.
  */
 
 class nsXFormsChoicesAccessible : public nsXFormsAccessible
 {
 public:
   nsXFormsChoicesAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
-  NS_IMETHOD GetRole(PRUint32 *aRole);
+  // nsIAccessible
   NS_IMETHOD GetValue(nsAString& aValue);
 
+  // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   void CacheChildren();
 };
 
 
 /**
  * Accessible object for xforms:select/xforms:select1 of full appearance that
  * may be represented by group of checkboxes or radiogroup.
  */
 
 class nsXFormsSelectFullAccessible : public nsXFormsSelectableAccessible
 {
 public:
   nsXFormsSelectFullAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
-  NS_IMETHOD GetRole(PRUint32 *aRole);
-
+  // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   void CacheChildren();
 };
 
 
 /**
  * Accessible object for a xforms:item when it is represented by a checkbox.
  * This occurs when the item is contained in a xforms:select with full
  * appearance. Such a xforms:select is represented by a checkgroup.
  */
 
 class nsXFormsItemCheckgroupAccessible : public nsXFormsSelectableItemAccessible
 {
 public:
   nsXFormsItemCheckgroupAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 
 /**
  * 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.
  */
 
 class nsXFormsItemRadiogroupAccessible : public nsXFormsSelectableItemAccessible
 {
 public:
   nsXFormsItemRadiogroupAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 
 /**
  * Accessible object for xforms:select1 of minimal appearance that is
  * represented by combobox.
  */
 
 class nsXFormsSelectComboboxAccessible : public nsXFormsSelectableAccessible
 {
 public:
   nsXFormsSelectComboboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
-  // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
-
   // Allows accessible nodes in anonymous content of xforms element by
   // always returning PR_TRUE value.
   NS_IMETHOD GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren);
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 
 /**
  * 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
  * minimal appearance. Such a xforms:select is represented by a combobox.
  */
 
 class nsXFormsItemComboboxAccessible : public nsXFormsSelectableItemAccessible
 {
 public:
   nsXFormsItemComboboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 #endif
 
--- a/accessible/src/xforms/nsXFormsWidgetsAccessible.cpp
+++ b/accessible/src/xforms/nsXFormsWidgetsAccessible.cpp
@@ -41,21 +41,19 @@
 // nsXFormsDropmarkerWidgetAccessible
 
 nsXFormsDropmarkerWidgetAccessible::
 nsXFormsDropmarkerWidgetAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
   nsLeafAccessible(aNode, aShell)
 {
 }
 
-NS_IMETHODIMP
-nsXFormsDropmarkerWidgetAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXFormsDropmarkerWidgetAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  NS_ENSURE_ARG_POINTER(aRole);
-
   *aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
   return NS_OK;
 }
 
 nsresult
 nsXFormsDropmarkerWidgetAccessible::GetStateInternal(PRUint32 *aState,
                                                      PRUint32 *aExtraState)
 {
@@ -123,39 +121,35 @@ nsXFormsDropmarkerWidgetAccessible::DoAc
 // nsXFormsCalendarWidgetAccessible
 
 nsXFormsCalendarWidgetAccessible::
 nsXFormsCalendarWidgetAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
   nsAccessibleWrap(aNode, aShell)
 {
 }
 
-NS_IMETHODIMP
-nsXFormsCalendarWidgetAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXFormsCalendarWidgetAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  NS_ENSURE_ARG_POINTER(aRole);
-
   *aRole = nsIAccessibleRole::ROLE_CALENDAR;
   return NS_OK;
 }
 
 
 // nsXFormsComboboxPopupWidgetAccessible
 
 nsXFormsComboboxPopupWidgetAccessible::
   nsXFormsComboboxPopupWidgetAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell):
   nsXFormsAccessible(aNode, aShell)
 {
 }
 
-NS_IMETHODIMP
-nsXFormsComboboxPopupWidgetAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXFormsComboboxPopupWidgetAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  NS_ENSURE_ARG_POINTER(aRole);
-
   *aRole = nsIAccessibleRole::ROLE_LIST;
   return NS_OK;
 }
 
 nsresult
 nsXFormsComboboxPopupWidgetAccessible::GetStateInternal(PRUint32 *aState,
                                                         PRUint32 *aExtraState)
 {
--- a/accessible/src/xforms/nsXFormsWidgetsAccessible.h
+++ b/accessible/src/xforms/nsXFormsWidgetsAccessible.h
@@ -50,55 +50,55 @@
 class nsXFormsDropmarkerWidgetAccessible : public nsLeafAccessible,
                                            public nsXFormsAccessibleBase
 {
 public:
   nsXFormsDropmarkerWidgetAccessible(nsIDOMNode *aNode,
                                      nsIWeakReference *aShell);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
-
   NS_IMETHOD GetNumActions(PRUint8 *aCount);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 
 /**
  * Accessible object for calendar widget. It is used by xforms:input[xsd:date].
  */
 class nsXFormsCalendarWidgetAccessible : public nsAccessibleWrap
 {
 public:
   nsXFormsCalendarWidgetAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell);
 
-  NS_IMETHOD GetRole(PRUint32 *aRole);
+  // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
 };
 
 
 /**
  * Accessible object for popup menu of minimal xforms select1 element that is
  * represented by combobox.
  */
 class nsXFormsComboboxPopupWidgetAccessible : public nsXFormsAccessible
 {
 public:
   nsXFormsComboboxPopupWidgetAccessible(nsIDOMNode *aNode,
                                         nsIWeakReference *aShell);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
   NS_IMETHOD GetValue(nsAString& aValue);
   NS_IMETHOD GetDescription(nsAString& aDescription);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
 protected:
   void CacheChildren();
 };
 
 #endif
--- a/accessible/src/xul/nsXULAlertAccessible.cpp
+++ b/accessible/src/xul/nsXULAlertAccessible.cpp
@@ -42,17 +42,18 @@
 
 NS_IMPL_ISUPPORTS_INHERITED0(nsXULAlertAccessible, nsAccessible)
 
 nsXULAlertAccessible::nsXULAlertAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell) :
   nsAccessibleWrap(aNode, aShell)
 {
 }
 
-NS_IMETHODIMP nsXULAlertAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXULAlertAccessible::GetRoleInternal(PRUint32 *aRole)
 {
   *aRole = nsIAccessibleRole::ROLE_ALERT;
   return NS_OK;
 }
 
 nsresult
 nsXULAlertAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
 {
--- a/accessible/src/xul/nsXULAlertAccessible.h
+++ b/accessible/src/xul/nsXULAlertAccessible.h
@@ -46,16 +46,16 @@
 class nsXULAlertAccessible : public nsAccessibleWrap
 {
 public:
   nsXULAlertAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
   NS_IMETHOD GetName(nsAString& aName);
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 #endif  
--- a/accessible/src/xul/nsXULColorPickerAccessible.cpp
+++ b/accessible/src/xul/nsXULColorPickerAccessible.cpp
@@ -51,19 +51,20 @@
 nsXULColorPickerTileAccessible::nsXULColorPickerTileAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
 nsFormControlAccessible(aNode, aShell)
 { 
 }
 
 /**
   * We are a pushbutton
   */
-NS_IMETHODIMP nsXULColorPickerTileAccessible::GetRole(PRUint32 *_retval)
+nsresult
+nsXULColorPickerTileAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  *_retval = nsIAccessibleRole::ROLE_PUSHBUTTON;
+  *aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
   return NS_OK;
 }
 
 /**
   * Possible states: focused, focusable, selected
   */
 nsresult
 nsXULColorPickerTileAccessible::GetStateInternal(PRUint32 *aState,
@@ -125,14 +126,15 @@ nsXULColorPickerAccessible::GetStateInte
   NS_ENSURE_A11Y_SUCCESS(rv, rv);
 
   *aState |= nsIAccessibleStates::STATE_FOCUSABLE |
              nsIAccessibleStates::STATE_HASPOPUP;
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULColorPickerAccessible::GetRole(PRUint32 *_retval)
+nsresult
+nsXULColorPickerAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  *_retval = nsIAccessibleRole::ROLE_BUTTONDROPDOWNGRID;
+  *aRole = nsIAccessibleRole::ROLE_BUTTONDROPDOWNGRID;
   return NS_OK;
 }
 
--- a/accessible/src/xul/nsXULColorPickerAccessible.h
+++ b/accessible/src/xul/nsXULColorPickerAccessible.h
@@ -43,28 +43,26 @@
 #include "nsFormControlAccessible.h"
 
 class nsXULColorPickerTileAccessible : public nsFormControlAccessible
 {
 public:
   nsXULColorPickerTileAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *_retval);
   NS_IMETHOD GetValue(nsAString& _retval);
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 class nsXULColorPickerAccessible : public nsXULColorPickerTileAccessible
 {
 public:
   nsXULColorPickerAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
-  // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *_retval);
-
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 #endif  
--- a/accessible/src/xul/nsXULFormControlAccessible.cpp
+++ b/accessible/src/xul/nsXULFormControlAccessible.cpp
@@ -100,19 +100,20 @@ NS_IMETHODIMP nsXULButtonAccessible::DoA
     return DoCommand();
   }
   return NS_ERROR_INVALID_ARG;
 }
 
 /**
   * We are a pushbutton
   */
-NS_IMETHODIMP nsXULButtonAccessible::GetRole(PRUint32 *_retval)
+nsresult
+nsXULButtonAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  *_retval = nsIAccessibleRole::ROLE_PUSHBUTTON;
+  *aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
   return NS_OK;
 }
 
 /**
   * Possible states: focused, focusable, unavailable(disabled)
   */
 nsresult
 nsXULButtonAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
@@ -187,20 +188,19 @@ void nsXULButtonAccessible::CacheChildre
       dropMarkerAccessible = walker.mState.accessible;
       walker.GetNextSibling();
     }
 
     // If the anonymous tree walker can find accessible children, 
     // and the last one is a push button, then use it as the only accessible 
     // child -- because this is the scenario where we have a dropmarker child
 
-    if (dropMarkerAccessible) {    
-      PRUint32 role;
-      if (NS_SUCCEEDED(dropMarkerAccessible->GetRole(&role)) &&
-          role == nsIAccessibleRole::ROLE_PUSHBUTTON) {
+    if (dropMarkerAccessible) {
+      if (nsAccUtils::RoleInternal(dropMarkerAccessible) ==
+          nsIAccessibleRole::ROLE_PUSHBUTTON) {
         SetFirstChild(dropMarkerAccessible);
         nsCOMPtr<nsPIAccessible> privChildAcc = do_QueryInterface(dropMarkerAccessible);
         privChildAcc->SetNextSibling(nsnull);
         privChildAcc->SetParent(this);
         mAccChildCount = 1;
       }
     }
   }
@@ -278,19 +278,20 @@ NS_IMETHODIMP nsXULDropmarkerAccessible:
     return NS_OK;
   }
   return NS_ERROR_INVALID_ARG;
 }
 
 /**
   * We are a pushbutton
   */
-NS_IMETHODIMP nsXULDropmarkerAccessible::GetRole(PRUint32 *aResult)
+nsresult
+nsXULDropmarkerAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  *aResult = nsIAccessibleRole::ROLE_PUSHBUTTON;
+  *aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
   return NS_OK;
 }
 
 nsresult
 nsXULDropmarkerAccessible::GetStateInternal(PRUint32 *aState,
                                             PRUint32 *aExtraState)
 {
   *aState = 0;
@@ -321,19 +322,20 @@ nsXULDropmarkerAccessible::GetStateInter
 nsXULCheckboxAccessible::nsXULCheckboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
 nsFormControlAccessible(aNode, aShell)
 { 
 }
 
 /**
   * We are a CheckButton
   */
-NS_IMETHODIMP nsXULCheckboxAccessible::GetRole(PRUint32 *_retval)
+nsresult
+nsXULCheckboxAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  *_retval = nsIAccessibleRole::ROLE_CHECKBUTTON;
+  *aRole = nsIAccessibleRole::ROLE_CHECKBUTTON;
   return NS_OK;
 }
 
 /**
   * Only one action available
   */
 NS_IMETHODIMP nsXULCheckboxAccessible::GetNumActions(PRUint8 *_retval)
 {
@@ -407,17 +409,18 @@ nsXULCheckboxAccessible::GetStateInterna
   * XUL groupbox
   */
 
 nsXULGroupboxAccessible::nsXULGroupboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
 nsAccessibleWrap(aNode, aShell)
 { 
 }
 
-NS_IMETHODIMP nsXULGroupboxAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXULGroupboxAccessible::GetRoleInternal(PRUint32 *aRole)
 {
   *aRole = nsIAccessibleRole::ROLE_GROUPING;
   return NS_OK;
 }
 
 nsresult
 nsXULGroupboxAccessible::GetNameInternal(nsAString& aName)
 {
@@ -470,19 +473,20 @@ nsXULGroupboxAccessible::GetRelationByTy
   */
 NS_IMPL_ISUPPORTS_INHERITED1(nsXULProgressMeterAccessible, nsFormControlAccessible, nsIAccessibleValue)
 
 nsXULProgressMeterAccessible::nsXULProgressMeterAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
 nsFormControlAccessible(aNode, aShell)
 { 
 }
 
-NS_IMETHODIMP nsXULProgressMeterAccessible::GetRole(PRUint32 *_retval)
+nsresult
+nsXULProgressMeterAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  *_retval = nsIAccessibleRole::ROLE_PROGRESSBAR;
+  *aRole = nsIAccessibleRole::ROLE_PROGRESSBAR;
   return NS_OK;
 }
 
 NS_IMETHODIMP nsXULProgressMeterAccessible::GetValue(nsAString& aValue)
 {
   aValue.Truncate();
   nsAccessible::GetValue(aValue);
   if (!aValue.IsEmpty()) {
@@ -596,19 +600,20 @@ nsXULRadioButtonAccessible::GetAttribute
   */
 
 /** Constructor */
 nsXULRadioGroupAccessible::nsXULRadioGroupAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
 nsXULSelectableAccessible(aNode, aShell)
 { 
 }
 
-NS_IMETHODIMP nsXULRadioGroupAccessible::GetRole(PRUint32 *_retval)
+nsresult
+nsXULRadioGroupAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  *_retval = nsIAccessibleRole::ROLE_GROUPING;
+  *aRole = nsIAccessibleRole::ROLE_GROUPING;
   return NS_OK;
 }
 
 nsresult
 nsXULRadioGroupAccessible::GetStateInternal(PRUint32 *aState,
                                             PRUint32 *aExtraState)
 {
   nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
@@ -632,19 +637,20 @@ nsXULRadioGroupAccessible::GetStateInter
 nsXULStatusBarAccessible::nsXULStatusBarAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
 nsAccessibleWrap(aNode, aShell)
 { 
 }
 
 /**
   * We are a statusbar
   */
-NS_IMETHODIMP nsXULStatusBarAccessible::GetRole(PRUint32 *_retval)
+nsresult
+nsXULStatusBarAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  *_retval = nsIAccessibleRole::ROLE_STATUSBAR;
+  *aRole = nsIAccessibleRole::ROLE_STATUSBAR;
   return NS_OK;
 }
 
 /**
   * XUL Toolbar Button
   */
 nsXULToolbarButtonAccessible::nsXULToolbarButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
 nsXULButtonAccessible(aNode, aShell)
@@ -708,34 +714,36 @@ nsXULToolbarButtonAccessible::IsSeparato
   * XUL ToolBar
   */
 
 nsXULToolbarAccessible::nsXULToolbarAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
 nsAccessibleWrap(aNode, aShell)
 { 
 }
 
-NS_IMETHODIMP nsXULToolbarAccessible::GetRole(PRUint32 *_retval)
+nsresult
+nsXULToolbarAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  *_retval = nsIAccessibleRole::ROLE_TOOLBAR;
+  *aRole = nsIAccessibleRole::ROLE_TOOLBAR;
   return NS_OK;
 }
 
 /**
   * XUL Toolbar Separator
   */
 
 nsXULToolbarSeparatorAccessible::nsXULToolbarSeparatorAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
 nsLeafAccessible(aNode, aShell)
 { 
 }
 
-NS_IMETHODIMP nsXULToolbarSeparatorAccessible::GetRole(PRUint32 *_retval)
+nsresult
+nsXULToolbarSeparatorAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  *_retval = nsIAccessibleRole::ROLE_SEPARATOR;
+  *aRole = nsIAccessibleRole::ROLE_SEPARATOR;
   return NS_OK;
 }
 
 nsresult
 nsXULToolbarSeparatorAccessible::GetStateInternal(PRUint32 *aState,
                                                   PRUint32 *aExtraState)
 {
   *aState = 0;  // no special state flags for toolbar separator
@@ -860,17 +868,18 @@ nsXULTextFieldAccessible::GetStateIntern
   }
   else {
     *aExtraState |= nsIAccessibleStates::EXT_STATE_SINGLE_LINE;
   }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULTextFieldAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXULTextFieldAccessible::GetRoleInternal(PRUint32 *aRole)
 {
   *aRole = nsIAccessibleRole::ROLE_ENTRY;
   nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
   if (content &&
       content->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
                            nsAccessibilityAtoms::password, eIgnoreCase)) {
     *aRole = nsIAccessibleRole::ROLE_PASSWORD_TEXT;
   }
--- a/accessible/src/xul/nsXULFormControlAccessible.h
+++ b/accessible/src/xul/nsXULFormControlAccessible.h
@@ -49,86 +49,88 @@
 class nsXULButtonAccessible : public nsAccessibleWrap
 // Don't inherit from nsFormControlAccessible - it doesn't allow children and a button can have a dropmarker child
 {
 public:
   enum { eAction_Click = 0 };
   nsXULButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *_retval); 
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
 protected:
   void CacheChildren();
 };
 
 class nsXULCheckboxAccessible : public nsFormControlAccessible
 {
 public:
   enum { eAction_Click = 0 };
   nsXULCheckboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *_retval); 
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 class nsXULDropmarkerAccessible : public nsFormControlAccessible
 {
 public:
   enum { eAction_Click = 0 };
   nsXULDropmarkerAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *_retval); 
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
 private:
   PRBool DropmarkerOpen(PRBool aToggleOpen);
 };
 
 class nsXULGroupboxAccessible : public nsAccessibleWrap
 {
 public:
   nsXULGroupboxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *_retval); 
   NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
                                nsIAccessibleRelation **aRelation);
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetNameInternal(nsAString& aName);
 };
 
 class nsXULProgressMeterAccessible : public nsFormControlAccessible
 {
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIACCESSIBLEVALUE
 
 public:
   nsXULProgressMeterAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
-  NS_IMETHOD GetRole(PRUint32 *aRole); 
   NS_IMETHOD GetValue(nsAString &aValue);
+
+  // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
 };
 
 class nsXULRadioButtonAccessible : public nsRadioButtonAccessible
 {
 
 public:
   nsXULRadioButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
@@ -137,78 +139,78 @@ public:
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 class nsXULRadioGroupAccessible : public nsXULSelectableAccessible
 {
 public:
   nsXULRadioGroupAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
-  // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
-
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 class nsXULStatusBarAccessible : public nsAccessibleWrap
 {
 public:
   nsXULStatusBarAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
-  NS_IMETHOD GetRole(PRUint32 *aRole);
+
+  // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
 };
 
 class nsXULToolbarButtonAccessible : public nsXULButtonAccessible
 {
 public:
   nsXULToolbarButtonAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
   static PRBool IsSeparator(nsIAccessible *aAccessible);
 };
 
 class nsXULToolbarAccessible : public nsAccessibleWrap
 {
 public:
   nsXULToolbarAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
-  NS_IMETHOD GetRole(PRUint32 *_retval); 
+
+  // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
 };
 
 class nsXULToolbarSeparatorAccessible : public nsLeafAccessible
 {
 public:
   nsXULToolbarSeparatorAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
-  // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
-
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 class nsXULTextFieldAccessible : public nsHyperTextAccessibleWrap
 {
 public:
   enum { eAction_Click = 0 };
 
   nsXULTextFieldAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
   NS_IMETHOD GetValue(nsAString& aValue);
-  NS_IMETHOD GetRole(PRUint32 *aRole);
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
   NS_IMETHOD GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren);
 
   // nsIAccessibleEditableText
   NS_IMETHOD GetAssociatedEditor(nsIEditor **aEditor);
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
 protected:
   already_AddRefed<nsIDOMNode> GetInputField();
 };
 
 
 #endif  
--- a/accessible/src/xul/nsXULMenuAccessible.cpp
+++ b/accessible/src/xul/nsXULMenuAccessible.cpp
@@ -420,19 +420,18 @@ nsXULMenuitemAccessible::GetKeyboardShor
     // We do not use nsCoreUtils::GetAccesskeyFor() because accesskeys for
     // menu are't registered by nsIEventStateManager.
     elt->GetAttribute(NS_LITERAL_STRING("accesskey"), accesskey);
     if (accesskey.IsEmpty())
       return NS_OK;
 
     nsCOMPtr<nsIAccessible> parentAccessible(GetParent());
     if (parentAccessible) {
-      PRUint32 role;
-      parentAccessible->GetRole(&role);
-      if (role == nsIAccessibleRole::ROLE_MENUBAR) {
+      if (nsAccUtils::RoleInternal(parentAccessible) ==
+          nsIAccessibleRole::ROLE_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 = 0;
           nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
           if (prefBranch)
             prefBranch->GetIntPref("ui.key.menuAccessKey", &gMenuAccesskeyModifier);
@@ -468,17 +467,18 @@ nsXULMenuitemAccessible::GetDefaultKeyBi
   if (accelText.IsEmpty())
     return NS_OK;
 
   aKeyBinding = accelText;
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULMenuitemAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXULMenuitemAccessible::GetRoleInternal(PRUint32 *aRole)
 {
   nsCOMPtr<nsIDOMXULContainerElement> xulContainer(do_QueryInterface(mDOMNode));
   if (xulContainer) {
     *aRole = nsIAccessibleRole::ROLE_PARENT_MENUITEM;
     return NS_OK;
   }
 
   nsCOMPtr<nsIAccessible> parent;
@@ -572,19 +572,20 @@ nsXULMenuSeparatorAccessible::GetStateIn
 }
 
 nsresult
 nsXULMenuSeparatorAccessible::GetNameInternal(nsAString& aName)
 {
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULMenuSeparatorAccessible::GetRole(PRUint32 *_retval)
+nsresult
+nsXULMenuSeparatorAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  *_retval = nsIAccessibleRole::ROLE_SEPARATOR;
+  *aRole = nsIAccessibleRole::ROLE_SEPARATOR;
   return NS_OK;
 }
 
 NS_IMETHODIMP nsXULMenuSeparatorAccessible::DoAction(PRUint8 index)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
@@ -689,17 +690,18 @@ nsXULMenupopupAccessible::GetNameInterna
   while (content && aName.IsEmpty()) {
     content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::label, aName);
     content = content->GetParent();
   }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULMenupopupAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXULMenupopupAccessible::GetRoleInternal(PRUint32 *aRole)
 {
   nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
   if (!content) {
     return NS_ERROR_FAILURE;
   }
   nsCOMPtr<nsIAccessible> parent;
   GetParent(getter_AddRefs(parent));
   if (parent) {
@@ -738,14 +740,15 @@ nsXULMenubarAccessible::GetStateInternal
 
 nsresult
 nsXULMenubarAccessible::GetNameInternal(nsAString& aName)
 {
   aName.AssignLiteral("Application");
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULMenubarAccessible::GetRole(PRUint32 *_retval)
+nsresult
+nsXULMenubarAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  *_retval = nsIAccessibleRole::ROLE_MENUBAR;
+  *aRole = nsIAccessibleRole::ROLE_MENUBAR;
   return NS_OK;
 }
 
--- a/accessible/src/xul/nsXULMenuAccessible.h
+++ b/accessible/src/xul/nsXULMenuAccessible.h
@@ -76,72 +76,68 @@ public:
   enum { eAction_Click = 0 };
 
   nsXULMenuitemAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
 
   // nsIAccessible
   NS_IMETHOD GetDescription(nsAString& aDescription);
   NS_IMETHOD GetKeyboardShortcut(nsAString& _retval);
   NS_IMETHOD GetDefaultKeyBinding(nsAString& aKeyBinding);
-  NS_IMETHOD GetRole(PRUint32 *_retval); 
   NS_IMETHOD DoAction(PRUint8 index);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
 
   // nsAccessNode
   virtual nsresult Init();
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
 
   NS_IMETHOD GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren);
 };
 
 class nsXULMenuSeparatorAccessible : public nsXULMenuitemAccessible
 {
 public:
   nsXULMenuSeparatorAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *_retval); 
   NS_IMETHOD DoAction(PRUint8 index);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 class nsXULMenupopupAccessible : public nsXULSelectableAccessible
 {
 public:
   nsXULMenupopupAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
 
-  // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
-
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
   // nsXULMenupopupAccessible
   static already_AddRefed<nsIDOMNode> FindInNodeList(nsIDOMNodeList *aNodeList,
                                                      nsIAtom *aAtom, PRUint32 aNameSpaceID);
   static void GenerateMenu(nsIDOMNode *aNode);
 };
 
 class nsXULMenubarAccessible : public nsAccessibleWrap
 {
 public:
   nsXULMenubarAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
 
-  // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *_retval); 
-
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 #endif  
--- a/accessible/src/xul/nsXULSelectAccessible.cpp
+++ b/accessible/src/xul/nsXULSelectAccessible.cpp
@@ -53,21 +53,19 @@
 // nsXULColumnsAccessible
 
 nsXULColumnsAccessible::
   nsXULColumnsAccessible(nsIDOMNode *aDOMNode, nsIWeakReference *aShell) :
   nsAccessibleWrap(aDOMNode, aShell)
 {
 }
 
-NS_IMETHODIMP
-nsXULColumnsAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXULColumnsAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  NS_ENSURE_ARG_POINTER(aRole);
-
   *aRole = nsIAccessibleRole::ROLE_LIST;
   return NS_OK;
 }
 
 nsresult
 nsXULColumnsAccessible::GetStateInternal(PRUint32 *aState,
                                          PRUint32 *aExtraState)
 {
@@ -93,21 +91,19 @@ nsXULColumnsAccessible::GetStateInternal
 // nsXULColumnItemAccessible
 
 nsXULColumnItemAccessible::
   nsXULColumnItemAccessible(nsIDOMNode *aDOMNode, nsIWeakReference *aShell) :
   nsLeafAccessible(aDOMNode, aShell)
 {
 }
 
-NS_IMETHODIMP
-nsXULColumnItemAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXULColumnItemAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  NS_ENSURE_ARG_POINTER(aRole);
-
   *aRole = nsIAccessibleRole::ROLE_COLUMNHEADER;
   return NS_OK;
 }
 
 nsresult
 nsXULColumnItemAccessible::GetStateInternal(PRUint32 *aState,
                                             PRUint32 *aExtraState)
 {
@@ -234,17 +230,18 @@ NS_IMETHODIMP nsXULListboxAccessible::Ge
     nsCOMPtr<nsIDOMXULSelectControlItemElement> selectedItem;
     select->GetSelectedItem(getter_AddRefs(selectedItem));
     if (selectedItem)
       return selectedItem->GetLabel(_retval);
   }
   return NS_ERROR_FAILURE;
 }
 
-NS_IMETHODIMP nsXULListboxAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXULListboxAccessible::GetRoleInternal(PRUint32 *aRole)
 {
   nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode);
   if (content) {
     // A richlistbox is used with the new autocomplete URL bar,
     // and has a parent popup <panel>
     nsCOMPtr<nsIDOMXULPopupElement> xulPopup =
       do_QueryInterface(content->GetParent());
     if (xulPopup) {
@@ -882,20 +879,18 @@ nsXULListitemAccessible::GetNameInternal
         childElement->GetAttribute(NS_LITERAL_STRING("label"), aName);
         return NS_OK;
       }
     }
   }
   return GetXULName(aName);
 }
 
-/**
-  *
-  */
-NS_IMETHODIMP nsXULListitemAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXULListitemAccessible::GetRoleInternal(PRUint32 *aRole)
 {
   nsCOMPtr<nsIAccessible> listAcc = GetListAccessible();
   NS_ENSURE_STATE(listAcc);
 
   if (nsAccUtils::Role(listAcc) == nsIAccessibleRole::ROLE_TABLE) {
     *aRole = nsIAccessibleRole::ROLE_ROW;
     return NS_OK;
   }
@@ -992,21 +987,19 @@ nsXULListitemAccessible::GetAttributesIn
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULListCellAccessible
 nsXULListCellAccessible::
   nsXULListCellAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell):
   nsHyperTextAccessibleWrap(aDOMNode, aShell)
 {
 }
 
-NS_IMETHODIMP
-nsXULListCellAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXULListCellAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  NS_ENSURE_ARG_POINTER(aRole);
-
   *aRole = nsIAccessibleRole::ROLE_CELL;
   return NS_OK;
 }
 
 /** ------------------------------------------------------ */
 /**  Finally, the Combobox widgets                         */
 /** ------------------------------------------------------ */
 
@@ -1022,17 +1015,18 @@ nsresult
 nsXULComboboxAccessible::Init()
 {
   nsresult rv = nsAccessibleWrap::Init();
   nsXULMenupopupAccessible::GenerateMenu(mDOMNode);
   return rv;
 }
 
 /** We are a combobox */
-NS_IMETHODIMP nsXULComboboxAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXULComboboxAccessible::GetRoleInternal(PRUint32 *aRole)
 {
   nsCOMPtr<nsIContent> content = do_QueryInterface(mDOMNode);
   if (!content) {
     return NS_ERROR_FAILURE;
   }
   if (content->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
                            NS_LITERAL_STRING("autocomplete"), eIgnoreCase)) {
     *aRole = nsIAccessibleRole::ROLE_AUTOCOMPLETE;
--- a/accessible/src/xul/nsXULSelectAccessible.h
+++ b/accessible/src/xul/nsXULSelectAccessible.h
@@ -50,40 +50,37 @@ class nsIWeakReference;
  * nsXULColumnsAccessible are accessible for list and tree columns elements
  * (xul:treecols and xul:listcols).
  */
 class nsXULColumnsAccessible : public nsAccessibleWrap
 {
 public:
   nsXULColumnsAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
 
-  // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
-
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 /**
  * nsXULColumnAccessible are accessibles for list and tree column elements
  * (xul:listcol and xul:treecol).
  */
 class nsXULColumnItemAccessible : public nsLeafAccessible
 {
 public:
   nsXULColumnItemAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
-
   NS_IMETHOD GetNumActions(PRUint8 *aNumActions);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
   enum { eAction_Click = 0 };
 };
 
 /**
   * Listboxes (xul:listbox) and Comboboxes (xul:menulist) are made up of a
   * number of different widgets, some of which are shared between the two.
@@ -112,20 +109,20 @@ class nsXULListboxAccessible : public ns
 public:
   nsXULListboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
   virtual ~nsXULListboxAccessible() {}
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIACCESSIBLETABLE
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
   NS_IMETHOD GetValue(nsAString& aValue);
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
 protected:
   PRBool IsTree();
 };
 
 /**
   * Listitems -- used in listboxes 
@@ -136,24 +133,24 @@ public:
   enum { eAction_Click = 0 };
 
   NS_DECL_ISUPPORTS_INHERITED
   
   nsXULListitemAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
   virtual ~nsXULListitemAccessible() {}
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *_retval);
   NS_IMETHOD GetActionName(PRUint8 index, nsAString& aName);
   // Don't use XUL menuitems's description attribute
   NS_IMETHOD GetDescription(nsAString& aDesc) { return nsAccessibleWrap::GetDescription(aDesc); }
   NS_IMETHOD GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
 
 protected:
   already_AddRefed<nsIAccessible> GetListAccessible();
 
 private:
   PRBool mIsCheckbox;
@@ -162,18 +159,18 @@ private:
 /**
  * Class represents xul:listcell.
  */
 class nsXULListCellAccessible : public nsHyperTextAccessibleWrap
 {
 public:
   nsXULListCellAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
 
-  // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
+  // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
 };
 
 /** ------------------------------------------------------ */
 /**  Finally, the Combobox widgets                         */
 /** ------------------------------------------------------ */
 
 /*
  * A class the represents the XUL Combobox widget.
@@ -182,24 +179,24 @@ class nsXULComboboxAccessible : public n
 {
 public:
   enum { eAction_Click = 0 };
 
   nsXULComboboxAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
   virtual ~nsXULComboboxAccessible() {}
 
   /* ----- nsIAccessible ----- */
-  NS_IMETHOD GetRole(PRUint32 *_retval);
   NS_IMETHOD GetValue(nsAString& _retval);
   NS_IMETHOD GetDescription(nsAString& aDescription);
   NS_IMETHOD GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren);
   NS_IMETHOD DoAction(PRUint8 index);
   NS_IMETHOD GetNumActions(PRUint8 *aNumActions);
   NS_IMETHOD GetActionName(PRUint8 index, nsAString& aName);
 
   // nsAccessNode
   virtual nsresult Init();
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 #endif
--- a/accessible/src/xul/nsXULSliderAccessible.cpp
+++ b/accessible/src/xul/nsXULSliderAccessible.cpp
@@ -46,21 +46,19 @@
 nsXULSliderAccessible::nsXULSliderAccessible(nsIDOMNode* aNode,
                                              nsIWeakReference* aShell) :
   nsAccessibleWrap(aNode, aShell)
 {
 }
 
 // nsIAccessible
 
-NS_IMETHODIMP
-nsXULSliderAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXULSliderAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  NS_ENSURE_ARG_POINTER(aRole);
-
   *aRole = nsIAccessibleRole::ROLE_SLIDER;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXULSliderAccessible::GetValue(nsAString& aValue)
 {
   return GetSliderAttr(nsAccessibilityAtoms::curpos, aValue);
@@ -228,17 +226,15 @@ nsXULSliderAccessible::SetSliderAttr(nsI
 // nsXULThumbAccessible
 
 nsXULThumbAccessible::nsXULThumbAccessible(nsIDOMNode* aNode,
                                            nsIWeakReference* aShell) :
   nsAccessibleWrap(aNode, aShell) {}
 
 // nsIAccessible
 
-NS_IMETHODIMP
-nsXULThumbAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXULThumbAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  NS_ENSURE_ARG_POINTER(aRole);
-
   *aRole = nsIAccessibleRole::ROLE_INDICATOR;
   return NS_OK;
 }
 
--- a/accessible/src/xul/nsXULSliderAccessible.h
+++ b/accessible/src/xul/nsXULSliderAccessible.h
@@ -44,29 +44,31 @@
 #include "nsIDOMElement.h"
 
 class nsXULSliderAccessible : public nsAccessibleWrap
 {
 public:
   nsXULSliderAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
   NS_IMETHOD GetValue(nsAString& aValue);
 
   // nsIAccessibleValue
   NS_IMETHOD GetMaximumValue(double *aMaximumValue);
   NS_IMETHOD GetMinimumValue(double *aMinimumValue);
   NS_IMETHOD GetMinimumIncrement(double *aMinIncrement);
   NS_IMETHOD GetCurrentValue(double *aValue);
   NS_IMETHOD SetCurrentValue(double aValue);
 
   // nsPIAccessible
   NS_IMETHOD GetAllowsAnonChildAccessibles(PRBool *aAllowsAnonChildren);
 
+  // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+
 protected:
   already_AddRefed<nsIContent> GetSliderNode();
 
   nsresult GetSliderAttr(nsIAtom *aName, nsAString& aValue);
   nsresult SetSliderAttr(nsIAtom *aName, const nsAString& aValue);
 
   nsresult GetSliderAttr(nsIAtom *aName, double *aValue);
   nsresult SetSliderAttr(nsIAtom *aName, double aValue);
@@ -76,14 +78,14 @@ private:
 };
 
 
 class nsXULThumbAccessible : public nsAccessibleWrap
 {
 public:
   nsXULThumbAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
-  // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
+  // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
 };
 
 #endif
 
--- a/accessible/src/xul/nsXULTabAccessible.cpp
+++ b/accessible/src/xul/nsXULTabAccessible.cpp
@@ -82,19 +82,20 @@ NS_IMETHODIMP nsXULTabAccessible::DoActi
       return NS_OK;
     }
     return NS_ERROR_FAILURE;
   }
   return NS_ERROR_INVALID_ARG;
 }
 
 /** We are a tab */
-NS_IMETHODIMP nsXULTabAccessible::GetRole(PRUint32 *_retval)
+nsresult
+nsXULTabAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  *_retval = nsIAccessibleRole::ROLE_PAGETAB;
+  *aRole = nsIAccessibleRole::ROLE_PAGETAB;
   return NS_OK;
 }
 
 /**
   * Possible states: focused, focusable, unavailable(disabled), offscreen
   */
 nsresult
 nsXULTabAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
@@ -222,19 +223,20 @@ nsXULTabAccessible::GetAttributesInterna
 
 /** Constructor */
 nsXULTabBoxAccessible::nsXULTabBoxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
 nsAccessibleWrap(aNode, aShell)
 { 
 }
 
 /** We are a window*/
-NS_IMETHODIMP nsXULTabBoxAccessible::GetRole(PRUint32 *_retval)
+nsresult
+nsXULTabBoxAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  *_retval = nsIAccessibleRole::ROLE_PANE;
+  *aRole = nsIAccessibleRole::ROLE_PANE;
   return NS_OK;
 }
 
 #ifdef NEVER
 /** 2 children, tabs, tabpanels */
 NS_IMETHODIMP nsXULTabBoxAccessible::GetChildCount(PRInt32 *_retval)
 {
   *_retval = 2;
@@ -248,19 +250,20 @@ NS_IMETHODIMP nsXULTabBoxAccessible::Get
 
 /** Constructor */
 nsXULTabsAccessible::nsXULTabsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
 nsXULSelectableAccessible(aNode, aShell)
 { 
 }
 
 /** We are a Page Tab List */
-NS_IMETHODIMP nsXULTabsAccessible::GetRole(PRUint32 *_retval)
+nsresult
+nsXULTabsAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  *_retval = nsIAccessibleRole::ROLE_PAGETABLIST;
+  *aRole = nsIAccessibleRole::ROLE_PAGETABLIST;
   return NS_OK;
 }
 
 /** no actions */
 NS_IMETHODIMP nsXULTabsAccessible::GetNumActions(PRUint8 *_retval)
 {
   *_retval = 0;
   return NS_OK;
@@ -283,21 +286,19 @@ nsXULTabsAccessible::GetNameInternal(nsA
 // nsXULTabpanelAccessible
 
 nsXULTabpanelAccessible::
   nsXULTabpanelAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
   nsAccessibleWrap(aNode, aShell)
 {
 }
 
-NS_IMETHODIMP
-nsXULTabpanelAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXULTabpanelAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  NS_ENSURE_ARG_POINTER(aRole);
-
   *aRole = nsIAccessibleRole::ROLE_PROPERTYPAGE;
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXULTabpanelAccessible::GetRelationByType(PRUint32 aRelationType,
                                            nsIAccessibleRelation **aRelation)
 {
--- a/accessible/src/xul/nsXULTabAccessible.h
+++ b/accessible/src/xul/nsXULTabAccessible.h
@@ -49,68 +49,72 @@
 class nsXULTabAccessible : public nsLeafAccessible
 {
 public:
   enum { eAction_Switch = 0 };
 
   nsXULTabAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *_retval); 
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
   NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
                                nsIAccessibleRelation **aRelation);
 
   // nsAccessible
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 /** 
   * Contains a tabs object and a tabPanels object. A complete
   *    entity with relationships between tabs and content to
   *    be displayed in the tabpanels object
   */
 class nsXULTabBoxAccessible : public nsAccessibleWrap
 {
 public:
   nsXULTabBoxAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
-  NS_IMETHOD GetRole(PRUint32 *_retval); 
+
+  // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
 };
 
 /**
  * A container of tab obejcts, xul:tabs element.
  */
 class nsXULTabsAccessible : public nsXULSelectableAccessible
 {
 public:
   nsXULTabsAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *_retval);
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
   NS_IMETHOD GetValue(nsAString& _retval);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
 };
 
 /**
  * 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.
  */
 class nsXULTabpanelAccessible : public nsAccessibleWrap
 {
 public:
   nsXULTabpanelAccessible(nsIDOMNode *aNode, nsIWeakReference *aShell);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
   NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
                                nsIAccessibleRelation **aRelation);
+
+  // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
 };
 
 #endif
 
--- a/accessible/src/xul/nsXULTextAccessible.cpp
+++ b/accessible/src/xul/nsXULTextAccessible.cpp
@@ -63,16 +63,23 @@ nsXULTextAccessible::GetNameInternal(nsA
 
   // if the value attr doesn't exist, the screen reader must get the accessible text
   // from the accessible text interface or from the children
   content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::value, aName);
   return NS_OK;
 }
 
 nsresult
+nsXULTextAccessible::GetRoleInternal(PRUint32 *aRole)
+{
+  *aRole = nsIAccessibleRole::ROLE_LABEL;
+  return NS_OK;
+}
+
+nsresult
 nsXULTextAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
 {
   nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState,
                                                             aExtraState);
   NS_ENSURE_A11Y_SUCCESS(rv, rv);
 
   // Labels and description have read only state
   // They are not focusable or selectable
@@ -122,19 +129,20 @@ nsXULTooltipAccessible::GetStateInternal
   nsresult rv = nsLeafAccessible::GetStateInternal(aState, aExtraState);
   NS_ENSURE_A11Y_SUCCESS(rv, rv);
 
   *aState &= ~nsIAccessibleStates::STATE_FOCUSABLE;
   *aState |= nsIAccessibleStates::STATE_READONLY;
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULTooltipAccessible::GetRole(PRUint32 *_retval)
+nsresult
+nsXULTooltipAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  *_retval = nsIAccessibleRole::ROLE_TOOLTIP;
+  *aRole = nsIAccessibleRole::ROLE_TOOLTIP;
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULLinkAccessible
 
 nsXULLinkAccessible::
   nsXULLinkAccessible(nsIDOMNode *aDomNode, nsIWeakReference *aShell):
@@ -171,21 +179,19 @@ nsXULLinkAccessible::GetNameInternal(nsA
   nsCOMPtr<nsIContent> content(do_QueryInterface(mDOMNode));
   content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::value, aName);
   if (!aName.IsEmpty())
     return NS_OK;
 
   return nsTextEquivUtils::GetNameFromSubtree(this, aName);
 }
 
-NS_IMETHODIMP
-nsXULLinkAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXULLinkAccessible::GetRoleInternal(PRUint32 *aRole)
 {
-  NS_ENSURE_ARG_POINTER(aRole);
-
   *aRole = nsIAccessibleRole::ROLE_LINK;
   return NS_OK;
 }
 
 
 nsresult
 nsXULLinkAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
 {
--- a/accessible/src/xul/nsXULTextAccessible.h
+++ b/accessible/src/xul/nsXULTextAccessible.h
@@ -48,59 +48,57 @@ class nsIWeakReference;
 
 class nsXULTextAccessible : public nsHyperTextAccessibleWrap
 {
 
 public:
   nsXULTextAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole) { *aRole = nsIAccessibleRole::ROLE_LABEL; return NS_OK; }
   NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
                                nsIAccessibleRelation **aRelation);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 class nsXULTooltipAccessible : public nsLeafAccessible
 {
 
 public:
   nsXULTooltipAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
 
-  // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *_retval); 
-
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 class nsXULLinkAccessible : public nsHyperTextAccessibleWrap
 {
 
 public:
   nsXULLinkAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *aRole);
   NS_IMETHOD GetValue(nsAString& aValue);
 
   NS_IMETHOD GetNumActions(PRUint8 *aNumActions);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsIAccessibleHyperLink
   NS_IMETHOD GetURI(PRInt32 aIndex, nsIURI **aURI);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
 protected:
   enum { eAction_Jump = 0 };
 
 };
 
 #endif  
--- a/accessible/src/xul/nsXULTreeAccessible.cpp
+++ b/accessible/src/xul/nsXULTreeAccessible.cpp
@@ -233,17 +233,18 @@ nsXULTreeAccessible::Shutdown()
     ClearCache(*mAccessNodeCache);
     delete mAccessNodeCache;
     mAccessNodeCache = nsnull;
   }
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsXULTreeAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXULTreeAccessible::GetRoleInternal(PRUint32 *aRole)
 {
   NS_ASSERTION(mTree, "No tree view");
   PRInt32 colCount = 0;
   if (NS_SUCCEEDED(GetColumnCount(mTree, &colCount)) && (colCount > 1))
     *aRole = nsIAccessibleRole::ROLE_TREE_TABLE;
   else
     *aRole = nsIAccessibleRole::ROLE_OUTLINE;
   return NS_OK;
@@ -821,17 +822,18 @@ nsresult
 nsXULTreeitemAccessible::Init()
 {
   nsresult rv = nsLeafAccessible::Init();
   NS_ENSURE_SUCCESS(rv, rv);
 
   return GetName(mCachedName);
 }
 
-NS_IMETHODIMP nsXULTreeitemAccessible::GetRole(PRUint32 *aRole)
+nsresult
+nsXULTreeitemAccessible::GetRoleInternal(PRUint32 *aRole)
 {
   PRInt32 colCount = 0;
   if (NS_SUCCEEDED(nsXULTreeAccessible::GetColumnCount(mTree, &colCount)) && colCount > 1)
     *aRole = nsIAccessibleRole::ROLE_CELL;
   else
     *aRole = nsIAccessibleRole::ROLE_OUTLINEITEM;
   return NS_OK;
 }
--- a/accessible/src/xul/nsXULTreeAccessible.h
+++ b/accessible/src/xul/nsXULTreeAccessible.h
@@ -57,31 +57,31 @@ public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIACCESSIBLESELECTABLE
   NS_DECL_NSIACCESSIBLETREECACHE
 
   nsXULTreeAccessible(nsIDOMNode* aDOMNode, nsIWeakReference* aShell);
   virtual ~nsXULTreeAccessible() {}
 
   // nsIAccessible
-  NS_IMETHOD GetRole(PRUint32 *_retval);
   NS_IMETHOD GetValue(nsAString& _retval);
 
   NS_IMETHOD GetFirstChild(nsIAccessible **_retval);
   NS_IMETHOD GetLastChild(nsIAccessible **_retval);
   NS_IMETHOD GetChildCount(PRInt32 *_retval);
   NS_IMETHOD GetFocusedChild(nsIAccessible **aFocusedChild);
 
   NS_IMETHOD GetDeepestChildAtPoint(PRInt32 aX, PRInt32 aY,
                                     nsIAccessible **aAccessible);
 
   // nsAccessNode
   virtual nsresult Shutdown();
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
   // nsXULTreeAccessible
   static void GetTreeBoxObject(nsIDOMNode* aDOMNode, nsITreeBoxObject** aBoxObject);
   static nsresult GetColumnCount(nsITreeBoxObject* aBoxObject, PRInt32 *aCount);
 
   static PRBool IsColumnHidden(nsITreeColumn *aColumn);
   static already_AddRefed<nsITreeColumn> GetNextVisibleColumn(nsITreeColumn *aColumn);
@@ -108,17 +108,16 @@ public:
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSPIACCESSIBLETREEITEM
 
   nsXULTreeitemAccessible(nsIAccessible *aParent, nsIDOMNode *aDOMNode, nsIWeakReference *aShell, PRInt32 aRow, nsITreeColumn* aColumn = nsnull);
   virtual ~nsXULTreeitemAccessible() {}
 
   // nsIAccessible
   NS_IMETHOD GetName(nsAString& aName);
-  NS_IMETHOD GetRole(PRUint32 *_retval);
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
 
   NS_IMETHOD GetParent(nsIAccessible **_retval);
   NS_IMETHOD GetNextSibling(nsIAccessible **_retval);
   NS_IMETHOD GetPreviousSibling(nsIAccessible **_retval);
 
@@ -134,16 +133,17 @@ public:
   NS_IMETHOD GetUniqueID(void **aUniqueID);
 
   // nsAccessNode
   virtual PRBool IsDefunct();
   virtual nsresult Init();
   virtual nsresult Shutdown();
 
   // nsAccessible
+  virtual nsresult GetRoleInternal(PRUint32 *aRole);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
 protected:
   PRBool IsExpandable();
   nsCOMPtr<nsITreeBoxObject> mTree;
   nsCOMPtr<nsITreeView> mTreeView;
   PRInt32 mRow;
   nsCOMPtr<nsITreeColumn> mColumn;
--- a/accessible/tests/mochitest/role.js
+++ b/accessible/tests/mochitest/role.js
@@ -57,15 +57,15 @@ function testRole(aAccOrElmOrID, aRole)
 function getRole(aAccOrElmOrID)
 {
   var acc = getAccessible(aAccOrElmOrID);
   if (!acc)
     return -1;
 
   var role = -1;
   try {
-    role = acc.finalRole;
+    role = acc.role;
   } catch(e) {
     ok(false, "Role for " + aAccOrElmOrID + " could not be retrieved!");
   }
 
   return role;
 }