Bug 1439773 - Move XBL accessibility role="xul:text" and role="xul:link" into XULMap.h
MozReview-Commit-ID: 4RY0ttkwbCB
--- a/accessible/base/XULMap.h
+++ b/accessible/base/XULMap.h
@@ -1,15 +1,16 @@
/* 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(browser, OuterDocAccessible)
XULMAP_TYPE(button, XULButtonAccessible)
XULMAP_TYPE(checkbox, XULCheckboxAccessible)
+XULMAP_TYPE(description, XULLabelAccessible)
XULMAP_TYPE(dropMarker, XULDropmarkerAccessible)
XULMAP_TYPE(editor, OuterDocAccessible)
XULMAP_TYPE(findbar, XULToolbarAccessible)
XULMAP_TYPE(groupbox, XULGroupboxAccessible)
XULMAP_TYPE(iframe, OuterDocAccessible)
XULMAP_TYPE(listbox, XULListboxAccessibleWrap)
XULMAP_TYPE(listhead, XULColumAccessible)
XULMAP_TYPE(listheader, XULColumnItemAccessible)
@@ -37,16 +38,27 @@ XULMAP_TYPE(toolbarspring, XULToolbarSep
XULMAP_TYPE(treecol, XULColumnItemAccessible)
XULMAP_TYPE(treecolpicker, XULButtonAccessible)
XULMAP_TYPE(treecols, XULTreeColumAccessible)
XULMAP_TYPE(toolbar, XULToolbarAccessible)
XULMAP_TYPE(toolbarbutton, XULToolbarButtonAccessible)
XULMAP_TYPE(tooltip, XULTooltipAccessible)
XULMAP(
+ label,
+ [](nsIContent* aContent, Accessible* aContext) -> Accessible* {
+ if (aContent->IsElement() &&
+ aContent->AsElement()->ClassList()->Contains(NS_LITERAL_STRING("text-link"))) {
+ return new XULLinkAccessible(aContent, aContext->Document());
+ }
+ return new XULLabelAccessible(aContent, aContext->Document());
+ }
+)
+
+XULMAP(
image,
[](nsIContent* aContent, Accessible* aContext) -> Accessible* {
if (aContent->IsElement() &&
aContent->AsElement()->HasAttr(kNameSpaceID_None, nsGkAtoms::onclick)) {
return new XULToolbarButtonAccessible(aContent, aContext->Document());
}
// Don't include nameless images in accessible tree.
--- a/accessible/base/nsAccessibilityService.cpp
+++ b/accessible/base/nsAccessibilityService.cpp
@@ -1479,22 +1479,16 @@ nsAccessibilityService::CreateAccessible
#ifdef MOZ_XUL
// XUL controls
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:link")) {
- accessible = new XULLinkAccessible(aContent, aDoc);
-
- } else if (role.EqualsLiteral("xul:text")) {
- accessible = new XULLabelAccessible(aContent, aDoc);
-
}
#endif // MOZ_XUL
return accessible.forget();
}
already_AddRefed<Accessible>
nsAccessibilityService::CreateAccessibleByFrameType(nsIFrame* aFrame,
--- a/toolkit/content/widgets/text.xml
+++ b/toolkit/content/widgets/text.xml
@@ -5,17 +5,17 @@
<bindings id="textBindings"
xmlns="http://www.mozilla.org/xbl"
xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml">
<!-- bound to <description>s -->
- <binding id="text-base" role="xul:text">
+ <binding id="text-base">
<implementation implements="nsIDOMXULDescriptionElement">
<property name="disabled" onset="if (val) this.setAttribute('disabled', 'true');
else this.removeAttribute('disabled');
return val;"
onget="return this.getAttribute('disabled') == 'true';"/>
<property name="value" onget="return this.getAttribute('value');"
onset="this.setAttribute('value', val); return val;"/>
<property name="crop" onget="return this.getAttribute('crop');"
@@ -282,17 +282,17 @@
<handler event="click" action="if (this.disabled) return;
var controlElement = this.labeledControlElement;
if(controlElement)
controlElement.focus();
"/>
</handlers>
</binding>
- <binding id="text-link" extends="chrome://global/content/bindings/text.xml#text-label" role="xul:link">
+ <binding id="text-link" extends="chrome://global/content/bindings/text.xml#text-label">
<implementation>
<property name="href" onget="return this.getAttribute('href');"
onset="this.setAttribute('href', val); return val;" />
<method name="open">
<parameter name="aEvent"/>
<body>
<![CDATA[
var href = this.href;