Bug 1428930 - Move some XBL accessibility roles into XULMap.h. r=bgrins,surkov draft
authorPaolo Amadini <paolo.mozmail@amadzone.org>
Wed, 07 Feb 2018 13:23:53 +0000
changeset 752049 2d294c2120aa6f1433333d8ff358e9cf522511c8
parent 752021 4fe6f6560083f8c8257282bef1d4e0ced9d1b975
push id98149
push userpaolo.mozmail@amadzone.org
push dateWed, 07 Feb 2018 13:39:59 +0000
reviewersbgrins, surkov
bugs1428930
milestone60.0a1
Bug 1428930 - Move some XBL accessibility roles into XULMap.h. r=bgrins,surkov MozReview-Commit-ID: Iye8XoQ7neq
accessible/base/XULMap.h
accessible/base/nsAccessibilityService.cpp
accessible/base/nsAccessibilityService.h
browser/components/customizableui/content/toolbar.xml
browser/components/translation/translation-infobar.xml
dom/base/nsGkAtomList.h
toolkit/content/widgets/checkbox.xml
toolkit/content/widgets/general.xml
toolkit/content/widgets/groupbox.xml
toolkit/content/widgets/listbox.xml
toolkit/content/widgets/menu.xml
toolkit/content/widgets/menulist.xml
toolkit/content/widgets/notification.xml
toolkit/content/widgets/popup.xml
toolkit/content/widgets/progressmeter.xml
toolkit/content/widgets/radio.xml
toolkit/content/widgets/tabbox.xml
toolkit/content/widgets/toolbar.xml
toolkit/content/widgets/tree.xml
--- a/accessible/base/XULMap.h
+++ b/accessible/base/XULMap.h
@@ -1,14 +1,44 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
+XULMAP_TYPE(checkbox, XULCheckboxAccessible)
+XULMAP_TYPE(dropMarker, XULDropmarkerAccessible)
+XULMAP_TYPE(findbar, XULToolbarAccessible)
+XULMAP_TYPE(groupbox, XULGroupboxAccessible)
+XULMAP_TYPE(listbox, XULListboxAccessibleWrap)
+XULMAP_TYPE(listhead, XULColumAccessible)
+XULMAP_TYPE(listheader, XULColumnItemAccessible)
+XULMAP_TYPE(listitem, XULListitemAccessible)
+XULMAP_TYPE(menu, XULMenuitemAccessibleWrap)
+XULMAP_TYPE(menubar, XULMenubarAccessible)
+XULMAP_TYPE(menucaption, XULMenuitemAccessibleWrap)
+XULMAP_TYPE(menuitem, XULMenuitemAccessibleWrap)
+XULMAP_TYPE(menulist, XULComboboxAccessible)
 XULMAP_TYPE(menuseparator, XULMenuSeparatorAccessible)
+XULMAP_TYPE(notification, XULAlertAccessible)
+XULMAP_TYPE(progressmeter, XULProgressMeterAccessible)
+XULMAP_TYPE(radio, XULRadioButtonAccessible)
+XULMAP_TYPE(radiogroup, XULRadioGroupAccessible)
+XULMAP_TYPE(richlistbox, XULListboxAccessibleWrap)
+XULMAP_TYPE(richlistitem, XULListitemAccessible)
 XULMAP_TYPE(statusbar, XULStatusBarAccessible)
+XULMAP_TYPE(tab, XULTabAccessible)
+XULMAP_TYPE(tabpanels, XULTabpanelsAccessible)
+XULMAP_TYPE(tabs, XULTabsAccessible)
+XULMAP_TYPE(toolbarseparator, XULToolbarSeparatorAccessible)
+XULMAP_TYPE(toolbarspacer, XULToolbarSeparatorAccessible)
+XULMAP_TYPE(toolbarspring, XULToolbarSeparatorAccessible)
+XULMAP_TYPE(treecol, XULColumnItemAccessible)
+XULMAP_TYPE(treecolpicker, XULButtonAccessible)
+XULMAP_TYPE(treecols, XULTreeColumAccessible)
+XULMAP_TYPE(toolbar, XULToolbarAccessible)
+XULMAP_TYPE(tooltip, XULTooltipAccessible)
 
 XULMAP(
   image,
   [](nsIContent* aContent, Accessible* aContext) -> Accessible* {
     if (aContent->IsElement() &&
         aContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::onclick)) {
       return new XULToolbarButtonAccessible(aContent, aContext->Document());
     }
@@ -17,8 +47,54 @@ XULMAP(
     if (!aContent->IsElement() ||
         !aContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::tooltiptext)) {
       return nullptr;
     }
 
     return new ImageAccessibleWrap(aContent, aContext->Document());
   }
 )
