Bug 996268 - Move traversal rule prefilter to constants. r=yzen
authorEitan Isaacson <eitan@monotonous.org>
Wed, 16 Apr 2014 22:02:40 -0700
changeset 197442 09177e52a4c4c08e6488a7a440191fe265745009
parent 197441 2bfdbce8d055ab966b86b4d6e4b99c0dfd568e44
child 197443 d1ed266256d3476aec2bb84f9a4ac0c8052adb38
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersyzen
bugs996268
milestone31.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 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;