Backed out 3 changesets (bug 937775, bug 937369, bug 937466) for mochitest-other failures.

Backed out changeset 3fd86b311a5a (bug 937775)
Backed out changeset 550a02fca7b3 (bug 937466)
Backed out changeset 298618421b51 (bug 937369)
This commit is contained in:
Ryan VanderMeulen 2013-11-18 14:02:20 -05:00
parent 49ee2bf8a9
commit 88e735eaa7
10 changed files with 230 additions and 212 deletions

View File

@ -86,7 +86,7 @@ this.AccessFu = {
Cu.import('resource://gre/modules/accessibility/TouchAdapter.jsm');
Cu.import('resource://gre/modules/accessibility/Presentation.jsm');
Logger.info('Enabled');
Logger.info('enable');
for each (let mm in Utils.AllMessageManagers) {
this._addMessageListeners(mm);
@ -145,7 +145,7 @@ this.AccessFu = {
this._enabled = false;
Logger.info('Disabled');
Logger.info('disable');
Utils.win.document.removeChild(this.stylesheet.get());
@ -524,8 +524,9 @@ var Output = {
for (let action of aActions) {
let window = Utils.win;
Logger.debug('tts.' + action.method, '"' + action.data + '"',
JSON.stringify(action.options));
Logger.info('tts.' + action.method,
'"' + action.data + '"',
JSON.stringify(action.options));
if (!action.options.enqueue && this.webspeechEnabled) {
window.speechSynthesis.cancel();
@ -714,8 +715,8 @@ var Input = {
_handleGesture: function _handleGesture(aGesture) {
let gestureName = aGesture.type + aGesture.touches.length;
Logger.debug('Gesture', aGesture.type,
'(fingers: ' + aGesture.touches.length + ')');
Logger.info('Gesture', aGesture.type,
'(fingers: ' + aGesture.touches.length + ')');
switch (gestureName) {
case 'dwell1':

View File

@ -1,39 +0,0 @@
const Ci = Components.interfaces;
const Cu = Components.utils;
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
this.EXPORTED_SYMBOLS = ['Roles', 'Events', 'Relations', 'Filters'];
function ConstantsMap (aObject, aPrefix) {
let offset = aPrefix.length;
for (var name in aObject) {
if (name.indexOf(aPrefix) === 0) {
this[name.slice(offset)] = aObject[name];
}
}
}
XPCOMUtils.defineLazyGetter(
this, 'Roles',
function() {
return new ConstantsMap(Ci.nsIAccessibleRole, 'ROLE_');
});
XPCOMUtils.defineLazyGetter(
this, 'Events',
function() {
return new ConstantsMap(Ci.nsIAccessibleEvent, 'EVENT_');
});
XPCOMUtils.defineLazyGetter(
this, 'Relations',
function() {
return new ConstantsMap(Ci.nsIAccessibleRelation, 'RELATION_');
});
XPCOMUtils.defineLazyGetter(
this, 'Filters',
function() {
return new ConstantsMap(Ci.nsIAccessibleTraversalRule, 'FILTER_');
});

View File

@ -7,6 +7,21 @@
const Ci = Components.interfaces;
const Cu = Components.utils;
const EVENT_VIRTUALCURSOR_CHANGED = Ci.nsIAccessibleEvent.EVENT_VIRTUALCURSOR_CHANGED;
const EVENT_STATE_CHANGE = Ci.nsIAccessibleEvent.EVENT_STATE_CHANGE;
const EVENT_SCROLLING_START = Ci.nsIAccessibleEvent.EVENT_SCROLLING_START;
const EVENT_TEXT_CARET_MOVED = Ci.nsIAccessibleEvent.EVENT_TEXT_CARET_MOVED;
const EVENT_TEXT_INSERTED = Ci.nsIAccessibleEvent.EVENT_TEXT_INSERTED;
const EVENT_TEXT_REMOVED = Ci.nsIAccessibleEvent.EVENT_TEXT_REMOVED;
const EVENT_FOCUS = Ci.nsIAccessibleEvent.EVENT_FOCUS;
const EVENT_SHOW = Ci.nsIAccessibleEvent.EVENT_SHOW;
const EVENT_HIDE = Ci.nsIAccessibleEvent.EVENT_HIDE;
const ROLE_INTERNAL_FRAME = Ci.nsIAccessibleRole.ROLE_INTERNAL_FRAME;
const ROLE_DOCUMENT = Ci.nsIAccessibleRole.ROLE_DOCUMENT;
const ROLE_CHROME_WINDOW = Ci.nsIAccessibleRole.ROLE_CHROME_WINDOW;
const ROLE_TEXT_LEAF = Ci.nsIAccessibleRole.ROLE_TEXT_LEAF;
const TEXT_NODE = 3;
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
@ -20,10 +35,6 @@ XPCOMUtils.defineLazyModuleGetter(this, 'Presentation',
'resource://gre/modules/accessibility/Presentation.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'TraversalRules',
'resource://gre/modules/accessibility/TraversalRules.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Roles',
'resource://gre/modules/accessibility/Constants.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Events',
'resource://gre/modules/accessibility/Constants.jsm');
this.EXPORTED_SYMBOLS = ['EventManager'];
@ -46,7 +57,7 @@ this.EventManager.prototype = {
start: function start() {
try {
if (!this._started) {
Logger.debug('EventManager.start');
Logger.info('EventManager.start', Utils.MozBuildApp);
this._started = true;
@ -73,7 +84,7 @@ this.EventManager.prototype = {
if (!this._started) {
return;
}
Logger.debug('EventManager.stop');
Logger.info('EventManager.stop', Utils.MozBuildApp);
AccessibilityEventObserver.removeListener(this);
try {
this.webProgress.removeProgressListener(this);
@ -133,7 +144,7 @@ this.EventManager.prototype = {
// Don't bother with non-content events in firefox.
if (Utils.MozBuildApp == 'browser' &&
aEvent.eventType != Events.VIRTUALCURSOR_CHANGED &&
aEvent.eventType != EVENT_VIRTUALCURSOR_CHANGED &&
// XXX Bug 442005 results in DocAccessible::getDocType returning
// NS_ERROR_FAILURE. Checking for aEvent.accessibleDocument.docType ==
// 'window' does not currently work.
@ -143,12 +154,12 @@ this.EventManager.prototype = {
}
switch (aEvent.eventType) {
case Events.VIRTUALCURSOR_CHANGED:
case EVENT_VIRTUALCURSOR_CHANGED:
{
let pivot = aEvent.accessible.
QueryInterface(Ci.nsIAccessibleDocument).virtualCursor;
let position = pivot.position;
if (position && position.role == Roles.INTERNAL_FRAME)
if (position && position.role == ROLE_INTERNAL_FRAME)
break;
let event = aEvent.
QueryInterface(Ci.nsIAccessibleVirtualCursorChangeEvent);
@ -163,7 +174,7 @@ this.EventManager.prototype = {
break;
}
case Events.STATE_CHANGE:
case EVENT_STATE_CHANGE:
{
let event = aEvent.QueryInterface(Ci.nsIAccessibleStateChangeEvent);
if (event.state == Ci.nsIAccessibleStates.STATE_CHECKED &&
@ -180,13 +191,13 @@ this.EventManager.prototype = {
}
break;
}
case Events.SCROLLING_START:
case EVENT_SCROLLING_START:
{
let vc = Utils.getVirtualCursor(aEvent.accessibleDocument);
vc.moveNext(TraversalRules.Simple, aEvent.accessible, true);
break;
}
case Events.TEXT_CARET_MOVED:
case EVENT_TEXT_CARET_MOVED:
{
let acc = aEvent.accessible;
let characterCount = acc.
@ -222,7 +233,7 @@ this.EventManager.prototype = {
this.editState = editState;
break;
}
case Events.SHOW:
case EVENT_SHOW:
{
let {liveRegion, isPolite} = this._handleLiveRegion(aEvent,
['additions', 'all']);
@ -231,14 +242,14 @@ this.EventManager.prototype = {
break;
}
// Show for text is handled by the EVENT_TEXT_INSERTED handler.
if (aEvent.accessible.role === Roles.TEXT_LEAF) {
if (aEvent.accessible.role === ROLE_TEXT_LEAF) {
break;
}
this._dequeueLiveEvent(Events.HIDE, liveRegion);
this._dequeueLiveEvent(EVENT_HIDE, liveRegion);
this.present(Presentation.liveRegion(liveRegion, isPolite, false));
break;
}
case Events.HIDE:
case EVENT_HIDE:
{
let {liveRegion, isPolite} = this._handleLiveRegion(
aEvent.QueryInterface(Ci.nsIAccessibleHideEvent),
@ -248,14 +259,14 @@ this.EventManager.prototype = {
break;
}
// Hide for text is handled by the EVENT_TEXT_REMOVED handler.
if (aEvent.accessible.role === Roles.TEXT_LEAF) {
if (aEvent.accessible.role === ROLE_TEXT_LEAF) {
break;
}
this._queueLiveEvent(Events.HIDE, liveRegion, isPolite);
this._queueLiveEvent(EVENT_HIDE, liveRegion, isPolite);
break;
}
case Events.TEXT_INSERTED:
case Events.TEXT_REMOVED:
case EVENT_TEXT_INSERTED:
case EVENT_TEXT_REMOVED:
{
let {liveRegion, isPolite} = this._handleLiveRegion(aEvent,
['text', 'all']);
@ -266,12 +277,12 @@ this.EventManager.prototype = {
}
break;
}
case Events.FOCUS:
case EVENT_FOCUS:
{
// Put vc where the focus is at
let acc = aEvent.accessible;
let doc = aEvent.accessibleDocument;
if (acc.role != Roles.DOCUMENT && doc.role != Roles.CHROME_WINDOW) {
if (acc.role != ROLE_DOCUMENT && doc.role != ROLE_CHROME_WINDOW) {
let vc = Utils.getVirtualCursor(doc);
vc.moveNext(TraversalRules.Simple, acc, true);
}
@ -303,11 +314,11 @@ this.EventManager.prototype = {
return;
}
if (aLiveRegion) {
if (aEvent.eventType === Events.TEXT_REMOVED) {
this._queueLiveEvent(Events.TEXT_REMOVED, aLiveRegion, aIsPolite,
if (aEvent.eventType === EVENT_TEXT_REMOVED) {
this._queueLiveEvent(EVENT_TEXT_REMOVED, aLiveRegion, aIsPolite,
modifiedText);
} else {
this._dequeueLiveEvent(Events.TEXT_REMOVED, aLiveRegion);
this._dequeueLiveEvent(EVENT_TEXT_REMOVED, aLiveRegion);
this.present(Presentation.liveRegion(aLiveRegion, aIsPolite, false,
modifiedText));
}

View File

@ -1,3 +1,19 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this file,
# You can obtain one at http://mozilla.org/MPL/2.0/.
INSTALL_TARGETS += ACCESSFU
ACCESSFU_FILES := \
AccessFu.jsm \
EventManager.jsm \
jar.mn \
Makefile.in \
OutputGenerator.jsm \
Presentation.jsm \
TouchAdapter.jsm \
TraversalRules.jsm \
Utils.jsm \
$(NULL)
ACCESSFU_DEST = $(FINAL_TARGET)/modules/accessibility

View File

@ -18,6 +18,10 @@ const NAME_FROM_SUBTREE_RULE = 0x10;
const OUTPUT_DESC_FIRST = 0;
const OUTPUT_DESC_LAST = 1;
const ROLE_LISTITEM = Ci.nsIAccessibleRole.ROLE_LISTITEM;
const ROLE_STATICTEXT = Ci.nsIAccessibleRole.ROLE_STATICTEXT;
const ROLE_LINK = Ci.nsIAccessibleRole.ROLE_LINK;
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Utils',
'resource://gre/modules/accessibility/Utils.jsm');
@ -27,8 +31,6 @@ XPCOMUtils.defineLazyModuleGetter(this, 'Logger',
'resource://gre/modules/accessibility/Utils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'PluralForm',
'resource://gre/modules/PluralForm.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Roles',
'resource://gre/modules/accessibility/Constants.jsm');
var gStringBundle = Cc['@mozilla.org/intl/stringbundle;1'].
getService(Ci.nsIStringBundleService).
@ -695,8 +697,8 @@ this.BrailleGenerator = {
let braille = this.objectOutputFunctions._generateBaseOutput.apply(this, arguments);
if (aAccessible.indexInParent === 1 &&
aAccessible.parent.role == Roles.LISTITEM &&
aAccessible.previousSibling.role == Roles.STATICTEXT) {
aAccessible.parent.role == ROLE_LISTITEM &&
aAccessible.previousSibling.role == ROLE_STATICTEXT) {
if (aAccessible.parent.parent && aAccessible.parent.parent.DOMNode &&
aAccessible.parent.parent.DOMNode.nodeName == 'UL') {
braille.unshift('*');
@ -753,7 +755,7 @@ this.BrailleGenerator = {
statictext: function statictext(aAccessible, aRoleStr, aStates, aFlags) {
// Since we customize the list bullet's output, we add the static
// text from the first node in each listitem, so skip it here.
if (aAccessible.parent.role == Roles.LISTITEM) {
if (aAccessible.parent.role == ROLE_LISTITEM) {
return [];
}
@ -786,7 +788,7 @@ this.BrailleGenerator = {
},
_getContextStart: function _getContextStart(aContext) {
if (aContext.accessible.parent.role == Roles.LINK) {
if (aContext.accessible.parent.role == ROLE_LINK) {
return [aContext.accessible.parent];
}

View File

@ -46,7 +46,7 @@ this.TouchAdapter = {
SYNTH_ID: -1,
start: function TouchAdapter_start() {
Logger.debug('TouchAdapter.start');
Logger.info('TouchAdapter.start');
this._touchPoints = {};
this._dwellTimeout = 0;
@ -64,7 +64,7 @@ this.TouchAdapter = {
},
stop: function TouchAdapter_stop() {
Logger.debug('TouchAdapter.stop');
Logger.info('TouchAdapter.stop');
let target = Utils.win;

View File

@ -9,24 +9,61 @@ const Ci = Components.interfaces;
const Cu = Components.utils;
const Cr = Components.results;
const FILTER_IGNORE = Ci.nsIAccessibleTraversalRule.FILTER_IGNORE;
const FILTER_MATCH = Ci.nsIAccessibleTraversalRule.FILTER_MATCH;
const FILTER_IGNORE_SUBTREE = Ci.nsIAccessibleTraversalRule.FILTER_IGNORE_SUBTREE;
const ROLE_MENUITEM = Ci.nsIAccessibleRole.ROLE_MENUITEM;
const ROLE_LINK = Ci.nsIAccessibleRole.ROLE_LINK;
const ROLE_PAGETAB = Ci.nsIAccessibleRole.ROLE_PAGETAB;
const ROLE_GRAPHIC = Ci.nsIAccessibleRole.ROLE_GRAPHIC;
const ROLE_STATICTEXT = Ci.nsIAccessibleRole.ROLE_STATICTEXT;
const ROLE_TEXT_LEAF = Ci.nsIAccessibleRole.ROLE_TEXT_LEAF;
const ROLE_PUSHBUTTON = Ci.nsIAccessibleRole.ROLE_PUSHBUTTON;
const ROLE_SPINBUTTON = Ci.nsIAccessibleRole.ROLE_SPINBUTTON;
const ROLE_CHECKBUTTON = Ci.nsIAccessibleRole.ROLE_CHECKBUTTON;
const ROLE_RADIOBUTTON = Ci.nsIAccessibleRole.ROLE_RADIOBUTTON;
const ROLE_COMBOBOX = Ci.nsIAccessibleRole.ROLE_COMBOBOX;
const ROLE_PROGRESSBAR = Ci.nsIAccessibleRole.ROLE_PROGRESSBAR;
const ROLE_BUTTONDROPDOWN = Ci.nsIAccessibleRole.ROLE_BUTTONDROPDOWN;
const ROLE_BUTTONMENU = Ci.nsIAccessibleRole.ROLE_BUTTONMENU;
const ROLE_CHECK_MENU_ITEM = Ci.nsIAccessibleRole.ROLE_CHECK_MENU_ITEM;
const ROLE_PASSWORD_TEXT = Ci.nsIAccessibleRole.ROLE_PASSWORD_TEXT;
const ROLE_RADIO_MENU_ITEM = Ci.nsIAccessibleRole.ROLE_RADIO_MENU_ITEM;
const ROLE_TOGGLE_BUTTON = Ci.nsIAccessibleRole.ROLE_TOGGLE_BUTTON;
const ROLE_KEY = Ci.nsIAccessibleRole.ROLE_KEY;
const ROLE_ENTRY = Ci.nsIAccessibleRole.ROLE_ENTRY;
const ROLE_LIST = Ci.nsIAccessibleRole.ROLE_LIST;
const ROLE_DEFINITION_LIST = Ci.nsIAccessibleRole.ROLE_DEFINITION_LIST;
const ROLE_LISTITEM = Ci.nsIAccessibleRole.ROLE_LISTITEM;
const ROLE_BUTTONDROPDOWNGRID = Ci.nsIAccessibleRole.ROLE_BUTTONDROPDOWNGRID;
const ROLE_LISTBOX = Ci.nsIAccessibleRole.ROLE_LISTBOX;
const ROLE_OPTION = Ci.nsIAccessibleRole.ROLE_OPTION;
const ROLE_SLIDER = Ci.nsIAccessibleRole.ROLE_SLIDER;
const ROLE_HEADING = Ci.nsIAccessibleRole.ROLE_HEADING;
const ROLE_HEADER = Ci.nsIAccessibleRole.ROLE_HEADER;
const ROLE_TERM = Ci.nsIAccessibleRole.ROLE_TERM;
const ROLE_SEPARATOR = Ci.nsIAccessibleRole.ROLE_SEPARATOR;
const ROLE_TABLE = Ci.nsIAccessibleRole.ROLE_TABLE;
const ROLE_INTERNAL_FRAME = Ci.nsIAccessibleRole.ROLE_INTERNAL_FRAME;
const ROLE_PARAGRAPH = Ci.nsIAccessibleRole.ROLE_PARAGRAPH;
const ROLE_SECTION = Ci.nsIAccessibleRole.ROLE_SECTION;
const ROLE_LABEL = Ci.nsIAccessibleRole.ROLE_LABEL;
this.EXPORTED_SYMBOLS = ['TraversalRules'];
Cu.import('resource://gre/modules/accessibility/Utils.jsm');
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Roles',
'resource://gre/modules/accessibility/Constants.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Filters',
'resource://gre/modules/accessibility/Constants.jsm');
let gSkipEmptyImages = new PrefCache('accessibility.accessfu.skip_empty_images');
function BaseTraversalRule(aRoles, aMatchFunc) {
this._explicitMatchRoles = new Set(aRoles);
this._matchRoles = aRoles;
if (aRoles.indexOf(Roles.LABEL) < 0) {
this._matchRoles.push(Roles.LABEL);
if (aRoles.indexOf(ROLE_LABEL) < 0) {
this._matchRoles.push(ROLE_LABEL);
}
this._matchFunc = aMatchFunc || function (acc) { return Filters.MATCH; };
this._matchFunc = aMatchFunc || function (acc) { return FILTER_MATCH; };
}
BaseTraversalRule.prototype = {
@ -43,20 +80,20 @@ BaseTraversalRule.prototype = {
match: function BaseTraversalRule_match(aAccessible)
{
let role = aAccessible.role;
if (role == Roles.INTERNAL_FRAME) {
if (role == ROLE_INTERNAL_FRAME) {
return (Utils.getMessageManager(aAccessible.DOMNode)) ?
Filters.MATCH | Filters.IGNORE_SUBTREE : Filters.IGNORE;
FILTER_MATCH | FILTER_IGNORE_SUBTREE : FILTER_IGNORE;
}
let matchResult = this._explicitMatchRoles.has(role) ?
this._matchFunc(aAccessible) : Filters.IGNORE;
this._matchFunc(aAccessible) : FILTER_IGNORE;
// If we are on a label that nests a checkbox/radio we should land on it.
// It is a bigger touch target, and it reduces clutter.
if (role == Roles.LABEL && !(matchResult & Filters.IGNORE_SUBTREE)) {
if (role == ROLE_LABEL && !(matchResult & FILTER_IGNORE_SUBTREE)) {
let control = Utils.getEmbeddedControl(aAccessible);
if (control && this._explicitMatchRoles.has(control.role)) {
matchResult = this._matchFunc(control) | Filters.IGNORE_SUBTREE;
matchResult = this._matchFunc(control) | FILTER_IGNORE_SUBTREE;
}
}
@ -67,32 +104,32 @@ BaseTraversalRule.prototype = {
};
var gSimpleTraversalRoles =
[Roles.MENUITEM,
Roles.LINK,
Roles.PAGETAB,
Roles.GRAPHIC,
Roles.STATICTEXT,
Roles.TEXT_LEAF,
Roles.PUSHBUTTON,
Roles.CHECKBUTTON,
Roles.RADIOBUTTON,
Roles.COMBOBOX,
Roles.PROGRESSBAR,
Roles.BUTTONDROPDOWN,
Roles.BUTTONMENU,
Roles.CHECK_MENU_ITEM,
Roles.PASSWORD_TEXT,
Roles.RADIO_MENU_ITEM,
Roles.TOGGLE_BUTTON,
Roles.ENTRY,
Roles.KEY,
Roles.HEADER,
Roles.HEADING,
Roles.SLIDER,
Roles.SPINBUTTON,
Roles.OPTION,
[ROLE_MENUITEM,
ROLE_LINK,
ROLE_PAGETAB,
ROLE_GRAPHIC,
ROLE_STATICTEXT,
ROLE_TEXT_LEAF,
ROLE_PUSHBUTTON,
ROLE_CHECKBUTTON,
ROLE_RADIOBUTTON,
ROLE_COMBOBOX,
ROLE_PROGRESSBAR,
ROLE_BUTTONDROPDOWN,
ROLE_BUTTONMENU,
ROLE_CHECK_MENU_ITEM,
ROLE_PASSWORD_TEXT,
ROLE_RADIO_MENU_ITEM,
ROLE_TOGGLE_BUTTON,
ROLE_ENTRY,
ROLE_KEY,
ROLE_HEADER,
ROLE_HEADING,
ROLE_SLIDER,
ROLE_SPINBUTTON,
ROLE_OPTION,
// Used for traversing in to child OOP frames.
Roles.INTERNAL_FRAME];
ROLE_INTERNAL_FRAME];
this.TraversalRules = {
Simple: new BaseTraversalRule(
@ -109,47 +146,47 @@ this.TraversalRules = {
}
switch (aAccessible.role) {
case Roles.COMBOBOX:
case ROLE_COMBOBOX:
// We don't want to ignore the subtree because this is often
// where the list box hangs out.
return Filters.MATCH;
case Roles.TEXT_LEAF:
return FILTER_MATCH;
case ROLE_TEXT_LEAF:
{
// Nameless text leaves are boring, skip them.
let name = aAccessible.name;
if (name && name.trim())
return Filters.MATCH;
return FILTER_MATCH;
else
return Filters.IGNORE;
return FILTER_IGNORE;
}
case Roles.STATICTEXT:
case ROLE_STATICTEXT:
{
let parent = aAccessible.parent;
// Ignore prefix static text in list items. They are typically bullets or numbers.
if (parent.childCount > 1 && aAccessible.indexInParent == 0 &&
parent.role == Roles.LISTITEM)
return Filters.IGNORE;
parent.role == ROLE_LISTITEM)
return FILTER_IGNORE;
return Filters.MATCH;
return FILTER_MATCH;
}
case Roles.GRAPHIC:
case ROLE_GRAPHIC:
return TraversalRules._shouldSkipImage(aAccessible);
case Roles.LINK:
case Roles.HEADER:
case Roles.HEADING:
case ROLE_LINK:
case ROLE_HEADER:
case ROLE_HEADING:
return hasZeroOrSingleChildDescendants() ?
(Filters.MATCH | Filters.IGNORE_SUBTREE) : (Filters.IGNORE);
(FILTER_MATCH | FILTER_IGNORE_SUBTREE) : (FILTER_IGNORE);
default:
// Ignore the subtree, if there is one. So that we don't land on
// the same content that was already presented by its parent.
return Filters.MATCH |
Filters.IGNORE_SUBTREE;
return FILTER_MATCH |
FILTER_IGNORE_SUBTREE;
}
}
),
Anchor: new BaseTraversalRule(
[Roles.LINK],
[ROLE_LINK],
function Anchor_match(aAccessible)
{
// We want to ignore links, only focus named anchors.
@ -157,67 +194,67 @@ this.TraversalRules = {
let extraState = {};
aAccessible.getState(state, extraState);
if (state.value & Ci.nsIAccessibleStates.STATE_LINKED) {
return Filters.IGNORE;
return FILTER_IGNORE;
} else {
return Filters.MATCH;
return FILTER_MATCH;
}
}),
Button: new BaseTraversalRule(
[Roles.PUSHBUTTON,
Roles.SPINBUTTON,
Roles.TOGGLE_BUTTON,
Roles.BUTTONDROPDOWN,
Roles.BUTTONDROPDOWNGRID]),
[ROLE_PUSHBUTTON,
ROLE_SPINBUTTON,
ROLE_TOGGLE_BUTTON,
ROLE_BUTTONDROPDOWN,
ROLE_BUTTONDROPDOWNGRID]),
Combobox: new BaseTraversalRule(
[Roles.COMBOBOX,
Roles.LISTBOX]),
[ROLE_COMBOBOX,
ROLE_LISTBOX]),
Landmark: new BaseTraversalRule(
[],
function Landmark_match(aAccessible) {
return Utils.getLandmarkName(aAccessible) ? Filters.MATCH :
Filters.IGNORE;
return Utils.getLandmarkName(aAccessible) ? FILTER_MATCH :
FILTER_IGNORE;
}
),
Entry: new BaseTraversalRule(
[Roles.ENTRY,
Roles.PASSWORD_TEXT]),
[ROLE_ENTRY,
ROLE_PASSWORD_TEXT]),
FormElement: new BaseTraversalRule(
[Roles.PUSHBUTTON,
Roles.SPINBUTTON,
Roles.TOGGLE_BUTTON,
Roles.BUTTONDROPDOWN,
Roles.BUTTONDROPDOWNGRID,
Roles.COMBOBOX,
Roles.LISTBOX,
Roles.ENTRY,
Roles.PASSWORD_TEXT,
Roles.PAGETAB,
Roles.RADIOBUTTON,
Roles.RADIO_MENU_ITEM,
Roles.SLIDER,
Roles.CHECKBUTTON,
Roles.CHECK_MENU_ITEM]),
[ROLE_PUSHBUTTON,
ROLE_SPINBUTTON,
ROLE_TOGGLE_BUTTON,
ROLE_BUTTONDROPDOWN,
ROLE_BUTTONDROPDOWNGRID,
ROLE_COMBOBOX,
ROLE_LISTBOX,
ROLE_ENTRY,
ROLE_PASSWORD_TEXT,
ROLE_PAGETAB,
ROLE_RADIOBUTTON,
ROLE_RADIO_MENU_ITEM,
ROLE_SLIDER,
ROLE_CHECKBUTTON,
ROLE_CHECK_MENU_ITEM]),
Graphic: new BaseTraversalRule(
[Roles.GRAPHIC],
[ROLE_GRAPHIC],
function Graphic_match(aAccessible) {
return TraversalRules._shouldSkipImage(aAccessible);
}),
Heading: new BaseTraversalRule(
[Roles.HEADING]),
[ROLE_HEADING]),
ListItem: new BaseTraversalRule(
[Roles.LISTITEM,
Roles.TERM]),
[ROLE_LISTITEM,
ROLE_TERM]),
Link: new BaseTraversalRule(
[Roles.LINK],
[ROLE_LINK],
function Link_match(aAccessible)
{
// We want to ignore anchors, only focus real links.
@ -225,50 +262,50 @@ this.TraversalRules = {
let extraState = {};
aAccessible.getState(state, extraState);
if (state.value & Ci.nsIAccessibleStates.STATE_LINKED) {
return Filters.MATCH;
return FILTER_MATCH;
} else {
return Filters.IGNORE;
return FILTER_IGNORE;
}
}),
List: new BaseTraversalRule(
[Roles.LIST,
Roles.DEFINITION_LIST]),
[ROLE_LIST,
ROLE_DEFINITION_LIST]),
PageTab: new BaseTraversalRule(
[Roles.PAGETAB]),
[ROLE_PAGETAB]),
Paragraph: new BaseTraversalRule(
[Roles.PARAGRAPH,
Roles.SECTION],
[ROLE_PARAGRAPH,
ROLE_SECTION],
function Paragraph_match(aAccessible) {
for (let child = aAccessible.firstChild; child; child = child.nextSibling) {
if (child.role === Roles.TEXT_LEAF) {
return Filters.MATCH | Filters.IGNORE_SUBTREE;
if (child.role === ROLE_TEXT_LEAF) {
return FILTER_MATCH | FILTER_IGNORE_SUBTREE;
}
}
return Filters.IGNORE;
return FILTER_IGNORE;
}),
RadioButton: new BaseTraversalRule(
[Roles.RADIOBUTTON,
Roles.RADIO_MENU_ITEM]),
[ROLE_RADIOBUTTON,
ROLE_RADIO_MENU_ITEM]),
Separator: new BaseTraversalRule(
[Roles.SEPARATOR]),
[ROLE_SEPARATOR]),
Table: new BaseTraversalRule(
[Roles.TABLE]),
[ROLE_TABLE]),
Checkbox: new BaseTraversalRule(
[Roles.CHECKBUTTON,
Roles.CHECK_MENU_ITEM]),
[ROLE_CHECKBUTTON,
ROLE_CHECK_MENU_ITEM]),
_shouldSkipImage: function _shouldSkipImage(aAccessible) {
if (gSkipEmptyImages.value && aAccessible.name === '') {
return Filters.IGNORE;
return FILTER_IGNORE;
}
return Filters.MATCH;
return FILTER_MATCH;
}
};

View File

@ -8,17 +8,19 @@ const Cu = Components.utils;
const Cc = Components.classes;
const Ci = Components.interfaces;
const EVENT_STATE_CHANGE = Ci.nsIAccessibleEvent.EVENT_STATE_CHANGE;
const ROLE_CELL = Ci.nsIAccessibleRole.ROLE_CELL;
const ROLE_COLUMNHEADER = Ci.nsIAccessibleRole.ROLE_COLUMNHEADER;
const ROLE_ROWHEADER = Ci.nsIAccessibleRole.ROLE_ROWHEADER;
const RELATION_LABEL_FOR = Ci.nsIAccessibleRelation.RELATION_LABEL_FOR;
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, 'Services',
'resource://gre/modules/Services.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Rect',
'resource://gre/modules/Geometry.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Roles',
'resource://gre/modules/accessibility/Constants.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Events',
'resource://gre/modules/accessibility/Constants.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Relations',
'resource://gre/modules/accessibility/Constants.jsm');
this.EXPORTED_SYMBOLS = ['Utils', 'Logger', 'PivotContext', 'PrefCache'];
@ -295,7 +297,7 @@ this.Utils = {
getEmbeddedControl: function getEmbeddedControl(aLabel) {
if (aLabel) {
let relation = aLabel.getRelationByType(Relations.LABEL_FOR);
let relation = aLabel.getRelationByType(RELATION_LABEL_FOR);
for (let i = 0; i < relation.targetsCount; i++) {
let target = relation.getTarget(i);
if (target.parent === aLabel) {
@ -397,7 +399,7 @@ this.Logger = {
eventToString: function eventToString(aEvent) {
let str = Utils.AccRetrieval.getStringEventType(aEvent.eventType);
if (aEvent.eventType == Events.STATE_CHANGE) {
if (aEvent.eventType == EVENT_STATE_CHANGE) {
let event = aEvent.QueryInterface(Ci.nsIAccessibleStateChangeEvent);
let stateStrings = event.isExtraState ?
Utils.AccRetrieval.getStringStates(0, event.state) :
@ -631,7 +633,7 @@ PivotContext.prototype = {
if (!aAccessible) {
return null;
}
if ([Roles.CELL, Roles.COLUMNHEADER, Roles.ROWHEADER].indexOf(
if ([ROLE_CELL, ROLE_COLUMNHEADER, ROLE_ROWHEADER].indexOf(
aAccessible.role) < 0) {
return null;
}
@ -692,12 +694,12 @@ PivotContext.prototype = {
cellInfo.columnHeaders = [];
if (cellInfo.columnChanged && cellInfo.current.role !==
Roles.COLUMNHEADER) {
ROLE_COLUMNHEADER) {
cellInfo.columnHeaders = [headers for (headers of getHeaders(
cellInfo.current.columnHeaderCells))];
}
cellInfo.rowHeaders = [];
if (cellInfo.rowChanged && cellInfo.current.role === Roles.CELL) {
if (cellInfo.rowChanged && cellInfo.current.role === ROLE_CELL) {
cellInfo.rowHeaders = [headers for (headers of getHeaders(
cellInfo.current.rowHeaderCells))];
}

View File

@ -5,6 +5,9 @@
let Ci = Components.interfaces;
let Cu = Components.utils;
const ROLE_ENTRY = Ci.nsIAccessibleRole.ROLE_ENTRY;
const ROLE_INTERNAL_FRAME = Ci.nsIAccessibleRole.ROLE_INTERNAL_FRAME;
const MOVEMENT_GRANULARITY_CHARACTER = 1;
const MOVEMENT_GRANULARITY_WORD = 2;
const MOVEMENT_GRANULARITY_PARAGRAPH = 8;
@ -22,8 +25,6 @@ XPCOMUtils.defineLazyModuleGetter(this, 'EventManager',
'resource://gre/modules/accessibility/EventManager.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'ObjectWrapper',
'resource://gre/modules/ObjectWrapper.jsm');
XPCOMUtils.defineLazyModuleGetter(this, 'Roles',
'resource://gre/modules/accessibility/Constants.jsm');
Logger.debug('content-script.js');
@ -136,7 +137,7 @@ function forwardToParent(aMessage) {
function forwardToChild(aMessage, aListener, aVCPosition) {
let acc = aVCPosition || Utils.getVirtualCursor(content.document).position;
if (!Utils.isAliveAndVisible(acc) || acc.role != Roles.INTERNAL_FRAME) {
if (!Utils.isAliveAndVisible(acc) || acc.role != ROLE_INTERNAL_FRAME) {
return false;
}
@ -164,7 +165,7 @@ function activateCurrent(aMessage) {
Logger.debug('activateCurrent');
function activateAccessible(aAccessible) {
if (aMessage.json.activateIfKey &&
aAccessible.role != Roles.KEY) {
aAccessible.role != Ci.nsIAccessibleRole.ROLE_KEY) {
// Only activate keys, don't do anything on other objects.
return;
}
@ -218,7 +219,7 @@ function activateCurrent(aMessage) {
}
let focusedAcc = Utils.AccRetrieval.getAccessibleFor(content.document.activeElement);
if (focusedAcc && focusedAcc.role === Roles.ENTRY) {
if (focusedAcc && focusedAcc.role === ROLE_ENTRY) {
moveCaretTo(focusedAcc, aMessage.json.offset);
return;
}

View File

@ -3,16 +3,3 @@
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
JS_MODULES_PATH = 'modules/accessibility'
EXTRA_JS_MODULES += [
'AccessFu.jsm',
'Constants.jsm',
'EventManager.jsm',
'OutputGenerator.jsm',
'Presentation.jsm',
'TouchAdapter.jsm',
'TraversalRules.jsm',
'Utils.jsm'
]