Commit f097bedb authored by dtseng's avatar dtseng Committed by Commit bot

Implement auto read on load complete

This cl adds an option/preference for a user to trigger automatic read/continuous read on load. Defaults to off.

BUG=672938
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation

Review-Url: https://codereview.chromium.org/2577473003
Cr-Commit-Position: refs/heads/master@{#439110}
parent a8262c2c
......@@ -34,6 +34,13 @@
</label>
</div>
<div class="option">
<input id="autoRead" type="checkbox" class="checkbox pref" name="autoRead"></input>
<label for="autoRead" class="i18n" msgid="options_auto_read">
Automatically read a page after it finishes loading.
</label>
</div>
<h2 class="i18n" msgid="options_voices">Voices</h2>
<p class="i18n description" msgid="options_voices_description" id="voices_description">
Change the current voice by selecting an option from the list below.
......
......@@ -60,6 +60,7 @@ cvox.ChromeVoxPrefs = function() {
*/
cvox.ChromeVoxPrefs.DEFAULT_PREFS = {
'active': true,
'autoRead': false,
'brailleCaptions': false,
'brailleSideBySide': true,
// TODO(dtseng): Leaking state about multiple key maps here until we have a
......
......@@ -297,6 +297,15 @@ DesktopAutomationHandler.prototype = {
// ChromeVox.
this.createTextEditHandlerIfNeeded_(focus);
// If auto read is set, skip focus recovery and start reading from the top.
if (localStorage['autoRead'] == 'true' &&
AutomationUtil.getTopLevelRoot(evt.target) == evt.target) {
ChromeVoxState.instance.setCurrentRange(cursors.Range.fromNode(evt.target));
cvox.ChromeVox.tts.stop();
CommandHandler.onCommand('readFromHere');
return;
}
// If initial focus was already placed on this page (e.g. if a user starts
// tabbing before load complete), then don't move ChromeVox's position on
// the page.
......
......@@ -474,6 +474,9 @@
<message desc="An option to use more verbose feedback for the user." name="IDS_CHROMEVOX_OPTIONS_VERBOSITY_VERBOSE">
Enable verbose descriptions.
</message>
<message desc="An option to automatically read the page after it loads." name="IDS_CHROMEVOX_OPTIONS_AUTO_READ">
Automatically read page after it finishes loading.
</message>
<message desc="An option to show the cursor between characters." name="IDS_CHROMEVOX_OPTIONS_CURSOR_BETWEEN_CHARACTERS">
Place cursor between characters when editing text (like Mac OS X).
</message>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment