2013-11-19 22:17:43 +04:00
|
|
|
const Ci = Components.interfaces;
|
|
|
|
const Cu = Components.utils;
|
|
|
|
|
2017-08-01 19:13:27 +03:00
|
|
|
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
2013-11-19 22:17:43 +04:00
|
|
|
|
2017-08-01 19:13:27 +03:00
|
|
|
this.EXPORTED_SYMBOLS = ["Roles", "Events", "Relations",
|
|
|
|
"Filters", "States", "Prefilters"];
|
2013-11-19 22:17:43 +04:00
|
|
|
|
2014-01-28 04:35:13 +04:00
|
|
|
function ConstantsMap (aObject, aPrefix, aMap = {}, aModifier = null) {
|
2013-11-19 22:17:43 +04:00
|
|
|
let offset = aPrefix.length;
|
|
|
|
for (var name in aObject) {
|
|
|
|
if (name.indexOf(aPrefix) === 0) {
|
2014-01-28 04:35:13 +04:00
|
|
|
aMap[name.slice(offset)] = aModifier ?
|
|
|
|
aModifier(aObject[name]) : aObject[name];
|
2013-11-19 22:17:43 +04:00
|
|
|
}
|
|
|
|
}
|
2014-01-28 04:35:13 +04:00
|
|
|
|
|
|
|
return aMap;
|
2013-11-19 22:17:43 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
XPCOMUtils.defineLazyGetter(
|
2017-08-01 19:13:27 +03:00
|
|
|
this, "Roles",
|
2013-11-19 22:17:43 +04:00
|
|
|
function() {
|
2017-08-01 19:13:27 +03:00
|
|
|
return ConstantsMap(Ci.nsIAccessibleRole, "ROLE_");
|
2013-11-19 22:17:43 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
XPCOMUtils.defineLazyGetter(
|
2017-08-01 19:13:27 +03:00
|
|
|
this, "Events",
|
2013-11-19 22:17:43 +04:00
|
|
|
function() {
|
2017-08-01 19:13:27 +03:00
|
|
|
return ConstantsMap(Ci.nsIAccessibleEvent, "EVENT_");
|
2013-11-19 22:17:43 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
XPCOMUtils.defineLazyGetter(
|
2017-08-01 19:13:27 +03:00
|
|
|
this, "Relations",
|
2013-11-19 22:17:43 +04:00
|
|
|
function() {
|
2017-08-01 19:13:27 +03:00
|
|
|
return ConstantsMap(Ci.nsIAccessibleRelation, "RELATION_");
|
2013-11-19 22:17:43 +04:00
|
|
|
});
|
|
|
|
|
2014-04-17 09:02:40 +04:00
|
|
|
XPCOMUtils.defineLazyGetter(
|
2017-08-01 19:13:27 +03:00
|
|
|
this, "Prefilters",
|
2014-04-17 09:02:40 +04:00
|
|
|
function() {
|
2017-08-01 19:13:27 +03:00
|
|
|
return ConstantsMap(Ci.nsIAccessibleTraversalRule, "PREFILTER_");
|
2014-04-17 09:02:40 +04:00
|
|
|
});
|
|
|
|
|
2013-11-19 22:17:43 +04:00
|
|
|
XPCOMUtils.defineLazyGetter(
|
2017-08-01 19:13:27 +03:00
|
|
|
this, "Filters",
|
2013-11-19 22:17:43 +04:00
|
|
|
function() {
|
2017-08-01 19:13:27 +03:00
|
|
|
return ConstantsMap(Ci.nsIAccessibleTraversalRule, "FILTER_");
|
2014-01-28 04:35:13 +04:00
|
|
|
});
|
|
|
|
|
|
|
|
XPCOMUtils.defineLazyGetter(
|
2017-08-01 19:13:27 +03:00
|
|
|
this, "States",
|
2014-01-28 04:35:13 +04:00
|
|
|
function() {
|
2017-08-01 19:13:27 +03:00
|
|
|
let statesMap = ConstantsMap(Ci.nsIAccessibleStates, "STATE_", {},
|
2014-01-28 04:35:13 +04:00
|
|
|
(val) => { return { base: val, extended: 0 }; });
|
2017-08-01 19:13:27 +03:00
|
|
|
ConstantsMap(Ci.nsIAccessibleStates, "EXT_STATE_", statesMap,
|
2014-01-28 04:35:13 +04:00
|
|
|
(val) => { return { base: 0, extended: val }; });
|
|
|
|
return statesMap;
|
2013-11-19 22:17:43 +04:00
|
|
|
});
|