+
+XULMAP(
+  listcell,
+  [](nsIContent* aContent, Accessible* aContext) -> Accessible* {
+    // Only create cells if there's more than one per row.
+    nsIContent* listItem = aContent->GetParent();
+    if (!listItem) {
+      return nullptr;
+    }
+
+    for (nsIContent* child = listItem->GetFirstChild(); child;
+         child = child->GetNextSibling()) {
+      if (child->IsXULElement(nsGkAtoms::listcell) && child != aContent) {
+        return new XULListCellAccessibleWrap(aContent, aContext->Document());
+      }
+    }
+
+    return nullptr;
+  }
+)
+
+XULMAP(
+  tree,
+  [](nsIContent* aContent, Accessible* aContext) -> Accessible* {
+    nsIContent* child = nsTreeUtils::GetDescendantChild(aContent,
+                                                        nsGkAtoms::treechildren);
+    if (!child)
+      return nullptr;
+
+    nsTreeBodyFrame* treeFrame = do_QueryFrame(child->GetPrimaryFrame());
+    if (!treeFrame)
+      return nullptr;
+
+    RefPtr<nsTreeColumns> treeCols = treeFrame->Columns();
+    int32_t count = 0;
+    treeCols->GetCount(&count);
+
+    // Outline of list accessible.
+    if (count == 1) {
+      return new XULTreeAccessible(aContent, aContext->Document(), treeFrame);
+    }
+
+    // Table or tree table accessible.
+    return new XULTreeGridAccessibleWrap(aContent, aContext->Document(), treeFrame);
+  }
+)
--- a/accessible/base/nsAccessibilityService.cpp
+++ b/accessible/base/nsAccessibilityService.cpp
@@ -1455,81 +1455,31 @@ nsAccessibilityService::CreateAccessible
   if (role.EqualsLiteral("outerdoc")) {
     RefPtr<Accessible> accessible = new OuterDocAccessible(aContent, aDoc);
     return accessible.forget();
   }
 
   RefPtr<Accessible> accessible;
 #ifdef MOZ_XUL
   // XUL controls
