Backout Bug 942650 - Some toolbars have unknown accessible role or worse - to fix commit message DONTBUILD
authorAlexander Surkov <surkov.alexander@gmail.com>
Thu, 05 Dec 2013 11:03:48 -0500
changeset 174616 9050b8a0ce6d977c4421a37bbff5ad6348e53bdd
parent 174615 7e15bc7f7e4c66d852fabaea632e8e0091821e5e
child 174617 328d23950f6371a4260fd39c2bfcfec04b452eba
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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
Backout Bug 942650 - Some toolbars have unknown accessible role or worse - to fix commit message DONTBUILD
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;
       }
     }
 
-    // XBL bindings may use @role attribute to point the accessible type
-    // they belong to.
+    // Elements may implement nsIAccessibleProvider via XBL. This allows them to
+    // say what kind of accessible to create.
     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,17 +173,18 @@ private:
   bool Init();
 
   /**
    * Shutdowns accessibility service.
    */
   void Shutdown();
 
   /**
-   * Create accessible for the element having XBL bindings.
+   * Create accessible for the element implementing nsIAccessibleProvider
+   * interface.
    */
   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,17 +70,20 @@ public:
     { mType = eXULTabpanelsType; }
 
   // Accessible
   virtual a11y::role NativeRole();
 };
 
 
 /**
- * A tabpanel object, child elements of xul:tabpanels element.
+ * 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.
  *
  * 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,24 +1,16 @@
 <?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" />
 
@@ -79,19 +71,16 @@
             name: "hello",
             children: [ ]
           }
         ]
       };
 
       testAccessibleTree("toolbar2", accTree);
 
-      if (!SEAMONKEY)
-        testAccessibleTree("tb_customizable", { TOOLBAR: [] });
-
       SimpleTest.finish()
     }
 
     SimpleTest.waitForExplicitFinish();
     addA11yLoadEvent(doTest);
   ]]>
   </script>
 
@@ -116,15 +105,13 @@
         <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,23 +3,29 @@
    - 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>
+    <implementation implements="nsIAccessibleProvider">
       <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);