Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/chromevox/injected/event_watcher.js

Issue 596033002: Entering / exiting dialog notification should not interrupt live region. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@event_watcher_tests
Patch Set: Enum, and better test Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @fileoverview Watches for events in the browser such as focus changes. 6 * @fileoverview Watches for events in the browser such as focus changes.
7 * 7 *
8 */ 8 */
9 9
10 goog.provide('cvox.ChromeVoxEventWatcher'); 10 goog.provide('cvox.ChromeVoxEventWatcher');
(...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 if (dialog == cvox.ChromeVox.navigationManager.currentDialog) { 1318 if (dialog == cvox.ChromeVox.navigationManager.currentDialog) {
1319 return false; 1319 return false;
1320 } 1320 }
1321 1321
1322 if (cvox.ChromeVox.navigationManager.currentDialog && !dialog) { 1322 if (cvox.ChromeVox.navigationManager.currentDialog && !dialog) {
1323 if (!cvox.DomUtil.isDescendantOfNode( 1323 if (!cvox.DomUtil.isDescendantOfNode(
1324 document.activeElement, 1324 document.activeElement,
1325 cvox.ChromeVox.navigationManager.currentDialog)) { 1325 cvox.ChromeVox.navigationManager.currentDialog)) {
1326 cvox.ChromeVox.navigationManager.currentDialog = null; 1326 cvox.ChromeVox.navigationManager.currentDialog = null;
1327 1327
1328 cvox.ChromeVox.tts.speak( 1328 cvox.ChromeVoxEventWatcher.speakAnnotationWithCategory_(
1329 cvox.ChromeVox.msgs.getMsg('exiting_dialog'), 1329 cvox.ChromeVox.msgs.getMsg('exiting_dialog'),
1330 cvox.ChromeVoxEventWatcher.queueMode_(), 1330 cvox.TtsCategory.NAV);
1331 cvox.AbstractTts.PERSONALITY_ANNOTATION);
1332 return true; 1331 return true;
1333 } 1332 }
1334 } else { 1333 } else {
1335 if (dialog) { 1334 if (dialog) {
1336 cvox.ChromeVox.navigationManager.currentDialog = dialog; 1335 cvox.ChromeVox.navigationManager.currentDialog = dialog;
1337 cvox.ChromeVox.tts.speak( 1336 cvox.ChromeVoxEventWatcher.speakAnnotationWithCategory_(
1338 cvox.ChromeVox.msgs.getMsg('entering_dialog'), 1337 cvox.ChromeVox.msgs.getMsg('entering_dialog'),
1339 cvox.ChromeVoxEventWatcher.queueMode_(), 1338 cvox.TtsCategory.NAV);
1340 cvox.AbstractTts.PERSONALITY_ANNOTATION); 1339
1341 if (role == 'alertdialog') { 1340 if (role == 'alertdialog') {
1342 var dialogDescArray = 1341 var dialogDescArray =
1343 cvox.DescriptionUtil.getFullDescriptionsFromChildren(null, dialog); 1342 cvox.DescriptionUtil.getFullDescriptionsFromChildren(null, dialog);
1344 var descSpeaker = new cvox.NavigationSpeaker(); 1343 var descSpeaker = new cvox.NavigationSpeaker();
1345 descSpeaker.speakDescriptionArray(dialogDescArray, 1344 descSpeaker.speakDescriptionArray(dialogDescArray,
1346 cvox.AbstractTts.QUEUE_MODE_QUEUE, 1345 cvox.AbstractTts.QUEUE_MODE_QUEUE,
1347 null); 1346 null);
1348 } 1347 }
1349 return true; 1348 return true;
1350 } 1349 }
1351 } 1350 }
1352 return false; 1351 return false;
1353 }; 1352 };
1354 1353
1355 /** 1354 /**
1355 * Speak the given text with the annotation personality and the given
1356 * speech queue utterance category.
1357 * @param {string} text The text to speak.
1358 * @param {string} category The category of text, used by the speech queue
1359 * when flushing all speech from the same category while leaving other
1360 * speech in the queue.
1361 * @private
1362 */
1363 cvox.ChromeVoxEventWatcher.speakAnnotationWithCategory_ = function(
1364 text, category) {
1365 var properties = {};
1366 var src = cvox.AbstractTts.PERSONALITY_ANNOTATION;
1367 for (var key in src) {
1368 properties[key] = src[key];
1369 }
1370 properties['category'] = category;
1371 cvox.ChromeVox.tts.speak(
1372 text,
1373 cvox.ChromeVoxEventWatcher.queueMode_(),
1374 properties);
1375 };
1376
1377 /**
1356 * Returns true if we should wait to process events. 1378 * Returns true if we should wait to process events.
1357 * @param {number} lastFocusTimestamp The timestamp of the last focus event. 1379 * @param {number} lastFocusTimestamp The timestamp of the last focus event.
1358 * @param {number} firstTimestamp The timestamp of the first event. 1380 * @param {number} firstTimestamp The timestamp of the first event.
1359 * @param {number} currentTime The current timestamp. 1381 * @param {number} currentTime The current timestamp.
1360 * @return {boolean} True if we should wait to process events. 1382 * @return {boolean} True if we should wait to process events.
1361 */ 1383 */
1362 cvox.ChromeVoxEventWatcherUtil.shouldWaitToProcess = function( 1384 cvox.ChromeVoxEventWatcherUtil.shouldWaitToProcess = function(
1363 lastFocusTimestamp, firstTimestamp, currentTime) { 1385 lastFocusTimestamp, firstTimestamp, currentTime) {
1364 var timeSinceFocusEvent = currentTime - lastFocusTimestamp; 1386 var timeSinceFocusEvent = currentTime - lastFocusTimestamp;
1365 var timeSinceFirstEvent = currentTime - firstTimestamp; 1387 var timeSinceFirstEvent = currentTime - firstTimestamp;
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
1584 ((currentFocus.type == 'date') || 1606 ((currentFocus.type == 'date') ||
1585 (currentFocus.type == 'month') || 1607 (currentFocus.type == 'month') ||
1586 (currentFocus.type == 'week'))) { 1608 (currentFocus.type == 'week'))) {
1587 cvox.ChromeVoxEventWatcher.currentDateHandler = 1609 cvox.ChromeVoxEventWatcher.currentDateHandler =
1588 new cvox.ChromeVoxHTMLDateWidget(currentFocus, cvox.ChromeVox.tts); 1610 new cvox.ChromeVoxHTMLDateWidget(currentFocus, cvox.ChromeVox.tts);
1589 } else { 1611 } else {
1590 cvox.ChromeVoxEventWatcher.currentDateHandler = null; 1612 cvox.ChromeVoxEventWatcher.currentDateHandler = null;
1591 } 1613 }
1592 return (null != cvox.ChromeVoxEventWatcher.currentDateHandler); 1614 return (null != cvox.ChromeVoxEventWatcher.currentDateHandler);
1593 }; 1615 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698