summaryrefslogtreecommitdiffstats
path: root/accessible/jsat/Constants.jsm
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /accessible/jsat/Constants.jsm
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'accessible/jsat/Constants.jsm')
-rw-r--r--accessible/jsat/Constants.jsm59
1 files changed, 59 insertions, 0 deletions
diff --git a/accessible/jsat/Constants.jsm b/accessible/jsat/Constants.jsm
new file mode 100644
index 000000000..152604431
--- /dev/null
+++ b/accessible/jsat/Constants.jsm
@@ -0,0 +1,59 @@
+const Ci = Components.interfaces;
+const Cu = Components.utils;
+
+Cu.import('resource://gre/modules/XPCOMUtils.jsm');
+
+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];
+ }
+ }
+
+ return aMap;
+}
+
+XPCOMUtils.defineLazyGetter(
+ this, 'Roles',
+ function() {
+ return ConstantsMap(Ci.nsIAccessibleRole, 'ROLE_');
+ });
+
+XPCOMUtils.defineLazyGetter(
+ this, 'Events',
+ function() {
+ return ConstantsMap(Ci.nsIAccessibleEvent, 'EVENT_');
+ });
+
+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() {
+ let statesMap = ConstantsMap(Ci.nsIAccessibleStates, 'STATE_', {},
+ (val) => { return { base: val, extended: 0 }; });
+ ConstantsMap(Ci.nsIAccessibleStates, 'EXT_STATE_', statesMap,
+ (val) => { return { base: 0, extended: val }; });
+ return statesMap;
+ });