-  if (role.EqualsLiteral("xul:alert")) {
-    accessible = new XULAlertAccessible(aContent, aDoc);
-
-  } else if (role.EqualsLiteral("xul:button")) {
+  if (role.EqualsLiteral("xul:button")) {
     accessible = new XULButtonAccessible(aContent, aDoc);
 
-  } else if (role.EqualsLiteral("xul:checkbox")) {
-    accessible = new XULCheckboxAccessible(aContent, aDoc);
-
   } else if (role.EqualsLiteral("xul:colorpicker")) {
     accessible = new XULColorPickerAccessible(aContent, aDoc);
 
   } else if (role.EqualsLiteral("xul:colorpickertile")) {
     accessible = new XULColorPickerTileAccessible(aContent, aDoc);
 
   } else if (role.EqualsLiteral("xul:combobox")) {
     accessible = new XULComboboxAccessible(aContent, aDoc);
 
-  } else if (role.EqualsLiteral("xul:tabpanels")) {
-      accessible = new XULTabpanelsAccessible(aContent, aDoc);
-
-  } else if (role.EqualsLiteral("xul:dropmarker")) {
-      accessible = new XULDropmarkerAccessible(aContent, aDoc);
-
-  } else if (role.EqualsLiteral("xul:groupbox")) {
-      accessible = new XULGroupboxAccessible(aContent, aDoc);
-
   } else if (role.EqualsLiteral("xul:link")) {
     accessible = new XULLinkAccessible(aContent, aDoc);
 
-  } else if (role.EqualsLiteral("xul:listbox")) {
-      accessible = new XULListboxAccessibleWrap(aContent, aDoc);
-
-  } else if (role.EqualsLiteral("xul:listcell")) {
-    // Only create cells if there's more than one per row.
-    nsIContent* listItem = aContent->GetParent();
-    if (!listItem)
-      return nullptr;
-
-    for (nsIContent* child = listItem->GetFirstChild(); child;
-         child = child->GetNextSibling()) {
-      if (child->IsXULElement(nsGkAtoms::listcell) && child != aContent) {
-        accessible = new XULListCellAccessibleWrap(aContent, aDoc);
-        break;
-      }
-    }
-
-  } else if (role.EqualsLiteral("xul:listhead")) {
-    accessible = new XULColumAccessible(aContent, aDoc);
-
-  } else if (role.EqualsLiteral("xul:listheader")) {
-    accessible = new XULColumnItemAccessible(aContent, aDoc);
-
-  } else if (role.EqualsLiteral("xul:listitem")) {
-    accessible = new XULListitemAccessible(aContent, aDoc);
-
-  } else if (role.EqualsLiteral("xul:menubar")) {
-    accessible = new XULMenubarAccessible(aContent, aDoc);
-
-  } else if (role.EqualsLiteral("xul:menulist")) {
-    accessible = new XULComboboxAccessible(aContent, aDoc);
-
-  } else if (role.EqualsLiteral("xul:menuitem")) {
-    accessible = new XULMenuitemAccessibleWrap(aContent, aDoc);
-
   } else if (role.EqualsLiteral("xul:menupopup")) {
 #ifdef MOZ_ACCESSIBILITY_ATK
     // ATK considers this node to be redundant when within menubars, and it makes menu
     // navigation with assistive technologies more difficult
     // XXX In the future we will should this for consistency across the nsIAccessible
     // implementations on each platform for a consistent scripting environment, but
     // then strip out redundant accessibles in the AccessibleWrap class for each platform.
     nsIContent *parent = aContent->GetParent();
@@ -1546,61 +1496,28 @@ nsAccessibilityService::CreateAccessible
     if (aContent->IsElement() &&
         aContent->AsElement()->AttrValueIs(kNameSpaceID_None,
                                            nsGkAtoms::noautofocus,
                                            nsGkAtoms::_true, eCaseMatters))
       accessible = new XULAlertAccessible(aContent, aDoc);
     else
       accessible = new EnumRoleAccessible<roles::PANE>(aContent, aDoc);
 
-  } else if (role.EqualsLiteral("xul:progressmeter")) {
-    accessible = new XULProgressMeterAccessible(aContent, aDoc);
-
   } else if (role.EqualsLiteral("xul:scale")) {
     accessible = new XULSliderAccessible(aContent, aDoc);
 
-  } else if (role.EqualsLiteral("xul:radiobutton")) {
-    accessible = new XULRadioButtonAccessible(aContent, aDoc);
-
-  } else if (role.EqualsLiteral("xul:radiogroup")) {
-    accessible = new XULRadioGroupAccessible(aContent, aDoc);
-
-  } else if (role.EqualsLiteral("xul:tab")) {
-    accessible = new XULTabAccessible(aContent, aDoc);
-
-  } else if (role.EqualsLiteral("xul:tabs")) {
-    accessible = new XULTabsAccessible(aContent, aDoc);
-
   } else if (role.EqualsLiteral("xul:text")) {
     accessible = new XULLabelAccessible(aContent, aDoc);
 
   } else if (role.EqualsLiteral("xul:textbox")) {
     accessible = new EnumRoleAccessible<roles::SECTION>(aContent, aDoc);
 
   } else if (role.EqualsLiteral("xul:thumb")) {
     accessible = new XULThumbAccessible(aContent, aDoc);
 
-  } else if (role.EqualsLiteral("xul:tree")) {
-    accessible = CreateAccessibleForXULTree(aContent, aDoc);
-
-  } else if (role.EqualsLiteral("xul:treecolumns")) {
-    accessible = new XULTreeColumAccessible(aContent, aDoc);
-
-  } else if (role.EqualsLiteral("xul:treecolumnitem")) {
-    accessible = new XULColumnItemAccessible(aContent, aDoc);
-
-  } else if (role.EqualsLiteral("xul:toolbar")) {
-    accessible = new XULToolbarAccessible(aContent, aDoc);
-
-  } else if (role.EqualsLiteral("xul:toolbarseparator")) {
-    accessible = new XULToolbarSeparatorAccessible(aContent, aDoc);
-
-  } else if (role.EqualsLiteral("xul:tooltip")) {
-    accessible = new XULTooltipAccessible(aContent, aDoc);
-
   } else if (role.EqualsLiteral("xul:toolbarbutton")) {
     accessible = new XULToolbarButtonAccessible(aContent, aDoc);
 
   }
 #endif // MOZ_XUL
 
   return accessible.forget();
 }
