| Index: chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
|
| diff --git a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
|
| index 30d36566f3c36b19afde6c3caf81f9beeec3c98f..8ca7f4dbc1b66eb4156e71ea95faf90528097c46 100644
|
| --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
|
| +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js
|
| @@ -92,7 +92,7 @@ Output = function() {
|
| * @type {boolean}
|
| * @private
|
| */
|
| - this.outputContextFirst_ = localStorage['outputContextFirst'] == 'true';
|
| + this.outputContextFirst_ = false;
|
| };
|
|
|
| /**
|
| @@ -106,11 +106,11 @@ Output.SPACE = ' ';
|
| * @const {Object<{msgId: string,
|
| * earconId: (string|undefined),
|
| * inherits: (string|undefined),
|
| - * ignoreAncestry: (boolean|undefined)}>}
|
| + * outputContextFirst: (boolean|undefined)}>}
|
| * msgId: the message id of the role.
|
| * earconId: an optional earcon to play when encountering the role.
|
| * inherits: inherits rules from this role.
|
| - * ignoreAncestry: don't output ancestry changes when encountering this role.
|
| + * outputContextFirst: where to place the context output.
|
| * @private
|
| */
|
| Output.ROLE_INFO_ = {
|
| @@ -149,7 +149,8 @@ Output.ROLE_INFO_ = {
|
| inherits: 'cell'
|
| },
|
| comboBox: {
|
| - msgId: 'role_combobox'
|
| + msgId: 'role_combobox',
|
| + earconId: 'LISTBOX'
|
| },
|
| complementary: {
|
| msgId: 'role_complementary',
|
| @@ -230,7 +231,8 @@ Output.ROLE_INFO_ = {
|
| inherits: 'abstractContainer'
|
| },
|
| menu: {
|
| - msgId: 'role_menu'
|
| + msgId: 'role_menu',
|
| + outputContextFirst: true
|
| },
|
| menuBar: {
|
| msgId: 'role_menubar',
|
| @@ -268,6 +270,9 @@ Output.ROLE_INFO_ = {
|
| radioGroup: {
|
| msgId: 'role_radiogroup',
|
| },
|
| + rootWebArea: {
|
| + outputContextFirst: true
|
| + },
|
| row: {
|
| msgId: 'role_row',
|
| inherits: 'abstractContainer'
|
| @@ -323,7 +328,8 @@ Output.ROLE_INFO_ = {
|
| },
|
| toggleButton: {
|
| msgId: 'role_button',
|
| - inherits: 'checkBox'
|
| + inherits: 'checkBox',
|
| + earconId: 'BUTTON'
|
| },
|
| tree: {
|
| msgId: 'role_tree'
|
| @@ -891,21 +897,24 @@ Output.prototype = {
|
| */
|
| go: function() {
|
| // Speech.
|
| - var queueMode = this.queueMode_;
|
| - this.speechBuffer_.forEach(function(buff, i, a) {
|
| - if (Output.forceModeForNextSpeechUtterance_ !== undefined &&
|
| - buff.length > 0) {
|
| - queueMode = Output.forceModeForNextSpeechUtterance_;
|
| - Output.forceModeForNextSpeechUtterance_ = undefined;
|
| - }
|
| + var queueMode = cvox.QueueMode.FLUSH;
|
| + if (Output.forceModeForNextSpeechUtterance_ !== undefined)
|
| + queueMode = Output.forceModeForNextSpeechUtterance_;
|
| + else if (this.queueMode_ !== undefined)
|
| + queueMode = this.queueMode_;
|
| +
|
| + if (this.speechBuffer_.length > 0)
|
| + Output.forceModeForNextSpeechUtterance_ = undefined;
|
| +
|
| + for (var i = 0; i < this.speechBuffer_.length; i++) {
|
| + var buff = this.speechBuffer_[i];
|
| + var speechProps = /** @type {Object} */(
|
| + buff.getSpanInstanceOf(Output.SpeechProperties)) || {};
|
| +
|
| + speechProps.category = this.speechCategory_;
|
|
|
| - var speechProps = {};
|
| (function() {
|
| var scopedBuff = buff;
|
| - speechProps =
|
| - scopedBuff.getSpanInstanceOf(Output.SpeechProperties) || {};
|
| - speechProps.category = this.speechCategory_;
|
| -
|
| speechProps['startCallback'] = function() {
|
| var actions = scopedBuff.getSpansInstanceOf(Output.Action);
|
| if (actions) {
|
| @@ -914,16 +923,15 @@ Output.prototype = {
|
| });
|
| }
|
| };
|
| - }.bind(this)());
|
| + }());
|
|
|
| - if (this.speechEndCallback_ && i == a.length - 1)
|
| + if (i == this.speechBuffer_.length - 1)
|
| speechProps['endCallback'] = this.speechEndCallback_;
|
| - else
|
| - speechProps['endCallback'] = null;
|
| +
|
| cvox.ChromeVox.tts.speak(
|
| buff.toString(), queueMode, speechProps);
|
| queueMode = cvox.QueueMode.QUEUE;
|
| - }.bind(this));
|
| + }
|
|
|
| // Braille.
|
| if (this.brailleBuffer_.length) {
|
| @@ -967,6 +975,17 @@ Output.prototype = {
|
| if (prevRange && !prevRange.isValid())
|
| prevRange = null;
|
|
|
| + // Scan ancestors to get the value of |outputContextFirst|.
|
| + var parent = range.start.node;
|
| + while (parent) {
|
| + if (Output.ROLE_INFO_[parent.role] &&
|
| + Output.ROLE_INFO_[parent.role].outputContextFirst) {
|
| + this.outputContextFirst_ = true;
|
| + break;
|
| + }
|
| + parent = parent.parent;
|
| + }
|
| +
|
| if (range.isSubNode())
|
| this.subNode_(range, prevRange, type, buff);
|
| else
|
| @@ -1364,11 +1383,6 @@ Output.prototype = {
|
| * @private
|
| */
|
| ancestry_: function(node, prevNode, type, buff) {
|
| - // Check to see if ancestry output is ignored.
|
| - if (Output.ROLE_INFO_[node.role] &&
|
| - Output.ROLE_INFO_[node.role].ignoreAncestry)
|
| - return;
|
| -
|
| var prevUniqueAncestors =
|
| AutomationUtil.getUniqueAncestors(node, prevNode);
|
| var uniqueAncestors = AutomationUtil.getUniqueAncestors(prevNode, node);
|
|
|