Bug 996268 - Move traversal rule prefilter to constants. r=yzen
☠☠ backed out by 18224f0cc4dd ☠ ☠
authorEitan Isaacson <eitan@monotonous.org>
Wed, 16 Apr 2014 18:27:00 -0700
changeset 179271 31b7ff03d49665d2a12d232ce0da4a96eac921a9
parent 179270 acdf76fb15b96c34625b2ec35b7cf46ccffa1784
child 179272 fceba10dc04b85c2abca0a429c6bb3012f48ca0e
push id272
push userpvanderbeken@mozilla.com
push dateMon, 05 May 2014 16:31:18 +0000
reviewersyzen
bugs996268
milestone31.0a1
Bug 996268 - Move traversal rule prefilter to constants. r=yzen
accessible/src/jsat/Constants.jsm
accessible/src/jsat/TraversalRules.jsm
--- a/accessible/src/jsat/Constants.jsm
+++ b/accessible/src/jsat/Constants.jsm
@@ -1,14 +1,15 @@
 const Ci = Components.interfaces;
 const Cu = Components.utils;
 
 Cu.import('resource://gre/modules/XPCOMUtils.jsm');
 
-this.EXPORTED_SYMBOLS = ['Roles', 'Events', 'Relations', 'Filters', 'States'];
+this.EXPORTED_SYMBOLS = ['Roles', 'Events', 'Relations',
+                         'Filters', 'States', 'Prefilters'];
 
 function ConstantsMap (aObject, aPrefix, aMap = {}, aModifier = null) {
   let offset = aPrefix.length;
   for (var name in aObject) {
     if (name.indexOf(aPrefix) === 0) {
       aMap[name.slice(offset)] = aModifier ?
         aModifier(aObject[name]) : aObject[name];
     }
@@ -31,16 +32,22 @@ XPCOMUtils.defineLazyGetter(
 
 XPCOMUtils.defineLazyGetter(
   this, 'Relations',
   function() {
     return ConstantsMap(Ci.nsIAccessibleRelation, 'RELATION_');
   });
 
 XPCOMUtils.defineLazyGetter(
+  this, 'Prefilters',
+  function() {
+    return ConstantsMap(Ci.nsIAccessibleTraversalRule, 'PREFILTER_');
+  });
+
+XPCOMUtils.defineLazyGetter(
   this, 'Filters',
   function() {
     return ConstantsMap(Ci.nsIAccessibleTraversalRule, 'FILTER_');
   });
 
 XPCOMUtils.defineLazyGetter(
   this, 'States',
   function() {
--- a/accessible/src/jsat/TraversalRules.jsm
+++ b/accessible/src/jsat/TraversalRules.jsm
@@ -14,16 +14,18 @@ this.EXPORTED_SYMBOLS = ['TraversalRules
 Cu.import('resource://gre/modules/accessibility/Utils.jsm');
 Cu.import('resource://gre/modules/XPCOMUtils.jsm');
 XPCOMUtils.defineLazyModuleGetter(this, 'Roles',
   'resource://gre/modules/accessibility/Constants.jsm');
 XPCOMUtils.defineLazyModuleGetter(this, 'Filters',
   'resource://gre/modules/accessibility/Constants.jsm');
 XPCOMUtils.defineLazyModuleGetter(this, 'States',
   'resource://gre/modules/accessibility/Constants.jsm');
+XPCOMUtils.defineLazyModuleGetter(this, 'Prefilters',
+  'resource://gre/modules/accessibility/Constants.jsm');
 
 let gSkipEmptyImages = new PrefCache('accessibility.accessfu.skip_empty_images');
 
 function BaseTraversalRule(aRoles, aMatchFunc, aPreFilter) {
   this._explicitMatchRoles = new Set(aRoles);
   this._matchRoles = aRoles;
   if (aRoles.indexOf(Roles.LABEL) < 0) {
     this._matchRoles.push(Roles.LABEL);
@@ -141,31 +143,28 @@ var gSimpleMatchFunc = function gSimpleM
   default:
     // Ignore the subtree, if there is one. So that we don't land on
     // the same content that was already presented by its parent.
     return Filters.MATCH |
       Filters.IGNORE_SUBTREE;
   }
 };
 
-var gSimplePreFilter = Ci.nsIAccessibleTraversalRule.PREFILTER_DEFUNCT |
-  Ci.nsIAccessibleTraversalRule.PREFILTER_INVISIBLE |
-  Ci.nsIAccessibleTraversalRule.PREFILTER_ARIA_HIDDEN |
-  Ci.nsIAccessibleTraversalRule.PREFILTER_TRANSPARENT;
+var gSimplePreFilter = Prefilters.DEFUNCT |
+  Prefilters.INVISIBLE |
+  Prefilters.ARIA_HIDDEN |
+  Prefilters.TRANSPARENT;
 
 this.TraversalRules = {
   Simple: new BaseTraversalRule(gSimpleTraversalRoles, gSimpleMatchFunc),
 
   SimpleOnScreen: new BaseTraversalRule(
     gSimpleTraversalRoles, gSimpleMatchFunc,
-    Ci.nsIAccessibleTraversalRule.PREFILTER_DEFUNCT |
-      Ci.nsIAccessibleTraversalRule.PREFILTER_INVISIBLE |
-      Ci.nsIAccessibleTraversalRule.PREFILTER_ARIA_HIDDEN |
-      Ci.nsIAccessibleTraversalRule.PREFILTER_TRANSPARENT |
-      Ci.nsIAccessibleTraversalRule.PREFILTER_OFFSCREEN),
+    Prefilters.DEFUNCT | Prefilters.INVISIBLE | Prefilters.ARIA_HIDDEN |
+    Prefilters.TRANSPARENT | Prefilters.OFFSCREEN),
 
   Anchor: new BaseTraversalRule(
     [Roles.LINK],
     function Anchor_match(aAccessible)
     {
       // We want to ignore links, only focus named anchors.
       if (Utils.getState(aAccessible).contains(States.LINKED)) {
         return Filters.IGNORE;