Bug 756690 - Add option to not land on images with no alt text. r=eeejay

This commit is contained in:
Max Li 2013-06-17 16:25:24 -04:00
parent 4f43e21bf5
commit 1341e7eb79
3 changed files with 20 additions and 2 deletions

View File

@ -14,6 +14,8 @@ this.EXPORTED_SYMBOLS = ['TraversalRules'];
Cu.import('resource://gre/modules/accessibility/Utils.jsm');
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
let gSkipEmptyImages = new PrefCache('accessibility.accessfu.skip_empty_images');
function BaseTraversalRule(aRoles, aMatchFunc) {
this._matchRoles = aRoles;
this._matchFunc = aMatchFunc;
@ -103,6 +105,8 @@ this.TraversalRules = {
return Ci.nsIAccessibleTraversalRule.FILTER_MATCH;
}
case Ci.nsIAccessibleRole.ROLE_GRAPHIC:
return TraversalRules._shouldSkipImage(aAccessible);
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.
@ -168,7 +172,10 @@ this.TraversalRules = {
Ci.nsIAccessibleRole.ROLE_CHECK_MENU_ITEM]),
Graphic: new BaseTraversalRule(
[Ci.nsIAccessibleRole.ROLE_GRAPHIC]),
[Ci.nsIAccessibleRole.ROLE_GRAPHIC],
function Graphic_match(aAccessible) {
return TraversalRules._shouldSkipImage(aAccessible);
}),
Heading: new BaseTraversalRule(
[Ci.nsIAccessibleRole.ROLE_HEADING]),
@ -211,5 +218,12 @@ this.TraversalRules = {
Checkbox: new BaseTraversalRule(
[Ci.nsIAccessibleRole.ROLE_CHECKBUTTON,
Ci.nsIAccessibleRole.ROLE_CHECK_MENU_ITEM])
Ci.nsIAccessibleRole.ROLE_CHECK_MENU_ITEM]),
_shouldSkipImage: function _shouldSkipImage(aAccessible) {
if (gSkipEmptyImages.value && aAccessible.name === '') {
return Ci.nsIAccessibleTraversalRule.FILTER_IGNORE;
}
return Ci.nsIAccessibleTraversalRule.FILTER_MATCH;
}
};

View File

@ -641,6 +641,8 @@ pref("dom.disable_window_open_dialog_feature", true);
// Screen reader support
pref("accessibility.accessfu.activate", 2);
// Whether to skip images with empty alt text
pref("accessibility.accessfu.skip_empty_images", true);
// Enable hit-target fluffing
pref("ui.touch.radius.enabled", false);

View File

@ -649,6 +649,8 @@ pref("accessibility.accessfu.activate", 2);
pref("accessibility.accessfu.quicknav_modes", "Link,Heading,FormElement,ListItem");
// Setting for an utterance order (0 - description first, 1 - description last).
pref("accessibility.accessfu.utterance", 0);
// Whether to skip images with empty alt text
pref("accessibility.accessfu.skip_empty_images", true);
// Mobile manages state by autodetection
pref("network.manage-offline-status", true);