mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 20:05:49 +00:00
Bug 1291837 - Wind all the way back when pressing previous in Narrate. r=jaws
MozReview-Commit-ID: 7dbbPPXHPuX --HG-- extra : rebase_source : 7a3ad1eaa8e1c3d37d7db85a979546cf2aef2499
This commit is contained in:
parent
7043587cd4
commit
4ab986dd19
@ -240,25 +240,28 @@ Narrator.prototype = {
|
||||
},
|
||||
|
||||
skipPrevious: function() {
|
||||
let tw = this._treeWalker;
|
||||
tw.previousNode();
|
||||
if (this._timeIntoParagraph < PREV_THRESHOLD) {
|
||||
tw.previousNode();
|
||||
}
|
||||
this._win.speechSynthesis.cancel();
|
||||
this._goBackParagraphs(this._timeIntoParagraph < PREV_THRESHOLD ? 2 : 1);
|
||||
},
|
||||
|
||||
setRate: function(rate) {
|
||||
this._speechOptions.rate = rate;
|
||||
/* repeat current paragraph */
|
||||
this._treeWalker.previousNode();
|
||||
this._win.speechSynthesis.cancel();
|
||||
this._goBackParagraphs(1);
|
||||
},
|
||||
|
||||
setVoice: function(voice) {
|
||||
this._speechOptions.voice = this._getVoice(voice);
|
||||
/* repeat current paragraph */
|
||||
this._treeWalker.previousNode();
|
||||
this._goBackParagraphs(1);
|
||||
},
|
||||
|
||||
_goBackParagraphs: function(count) {
|
||||
let tw = this._treeWalker;
|
||||
for (let i = 0; i < count; i++) {
|
||||
if (!tw.previousNode()) {
|
||||
tw.currentNode = tw.root;
|
||||
}
|
||||
}
|
||||
this._win.speechSynthesis.cancel();
|
||||
}
|
||||
};
|
||||
|
@ -57,6 +57,13 @@ add_task(function* testNarrate() {
|
||||
|
||||
NarrateTestUtils.isStartedState(content, ok);
|
||||
|
||||
promiseEvent = ContentTaskUtils.waitForEvent(content, "paragraphstart");
|
||||
$(NarrateTestUtils.BACK).click();
|
||||
speechinfo = (yield promiseEvent).detail;
|
||||
is(speechinfo.paragraph, paragraph, "first paragraph being spoken");
|
||||
|
||||
NarrateTestUtils.isStartedState(content, ok);
|
||||
|
||||
let eventUtils = NarrateTestUtils.getEventUtils(content);
|
||||
|
||||
promiseEvent = ContentTaskUtils.waitForEvent(content, "paragraphstart");
|
||||
|
Loading…
Reference in New Issue
Block a user