@@ -1826,48 +1743,16 @@ nsAccessibilityService::HasAccessible(ns
     return false;
 
   return document->HasAccessible(node);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessibilityService private (DON'T put methods here)
 
-#ifdef MOZ_XUL
-already_AddRefed<Accessible>
-nsAccessibilityService::CreateAccessibleForXULTree(nsIContent* aContent,
-                                                   DocAccessible* aDoc)
-{
-  nsIContent* child = nsTreeUtils::GetDescendantChild(aContent,
-                                                      nsGkAtoms::treechildren);
-  if (!child)
-    return nullptr;
-
-  nsTreeBodyFrame* treeFrame = do_QueryFrame(child->GetPrimaryFrame());
-  if (!treeFrame)
-    return nullptr;
-
-  RefPtr<nsTreeColumns> treeCols = treeFrame->Columns();
-  int32_t count = 0;
-  treeCols->GetCount(&count);
-
-  // Outline of list accessible.
-  if (count == 1) {
-    RefPtr<Accessible> accessible =
-      new XULTreeAccessible(aContent, aDoc, treeFrame);
-    return accessible.forget();
-  }
-
-  // Table or tree table accessible.
-  RefPtr<Accessible> accessible =
-    new XULTreeGridAccessibleWrap(aContent, aDoc, treeFrame);
-  return accessible.forget();
-}
-#endif
-
 void
 nsAccessibilityService::SetConsumers(uint32_t aConsumers) {
   if (gConsumers & aConsumers) {
     return;
   }
 
   gConsumers |= aConsumers;
   NotifyOfConsumersChange();
--- a/accessible/base/nsAccessibilityService.h
+++ b/accessible/base/nsAccessibilityService.h
@@ -319,24 +319,16 @@ private:
    */
   void SetConsumers(uint32_t aConsumers);
 
   /**
    * Unset accessibility service consumers.
    */
   void UnsetConsumers(uint32_t aConsumers);
 
-#ifdef MOZ_XUL
-  /**
-   * Create accessible for XUL tree element.
-   */
-  already_AddRefed<Accessible>
-    CreateAccessibleForXULTree(nsIContent* aContent, DocAccessible* aDoc);
-#endif
-
   /**
    * Reference for accessibility service instance.
    */
   static nsAccessibilityService* gAccessibilityService;
 
   /**
    * Reference for application accessible instance.
    */
--- a/browser/components/customizableui/content/toolbar.xml
+++ b/browser/components/customizableui/content/toolbar.xml
@@ -3,17 +3,17 @@
    - License, v. 2.0. If a copy of the MPL was not distributed with this
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 <bindings id="browserToolbarBindings"
           xmlns="http://www.mozilla.org/xbl"
           xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
           xmlns:xbl="http://www.mozilla.org/xbl">
 
-  <binding id="toolbar" role="xul:toolbar">
+  <binding id="toolbar">
     <resources>
       <stylesheet src="chrome://global/skin/toolbar.css"/>
     </resources>
     <implementation>
       <field name="overflowedDuringConstruction">null</field>
 
       <constructor><![CDATA[
           let scope = {};
--- a/browser/components/translation/translation-infobar.xml
+++ b/browser/components/translation/translation-infobar.xml
@@ -11,17 +11,17 @@
 <!ENTITY % translationDTD SYSTEM "chrome://browser/locale/translation.dtd" >
 %translationDTD;
 ]>
 
 <bindings id="translationBindings"
           xmlns="http://www.mozilla.org/xbl"
           xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
           xmlns:xbl="http://www.mozilla.org/xbl">
-  <binding id="translationbar" extends="chrome://global/content/bindings/notification.xml#notification" role="xul:alert">
+  <binding id="translationbar" extends="chrome://global/content/bindings/notification.xml#notification">
     <resources>
       <stylesheet src="chrome://global/skin/notification.css"/>
     </resources>
     <content>
       <xul:hbox anonid="details" align="center" flex="1">
         <xul:image class="translate-infobar-element messageImage"
                    anonid="messageImage"/>
         <xul:panel anonid="welcomePanel" class="translation-welcome-panel"
--- a/dom/base/nsGkAtomList.h
+++ b/dom/base/nsGkAtomList.h
@@ -458,16 +458,17 @@ GK_ATOM(face, "face")
 GK_ATOM(fallback, "fallback")
 GK_ATOM(_false, "false")
 GK_ATOM(farthest, "farthest")
 GK_ATOM(field, "field")
 GK_ATOM(fieldset, "fieldset")
 GK_ATOM(file, "file")
 GK_ATOM(figcaption, "figcaption")
 GK_ATOM(figure, "figure")
+GK_ATOM(findbar, "findbar")
 GK_ATOM(fixed, "fixed")
 GK_ATOM(flags, "flags")
 GK_ATOM(flex, "flex")
 GK_ATOM(flexgroup, "flexgroup")
 GK_ATOM(flip, "flip")
 GK_ATOM(floating, "floating")
 GK_ATOM(floor, "floor")
 GK_ATOM(flowlength, "flowlength")
@@ -504,16 +505,17 @@ GK_ATOM(getter, "getter")
 GK_ATOM(glyphchar, "glyphchar")
 GK_ATOM(glyphid, "glyphid")
 GK_ATOM(graphicsDocument, "graphics-document")
 GK_ATOM(graphicsObject, "graphics-object")
 GK_ATOM(graphicsSymbol, "graphics-symbol")
 GK_ATOM(grid, "grid")
 GK_ATOM(grippy, "grippy")
 GK_ATOM(group, "group")
+GK_ATOM(groupbox, "groupbox")
 GK_ATOM(groupingSeparator, "grouping-separator")
 GK_ATOM(groupingSize, "grouping-size")
 GK_ATOM(grow, "grow")
 GK_ATOM(gutter, "gutter")
 GK_ATOM(h1, "h1")
 GK_ATOM(h2, "h2")
 GK_ATOM(h3, "h3")
 GK_ATOM(h4, "h4")
@@ -683,16 +685,17 @@ GK_ATOM(maxwidth, "maxwidth")
 GK_ATOM(mayscript, "mayscript")
 GK_ATOM(media, "media")
 GK_ATOM(mediaType, "media-type")
 GK_ATOM(member, "member")
 GK_ATOM(menu, "menu")
 GK_ATOM(menubar, "menubar")
 GK_ATOM(menubutton, "menubutton")
 GK_ATOM(menuButton, "menu-button")
+GK_ATOM(menucaption, "menucaption")
 GK_ATOM(menugroup, "menugroup")
 GK_ATOM(menuitem, "menuitem")
 GK_ATOM(menulist, "menulist")
 GK_ATOM(menupopup, "menupopup")
 GK_ATOM(menuseparator, "menuseparator")
 GK_ATOM(message, "message")
 GK_ATOM(meta, "meta")
 GK_ATOM(referrer, "referrer")
@@ -760,16 +763,17 @@ GK_ATOM(noisolation, "noisolation")
 GK_ATOM(nomodule, "nomodule")
 GK_ATOM(nonce, "nonce")
 GK_ATOM(none, "none")
 GK_ATOM(noresize, "noresize")
 GK_ATOM(normal, "normal")
 GK_ATOM(normalizeSpace, "normalize-space")
 GK_ATOM(noscript, "noscript")
 GK_ATOM(noshade, "noshade")
+GK_ATOM(notification, "notification")
 GK_ATOM(novalidate, "novalidate")
 GK_ATOM(_not, "not")
 GK_ATOM(nowrap, "nowrap")
 GK_ATOM(number, "number")
 GK_ATOM(null, "null")
 GK_ATOM(object, "object")
 GK_ATOM(objectType, "object-type")
 GK_ATOM(observer, "observer")
--- a/toolkit/content/widgets/checkbox.xml
+++ b/toolkit/content/widgets/checkbox.xml
@@ -4,17 +4,17 @@
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 
 <bindings id="checkboxBindings"
    xmlns="http://www.mozilla.org/xbl"
    xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    xmlns:xbl="http://www.mozilla.org/xbl">
 
-  <binding id="checkbox" role="xul:checkbox"
+  <binding id="checkbox"
     extends="chrome://global/content/bindings/general.xml#basetext">
     <resources>
       <stylesheet src="chrome://global/skin/checkbox.css"/>
     </resources>
 
     <content>
       <xul:image class="checkbox-check" xbl:inherits="checked,disabled"/>
       <xul:hbox class="checkbox-label-box" flex="1">
--- a/toolkit/content/widgets/general.xml
+++ b/toolkit/content/widgets/general.xml
@@ -127,17 +127,17 @@
             this.selectedIndex = selectedIndex;
             return val;
           ]]>
         </setter>
       </property>
     </implementation>
   </binding>
 
-  <binding id="dropmarker" extends="xul:button" role="xul:dropmarker">
+  <binding id="dropmarker" extends="xul:button">
     <resources>
       <stylesheet src="chrome://global/skin/dropmarker.css"/>
     </resources>
 
     <content>
       <xul:image class="dropmarker-icon"/>
     </content>
   </binding>
--- a/toolkit/content/widgets/groupbox.xml
+++ b/toolkit/content/widgets/groupbox.xml
@@ -10,17 +10,17 @@
    xmlns:xbl="http://www.mozilla.org/xbl">
 
   <binding id="groupbox-base">
     <resources>
       <stylesheet src="chrome://global/skin/groupbox.css"/>
     </resources>
   </binding>
 
-  <binding id="groupbox" role="xul:groupbox"
+  <binding id="groupbox"
     extends="chrome://global/content/bindings/groupbox.xml#groupbox-base">
     <content>
       <xul:hbox class="groupbox-title" align="center" pack="start">
         <children includes="caption"/>
       </xul:hbox>
       <xul:box flex="1" class="groupbox-body" xbl:inherits="orient,align,pack">
         <children/>
       </xul:box>
--- a/toolkit/content/widgets/listbox.xml
+++ b/toolkit/content/widgets/listbox.xml
@@ -70,17 +70,17 @@
      * @param aDirection - specifies scrolling direction, should be either -1 or 1
      * @return the number of elements the selection scrolled
      */
     scrollOnePage(aDirection)
 
     /** Fire "select" event */
     _fireOnSelect()
    -->
-   <binding id="listbox-base" role="xul:listbox"
+   <binding id="listbox-base"
             extends="chrome://global/content/bindings/general.xml#basecontrol">
 
     <implementation implements="nsIDOMXULMultiSelectControlElement">
       <field name="_lastKeyTime">0</field>
       <field name="_incrementalString">""</field>
 
     <!-- nsIDOMXULSelectControlElement -->
       <property name="selectedItem"
@@ -943,17 +943,17 @@
         // shouldn't be scrolled by pixel scrolling events before a line/page
         // scrolling event.
         event.preventDefault();
       ]]>
       </handler>
     </handlers>
   </binding>
 
