mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-27 10:57:34 +09:00
import FIREFOX_52_6_0esr_RELEASE from mozilla-esr52 hg repo
This commit is contained in:
commit
dcd9973243
150858 changed files with 23884658 additions and 0 deletions
59
accessible/jsat/Constants.jsm
Normal file
59
accessible/jsat/Constants.jsm
Normal file
|
|
@ -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;
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue