Bug 467139 - NameFromSubtree rule should be based on role, r=aaronlev, marcoz, davidb, sr=neil
authorAlexander Surkov <surkov.alexander@gmail.com>
Wed, 03 Dec 2008 15:18:41 +0800
changeset 22204 45104f550b5205e80fa5f57be7c5815b6fe987dd
parent 22203 2c8799d7166e971a4a97414b239ff2bbeed7e52b
child 22205 e51b963dcc880997438c49e0948d8956e6098c6b
push idunknown
push userunknown
push dateunknown
reviewersaaronlev, marcoz, davidb, neil
bugs467139
milestone1.9.2a1pre
Bug 467139 - NameFromSubtree rule should be based on role, r=aaronlev, marcoz, davidb, sr=neil
accessible/src/base/Makefile.in
accessible/src/base/nsARIAMap.cpp
accessible/src/base/nsARIAMap.h
accessible/src/base/nsAccessible.cpp
accessible/src/base/nsAccessible.h
accessible/src/base/nsNameUtils.cpp
accessible/src/base/nsNameUtils.h
accessible/src/html/nsHTMLFormControlAccessible.cpp
accessible/src/html/nsHTMLFormControlAccessible.h
accessible/src/html/nsHTMLLinkAccessible.cpp
accessible/src/html/nsHTMLLinkAccessible.h
accessible/src/xul/nsXULColorPickerAccessible.cpp
accessible/src/xul/nsXULColorPickerAccessible.h
accessible/src/xul/nsXULSelectAccessible.cpp
accessible/src/xul/nsXULSelectAccessible.h
accessible/src/xul/nsXULTextAccessible.cpp
accessible/src/xul/nsXULTextAccessible.h
--- a/accessible/src/base/Makefile.in
+++ b/accessible/src/base/Makefile.in
@@ -76,16 +76,17 @@ CPPSRCS = \
   nsAccessNode.cpp \
   nsAccessibleEventData.cpp \
   nsARIAMap.cpp \
   nsDocAccessible.cpp \
   nsOuterDocAccessible.cpp \
   nsAccessibilityAtoms.cpp \
   nsCoreUtils.cpp \
   nsAccUtils.cpp \
+  nsNameUtils.cpp \
   nsAccessibilityService.cpp \
   nsAccessible.cpp \
   nsAccessibleRelation.cpp \
   nsAccessibleTreeWalker.cpp \
   nsBaseWidgetAccessible.cpp \
   nsFormControlAccessible.cpp \
   nsRootAccessible.cpp \
   nsApplicationAccessible.cpp \