-  <binding id="listitem" role="xul:listitem"
+  <binding id="listitem"
            extends="chrome://global/content/bindings/general.xml#basetext">
     <resources>
       <stylesheet src="chrome://global/skin/listbox.css"/>
     </resources>
 
     <content>
       <children>
         <xul:listcell xbl:inherits="label,crop,disabled,flexlabel"/>
@@ -1117,17 +1117,17 @@
            extends="chrome://global/content/bindings/listbox.xml#listitem-checkbox">
     <content>
       <children>
         <xul:listcell type="checkbox" class="listcell-iconic" xbl:inherits="label,image,crop,checked,disabled,flexlabel"/>
       </children>
     </content>
   </binding>
 
-  <binding id="listcell" role="xul:listcell"
+  <binding id="listcell"
            extends="chrome://global/content/bindings/general.xml#basecontrol">
 
     <resources>
       <stylesheet src="chrome://global/skin/listbox.css"/>
     </resources>
 
     <content>
       <children>
@@ -1162,30 +1162,30 @@
       <children>
         <xul:image class="listcell-check" xbl:inherits="checked,disabled"/>
         <xul:image class="listcell-icon" xbl:inherits="src=image"/>
         <xul:label class="listcell-label" xbl:inherits="value=label,flex=flexlabel,crop,disabled" flex="1" crop="right"/>
       </children>
     </content>
   </binding>
 
