Bug 898545 - Get rid of simple touch rule, and make the simple rule use bigger targets when possible. r=marcoz

This commit is contained in:
Eitan Isaacson 2013-07-26 14:09:17 -07:00
parent 0c95eabb49
commit 624c35874a
2 changed files with 19 additions and 16 deletions

View File

@ -658,7 +658,7 @@ var Input = {
switch (gestureName) {
case 'dwell1':
case 'explore1':
this.moveToPoint('SimpleTouch', aGesture.x, aGesture.y);
this.moveToPoint('Simple', aGesture.x, aGesture.y);
break;
case 'doubletap1':
this.activateCurrent();

View File

@ -39,6 +39,7 @@ const ROLE_BUTTONDROPDOWNGRID = Ci.nsIAccessibleRole.ROLE_BUTTONDROPDOWNGRID;
const ROLE_LISTBOX = Ci.nsIAccessibleRole.ROLE_LISTBOX;
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;
@ -103,6 +104,8 @@ var gSimpleTraversalRoles =
ROLE_RADIO_MENU_ITEM,
ROLE_TOGGLE_BUTTON,
ROLE_ENTRY,
ROLE_HEADER,
ROLE_HEADING,
// Used for traversing in to child OOP frames.
ROLE_INTERNAL_FRAME];
@ -110,6 +113,16 @@ this.TraversalRules = {
Simple: new BaseTraversalRule(
gSimpleTraversalRoles,
function Simple_match(aAccessible) {
function hasZeroOrSingleChildDescendants () {
for (let acc = aAccessible; acc.childCount > 0; acc = acc.firstChild) {
if (acc.childCount > 1) {
return false;
}
}
return true;
}
switch (aAccessible.role) {
case ROLE_COMBOBOX:
// We don't want to ignore the subtree because this is often
@ -124,13 +137,6 @@ this.TraversalRules = {
else
return FILTER_IGNORE;
}
case ROLE_LINK:
// If the link has children we should land on them instead.
// Image map links don't have children so we need to match those.
if (aAccessible.childCount == 0)
return FILTER_MATCH;
else
return FILTER_IGNORE;
case ROLE_STATICTEXT:
{
let parent = aAccessible.parent;
@ -143,6 +149,11 @@ this.TraversalRules = {
}
case ROLE_GRAPHIC:
return TraversalRules._shouldSkipImage(aAccessible);
case ROLE_LINK:
case ROLE_HEADER:
case ROLE_HEADING:
return hasZeroOrSingleChildDescendants() ?
(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.
@ -152,14 +163,6 @@ this.TraversalRules = {
}
),
SimpleTouch: new BaseTraversalRule(
gSimpleTraversalRoles,
function Simple_match(aAccessible) {
return FILTER_MATCH |
FILTER_IGNORE_SUBTREE;
}
),
Anchor: new BaseTraversalRule(
[ROLE_LINK],
function Anchor_match(aAccessible)