Bug 760451 - Support skip links. r=davidb

This commit is contained in:
Eitan Isaacson 2012-06-03 22:02:56 -04:00
parent 26dcaaeb28
commit 20052e6784
2 changed files with 21 additions and 0 deletions

View File

@ -351,6 +351,11 @@ var AccessFu = {
}
break;
}
case Ci.nsIAccessibleEvent.EVENT_SCROLLING_START:
{
VirtualCursorController.moveCursorToObject(aEvent.accessible);
break;
}
default:
break;
}

View File

@ -165,6 +165,22 @@ var VirtualCursorController = {
QueryInterface(Ci.nsIAccessibleCursorable).virtualCursor;
},
moveCursorToObject: function moveCursorToObject(aAccessible, aRule) {
let doc = aAccessible.document;
while (doc) {
let vc = null;
try {
vc = doc.QueryInterface(Ci.nsIAccessibleCursorable).virtualCursor;
} catch (x) {
doc = doc.parentDocument;
continue;
}
if (vc)
vc.moveNext(aRule || this.SimpleTraversalRule, aAccessible, true);
break;
}
},
SimpleTraversalRule: {
getMatchRoles: function SimpleTraversalRule_getmatchRoles(aRules) {
aRules.value = this._matchRoles;