-  <binding id="listhead" role="xul:listhead">
+  <binding id="listhead">
 
     <resources>
       <stylesheet src="chrome://global/skin/listbox.css"/>
     </resources>
 
     <content>
       <xul:listheaditem>
         <children includes="listheader"/>
       </xul:listheaditem>
     </content>
   </binding>
 
-  <binding id="listheader" display="xul:button" role="xul:listheader">
+  <binding id="listheader" display="xul:button">
 
     <resources>
       <stylesheet src="chrome://global/skin/listbox.css"/>
     </resources>
 
     <content>
       <xul:image class="listheader-icon"/>
       <xul:label class="listheader-label" xbl:inherits="value=label,crop" flex="1" crop="right"/>
--- a/toolkit/content/widgets/menu.xml
+++ b/toolkit/content/widgets/menu.xml
@@ -4,17 +4,17 @@
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 
 <bindings id="menuitemBindings"
    xmlns="http://www.mozilla.org/xbl"
    xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    xmlns:xbl="http://www.mozilla.org/xbl">
 
-  <binding id="menuitem-base" role="xul:menuitem"
+  <binding id="menuitem-base"
            extends="chrome://global/content/bindings/general.xml#basetext">
     <implementation implements="nsIDOMXULSelectControlItemElement, nsIDOMXULContainerItemElement">
       <property name="value" onset="this.setAttribute('value', val); return val;"
                              onget="return this.getAttribute('value');"/>
       <!-- nsIDOMXULSelectControlItemElement -->
       <property name="selected" readonly="true"
                 onget="return this.getAttribute('selected') == 'true';"/>
       <property name="control" readonly="true">
--- a/toolkit/content/widgets/menulist.xml
+++ b/toolkit/content/widgets/menulist.xml
@@ -12,17 +12,17 @@
 
   <binding id="menulist-base" extends="chrome://global/content/bindings/general.xml#basecontrol">
     <resources>
       <stylesheet src="chrome://global/content/menulist.css"/>
       <stylesheet src="chrome://global/skin/menulist.css"/>
     </resources>
   </binding>
 
-  <binding id="menulist" display="xul:menu" role="xul:menulist"
+  <binding id="menulist" display="xul:menu"
            extends="chrome://global/content/bindings/menulist.xml#menulist-base">
     <content sizetopopup="pref">
       <xul:hbox class="menulist-label-box" flex="1">
         <xul:image class="menulist-icon" xbl:inherits="src=image,src"/>
         <xul:label class="menulist-label" xbl:inherits="value=label,crop,accesskey,highlightable" crop="right" flex="1"/>
         <xul:label class="menulist-highlightable-label" xbl:inherits="xbl:text=label,crop,accesskey,highlightable" crop="right" flex="1"/>
       </xul:hbox>
       <xul:dropmarker class="menulist-dropmarker" type="menu" xbl:inherits="disabled,open"/>
--- a/toolkit/content/widgets/notification.xml
+++ b/toolkit/content/widgets/notification.xml
@@ -393,17 +393,17 @@
         if (event.target.localName == "notification" &&
             event.propertyName == "margin-top")
           this._finishAnimation();
       ]]></handler>
     </handlers>
 
   </binding>
 
-  <binding id="notification" role="xul:alert">
+  <binding id="notification">
     <content>
       <xul:hbox anonid="details" align="center" flex="1"
                 oncommand="this.parentNode._doButtonCommand(event);">
         <xul:image anonid="messageImage" class="messageImage" xbl:inherits="src=image,type,value"/>
         <xul:description anonid="messageText" class="messageText" flex="1" xbl:inherits="xbl:text=label"/>
         <xul:spacer flex="1"/>
         <children/>
       </xul:hbox>
--- a/toolkit/content/widgets/popup.xml
+++ b/toolkit/content/widgets/popup.xml
@@ -536,17 +536,17 @@
         }
       </handler>
       <handler event="popuppositioned" phase="target">
         this.adjustArrowPosition();
       </handler>
     </handlers>
   </binding>
 
