Bug 1521163 - add STATIC_TEXT role to the list of accessible objects that we calculate colour contrast for. r=pbro
authorYura Zenevich <yura.zenevich@gmail.com>
Mon, 21 Jan 2019 08:58:53 +0000
changeset 514702 2d56b2958a4138a81d5929a88e5200d6bf8b864d
parent 514701 1cccd0ed64c30ca3d7873620f3aac6afe09f82e2
child 514703 71e42954633fde1ee9b48166c18d2e178ad08890
push id1953
push userffxbld-merge
push dateMon, 11 Mar 2019 12:10:20 +0000
treeherdermozilla-release@9c35dcbaa899 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspbro
bugs1521163
milestone66.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 1521163 - add STATIC_TEXT role to the list of accessible objects that we calculate colour contrast for. r=pbro MozReview-Commit-ID: HLM7w8dfKdT Differential Revision: https://phabricator.services.mozilla.com/D17008
devtools/server/actors/accessibility/accessible.js
--- a/devtools/server/actors/accessibility/accessible.js
+++ b/devtools/server/actors/accessibility/accessible.js
@@ -16,16 +16,22 @@ const nsIAccessibleRelation = Ci.nsIAcce
 const RELATIONS_TO_IGNORE = new Set([
   nsIAccessibleRelation.RELATION_CONTAINING_APPLICATION,
   nsIAccessibleRelation.RELATION_CONTAINING_TAB_PANE,
   nsIAccessibleRelation.RELATION_CONTAINING_WINDOW,
   nsIAccessibleRelation.RELATION_PARENT_WINDOW_OF,
   nsIAccessibleRelation.RELATION_SUBWINDOW_OF,
 ]);
 
+const nsIAccessibleRole = Ci.nsIAccessibleRole;
+const TEXT_ROLES = new Set([
+  nsIAccessibleRole.ROLE_TEXT_LEAF,
+  nsIAccessibleRole.ROLE_STATICTEXT,
+]);
+
 const STATE_DEFUNCT = Ci.nsIAccessibleStates.EXT_STATE_DEFUNCT;
 const CSS_TEXT_SELECTOR = "#text";
 
 /**
  * Get node inforamtion such as nodeType and the unique CSS selector for the node.
  * @param  {DOMNode} node
  *         Node for which to get the information.
  * @return {Object}
@@ -364,24 +370,20 @@ const AccessibleActor = ActorClassWithSp
       states: this.states,
       actions: this.actions,
       attributes: this.attributes,
     };
   },
 
   _isValidTextLeaf(rawAccessible) {
     return !isDefunct(rawAccessible) &&
-           rawAccessible.role === Ci.nsIAccessibleRole.ROLE_TEXT_LEAF &&
+           TEXT_ROLES.has(rawAccessible.role) &&
            rawAccessible.name && rawAccessible.name.trim().length > 0;
   },
 
-  get _nonEmptyTextLeafs() {
-    return this.children().filter(child => this._isValidTextLeaf(child.rawAccessible));
-  },
-
   /**
    * Calculate the contrast ratio of the given accessible.
    */
   async _getContrastRatio() {
     if (!this._isValidTextLeaf(this.rawAccessible)) {
       return null;
     }