Bug 1439773 - Move XBL accessibility role="xul:text" and role="xul:link" into XULMap.h r=enndeakin+6102
authorTimothy Guan-tin Chien <timdream@gmail.com>
Fri, 02 Mar 2018 09:50:39 -0800
changeset 461597 853ef87ccb4f1aa5482916d6560c4461eacfcf86
parent 461596 9bb3ef4fd027d0354055de0bf33514bdad5ac76d
child 461598 194cb5ea7ed6011b9f0c0db74474f737f3bc5729
push id1683
push usersfraser@mozilla.com
push dateThu, 26 Apr 2018 16:43:40 +0000
treeherdermozilla-release@5af6cb21869d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersenndeakin
bugs1439773
milestone60.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 1439773 - Move XBL accessibility role="xul:text" and role="xul:link" into XULMap.h r=enndeakin+6102 MozReview-Commit-ID: 4RY0ttkwbCB
accessible/base/XULMap.h
accessible/base/nsAccessibilityService.cpp
toolkit/content/widgets/text.xml
--- 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;