-  <binding id="tooltip" role="xul:tooltip"
+  <binding id="tooltip"
            extends="chrome://global/content/bindings/popup.xml#popup-base">
     <content>
       <children>
         <xul:label class="tooltip-label" xbl:inherits="xbl:text=label" flex="1"/>
       </children>
     </content>
 
     <implementation>
--- a/toolkit/content/widgets/progressmeter.xml
+++ b/toolkit/content/widgets/progressmeter.xml
@@ -4,17 +4,17 @@
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 
 <bindings id="progressmeterBindings"
    xmlns="http://www.mozilla.org/xbl"
    xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    xmlns:xbl="http://www.mozilla.org/xbl">
 
-  <binding id="progressmeter" role="xul:progressmeter">
+  <binding id="progressmeter">
     <resources>
       <stylesheet src="chrome://global/skin/progressmeter.css"/>
     </resources>
 
     <content>
       <xul:spacer class="progress-bar" xbl:inherits="mode"/>
       <xul:spacer class="progress-remainder" xbl:inherits="mode"/>
     </content>
--- a/toolkit/content/widgets/radio.xml
+++ b/toolkit/content/widgets/radio.xml
@@ -4,17 +4,17 @@
    - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
 
 
 <bindings id="radioBindings"
    xmlns="http://www.mozilla.org/xbl"
    xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    xmlns:xbl="http://www.mozilla.org/xbl">
 
-  <binding id="radiogroup" role="xul:radiogroup"
+  <binding id="radiogroup"
            extends="chrome://global/content/bindings/general.xml#basecontrol">
     <resources>
       <stylesheet src="chrome://global/skin/radio.css"/>
     </resources>
 
     <implementation implements="nsIDOMXULSelectControlElement">
       <constructor>
         <![CDATA[
@@ -422,17 +422,17 @@
       </handler>
       <handler event="blur" phase="target">
         this.removeAttribute("focused");
         this.focusedItem = null;
       </handler>
     </handlers>
   </binding>
 
-  <binding id="radio" role="xul:radiobutton"
+  <binding id="radio"
     extends="chrome://global/content/bindings/general.xml#basetext">
     <resources>
       <stylesheet src="chrome://global/skin/radio.css"/>
     </resources>
 
     <content>
       <xul:image class="radio-check" xbl:inherits="disabled,selected"/>
       <xul:hbox class="radio-label-box" align="center" flex="1">
--- a/toolkit/content/widgets/tabbox.xml
+++ b/toolkit/content/widgets/tabbox.xml
@@ -217,17 +217,17 @@
           Components.interfaces.nsIEventListenerService;
         let els = Components.classes["@mozilla.org/eventlistenerservice;1"]
                             .getService(nsIEventListenerService);
         els.removeSystemEventListener(this._eventNode, "keydown", this, false);
       </destructor>
     </implementation>
   </binding>
 
-  <binding id="tabs" role="xul:tabs"
+  <binding id="tabs"
            extends="chrome://global/content/bindings/general.xml#basecontrol">
     <resources>
       <stylesheet src="chrome://global/skin/tabbox.css"/>
     </resources>
 
     <content>
       <xul:spacer class="tabs-left"/>
       <children/>
@@ -576,17 +576,17 @@
 
         event.stopPropagation();
       ]]>
       </handler>
     </handlers>
 #endif
   </binding>
 
-  <binding id="tabpanels" role="xul:tabpanels"
+  <binding id="tabpanels"
            extends="chrome://global/content/bindings/tabbox.xml#tab-base">
     <implementation implements="nsIDOMXULRelatedElement">
       <!-- nsIDOMXULRelatedElement -->
       <method name="getRelatedElement">
         <parameter name="aTabPanelElm"/>
         <body>
         <![CDATA[
           if (!aTabPanelElm)
@@ -687,17 +687,17 @@
             this.selectedIndex = selectedIndex;
             return val;
           ]]>
         </setter>
       </property>
     </implementation>
   </binding>
 
-  <binding id="tab" display="xul:button" role="xul:tab"
+  <binding id="tab" display="xul:button"
            extends="chrome://global/content/bindings/general.xml#basetext">
     <resources>
       <stylesheet src="chrome://global/skin/tabbox.css"/>
     </resources>
 
     <content>
       <xul:hbox class="tab-middle box-inherit" xbl:inherits="align,dir,pack,orient,selected,visuallyselected" flex="1">
         <xul:image class="tab-icon"
--- a/toolkit/content/widgets/toolbar.xml
+++ b/toolkit/content/widgets/toolbar.xml
@@ -10,17 +10,17 @@
           xmlns:xbl="http://www.mozilla.org/xbl">
 
   <binding id="toolbar-base">
     <resources>
       <stylesheet src="chrome://global/skin/toolbar.css"/>
     </resources>
   </binding>
 
