mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 967238 - moved State constructor and prototype out of getState utility. r=eeejay
--- accessible/src/jsat/Utils.jsm | 44 ++++++++++++++++++++++++------------------- 1 file changed, 25 insertions(+), 19 deletions(-)
This commit is contained in:
parent
a0af173362
commit
d6963584d9
@ -189,25 +189,6 @@ this.Utils = {
|
||||
},
|
||||
|
||||
getState: function getState(aAccessibleOrEvent) {
|
||||
function State(aBase, aExtended) {
|
||||
this.base = aBase;
|
||||
this.extended = aExtended;
|
||||
|
||||
this.contains = (other) => {
|
||||
return !!(this.base & other.base || this.extended & other.extended);
|
||||
};
|
||||
|
||||
this.toString = () => {
|
||||
let stateStrings = Utils.AccRetrieval.
|
||||
getStringStates(this.base, this.extended);
|
||||
let statesArray = new Array(stateStrings.length);
|
||||
for (let i = 0; i < statesArray.length; i++) {
|
||||
statesArray[i] = stateStrings.item(i);
|
||||
}
|
||||
return '[' + statesArray.join(', ') + ']';
|
||||
};
|
||||
}
|
||||
|
||||
if (aAccessibleOrEvent instanceof Ci.nsIAccessibleStateChangeEvent) {
|
||||
return new State(
|
||||
aAccessibleOrEvent.isExtraState ? 0 : aAccessibleOrEvent.state,
|
||||
@ -330,6 +311,31 @@ this.Utils = {
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* State object used internally to process accessible's states.
|
||||
* @param {Number} aBase Base state.
|
||||
* @param {Number} aExtended Extended state.
|
||||
*/
|
||||
function State(aBase, aExtended) {
|
||||
this.base = aBase;
|
||||
this.extended = aExtended;
|
||||
}
|
||||
|
||||
State.prototype = {
|
||||
contains: function State_contains(other) {
|
||||
return !!(this.base & other.base || this.extended & other.extended);
|
||||
},
|
||||
toString: function State_toString() {
|
||||
let stateStrings = Utils.AccRetrieval.
|
||||
getStringStates(this.base, this.extended);
|
||||
let statesArray = new Array(stateStrings.length);
|
||||
for (let i = 0; i < statesArray.length; i++) {
|
||||
statesArray[i] = stateStrings.item(i);
|
||||
}
|
||||
return '[' + statesArray.join(', ') + ']';
|
||||
}
|
||||
};
|
||||
|
||||
this.Logger = {
|
||||
DEBUG: 0,
|
||||
INFO: 1,
|
||||
|
Loading…
Reference in New Issue
Block a user