Bug 942650 - Some toolbars have unknown accessible role or worse, r=tbsaunde

This commit is contained in:
Alexander Surkov 2013-12-05 10:43:40 -05:00
parent c7f8cc63c2
commit f0d833e65b
5 changed files with 19 additions and 16 deletions

View file

@ -1006,8 +1006,8 @@ nsAccessibilityService::GetOrCreateAccessible(nsINode* aNode,
} }
} }
// Elements may implement nsIAccessibleProvider via XBL. This allows them to // XBL bindings may use @role attribute to point the accessible type
// say what kind of accessible to create. // they belong to.
newAcc = CreateAccessibleByType(content, document); newAcc = CreateAccessibleByType(content, document);
// Any XUL box can be used as tabpanel, make sure we create a proper // Any XUL box can be used as tabpanel, make sure we create a proper

View file

@ -178,8 +178,7 @@ private:
void Shutdown(); void Shutdown();
/** /**
* Create accessible for the element implementing nsIAccessibleProvider * Create accessible for the element having XBL bindings.
* interface.
*/ */
already_AddRefed<Accessible> already_AddRefed<Accessible>
CreateAccessibleByType(nsIContent* aContent, DocAccessible* aDoc); CreateAccessibleByType(nsIContent* aContent, DocAccessible* aDoc);

View file

@ -75,10 +75,7 @@ public:
/** /**
* A tabpanel object, child elements of xul:tabpanels element. Note,the object * A tabpanel object, child elements of xul:tabpanels element.
* 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 * 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 * for example we do not create instance of this class for XUL textbox used as

View file

@ -3,9 +3,17 @@
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/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" <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="Accessible XUL checkbox and radio hierarchy tests"> title="Accessible XUL checkbox and radio hierarchy tests">
<!-- Firefox toolbar -->
<script type="application/javascript"
src="chrome://browser/content/browser.js"/>
<script type="application/javascript" <script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
@ -76,6 +84,9 @@
testAccessibleTree("toolbar2", accTree); testAccessibleTree("toolbar2", accTree);
if (!SEAMONKEY)
testAccessibleTree("tb_customizable", { TOOLBAR: [] });
SimpleTest.finish() SimpleTest.finish()
} }
@ -110,6 +121,8 @@
<toolbar id="toolbar2" toolbarname="2nd" aria-label="My second toolbar"> <toolbar id="toolbar2" toolbarname="2nd" aria-label="My second toolbar">
<toolbarbutton id="button2" label="hello"/> <toolbarbutton id="button2" label="hello"/>
</toolbar> </toolbar>
<toolbar id="tb_customizable" customizable="true"/>
</vbox> </vbox>
</hbox> </hbox>

View file

@ -8,19 +8,13 @@
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:xbl="http://www.mozilla.org/xbl"> xmlns:xbl="http://www.mozilla.org/xbl">
<binding id="toolbar"> <binding id="toolbar" role="xul:toolbar">
<resources> <resources>
<stylesheet src="chrome://global/skin/toolbar.css"/> <stylesheet src="chrome://global/skin/toolbar.css"/>
</resources> </resources>
<implementation implements="nsIAccessibleProvider"> <implementation>
<field name="overflowedDuringConstruction">null</field> <field name="overflowedDuringConstruction">null</field>
<property name="accessibleType" readonly="true">
<getter>
return Components.interfaces.nsIAccessibleProvider.XULToolbar;
</getter>
</property>
<constructor><![CDATA[ <constructor><![CDATA[
let scope = {}; let scope = {};
Cu.import("resource:///modules/CustomizableUI.jsm", scope); Cu.import("resource:///modules/CustomizableUI.jsm", scope);