Bug 942650 - Some toolbars have unknown accessible role or worse, r=tbsaunde Australis
☠☠ backed out by 453372e8d361 ☠ ☠
authorAlexander Surkov <surkov.alexander@gmail.com>
Thu, 05 Dec 2013 11:07:53 -0500
changeset 173643 328d23950f6371a4260fd39c2bfcfec04b452eba
parent 173642 9050b8a0ce6d977c4421a37bbff5ad6348e53bdd
child 173644 64f359e4e054e9c8f8d61e7f08e5310f9264c894
push id3224
push userlsblakk@mozilla.com
push dateTue, 04 Feb 2014 01:06:49 +0000
treeherdermozilla-beta@60c04d0987f1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstbsaunde
bugs942650
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 942650 - Some toolbars have unknown accessible role or worse, r=tbsaunde Australis
accessible/src/base/nsAccessibilityService.cpp
accessible/src/base/nsAccessibilityService.h
accessible/src/xul/XULTabAccessible.h
accessible/tests/mochitest/tree/test_formctrl.xul
browser/components/customizableui/content/toolbar.xml
--- a/accessible/src/base/nsAccessibilityService.cpp
+++ b/accessible/src/base/nsAccessibilityService.cpp
@@ -1001,18 +1001,18 @@ nsAccessibilityService::GetOrCreateAcces
       if (deckFrame && deckFrame->GetSelectedBox() != frame) {
         if (aIsSubtreeHidden)
           *aIsSubtreeHidden = true;
 
         return nullptr;
       }
     }
 
-    // Elements may implement nsIAccessibleProvider via XBL. This allows them to
-    // say what kind of accessible to create.
+    // XBL bindings may use @role attribute to point the accessible type
+    // they belong to.
     newAcc = CreateAccessibleByType(content, document);
 
     // Any XUL box can be used as tabpanel, make sure we create a proper
     // accessible for it.
     if (!newAcc && aContext->IsXULTabpanels() &&
         content->GetParent() == aContext->GetContent()) {
       nsIAtom* frameType = frame->GetType();
       if (frameType == nsGkAtoms::boxFrame ||
--- a/accessible/src/base/nsAccessibilityService.h
+++ b/accessible/src/base/nsAccessibilityService.h
@@ -173,18 +173,17 @@ private:
   bool Init();
 
   /**
    * Shutdowns accessibility service.
    */
   void Shutdown();
 
   /**
-   * Create accessible for the element implementing nsIAccessibleProvider
-   * interface.
+   * Create accessible for the element having XBL bindings.
    */
   already_AddRefed<Accessible>
     CreateAccessibleByType(nsIContent* aContent, DocAccessible* aDoc);
 
   /**
    * Create accessible for HTML node by tag name.
    */
   already_AddRefed<Accessible>
--- a/accessible/src/xul/XULTabAccessible.h
+++ b/accessible/src/xul/XULTabAccessible.h
@@ -70,20 +70,17 @@ public:
     { mType = eXULTabpanelsType; }
 
   // Accessible
   virtual a11y::role NativeRole();
 };
 
 
 /**
- * A tabpanel object, child elements of xul:tabpanels element. Note,the object
- * is created from nsAccessibilityService::GetAccessibleForDeckChildren()
- * method and we do not use nsIAccessibleProvider interface here because
- * all children of xul:tabpanels element acts as xul:tabpanel element.
+ * A tabpanel object, child elements of xul:tabpanels element.
  *
  * XXX: we need to move the class logic into generic class since
  * for example we do not create instance of this class for XUL textbox used as
  * a tabpanel.
  */
 class XULTabpanelAccessible : public AccessibleWrap
 {
 public:
--- a/accessible/tests/mochitest/tree/test_formctrl.xul
+++ b/accessible/tests/mochitest/tree/test_formctrl.xul
@@ -1,16 +1,24 @@
 <?xml version="1.0"?>
 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
                  type="text/css"?>
 
+<!-- Firefox toolbar -->
+<?xml-stylesheet href="chrome://browser/content/browser.css"
+                 type="text/css"?>
+
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         title="Accessible XUL checkbox and radio hierarchy tests">
 
+  <!-- Firefox toolbar -->
+  <script type="application/javascript"
+          src="chrome://browser/content/browser.js"/>
+
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
 
   <script type="application/javascript"
           src="../common.js" />
   <script type="application/javascript"
           src="../role.js" />
 
@@ -71,16 +79,19 @@
             name: "hello",
             children: [ ]
           }
         ]
       };
 
       testAccessibleTree("toolbar2", accTree);
 
+      if (!SEAMONKEY)
+        testAccessibleTree("tb_customizable", { TOOLBAR: [] });
+
       SimpleTest.finish()
     }
 
     SimpleTest.waitForExplicitFinish();
     addA11yLoadEvent(doTest);
   ]]>
   </script>
 
@@ -105,13 +116,15 @@
         <radio label="radio2"/>
       </radiogroup>
       <toolbar id="toolbar" toolbarname="My toolbar">
         <toolbarbutton id="button1" label="hello"/>
       </toolbar>
       <toolbar id="toolbar2" toolbarname="2nd" aria-label="My second toolbar">
         <toolbarbutton id="button2" label="hello"/>
       </toolbar>
+
+      <toolbar id="tb_customizable" customizable="true"/>
     </vbox>
   </hbox>
 
 </window>
 
--- a/browser/components/customizableui/content/toolbar.xml
+++ b/browser/components/customizableui/content/toolbar.xml
@@ -3,29 +3,23 @@
    - 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">
+  <binding id="toolbar" role="xul:toolbar">
     <resources>
       <stylesheet src="chrome://global/skin/toolbar.css"/>
     </resources>
-    <implementation implements="nsIAccessibleProvider">
+    <implementation>
       <field name="overflowedDuringConstruction">null</field>
 
-      <property name="accessibleType" readonly="true">
-        <getter>
-          return Components.interfaces.nsIAccessibleProvider.XULToolbar;
-        </getter>
-      </property>
-
       <constructor><![CDATA[
           let scope = {};
           Cu.import("resource:///modules/CustomizableUI.jsm", scope);
           // Add an early overflow event listener that will mark if the
           // toolbar overflowed during construction.
           if (scope.CustomizableUI.isAreaOverflowable(this.id)) {
             this.addEventListener("overflow", this);
             this.addEventListener("underflow", this);