Bug 1068160 - Send no-move b2g presentation when user reaches start/end of document. r=yzen

This commit is contained in:
Eitan Isaacson 2014-10-14 14:42:51 -07:00
parent cee5653152
commit 47e911d974
4 changed files with 36 additions and 4 deletions

View File

@ -127,10 +127,14 @@ this.ContentControl.prototype = {
// new position.
this.sendToChild(vc, aMessage, { action: childAction }, true);
}
} else if (!this._childMessageSenders.has(aMessage.target)) {
// We failed to move, and the message is not from a child, so forward
// to parent.
} else if (!this._childMessageSenders.has(aMessage.target) &&
origin !== 'top') {
// We failed to move, and the message is not from a parent, so forward
// to it.
this.sendToParent(aMessage);
} else {
this._contentScope.get().sendAsyncMessage('AccessFu:Present',
Presentation.noMove(action));
}
},

View File

@ -117,6 +117,11 @@ Presenter.prototype = {
announce: function announce(aAnnouncement) {}, // jshint ignore:line
/**
* User tried to move cursor forward or backward with no success.
* @param {string} aMoveMethod move method that was used (eg. 'moveNext').
*/
noMove: function noMove(aMoveMethod) {},
/**
* Announce a live region.
@ -536,6 +541,17 @@ B2GPresenter.prototype.announce =
};
};
B2GPresenter.prototype.noMove =
function B2GPresenter_noMove(aMoveMethod) {
return {
type: this.type,
details: {
eventType: 'no-move',
data: aMoveMethod
}
};
};
/**
* A braille presenter
*/
@ -636,6 +652,10 @@ this.Presentation = { // jshint ignore:line
for each (p in this.presenters)]; // jshint ignore:line
},
noMove: function Presentation_noMove(aMoveMethod) {
return [p.noMove(aMoveMethod) for each (p in this.presenters)]; // jshint ignore:line
},
liveRegion: function Presentation_liveRegion(aAccessible, aIsPolite, aIsHide,
aModifiedText) {
let context;

View File

@ -665,6 +665,12 @@ function ExpectedAnnouncement(aAnnouncement, aOptions) {
ExpectedAnnouncement.prototype = Object.create(ExpectedPresent.prototype);
function ExpectedNoMove(aOptions) {
ExpectedPresent.call(this, {eventType: 'no-move' }, null, aOptions);
}
ExpectedNoMove.prototype = Object.create(ExpectedPresent.prototype);
var AndroidEvent = {
VIEW_CLICKED: 0x01,
VIEW_LONG_CLICKED: 0x02,

View File

@ -34,6 +34,7 @@
new ExpectedCursorChange(
['Phone status bar', 'Traversal Rule test document'],
{ focused: 'body' })],
[ContentMessages.simpleMovePrevious, new ExpectedNoMove()],
[ContentMessages.simpleMoveNext,
new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
[ContentMessages.simpleMoveNext, new ExpectedCursorChange(
@ -251,7 +252,8 @@
doc.defaultView.hideAlert();
doc.querySelector('button#home').focus();
}, new ExpectedCursorChange(['Home', {'string': 'pushbutton'},
'Traversal Rule test document'])]
'Traversal Rule test document'])],
[ContentMessages.simpleMoveNext, new ExpectedNoMove()]
]);
addA11yLoadEvent(function() {