--- a/accessible/src/base/nsARIAMap.cpp
+++ b/accessible/src/base/nsARIAMap.cpp
@@ -58,506 +58,457 @@
 
 static const nsStateMapEntry kEndEntry = {nsnull, 0, 0};  // To fill in array of state mappings
 
 nsRoleMapEntry nsARIAMap::gWAIRoleMap[] = 
 {
   {
     "alert",
     nsIAccessibleRole::ROLE_ALERT,
-    eNameLabelOrTitle,
     eNoValue,
     eNoAction,
     kNoReqStates,
     kEndEntry
   },
   {
     "alertdialog",
     nsIAccessibleRole::ROLE_ALERT,
-    eNameOkFromChildren,
     eNoValue,
     eNoAction,
     kNoReqStates,
     kEndEntry
   },
   {
     "application",
     nsIAccessibleRole::ROLE_APPLICATION,
-    eNameLabelOrTitle,
     eNoValue,
     eNoAction,
     kNoReqStates,
     kEndEntry
   },
   {
     "article",
     nsIAccessibleRole::ROLE_DOCUMENT,
-    eNameLabelOrTitle,
     eNoValue,
     eNoAction,
     kNoReqStates,
     kEndEntry
   },
   {
     "button",
     nsIAccessibleRole::ROLE_PUSHBUTTON,
-    eNameOkFromChildren,
     eNoValue,
     eClickAction,
     kNoReqStates,
     {&nsAccessibilityAtoms::aria_pressed, kBoolState, nsIAccessibleStates::STATE_PRESSED},
     {&nsAccessibilityAtoms::aria_pressed, "mixed", nsIAccessibleStates::STATE_MIXED},
     kEndEntry
   },
   {
     "checkbox",
     nsIAccessibleRole::ROLE_CHECKBUTTON,
-    eNameOkFromChildren,
     eNoValue,
     eCheckUncheckAction,
     nsIAccessibleStates::STATE_CHECKABLE,
     {&nsAccessibilityAtoms::aria_checked, kBoolState, nsIAccessibleStates::STATE_CHECKED},
     {&nsAccessibilityAtoms::aria_checked, "mixed", nsIAccessibleStates::STATE_MIXED},
     {&nsAccessibilityAtoms::aria_readonly, kBoolState, nsIAccessibleStates::STATE_READONLY},
     kEndEntry
   },
   {
     "columnheader",
     nsIAccessibleRole::ROLE_COLUMNHEADER,
-    eNameOkFromChildren,
     eNoValue,
     eNoAction,
     kNoReqStates,
     {&nsAccessibilityAtoms::aria_selected, kBoolState, nsIAccessibleStates::STATE_SELECTED | nsIAccessibleStates::STATE_SELECTABLE},
     {&nsAccessibilityAtoms::aria_selected, "false", nsIAccessibleStates::STATE_SELECTABLE},
     {&nsAccessibilityAtoms::aria_readonly, kBoolState, nsIAccessibleStates::STATE_READONLY},
     kEndEntry
   },
   {
     "combobox",
     nsIAccessibleRole::ROLE_COMBOBOX,
-    eNameLabelOrTitle,
     eHasValueMinMax,
     eOpenCloseAction,
     nsIAccessibleStates::STATE_COLLAPSED | nsIAccessibleStates::STATE_HASPOPUP,
     // Manually map EXT_STATE_SUPPORTS_AUTOCOMPLETION aria-autocomplete
     {&nsAccessibilityAtoms::aria_readonly, kBoolState, nsIAccessibleStates::STATE_READONLY},
     {&nsAccessibilityAtoms::aria_expanded, kBoolState, nsIAccessibleStates::STATE_EXPANDED},
     kEndEntry
   },
   {
     "description",
     nsIAccessibleRole::ROLE_TEXT_CONTAINER,
-    eNameOkFromChildren,
     eNoValue,
     eNoAction,
     kNoReqStates,
     kEndEntry
   },
   {
     "dialog",
     nsIAccessibleRole::ROLE_DIALOG,
-    eNameLabelOrTitle,
     eNoValue,
     eNoAction,
     kNoReqStates,
     kEndEntry
   },
   {
     "document",
     nsIAccessibleRole::ROLE_DOCUMENT,
-    eNameLabelOrTitle,
     eNoValue,
     eNoAction,
     kNoReqStates,
     kEndEntry
   },
   {
     "grid",
     nsIAccessibleRole::ROLE_TABLE,
-    eNameLabelOrTitle,
     eNoValue,
     eNoAction,
     nsIAccessibleStates::STATE_FOCUSABLE,
     {&nsAccessibilityAtoms::aria_multiselectable, kBoolState, nsIAccessibleStates::STATE_MULTISELECTABLE | nsIAccessibleStates::STATE_EXTSELECTABLE},
     {&nsAccessibilityAtoms::aria_readonly, kBoolState, nsIAccessibleStates::STATE_READONLY},
     kEndEntry
   },
   {
     "gridcell",
     nsIAccessibleRole::ROLE_CELL,
-    eNameOkFromChildren,
     eNoValue,
     eNoAction,
     kNoReqStates,
     {&nsAccessibilityAtoms::aria_expanded, kBoolState, nsIAccessibleStates::STATE_EXPANDED},
     {&nsAccessibilityAtoms::aria_expanded, "false", nsIAccessibleStates::STATE_COLLAPSED},
     {&nsAccessibilityAtoms::aria_selected, kBoolState, nsIAccessibleStates::STATE_SELECTED | nsIAccessibleStates::STATE_SELECTABLE},
     {&nsAccessibilityAtoms::aria_selected, "false", nsIAccessibleStates::STATE_SELECTABLE},
     {&nsAccessibilityAtoms::aria_readonly, kBoolState, nsIAccessibleStates::STATE_READONLY},
     kEndEntry
   },
   {
     "group",
     nsIAccessibleRole::ROLE_GROUPING,
-    eNameLabelOrTitle,
     eNoValue,
     eNoAction,
     kNoReqStates,
     kEndEntry
   },
   {
     "heading",
     nsIAccessibleRole::ROLE_HEADING,
-    eNameLabelOrTitle,
     eNoValue,
     eNoAction,
     kNoReqStates,
     kEndEntry
   },
   {
     "img",
     nsIAccessibleRole::ROLE_GRAPHIC,
-    eNameLabelOrTitle,
     eNoValue,
     eNoAction,
     kNoReqStates,
     kEndEntry
   },
   {
     "label",
     nsIAccessibleRole::ROLE_LABEL,
-    eNameOkFromChildren,
     eNoValue,
     eNoAction,
     kNoReqStates,
     kEndEntry
   },
   {
     "link",
     nsIAccessibleRole::ROLE_LINK,
-    eNameOkFromChildren,
     eNoValue,
     eJumpAction,
     nsIAccessibleStates::STATE_LINKED,
     kEndEntry
   },
   {
     "list",
     nsIAccessibleRole::ROLE_LIST,
-    eNameLabelOrTitle,
     eNoValue,
     eNoAction,
     nsIAccessibleStates::STATE_READONLY,
     {&nsAccessibilityAtoms::aria_multiselectable, kBoolState, nsIAccessibleStates::STATE_MULTISELECTABLE | nsIAccessibleStates::STATE_EXTSELECTABLE},
     kEndEntry
   },
   {
     "listbox",
     nsIAccessibleRole::ROLE_LISTBOX,
-    eNameLabelOrTitle,
     eNoValue,
     eNoAction,
     kNoReqStates,
     {&nsAccessibilityAtoms::aria_readonly, kBoolState, nsIAccessibleStates::STATE_READONLY},
     {&nsAccessibilityAtoms::aria_multiselectable, kBoolState, nsIAccessibleStates::STATE_MULTISELECTABLE | nsIAccessibleStates::STATE_EXTSELECTABLE},
     kEndEntry
   },
   {
     "listitem",
     nsIAccessibleRole::ROLE_LISTITEM,
-    eNameOkFromChildren,
     eNoValue,
     eNoAction, // XXX: should depend on state, parent accessible
     nsIAccessibleStates::STATE_READONLY,
     {&nsAccessibilityAtoms::aria_selected, kBoolState, nsIAccessibleStates::STATE_SELECTED | nsIAccessibleStates::STATE_SELECTABLE},
     {&nsAccessibilityAtoms::aria_selected, "false", nsIAccessibleStates::STATE_SELECTABLE},
     {&nsAccessibilityAtoms::aria_checked, kBoolState, nsIAccessibleStates::STATE_CHECKED | nsIAccessibleStates::STATE_CHECKABLE},
     {&nsAccessibilityAtoms::aria_checked, "mixed", nsIAccessibleStates::STATE_MIXED | nsIAccessibleStates::STATE_CHECKABLE},
     {&nsAccessibilityAtoms::aria_checked, "false", nsIAccessibleStates::STATE_CHECKABLE},
     kEndEntry
   },
   {
     "math",
     nsIAccessibleRole::ROLE_FLAT_EQUATION,
-    eNameLabelOrTitle,
     eNoValue,
     eNoAction,
     kNoReqStates,
     kEndEntry
   },
   {
     "menu",
     nsIAccessibleRole::ROLE_MENUPOPUP,
-    eNameLabelOrTitle,
     eNoValue,
     eNoAction, // XXX: technically accessibles of menupopup role haven't
                // any action, but menu can be open or close.
     kNoReqStates,
     kEndEntry
   },
   {
     "menubar",
     nsIAccessibleRole::ROLE_MENUBAR,
-    eNameLabelOrTitle,
     eNoValue,
     eNoAction,
     kNoReqStates,
     kEndEntry
   },
   {
     "menuitem",
     nsIAccessibleRole::ROLE_MENUITEM,
-    eNameOkFromChildren,
     eNoValue,
     eClickAction,
     kNoReqStates,
     {&nsAccessibilityAtoms::aria_checked, kBoolState, nsIAccessibleStates::STATE_CHECKED | nsIAccessibleStates::STATE_CHECKABLE},
     {&nsAccessibilityAtoms::aria_checked, "mixed", nsIAccessibleStates::STATE_MIXED | nsIAccessibleStates::STATE_CHECKABLE},
     {&nsAccessibilityAtoms::aria_checked, "false", nsIAccessibleStates::STATE_CHECKABLE},
     kEndEntry
   },
   {
     "menuitemcheckbox",
     nsIAccessibleRole::ROLE_CHECK_MENU_ITEM,
-    eNameOkFromChildren,
     eNoValue,
     eClickAction,
     nsIAccessibleStates::STATE_CHECKABLE,
     {&nsAccessibilityAtoms::aria_checked, kBoolState, nsIAccessibleStates::STATE_CHECKED },
     {&nsAccessibilityAtoms::aria_checked, "mixed", nsIAccessibleStates::STATE_MIXED},
     kEndEntry
   },
   {
     "menuitemradio",
     nsIAccessibleRole::ROLE_RADIO_MENU_ITEM,
-    eNameOkFromChildren,
     eNoValue,
     eClickAction,
     nsIAccessibleStates::STATE_CHECKABLE,
     {&nsAccessibilityAtoms::aria_checked, kBoolState, nsIAccessibleStates::STATE_CHECKED },
     kEndEntry
   },
   {
     "option",
     nsIAccessibleRole::ROLE_OPTION,
-    eNameOkFromChildren,
     eNoValue,
     eSelectAction,
     kNoReqStates,
     {&nsAccessibilityAtoms::aria_selected, kBoolState, nsIAccessibleStates::STATE_SELECTED | nsIAccessibleStates::STATE_SELECTABLE},
     {&nsAccessibilityAtoms::aria_selected, "false", nsIAccessibleStates::STATE_SELECTABLE},
     {&nsAccessibilityAtoms::aria_checked, kBoolState, nsIAccessibleStates::STATE_CHECKED | nsIAccessibleStates::STATE_CHECKABLE},
     {&nsAccessibilityAtoms::aria_checked, "mixed", nsIAccessibleStates::STATE_MIXED | nsIAccessibleStates::STATE_CHECKABLE},
     {&nsAccessibilityAtoms::aria_checked, "false", nsIAccessibleStates::STATE_CHECKABLE},
     kEndEntry
   },
   {
     "presentation",
     nsIAccessibleRole::ROLE_NOTHING,
-    eNameLabelOrTitle,
     eNoValue,
     eNoAction,
     kNoReqStates,
     kEndEntry
   },
   {
     "progressbar",
     nsIAccessibleRole::ROLE_PROGRESSBAR,
-    eNameLabelOrTitle,
     eHasValueMinMax,
     eNoAction,
     nsIAccessibleStates::STATE_READONLY,
     kEndEntry
   },
   {
     "radio",
     nsIAccessibleRole::ROLE_RADIOBUTTON,
-    eNameOkFromChildren,
     eNoValue,
     eSelectAction,
     kNoReqStates,
     {&nsAccessibilityAtoms::aria_checked, kBoolState, nsIAccessibleStates::STATE_CHECKED},
     kEndEntry
   },
   {
     "radiogroup",
     nsIAccessibleRole::ROLE_GROUPING,
-    eNameLabelOrTitle,
     eNoValue,
     eNoAction,
     kNoReqStates,
     kEndEntry
   },
   {
     "region",
     nsIAccessibleRole::ROLE_PANE,
-    eNameLabelOrTitle,
     eNoValue,
     eNoAction,
     kNoReqStates,
     kEndEntry
   },
   {
     "row",
     nsIAccessibleRole::ROLE_ROW,
-    eNameOkFromChildren,
     eNoValue,
     eNoAction,
     kNoReqStates,
     {&nsAccessibilityAtoms::aria_selected, kBoolState, nsIAccessibleStates::STATE_SELECTED | nsIAccessibleStates::STATE_SELECTABLE},
     {&nsAccessibilityAtoms::aria_selected, "false", nsIAccessibleStates::STATE_SELECTABLE},
     {&nsAccessibilityAtoms::aria_expanded, kBoolState, nsIAccessibleStates::STATE_EXPANDED},
     {&nsAccessibilityAtoms::aria_expanded, "false", nsIAccessibleStates::STATE_COLLAPSED},
     kEndEntry
   },
   {
     "rowheader",
     nsIAccessibleRole::ROLE_ROWHEADER,
-    eNameOkFromChildren,
     eNoValue,
     eNoAction,
     kNoReqStates,
     {&nsAccessibilityAtoms::aria_selected, kBoolState, nsIAccessibleStates::STATE_SELECTED | nsIAccessibleStates::STATE_SELECTABLE},
     {&nsAccessibilityAtoms::aria_selected, "false", nsIAccessibleStates::STATE_SELECTABLE},
     {&nsAccessibilityAtoms::aria_readonly, kBoolState, nsIAccessibleStates::STATE_READONLY},
     kEndEntry
   },
   {
     "section",
     nsIAccessibleRole::ROLE_SECTION,
-    eNameLabelOrTitle,
     eNoValue,
     eNoAction,
     kNoReqStates,
     kEndEntry
   },
   {
     "separator",
     nsIAccessibleRole::ROLE_SEPARATOR,
-    eNameLabelOrTitle,
     eNoValue,
     eNoAction,
     kNoReqStates,
     kEndEntry
   },
   {
     "slider",
     nsIAccessibleRole::ROLE_SLIDER,
-    eNameLabelOrTitle,
     eHasValueMinMax,
     eNoAction,
     kNoReqStates,
     {&nsAccessibilityAtoms::aria_readonly, kBoolState, nsIAccessibleStates::STATE_READONLY},
     kEndEntry
   },
   {
     "spinbutton",
     nsIAccessibleRole::ROLE_SPINBUTTON,
-    eNameLabelOrTitle,
     eHasValueMinMax,
     eNoAction,
     kNoReqStates,
     {&nsAccessibilityAtoms::aria_readonly, kBoolState, nsIAccessibleStates::STATE_READONLY},
     kEndEntry
   },
   {
     "status",
     nsIAccessibleRole::ROLE_STATUSBAR,
-    eNameLabelOrTitle,
     eNoValue,
     eNoAction,
     kNoReqStates,
     kEndEntry
   },
   {
     "tab",
     nsIAccessibleRole::ROLE_PAGETAB,
-    eNameOkFromChildren,
     eNoValue,
     eSwitchAction,
     kNoReqStates,
     kEndEntry
   },
   {
     "tablist",
     nsIAccessibleRole::ROLE_PAGETABLIST,
-    eNameLabelOrTitle,
     eNoValue,
     eNoAction,
     kNoReqStates,
     kEndEntry
   },
   {
     "tabpanel",
     nsIAccessibleRole::ROLE_PROPERTYPAGE,
-    eNameLabelOrTitle,
     eNoValue,
     eNoAction,
     kNoReqStates,
     kEndEntry
   },
   {
     "textbox",
     nsIAccessibleRole::ROLE_ENTRY,
-    eNameLabelOrTitle,
     eNoValue,
     eActivateAction,
     kNoReqStates,
     // Manually map EXT_STATE_SINGLE_LINE and EXT_STATE_MULTI_LINE FROM aria-multiline
     // Manually map EXT_STATE_SUPPORTS_AUTOCOMPLETION aria-autocomplete
     {&nsAccessibilityAtoms::aria_autocomplete, "list", nsIAccessibleStates::STATE_HASPOPUP},
     {&nsAccessibilityAtoms::aria_autocomplete, "both", nsIAccessibleStates::STATE_HASPOPUP},
     {&nsAccessibilityAtoms::aria_readonly, kBoolState, nsIAccessibleStates::STATE_READONLY},
     kEndEntry
   },
   {
     "toolbar",
     nsIAccessibleRole::ROLE_TOOLBAR,
-    eNameLabelOrTitle,
     eNoValue,
     eNoAction,
     kNoReqStates,
     kEndEntry
   },
   {
     "tooltip",
     nsIAccessibleRole::ROLE_TOOLTIP,
-    eNameOkFromChildren,
     eNoValue,
     eNoAction,
     kNoReqStates,
     kEndEntry
   },
   {
     "tree",
     nsIAccessibleRole::ROLE_OUTLINE,
-    eNameLabelOrTitle,
     eNoValue,
     eNoAction,
     kNoReqStates,
     {&nsAccessibilityAtoms::aria_readonly, kBoolState, nsIAccessibleStates::STATE_READONLY},
     {&nsAccessibilityAtoms::aria_multiselectable, kBoolState, nsIAccessibleStates::STATE_MULTISELECTABLE | nsIAccessibleStates::STATE_EXTSELECTABLE},
     kEndEntry
   },
   {
     "treegrid",
     nsIAccessibleRole::ROLE_TREE_TABLE,
-    eNameLabelOrTitle,
     eNoValue,
     eNoAction,
     kNoReqStates,
     {&nsAccessibilityAtoms::aria_readonly, kBoolState, nsIAccessibleStates::STATE_READONLY},
     {&nsAccessibilityAtoms::aria_multiselectable, kBoolState, nsIAccessibleStates::STATE_MULTISELECTABLE | nsIAccessibleStates::STATE_EXTSELECTABLE},
     kEndEntry
   },
   {
     "treeitem",
     nsIAccessibleRole::ROLE_OUTLINEITEM,
-    eNameOkFromChildren,
     eNoValue,
     eActivateAction, // XXX: should expose second 'expand/collapse' action based
                      // on states
     kNoReqStates,
     {&nsAccessibilityAtoms::aria_selected, kBoolState, nsIAccessibleStates::STATE_SELECTED | nsIAccessibleStates::STATE_SELECTABLE},
     {&nsAccessibilityAtoms::aria_selected, "false", nsIAccessibleStates::STATE_SELECTABLE},
     {&nsAccessibilityAtoms::aria_expanded, kBoolState, nsIAccessibleStates::STATE_EXPANDED},
     {&nsAccessibilityAtoms::aria_expanded, "false", nsIAccessibleStates::STATE_COLLAPSED},
@@ -567,27 +518,25 @@ nsRoleMapEntry nsARIAMap::gWAIRoleMap[] 
   },
 };
 
 PRUint32 nsARIAMap::gWAIRoleMapLength = NS_ARRAY_LENGTH(nsARIAMap::gWAIRoleMap);
 
 nsRoleMapEntry nsARIAMap::gLandmarkRoleMap = {
   "",
   nsIAccessibleRole::ROLE_NOTHING,
-  eNameLabelOrTitle,
   eNoValue,
   eNoAction,
   kNoReqStates,
   kEndEntry
 };
 
 nsRoleMapEntry nsARIAMap::gEmptyRoleMap = {
   "",
   nsIAccessibleRole::ROLE_NOTHING,
-  eNameLabelOrTitle,
   eNoValue,
   eNoAction,
   kNoReqStates,
   kEndEntry
 };
 
 /**
  * Universal states:
--- a/accessible/src/base/nsARIAMap.h
+++ b/accessible/src/base/nsARIAMap.h
@@ -38,36 +38,16 @@
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef _nsARIAMap_H_
 #define _nsARIAMap_H_
 
 #include "prtypes.h"
 #include "nsAccessibilityAtoms.h"
 
-// Name mapping rule: can the name be computed from descendants?
-enum ENameRule
-{
-  // eNameLabelOrTitle:
-  // Collect name from:
-  //   1) The content subtrees pointed to by labelledby
-  //      which contains the IDs for the label content, or if unspecified
-  //   2) The title attribute if specified
-  eNameLabelOrTitle,
-  
-  // eNameOkFromChildren
-  // Collect name from:
-  //   1) The content subtrees pointed to by labelledby
-  //      which contains the IDs for the label content, or if un specified
-  //   2) The text and text equivalents from descendents,
-  //      as well as the value of controls, collected in depth-first order, or if empty
-  //   3) The title attribute if specified
-  eNameOkFromChildren
-};
-
 // Is nsIAccessible value supported for this role or not?
 enum EValueRule
 {
   eNoValue,
   eHasValueMinMax    // Supports value, min and max from aria-valuenow, aria-valuemin and aria-valuemax
 };
 
 // Should we expose action based on the ARIA role?
@@ -102,19 +82,16 @@ struct nsStateMapEntry
 struct nsRoleMapEntry
 {
   // ARIA role: string representation such as "button"
   const char *roleString;
   
   // Role mapping rule: maps to this nsIAccessibleRole
   PRUint32 role;
   
-  // Name mapping rule: how to compute nsIAccessible name
-  ENameRule nameRule;
-  
   // Value mapping rule: how to compute nsIAccessible value
   EValueRule valueRule;
 
   // Action mapping rule, how to expose nsIAccessible action
   EActionRule actionRule;
 
   // Automatic state mapping rule: always include in nsIAccessibleStates
   PRUint32 state;   // or kNoReqStates if no nsIAccessibleStates are automatic for this role.
--- a/accessible/src/base/nsAccessible.cpp
+++ b/accessible/src/base/nsAccessible.cpp
@@ -35,16 +35,17 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsAccessible.h"
 #include "nsAccessibleRelation.h"
 #include "nsHyperTextAccessibleWrap.h"
+#include "nsNameUtils.h"
 
 #include "nsIAccessibleDocument.h"
 #include "nsIAccessibleHyperText.h"
 #include "nsAccessibleTreeWalker.h"
 
 #include "nsIDOMElement.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMDocumentXBL.h"
@@ -1711,22 +1712,18 @@ nsresult nsAccessible::GetTextFromRelati
     if (NS_SUCCEEDED(rv)) {
       aName.CompressWhitespace();
     }
   }
   
   return NS_OK;
 }
 
-/**
-  * Only called if the element is not a nsIDOMXULControlElement. Initially walks up
-  *   the DOM tree to the form, concatonating label elements as it goes. Then checks for
-  *   labels with the for="controlID" property.
-  */
-nsresult nsAccessible::GetHTMLName(nsAString& aLabel, PRBool aCanAggregateSubtree)
+nsresult
+nsAccessible::GetHTMLName(nsAString& aLabel)
 {
   nsCOMPtr<nsIContent> content = nsCoreUtils::GetRoleContent(mDOMNode);
   if (!content) {
     aLabel.SetIsVoid(PR_TRUE);
     return NS_OK;
   }
 
   nsIContent *labelContent = nsCoreUtils::GetHTMLLabelContent(content);
@@ -1737,19 +1734,20 @@ nsresult nsAccessible::GetHTMLName(nsASt
 
     label.CompressWhitespace();
     if (!label.IsEmpty()) {
       aLabel = label;
       return NS_OK;
     }
   }
 
-  PRBool canAggregateName = mRoleMapEntry ?
-                            mRoleMapEntry->nameRule == eNameOkFromChildren :
-                            aCanAggregateSubtree;
+  PRUint32 role = nsAccUtils::Role(this);
+  PRUint32 canAggregateName =
+    nsNameUtils::gRoleToNameRulesMap[role] & eFromSubtree;
+
   if (canAggregateName) {
     // Don't use AppendFlatStringFromSubtree for container widgets like menulist
     nsresult rv = AppendFlatStringFromSubtree(content, &aLabel);
     NS_ENSURE_SUCCESS(rv, rv);
 
     if (!aLabel.IsEmpty())
       return NS_OK;
   }
@@ -1770,17 +1768,18 @@ nsresult nsAccessible::GetHTMLName(nsASt
   *        - label has either value="foo" or children
   *   3 - non-child label contains control="controlID"
   *        - label has either value="foo" or children
   * Once a label is found, the search is discontinued, so a control
   *  that has a label child as well as having a label external to
   *  the control that uses the control="controlID" syntax will use
   *  the child label for its Name.
   */
-nsresult nsAccessible::GetXULName(nsAString& aLabel, PRBool aCanAggregateSubtree)
+nsresult
+nsAccessible::GetXULName(nsAString& aLabel)
 {
   // CASE #1 (via label attribute) -- great majority of the cases
   nsresult rv = NS_OK;
 
   nsAutoString label;
   nsCOMPtr<nsIDOMXULLabeledControlElement> labeledEl(do_QueryInterface(mDOMNode));
   if (labeledEl) {
     rv = labeledEl->GetLabel(label);
@@ -1846,19 +1845,19 @@ nsresult nsAccessible::GetXULName(nsAStr
         parent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::title, label)) {
       label.CompressWhitespace();
       aLabel = label;
       return NS_OK;
     }
     parent = parent->GetParent();
   }
 
-  PRBool canAggregateName = mRoleMapEntry ?
-                            mRoleMapEntry->nameRule == eNameOkFromChildren :
-                            aCanAggregateSubtree;
+  PRUint32 role = nsAccUtils::Role(this);
+  PRUint32 canAggregateName =
+    nsNameUtils::gRoleToNameRulesMap[role] & eFromSubtree;
 
   return canAggregateName ?
          AppendFlatStringFromSubtree(content, &aLabel) : NS_OK;
 }
 
 NS_IMETHODIMP
 nsAccessible::FireAccessibleEvent(nsIAccessibleEvent *aEvent)
 {
@@ -3416,20 +3415,20 @@ nsAccessible::GetARIAName(nsAString& aNa
 nsresult
 nsAccessible::GetNameInternal(nsAString& aName)
 {
   nsCOMPtr<nsIContent> content = nsCoreUtils::GetRoleContent(mDOMNode);
   if (!content)
     return NS_OK;
 
   if (content->IsNodeOfType(nsINode::eHTML))
-    return GetHTMLName(aName, PR_FALSE);
+    return GetHTMLName(aName);
 
   if (content->IsNodeOfType(nsINode::eXUL))
-    return GetXULName(aName, PR_FALSE);
+    return GetXULName(aName);
 
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessible private methods
 
 already_AddRefed<nsIAccessible>
--- a/accessible/src/base/nsAccessible.h
+++ b/accessible/src/base/nsAccessible.h
@@ -175,19 +175,29 @@ protected:
    * for the subtree that's pointed to.
    *
    * @param aIDProperty  The ARIA relationship property to get the text for
    * @param aName        Where to put the text
    * @return error or success code
    */
   nsresult GetTextFromRelationID(nsIAtom *aIDProperty, nsString &aName);
 
-  // Name helpers
-  nsresult GetHTMLName(nsAString& _retval, PRBool aCanAggregateSubtree = PR_TRUE);
-  nsresult GetXULName(nsAString& aName, PRBool aCanAggregateSubtree = PR_TRUE);
+  //////////////////////////////////////////////////////////////////////////////
+  // Name helpers.
+
+  /**
+   * Compute the name of HTML node.
+   */
+  nsresult GetHTMLName(nsAString& aName);
+
+  /**
+   * Compute the name for XUL node.
+   */
+  nsresult GetXULName(nsAString& aName);
+
   // For accessibles that are not lists of choices, the name of the subtree should be the 
   // sum of names in the subtree
   nsresult AppendFlatStringFromSubtree(nsIContent *aContent, nsAString *aFlatString);
   nsresult AppendNameFromAccessibleFor(nsIContent *aContent, nsAString *aFlatString,
                                        PRBool aFromValue = PR_FALSE);
   nsresult AppendFlatStringFromContentNode(nsIContent *aContent, nsAString *aFlatString);
   nsresult AppendStringWithSpaces(nsAString *aFlatString, const nsAString& textEquivalent);
 
new file mode 100644
--- /dev/null
+++ b/accessible/src/base/nsNameUtils.cpp
@@ -0,0 +1,168 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:expandtab:shiftwidth=2:tabstop=2:
+ */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is Mozilla Foundation
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Alexander Surkov <surkov.alexander@gmail.com> (original author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#include "nsNameUtils.h"
+
+////////////////////////////////////////////////////////////////////////////////
+// Name rules to role map.
+
+PRUint32 nsNameUtils::gRoleToNameRulesMap[] =
+{
+  eNoRule,           // ROLE_NOTHING
+  eNoRule,           // ROLE_TITLEBAR
+  eNoRule,           // ROLE_MENUBAR
+  eNoRule,           // ROLE_SCROLLBAR
+  eNoRule,           // ROLE_GRIP
+  eNoRule,           // ROLE_SOUND
+  eNoRule,           // ROLE_CURSOR
+  eNoRule,           // ROLE_CARET
+  eNoRule,           // ROLE_ALERT
+  eNoRule,           // ROLE_WINDOW
+  eNoRule,           // ROLE_INTERNAL_FRAME
+  eNoRule,           // ROLE_MENUPOPUP
+  eFromSubtree,      // ROLE_MENUITEM
+  eFromSubtree,      // ROLE_TOOLTIP
+  eNoRule,           // ROLE_APPLICATION
+  eNoRule,           // ROLE_DOCUMENT
+  eNoRule,           // ROLE_PANE
+  eNoRule,           // ROLE_CHART
+  eNoRule,           // ROLE_DIALOG
+  eNoRule,           // ROLE_BORDER
+  eNoRule,           // ROLE_GROUPING
+  eNoRule,           // ROLE_SEPARATOR
+  eNoRule,           // ROLE_TOOLBAR
+  eNoRule,           // ROLE_STATUSBAR
+  eNoRule,           // ROLE_TABLE
+  eFromSubtree,      // ROLE_COLUMNHEADER
+  eFromSubtree,      // ROLE_ROWHEADER
+  eFromSubtree,      // ROLE_COLUMN
+  eFromSubtree,      // ROLE_ROW
+  eFromSubtree,      // ROLE_CELL
+  eFromSubtree,      // ROLE_LINK
+  eFromSubtree,      // ROLE_HELPBALLOON
+  eNoRule,           // ROLE_CHARACTER
+  eNoRule,           // ROLE_LIST
+  eFromSubtree,      // ROLE_LISTITEM
+  eNoRule,           // ROLE_OUTLINE
+  eFromSubtree,      // ROLE_OUTLINEITEM
+  eFromSubtree,      // ROLE_PAGETAB
+  eNoRule,           // ROLE_PROPERTYPAGE
+  eNoRule,           // ROLE_INDICATOR
+  eNoRule,           // ROLE_GRAPHIC
+  eNoRule,           // ROLE_STATICTEXT
+  eNoRule,           // ROLE_TEXT_LEAF
+  eFromSubtree,      // ROLE_PUSHBUTTON
+  eFromSubtree,      // ROLE_CHECKBUTTON
+  eFromSubtree,      // ROLE_RADIOBUTTON
+  eNoRule,           // ROLE_COMBOBOX
+  eNoRule,           // ROLE_DROPLIST
+  eNoRule,           // ROLE_PROGRESSBAR
+  eNoRule,           // ROLE_DIAL
+  eNoRule,           // ROLE_HOTKEYFIELD
+  eNoRule,           // ROLE_SLIDER
+  eNoRule,           // ROLE_SPINBUTTON
+  eNoRule,           // ROLE_DIAGRAM
+  eNoRule,           // ROLE_ANIMATION
+  eNoRule,           // ROLE_EQUATION
+  eFromSubtree,      // ROLE_BUTTONDROPDOWN
+  eFromSubtree,      // ROLE_BUTTONMENU
+  eFromSubtree,      // ROLE_BUTTONDROPDOWNGRID
+  eNoRule,           // ROLE_WHITESPACE
+  eNoRule,           // ROLE_PAGETABLIST
+  eNoRule,           // ROLE_CLOCK
+  eNoRule,           // ROLE_SPLITBUTTON
+  eNoRule,           // ROLE_IPADDRESS
+  eNoRule,           // ROLE_ACCEL_LABEL
+  eNoRule,           // ROLE_ARROW
+  eNoRule,           // ROLE_CANVAS
+  eFromSubtree,      // ROLE_CHECK_MENU_ITEM
+  eNoRule,           // ROLE_COLOR_CHOOSER
+  eNoRule,           // ROLE_DATE_EDITOR
+  eNoRule,           // ROLE_DESKTOP_ICON
+  eNoRule,           // ROLE_DESKTOP_FRAME
+  eNoRule,           // ROLE_DIRECTORY_PANE
+  eNoRule,           // ROLE_FILE_CHOOSER
+  eNoRule,           // ROLE_FONT_CHOOSER
+  eNoRule,           // ROLE_CHROME_WINDOW
+  eNoRule,           // ROLE_GLASS_PANE
+  eNoRule,           // ROLE_HTML_CONTAINER
+  eNoRule,           // ROLE_ICON
+  eNoRule,           // ROLE_LABEL
+  eNoRule,           // ROLE_LAYERED_PANE
+  eNoRule,           // ROLE_OPTION_PANE
+  eNoRule,           // ROLE_PASSWORD_TEXT
+  eNoRule,           // ROLE_POPUP_MENU
+  eFromSubtree,      // ROLE_RADIO_MENU_ITEM
+  eNoRule,           // ROLE_ROOT_PANE
+  eNoRule,           // ROLE_SCROLL_PANE
+  eNoRule,           // ROLE_SPLIT_PANE
+  eFromSubtree,      // ROLE_TABLE_COLUMN_HEADER
+  eFromSubtree,      // ROLE_TABLE_ROW_HEADER
+  eFromSubtree,      // ROLE_TEAR_OFF_MENU_ITEM
+  eNoRule,           // ROLE_TERMINAL
+  eNoRule,           // ROLE_TEXT_CONTAINER
+  eFromSubtree,      // ROLE_TOGGLE_BUTTON
+  eNoRule,           // ROLE_TREE_TABLE
+  eNoRule,           // ROLE_VIEWPORT
+  eNoRule,           // ROLE_HEADER
+  eNoRule,           // ROLE_FOOTER
+  eNoRule,           // ROLE_PARAGRAPH
+  eNoRule,           // ROLE_RULER
+  eNoRule,           // ROLE_AUTOCOMPLETE
+  eNoRule,           // ROLE_EDITBAR
+  eNoRule,           // ROLE_ENTRY
+  eNoRule,           // ROLE_CAPTION
+  eNoRule,           // ROLE_DOCUMENT_FRAME
+  eNoRule,           // ROLE_HEADING
+  eNoRule,           // ROLE_PAGE
+  eNoRule,           // ROLE_SECTION
+  eNoRule,           // ROLE_REDUNDANT_OBJECT
+  eNoRule,           // ROLE_FORM
+  eNoRule,           // ROLE_IME
+  eNoRule,           // ROLE_APP_ROOT
+  eFromSubtree,      // ROLE_PARENT_MENUITEM
+  eNoRule,           // ROLE_CALENDAR
+  eNoRule,           // ROLE_COMBOBOX_LIST
+  eFromSubtree,      // ROLE_COMBOBOX_OPTION
+  eNoRule,           // ROLE_IMAGE_MAP
+  eFromSubtree,      // ROLE_OPTION
+  eFromSubtree,      // ROLE_RICH_OPTION
+  eNoRule,           // ROLE_LISTBOX
+  eNoRule            // ROLE_FLAT_EQUATION
+};
new file mode 100644
--- /dev/null
+++ b/accessible/src/base/nsNameUtils.h
@@ -0,0 +1,71 @@
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:expandtab:shiftwidth=2:tabstop=2:
+ */
+/* ***** BEGIN LICENSE BLOCK *****
+ * Version: MPL 1.1/GPL 2.0/LGPL 2.1
+ *
+ * The contents of this file are subject to the Mozilla Public License Version
+ * 1.1 (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ * http://www.mozilla.org/MPL/
+ *
+ * Software distributed under the License is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+ * for the specific language governing rights and limitations under the
+ * License.
+ *
+ * The Original Code is mozilla.org code.
+ *
+ * The Initial Developer of the Original Code is Mozilla Foundation
+ * Portions created by the Initial Developer are Copyright (C) 2008
+ * the Initial Developer. All Rights Reserved.
+ *
+ * Contributor(s):
+ *   Alexander Surkov <surkov.alexander@gmail.com> (original author)
+ *
+ * Alternatively, the contents of this file may be used under the terms of
+ * either the GNU General Public License Version 2 or later (the "GPL"), or
+ * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+ * in which case the provisions of the GPL or the LGPL are applicable instead
+ * of those above. If you wish to allow use of your version of this file only
+ * under the terms of either the GPL or the LGPL, and not to allow others to
+ * use your version of this file under the terms of the MPL, indicate your
+ * decision by deleting the provisions above and replace them with the notice
+ * and other provisions required by the GPL or the LGPL. If you do not delete
+ * the provisions above, a recipient may use your version of this file under
+ * the terms of any one of the MPL, the GPL or the LGPL.
+ *
+ * ***** END LICENSE BLOCK ***** */
+
+#ifndef _nsNameUtils_H_
+#define _nsNameUtils_H_
+
+#include "prtypes.h"
+
+/**
+ * Name from subtree calculation rules.
+ */
+enum ENameFromSubtreeRule
+{
+  // do not walk into subtree to compute the name
+  eNoRule = 0x00,
+  
+  // compute the name from the subtree
+  eFromSubtree = 0x01
+};
+
+/**
+ * The class provides utils methods to compute the accessible name and
+ * description.
+ */
+class nsNameUtils
+{
+public:
+
+  /**
+   * Map array from roles to name rules (bit state of ENameFromSubtreeRule).
+   */
+  static PRUint32 gRoleToNameRulesMap[];
+};
+
+#endif
--- a/accessible/src/html/nsHTMLFormControlAccessible.cpp
+++ b/accessible/src/html/nsHTMLFormControlAccessible.cpp
@@ -364,22 +364,16 @@ nsHTML4ButtonAccessible::GetStateInterna
   nsAutoString buttonType;
   element->GetAttribute(NS_LITERAL_STRING("type"), buttonType);
   if (buttonType.LowerCaseEqualsLiteral("submit"))
     *aState |= nsIAccessibleStates::STATE_DEFAULT;
 
   return NS_OK;
 }
 
-nsresult
-nsHTML4ButtonAccessible::GetNameInternal(nsAString& aName)
-{
-  return GetHTMLName(aName, PR_TRUE);
-}
-
 // --- textfield -----
 
 nsHTMLTextFieldAccessible::nsHTMLTextFieldAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell):
 nsHyperTextAccessibleWrap(aNode, aShell)
 {
 }
 
 NS_IMPL_ISUPPORTS_INHERITED3(nsHTMLTextFieldAccessible, nsAccessible, nsHyperTextAccessible, nsIAccessibleText, nsIAccessibleEditableText)
--- a/accessible/src/html/nsHTMLFormControlAccessible.h
+++ b/accessible/src/html/nsHTMLFormControlAccessible.h
@@ -81,17 +81,17 @@ public:
 
   // 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 GetNameInternal(nsAString& aName);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 class nsHTML4ButtonAccessible : public nsHyperTextAccessibleWrap
 {
 
 public:
   enum { eAction_Click = 0 };
@@ -100,17 +100,16 @@ public:
 
   // 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 GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 class nsHTMLTextFieldAccessible : public nsHyperTextAccessibleWrap
 {
 
 public:
   enum { eAction_Click = 0 };
--- a/accessible/src/html/nsHTMLLinkAccessible.cpp
+++ b/accessible/src/html/nsHTMLLinkAccessible.cpp
@@ -52,22 +52,16 @@ nsHTMLLinkAccessible::nsHTMLLinkAccessib
 
 // Expose nsIAccessibleHyperLink unconditionally
 NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLLinkAccessible, nsHyperTextAccessibleWrap,
                              nsIAccessibleHyperLink)
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessible
 
-nsresult
-nsHTMLLinkAccessible::GetNameInternal(nsAString& aName)
-{
-  return GetHTMLName(aName, PR_TRUE);
-}
-
 NS_IMETHODIMP
 nsHTMLLinkAccessible::GetRole(PRUint32 *aRole)
 {
   NS_ENSURE_ARG_POINTER(aRole);
 
   *aRole = nsIAccessibleRole::ROLE_LINK;
   return NS_OK;
 }
--- a/accessible/src/html/nsHTMLLinkAccessible.h
+++ b/accessible/src/html/nsHTMLLinkAccessible.h
@@ -56,17 +56,16 @@ public:
   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 GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
 protected:
   enum { eAction_Jump = 0 };
 
   /**
    * Returns true if the link has href attribute.
    */
--- a/accessible/src/xul/nsXULColorPickerAccessible.cpp
+++ b/accessible/src/xul/nsXULColorPickerAccessible.cpp
@@ -86,22 +86,16 @@ nsXULColorPickerTileAccessible::GetState
   PRBool isSelected = PR_FALSE;
   element->HasAttribute(NS_LITERAL_STRING("selected"), &isSelected);
   if (isFocused)
     *aState |= nsIAccessibleStates::STATE_SELECTED;
 
   return NS_OK;
 }
 
-nsresult
-nsXULColorPickerTileAccessible::GetNameInternal(nsAString& aName)
-{
-  return GetXULName(aName);
-}
-
 NS_IMETHODIMP nsXULColorPickerTileAccessible::GetValue(nsAString& _retval)
 {
   if (!mDOMNode)
     return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIDOMElement> element(do_QueryInterface(mDOMNode));
   NS_ASSERTION(element, "No XUL Element for colorpicker");
   return element->GetAttribute(NS_LITERAL_STRING("color"), _retval);
--- a/accessible/src/xul/nsXULColorPickerAccessible.h
+++ b/accessible/src/xul/nsXULColorPickerAccessible.h
@@ -47,17 +47,16 @@ class nsXULColorPickerTileAccessible : p
 public:
   nsXULColorPickerTileAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
   // nsIAccessible
   NS_IMETHOD GetRole(PRUint32 *_retval);
   NS_IMETHOD GetValue(nsAString& _retval);
 
   // nsAccessible
-  virtual nsresult GetNameInternal(nsAString& aName);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 class nsXULColorPickerAccessible : public nsXULColorPickerTileAccessible
 {
 public:
   nsXULColorPickerAccessible(nsIDOMNode* aNode, nsIWeakReference* aShell);
 
--- a/accessible/src/xul/nsXULSelectAccessible.cpp
+++ b/accessible/src/xul/nsXULSelectAccessible.cpp
@@ -122,22 +122,16 @@ nsXULColumnItemAccessible::GetStateInter
 
   *aState = nsIAccessibleStates::STATE_READONLY;
   if (aExtraState)
     *aExtraState = 0;
 
   return NS_OK;
 }
 
-nsresult
-nsXULColumnItemAccessible::GetNameInternal(nsAString& aName)
-{
-  return GetXULName(aName);
-}
-
 NS_IMETHODIMP
 nsXULColumnItemAccessible::GetNumActions(PRUint8 *aNumActions)
 {
   NS_ENSURE_ARG_POINTER(aNumActions);
 
   *aNumActions = 1;
   return NS_OK;
 }
--- a/accessible/src/xul/nsXULSelectAccessible.h
+++ b/accessible/src/xul/nsXULSelectAccessible.h
@@ -74,17 +74,16 @@ public:
   // 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 GetNameInternal(nsAString& aName);
   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.
--- a/accessible/src/xul/nsXULTextAccessible.cpp
+++ b/accessible/src/xul/nsXULTextAccessible.cpp
@@ -113,22 +113,16 @@ nsXULTextAccessible::GetAccessibleRelate
   * For XUL tooltip
   */
 nsXULTooltipAccessible::nsXULTooltipAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell):
 nsLeafAccessible(aDomNode, aShell)
 { 
 }
 
 nsresult
-nsXULTooltipAccessible::GetNameInternal(nsAString& aName)
-{
-  return GetXULName(aName, PR_TRUE);
-}
-
-nsresult
 nsXULTooltipAccessible::GetStateInternal(PRUint32 *aState,
                                          PRUint32 *aExtraState)
 {
   nsresult rv = nsLeafAccessible::GetStateInternal(aState, aExtraState);
   NS_ENSURE_A11Y_SUCCESS(rv, rv);
 
   *aState &= ~nsIAccessibleStates::STATE_FOCUSABLE;
   *aState |= nsIAccessibleStates::STATE_READONLY;
--- a/accessible/src/xul/nsXULTextAccessible.h
+++ b/accessible/src/xul/nsXULTextAccessible.h
@@ -67,17 +67,16 @@ class nsXULTooltipAccessible : public ns
 
 public:
   nsXULTooltipAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);
 
   // nsIAccessible
   NS_IMETHOD GetRole(PRUint32 *_retval); 
 
   // nsAccessible
-  virtual nsresult GetNameInternal(nsAString& aName);
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 class nsXULLinkAccessible : public nsHyperTextAccessibleWrap
 {
 
 public:
   nsXULLinkAccessible(nsIDOMNode* aDomNode, nsIWeakReference* aShell);