-  <binding id="toolbar" role="xul:toolbar"
+  <binding id="toolbar"
            extends="chrome://global/content/bindings/toolbar.xml#toolbar-base" />
 
   <binding id="toolbar-menubar-autohide"
            extends="chrome://global/content/bindings/toolbar.xml#toolbar">
     <implementation>
       <constructor>
         this._setInactive();
       </constructor>
@@ -131,17 +131,17 @@
                      this.getAttribute("customizing") != "true";
             };
           } catch (e) {}
         }
       ]]></constructor>
     </implementation>
   </binding>
 
-  <binding id="menubar" role="xul:menubar"
+  <binding id="menubar"
            extends="chrome://global/content/bindings/toolbar.xml#toolbar-base" display="xul:menubar">
     <implementation>
        <field name="_active">false</field>
        <field name="_statusbar">null</field>
        <field name="_originalStatusText">null</field>
        <property name="statusbar" onget="return this.getAttribute('statusbar');"
                                   onset="this.setAttribute('statusbar', val); return val;"/>
        <method name="_updateStatusText">
@@ -176,17 +176,17 @@
             this._statusbar.label = this._originalStatusText;
           ]]>
         </handler>
         <handler event="DOMMenuItemActive">this._updateStatusText(event.target.statusText);</handler>
         <handler event="DOMMenuItemInactive">this._updateStatusText("");</handler>
     </handlers>
   </binding>
 
-  <binding id="toolbardecoration" role="xul:toolbarseparator" extends="chrome://global/content/bindings/toolbar.xml#toolbar-base">
+  <binding id="toolbardecoration" extends="chrome://global/content/bindings/toolbar.xml#toolbar-base">
   </binding>
 
   <binding id="toolbarpaletteitem" extends="chrome://global/content/bindings/toolbar.xml#toolbar-base" display="xul:button">
     <content>
       <xul:hbox class="toolbarpaletteitem-box" flex="1" xbl:inherits="type,place">
         <children/>
       </xul:hbox>
     </content>
--- a/toolkit/content/widgets/tree.xml
+++ b/toolkit/content/widgets/tree.xml
@@ -23,17 +23,17 @@
         <parameter name="aEvent"/>
         <body><![CDATA[
           return aEvent.getModifierState("Accel");
         ]]></body>
       </method>
     </implementation>
   </binding>
 
-  <binding id="tree" extends="chrome://global/content/bindings/tree.xml#tree-base" role="xul:tree">
+  <binding id="tree" extends="chrome://global/content/bindings/tree.xml#tree-base">
     <content hidevscroll="true" hidehscroll="true" clickthrough="never">
       <children includes="treecols"/>
       <xul:stack class="tree-stack" flex="1">
         <xul:treerows class="tree-rows" flex="1" xbl:inherits="hidevscroll">
           <children/>
         </xul:treerows>
         <xul:textbox anonid="input" class="tree-input" left="0" top="0" hidden="true"/>
       </xul:stack>
@@ -1020,17 +1020,17 @@
            }
            event.preventDefault();
          }
          ]]>
       </handler>
     </handlers>
   </binding>
 
-  <binding id="treecols" role="xul:treecolumns">
+  <binding id="treecols">
     <resources>
       <stylesheet src="chrome://global/skin/tree.css"/>
     </resources>
     <content orient="horizontal">
       <xul:hbox class="tree-scrollable-columns" flex="1">
         <children includes="treecol|splitter"/>
       </xul:hbox>
       <xul:treecolpicker class="treecol-image" fixed="true" xbl:inherits="tooltiptext=pickertooltiptext"/>
@@ -1264,17 +1264,17 @@
         if (cell.col && !cell.col.cycler && cell.childElt != "twisty")
           this.parentNode.changeOpenState(row);
       ]]>
       </handler>
 
     </handlers>
   </binding>
 
-  <binding id="treecol-base" role="xul:treecolumnitem"
+  <binding id="treecol-base"
            extends="chrome://global/content/bindings/tree.xml#tree-base">
     <implementation>
       <constructor>
         this.parentNode.parentNode._columnsDirty = true;
       </constructor>
 
       <property name="ordinal">
         <getter><![CDATA[
@@ -1482,17 +1482,17 @@
   </binding>
 
   <binding id="treecol-image" extends="chrome://global/content/bindings/tree.xml#treecol-base">
     <content>
       <xul:image class="treecol-icon" xbl:inherits="src"/>
     </content>
   </binding>
 
-  <binding id="columnpicker" display="xul:button" role="xul:button"
+  <binding id="columnpicker" display="xul:button"
            extends="chrome://global/content/bindings/tree.xml#tree-base">
     <content>
       <xul:image class="tree-columnpicker-icon"/>
       <xul:menupopup anonid="popup">
         <xul:menuseparator anonid="menuseparator"/>
         <xul:menuitem anonid="menuitem" label="&restoreColumnOrder.label;"/>
       </xul:menupopup>
     </content>