mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1459673 - Remove ANDROID_ prefix from Android event type constants in jsat. r=yzen
This commit is contained in:
parent
659145e037
commit
d992429c03
@ -1,19 +1,19 @@
|
||||
ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
const AndroidEvents = {
|
||||
ANDROID_VIEW_CLICKED: 0x01,
|
||||
ANDROID_VIEW_LONG_CLICKED: 0x02,
|
||||
ANDROID_VIEW_SELECTED: 0x04,
|
||||
ANDROID_VIEW_FOCUSED: 0x08,
|
||||
ANDROID_VIEW_TEXT_CHANGED: 0x10,
|
||||
ANDROID_WINDOW_STATE_CHANGED: 0x20,
|
||||
ANDROID_VIEW_HOVER_ENTER: 0x80,
|
||||
ANDROID_VIEW_HOVER_EXIT: 0x100,
|
||||
ANDROID_VIEW_SCROLLED: 0x1000,
|
||||
ANDROID_VIEW_TEXT_SELECTION_CHANGED: 0x2000,
|
||||
ANDROID_ANNOUNCEMENT: 0x4000,
|
||||
ANDROID_VIEW_ACCESSIBILITY_FOCUSED: 0x8000,
|
||||
ANDROID_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY: 0x20000,
|
||||
VIEW_CLICKED: 0x01,
|
||||
VIEW_LONG_CLICKED: 0x02,
|
||||
VIEW_SELECTED: 0x04,
|
||||
VIEW_FOCUSED: 0x08,
|
||||
VIEW_TEXT_CHANGED: 0x10,
|
||||
WINDOW_STATE_CHANGED: 0x20,
|
||||
VIEW_HOVER_ENTER: 0x80,
|
||||
VIEW_HOVER_EXIT: 0x100,
|
||||
VIEW_SCROLLED: 0x1000,
|
||||
VIEW_TEXT_SELECTION_CHANGED: 0x2000,
|
||||
ANNOUNCEMENT: 0x4000,
|
||||
VIEW_ACCESSIBILITY_FOCUSED: 0x8000,
|
||||
VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY: 0x20000,
|
||||
};
|
||||
|
||||
function ConstantsMap(aObject, aPrefix, aMap = {}, aModifier = null) {
|
||||
|
@ -44,13 +44,13 @@ class AndroidPresentor {
|
||||
let isExploreByTouch = (aReason == Ci.nsIAccessiblePivot.REASON_POINT &&
|
||||
Utils.AndroidSdkVersion >= 14);
|
||||
let focusEventType = (Utils.AndroidSdkVersion >= 16) ?
|
||||
AndroidEvents.ANDROID_VIEW_ACCESSIBILITY_FOCUSED :
|
||||
AndroidEvents.ANDROID_VIEW_FOCUSED;
|
||||
AndroidEvents.VIEW_ACCESSIBILITY_FOCUSED :
|
||||
AndroidEvents.VIEW_FOCUSED;
|
||||
|
||||
if (isExploreByTouch) {
|
||||
// This isn't really used by TalkBack so this is a half-hearted attempt
|
||||
// for now.
|
||||
androidEvents.push({eventType: AndroidEvents.ANDROID_VIEW_HOVER_EXIT, text: []});
|
||||
androidEvents.push({eventType: AndroidEvents.VIEW_HOVER_EXIT, text: []});
|
||||
}
|
||||
|
||||
if (aReason === Ci.nsIAccessiblePivot.REASON_TEXT) {
|
||||
@ -58,7 +58,7 @@ class AndroidPresentor {
|
||||
let adjustedText = context.textAndAdjustedOffsets;
|
||||
|
||||
androidEvents.push({
|
||||
eventType: AndroidEvents.ANDROID_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
|
||||
eventType: AndroidEvents.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
|
||||
text: [adjustedText.text],
|
||||
fromIndex: adjustedText.startOffset,
|
||||
toIndex: adjustedText.endOffset
|
||||
@ -67,7 +67,7 @@ class AndroidPresentor {
|
||||
} else {
|
||||
let state = Utils.getState(context.accessible);
|
||||
androidEvents.push({eventType: (isExploreByTouch) ?
|
||||
AndroidEvents.ANDROID_VIEW_HOVER_ENTER : focusEventType,
|
||||
AndroidEvents.VIEW_HOVER_ENTER : focusEventType,
|
||||
text: Utils.localize(UtteranceGenerator.genForContext(
|
||||
context)),
|
||||
bounds: context.bounds,
|
||||
@ -105,7 +105,7 @@ class AndroidPresentor {
|
||||
}
|
||||
|
||||
return [{
|
||||
eventType: AndroidEvents.ANDROID_VIEW_CLICKED,
|
||||
eventType: AndroidEvents.VIEW_CLICKED,
|
||||
text,
|
||||
checked: state.contains(States.CHECKED)
|
||||
}];
|
||||
@ -116,7 +116,7 @@ class AndroidPresentor {
|
||||
*/
|
||||
textChanged(aAccessible, aIsInserted, aStart, aLength, aText, aModifiedText) {
|
||||
let androidEvent = {
|
||||
eventType: AndroidEvents.ANDROID_VIEW_TEXT_CHANGED,
|
||||
eventType: AndroidEvents.VIEW_TEXT_CHANGED,
|
||||
text: [aText],
|
||||
fromIndex: aStart,
|
||||
removedCount: 0,
|
||||
@ -144,7 +144,7 @@ class AndroidPresentor {
|
||||
|
||||
if (Utils.AndroidSdkVersion >= 14 && !aIsFromUserInput) {
|
||||
androidEvents.push({
|
||||
eventType: AndroidEvents.ANDROID_VIEW_TEXT_SELECTION_CHANGED,
|
||||
eventType: AndroidEvents.VIEW_TEXT_SELECTION_CHANGED,
|
||||
text: [aText],
|
||||
fromIndex: aStart,
|
||||
toIndex: aEnd,
|
||||
@ -156,7 +156,7 @@ class AndroidPresentor {
|
||||
let [from, to] = aOldStart < aStart ?
|
||||
[aOldStart, aStart] : [aStart, aOldStart];
|
||||
androidEvents.push({
|
||||
eventType: AndroidEvents.ANDROID_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
|
||||
eventType: AndroidEvents.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
|
||||
text: [aText],
|
||||
fromIndex: from,
|
||||
toIndex: to
|
||||
@ -229,7 +229,7 @@ class AndroidPresentor {
|
||||
}
|
||||
|
||||
let events = [{
|
||||
eventType: AndroidEvents.ANDROID_VIEW_SCROLLED,
|
||||
eventType: AndroidEvents.VIEW_SCROLLED,
|
||||
text: [],
|
||||
scrollX: aWindow.scrollX,
|
||||
scrollY: aWindow.scrollY,
|
||||
@ -241,7 +241,7 @@ class AndroidPresentor {
|
||||
let currentAcc = currentContext.accessibleForBounds;
|
||||
if (Utils.isAliveAndVisible(currentAcc)) {
|
||||
events.push({
|
||||
eventType: AndroidEvents.ANDROID_VIEW_ACCESSIBILITY_FOCUSED,
|
||||
eventType: AndroidEvents.VIEW_ACCESSIBILITY_FOCUSED,
|
||||
bounds: Utils.getBounds(currentAcc)
|
||||
});
|
||||
}
|
||||
@ -264,8 +264,8 @@ class AndroidPresentor {
|
||||
let localizedAnnouncement = Utils.localize(aAnnouncement).join(" ");
|
||||
return [{
|
||||
eventType: (Utils.AndroidSdkVersion >= 16) ?
|
||||
AndroidEvents.ANDROID_ANNOUNCEMENT :
|
||||
AndroidEvents.ANDROID_VIEW_TEXT_CHANGED,
|
||||
AndroidEvents.ANNOUNCEMENT :
|
||||
AndroidEvents.VIEW_TEXT_CHANGED,
|
||||
text: [localizedAnnouncement],
|
||||
addedCount: localizedAnnouncement.length,
|
||||
removedCount: 0,
|
||||
@ -280,7 +280,7 @@ class AndroidPresentor {
|
||||
*/
|
||||
noMove(aMoveMethod) {
|
||||
return [{
|
||||
eventType: AndroidEvents.ANDROID_VIEW_ACCESSIBILITY_FOCUSED,
|
||||
eventType: AndroidEvents.VIEW_ACCESSIBILITY_FOCUSED,
|
||||
exitView: aMoveMethod,
|
||||
text: [""]
|
||||
}];
|
||||
|
@ -551,7 +551,7 @@ ExpectedPresent.prototype.ignore = function(aMessage) {
|
||||
|
||||
let firstEvent = (aMessage.json || [])[0];
|
||||
|
||||
return firstEvent && firstEvent.eventType === AndroidEvents.ANDROID_VIEW_SCROLLED;
|
||||
return firstEvent && firstEvent.eventType === AndroidEvents.VIEW_SCROLLED;
|
||||
};
|
||||
|
||||
function ExpectedCursorChange(aSpeech, aOptions) {
|
||||
@ -564,7 +564,7 @@ ExpectedCursorChange.prototype = Object.create(ExpectedPresent.prototype);
|
||||
|
||||
function ExpectedCursorTextChange(aSpeech, aStartOffset, aEndOffset, aOptions) {
|
||||
ExpectedPresent.call(this, [{
|
||||
eventType: AndroidEvents.ANDROID_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
|
||||
eventType: AndroidEvents.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
|
||||
fromIndex: aStartOffset,
|
||||
toIndex: aEndOffset
|
||||
}], aOptions);
|
||||
@ -578,7 +578,7 @@ ExpectedCursorTextChange.prototype =
|
||||
|
||||
function ExpectedClickAction(aOptions) {
|
||||
ExpectedPresent.call(this, [{
|
||||
eventType: AndroidEvents.ANDROID_VIEW_CLICKED
|
||||
eventType: AndroidEvents.VIEW_CLICKED
|
||||
}], aOptions);
|
||||
}
|
||||
|
||||
@ -586,7 +586,7 @@ ExpectedClickAction.prototype = Object.create(ExpectedPresent.prototype);
|
||||
|
||||
function ExpectedCheckAction(aChecked, aOptions) {
|
||||
ExpectedPresent.call(this, [{
|
||||
eventType: AndroidEvents.ANDROID_VIEW_CLICKED,
|
||||
eventType: AndroidEvents.VIEW_CLICKED,
|
||||
checked: aChecked
|
||||
}], aOptions);
|
||||
}
|
||||
@ -595,7 +595,7 @@ ExpectedCheckAction.prototype = Object.create(ExpectedPresent.prototype);
|
||||
|
||||
function ExpectedSwitchAction(aSwitched, aOptions) {
|
||||
ExpectedPresent.call(this, [{
|
||||
eventType: AndroidEvents.ANDROID_VIEW_CLICKED,
|
||||
eventType: AndroidEvents.VIEW_CLICKED,
|
||||
checked: aSwitched
|
||||
}], aOptions);
|
||||
}
|
||||
@ -619,7 +619,7 @@ ExpectedValueChange.prototype = Object.create(ExpectedPresent.prototype);
|
||||
// XXX: Implement Android event?
|
||||
function ExpectedTextChanged(aValue, aOptions) {
|
||||
ExpectedPresent.call(this, [{
|
||||
eventType: AndroidEvents.ANDROID_VIEW_TEXT_CHANGED
|
||||
eventType: AndroidEvents.VIEW_TEXT_CHANGED
|
||||
}], aOptions);
|
||||
}
|
||||
|
||||
@ -634,7 +634,7 @@ ExpectedEditState.prototype = Object.create(ExpectedMessage.prototype);
|
||||
|
||||
function ExpectedTextSelectionChanged(aStart, aEnd, aOptions) {
|
||||
ExpectedPresent.call(this, [{
|
||||
eventType: AndroidEvents.ANDROID_VIEW_TEXT_SELECTION_CHANGED,
|
||||
eventType: AndroidEvents.VIEW_TEXT_SELECTION_CHANGED,
|
||||
}], aOptions);
|
||||
}
|
||||
|
||||
@ -643,7 +643,7 @@ ExpectedTextSelectionChanged.prototype =
|
||||
|
||||
function ExpectedTextCaretChanged(aFrom, aTo, aOptions) {
|
||||
ExpectedPresent.call(this, [{
|
||||
eventType: AndroidEvents.ANDROID_VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
|
||||
eventType: AndroidEvents.VIEW_TEXT_TRAVERSED_AT_MOVEMENT_GRANULARITY,
|
||||
fromIndex: aFrom,
|
||||
toIndex: aTo
|
||||
}], aOptions);
|
||||
@ -653,7 +653,7 @@ ExpectedTextCaretChanged.prototype = Object.create(ExpectedPresent.prototype);
|
||||
|
||||
function ExpectedAnnouncement(aAnnouncement, aOptions) {
|
||||
ExpectedPresent.call(this, [{
|
||||
eventType: AndroidEvents.ANDROID_ANNOUNCEMENT,
|
||||
eventType: AndroidEvents.ANNOUNCEMENT,
|
||||
text: [ aAnnouncement],
|
||||
addedCount: aAnnouncement.length
|
||||
}], aOptions);
|
||||
|
@ -57,7 +57,7 @@
|
||||
|
||||
var tests = [{
|
||||
expected: [{
|
||||
"eventType": AndroidEvents.ANDROID_ANNOUNCEMENT,
|
||||
"eventType": AndroidEvents.ANNOUNCEMENT,
|
||||
"text": ["hidden I will be hidden"],
|
||||
"addedCount": "hidden I will be hidden".length,
|
||||
"removedCount": 0,
|
||||
@ -71,7 +71,7 @@
|
||||
}
|
||||
}, {
|
||||
expected: [{
|
||||
"eventType": AndroidEvents.ANDROID_ANNOUNCEMENT,
|
||||
"eventType": AndroidEvents.ANNOUNCEMENT,
|
||||
"text": ["hidden I will be hidden"],
|
||||
"addedCount": "hidden I will be hidden".length,
|
||||
"removedCount": 0,
|
||||
@ -86,7 +86,7 @@
|
||||
}
|
||||
}, {
|
||||
expected: [{
|
||||
"eventType": AndroidEvents.ANDROID_ANNOUNCEMENT,
|
||||
"eventType": AndroidEvents.ANNOUNCEMENT,
|
||||
"text": ["I will be shown"],
|
||||
"addedCount": "I will be shown".length,
|
||||
"removedCount": 0,
|
||||
@ -100,7 +100,7 @@
|
||||
}
|
||||
}, {
|
||||
expected: [{
|
||||
"eventType": AndroidEvents.ANDROID_ANNOUNCEMENT,
|
||||
"eventType": AndroidEvents.ANNOUNCEMENT,
|
||||
"text": ["I will be shown"],
|
||||
"addedCount": "I will be shown".length,
|
||||
"removedCount": 0,
|
||||
@ -115,7 +115,7 @@
|
||||
}
|
||||
}, {
|
||||
expected: [{
|
||||
"eventType": AndroidEvents.ANDROID_ANNOUNCEMENT,
|
||||
"eventType": AndroidEvents.ANNOUNCEMENT,
|
||||
"text": ["hidden I will be hidden"],
|
||||
"addedCount": "hidden I will be hidden".length,
|
||||
"removedCount": 0,
|
||||
@ -129,7 +129,7 @@
|
||||
}
|
||||
}, {
|
||||
expected: [{
|
||||
"eventType": AndroidEvents.ANDROID_ANNOUNCEMENT,
|
||||
"eventType": AndroidEvents.ANNOUNCEMENT,
|
||||
"text": ["hidden I will be hidden"],
|
||||
"addedCount": "hidden I will be hidden".length,
|
||||
"removedCount": 0,
|
||||
@ -144,7 +144,7 @@
|
||||
}
|
||||
}, {
|
||||
expected: [{
|
||||
"eventType": AndroidEvents.ANDROID_ANNOUNCEMENT,
|
||||
"eventType": AndroidEvents.ANNOUNCEMENT,
|
||||
"text": ["I will be shown"],
|
||||
"addedCount": "I will be shown".length,
|
||||
"removedCount": 0,
|
||||
@ -158,7 +158,7 @@
|
||||
}
|
||||
}, {
|
||||
expected: [{
|
||||
"eventType": AndroidEvents.ANDROID_ANNOUNCEMENT,
|
||||
"eventType": AndroidEvents.ANNOUNCEMENT,
|
||||
"text": ["I will be shown"],
|
||||
"addedCount": "I will be shown".length,
|
||||
"removedCount": 0,
|
||||
@ -173,7 +173,7 @@
|
||||
}
|
||||
}, {
|
||||
expected: [{
|
||||
"eventType": AndroidEvents.ANDROID_ANNOUNCEMENT,
|
||||
"eventType": AndroidEvents.ANNOUNCEMENT,
|
||||
"text": ["hidden I will be hidden"],
|
||||
"addedCount": "hidden I will be hidden".length,
|
||||
"removedCount": 0,
|
||||
@ -187,7 +187,7 @@
|
||||
}
|
||||
}, {
|
||||
expected: [{
|
||||
"eventType": AndroidEvents.ANDROID_ANNOUNCEMENT,
|
||||
"eventType": AndroidEvents.ANNOUNCEMENT,
|
||||
"text": ["hidden I will be hidden"],
|
||||
"addedCount": "hidden I will be hidden".length,
|
||||
"removedCount": 0,
|
||||
@ -201,7 +201,7 @@
|
||||
}
|
||||
}, {
|
||||
expected: [{
|
||||
"eventType": AndroidEvents.ANDROID_ANNOUNCEMENT,
|
||||
"eventType": AndroidEvents.ANNOUNCEMENT,
|
||||
"text": ["I will be shown"],
|
||||
"addedCount": "I will be shown".length,
|
||||
"removedCount": 0,
|
||||
@ -215,7 +215,7 @@
|
||||
}
|
||||
}, {
|
||||
expected: [{
|
||||
"eventType": AndroidEvents.ANDROID_ANNOUNCEMENT,
|
||||
"eventType": AndroidEvents.ANNOUNCEMENT,
|
||||
"text": ["I will be shown"],
|
||||
"addedCount": "I will be shown".length,
|
||||
"removedCount": 0,
|
||||
@ -229,7 +229,7 @@
|
||||
}
|
||||
}, {
|
||||
expected: [{
|
||||
"eventType": AndroidEvents.ANDROID_ANNOUNCEMENT,
|
||||
"eventType": AndroidEvents.ANNOUNCEMENT,
|
||||
"text": ["Text Added"],
|
||||
"addedCount": "Text Added".length,
|
||||
"removedCount": 0,
|
||||
@ -243,7 +243,7 @@
|
||||
}
|
||||
}, {
|
||||
expected: [{
|
||||
"eventType": AndroidEvents.ANDROID_ANNOUNCEMENT,
|
||||
"eventType": AndroidEvents.ANNOUNCEMENT,
|
||||
"text": ["Text Added"],
|
||||
"addedCount": "Text Added".length,
|
||||
"removedCount": 0,
|
||||
@ -257,7 +257,7 @@
|
||||
}
|
||||
}, {
|
||||
expected: [{
|
||||
"eventType": AndroidEvents.ANDROID_ANNOUNCEMENT,
|
||||
"eventType": AndroidEvents.ANNOUNCEMENT,
|
||||
"text": ["hidden Text Removed"],
|
||||
"addedCount": "hidden Text Removed".length,
|
||||
"removedCount": 0,
|
||||
@ -271,7 +271,7 @@
|
||||
}
|
||||
}, {
|
||||
expected: [{
|
||||
"eventType": AndroidEvents.ANDROID_ANNOUNCEMENT,
|
||||
"eventType": AndroidEvents.ANNOUNCEMENT,
|
||||
"text": ["Descendant Text Added"],
|
||||
"addedCount": "Descendant Text Added".length,
|
||||
"removedCount": 0,
|
||||
@ -285,7 +285,7 @@
|
||||
}
|
||||
}, {
|
||||
expected: [{
|
||||
"eventType": AndroidEvents.ANDROID_ANNOUNCEMENT,
|
||||
"eventType": AndroidEvents.ANNOUNCEMENT,
|
||||
"text": ["Descendant Text Added"],
|
||||
"addedCount": "Descendant Text Added".length,
|
||||
"removedCount": 0,
|
||||
@ -299,7 +299,7 @@
|
||||
}
|
||||
}, {
|
||||
expected: [{
|
||||
"eventType": AndroidEvents.ANDROID_ANNOUNCEMENT,
|
||||
"eventType": AndroidEvents.ANNOUNCEMENT,
|
||||
"text": ["hidden Descendant Text Removed"],
|
||||
"addedCount": "hidden Descendant Text Removed".length,
|
||||
"removedCount": 0,
|
||||
@ -313,7 +313,7 @@
|
||||
}
|
||||
}, {
|
||||
expected: [{
|
||||
"eventType": AndroidEvents.ANDROID_ANNOUNCEMENT,
|
||||
"eventType": AndroidEvents.ANNOUNCEMENT,
|
||||
"text": ["Descendant Text Added"],
|
||||
"addedCount": "Descendant Text Added".length,
|
||||
"removedCount": 0,
|
||||
@ -327,7 +327,7 @@
|
||||
}
|
||||
}, {
|
||||
expected: [{
|
||||
"eventType": AndroidEvents.ANDROID_ANNOUNCEMENT,
|
||||
"eventType": AndroidEvents.ANNOUNCEMENT,
|
||||
"text": ["Descendant Text Added"],
|
||||
"addedCount": "Descendant Text Added".length,
|
||||
"removedCount": 0,
|
||||
@ -341,7 +341,7 @@
|
||||
}
|
||||
}, {
|
||||
expected: [{
|
||||
"eventType": AndroidEvents.ANDROID_ANNOUNCEMENT,
|
||||
"eventType": AndroidEvents.ANNOUNCEMENT,
|
||||
"text": ["hidden Descendant Text Removed"],
|
||||
"addedCount": "hidden Descendant Text Removed".length,
|
||||
"removedCount": 0,
|
||||
@ -355,7 +355,7 @@
|
||||
}
|
||||
}, {
|
||||
expected: [{
|
||||
"eventType": AndroidEvents.ANDROID_ANNOUNCEMENT,
|
||||
"eventType": AndroidEvents.ANNOUNCEMENT,
|
||||
"text": ["I am replaced main"],
|
||||
"addedCount": "I am replaced main".length,
|
||||
"removedCount": 0,
|
||||
@ -370,7 +370,7 @@
|
||||
}
|
||||
}, {
|
||||
expected: [{
|
||||
"eventType": AndroidEvents.ANDROID_ANNOUNCEMENT,
|
||||
"eventType": AndroidEvents.ANNOUNCEMENT,
|
||||
"text": ["I am a replaced text"],
|
||||
"addedCount": "I am a replaced text".length,
|
||||
"removedCount": 0,
|
||||
@ -384,7 +384,7 @@
|
||||
}
|
||||
}, {
|
||||
expected: [{
|
||||
"eventType": AndroidEvents.ANDROID_ANNOUNCEMENT,
|
||||
"eventType": AndroidEvents.ANNOUNCEMENT,
|
||||
"text": ["I am a replaced text"],
|
||||
"addedCount": "I am a replaced text".length,
|
||||
"removedCount": 0,
|
||||
|
Loading…
Reference in New Issue
Block a user