Chromium Code Reviews| 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 e05465246b1ac362d64191f584dd250a78087901..3ac4b965f4912e7957304dca319169013e5ec110 100644 |
| --- a/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js |
| +++ b/chrome/browser/resources/chromeos/chromevox/cvox2/background/output.js |
| @@ -154,8 +154,8 @@ Output.RULES = { |
| enter: '$name $role' |
| }, |
| heading: { |
| - enter: '@aria_role_heading', |
| - speak: '@aria_role_heading $name=' |
| + enter: '@aria_role_heading -$hierarchicalLevel', |
|
Peter Lundblad
2015/04/02 09:43:54
Need to add this prefix to the documentation in th
|
| + speak: '@aria_role_heading -$hierarchicalLevel $name=' |
| }, |
| inlineTextBox: { |
| speak: '$value=' |
| @@ -166,7 +166,7 @@ Output.RULES = { |
| speak: '$name= $visited $earcon(LINK, @tag_link)=' |
| }, |
| list: { |
| - enter: '@aria_role_list @list_with_items($parentChildCount)' |
| + enter: '@aria_role_list -@list_with_items($parentChildCount)' |
| }, |
| listItem: { |
| enter: '$role' |
| @@ -473,11 +473,6 @@ Output.prototype = { |
| } |
| tokens.forEach(function(token) { |
| - // Always split at the beginning of each token for speech. |
| - var splitOptions = {}; |
| - splitOptions.annotation = new Output.StringSplit(); |
| - this.addToSpannable_(buff, new cvox.Spannable(), splitOptions); |
| - |
| // Ignore empty tokens. |
| if (!token) |
| return; |
| @@ -502,6 +497,17 @@ Output.prototype = { |
| var prefix = token[0]; |
| token = token.slice(1); |
| + // Split up the utterance if there isn't a continuation prefix. |
| + if (prefix == '-') { |
|
Peter Lundblad
2015/04/02 09:43:54
There's an implicit ordering of prefixes here. Sh
David Tseng
2015/04/02 23:50:49
You're probably right. I can take a look at some j
|
| + prefix = token[0]; |
| + token = token.slice(1); |
| + options.needsPrefix = true; |
| + } else { |
| + var splitOptions = {}; |
| + splitOptions.annotation = new Output.StringSplit(); |
| + this.addToSpannable_(buff, new cvox.Spannable(), splitOptions); |
| + } |
| + |
| if (opt_exclude[token]) |
| return; |
| @@ -579,7 +585,10 @@ Output.prototype = { |
| } |
| this.addToSpannable_(buff, msg, options); |
| } else if (node.attributes[token]) { |
| - this.addToSpannable_(buff, node.attributes[token], options); |
| + var value = node.attributes[token]; |
| + if (typeof(value) != 'string') |
| + value = String(value); |
| + this.addToSpannable_(buff, value, options); |
| } else if (node.state[token]) { |
| this.addToSpannable_(buff, token, options); |
| } else if (tree.firstChild) { |
| @@ -773,10 +782,12 @@ Output.prototype = { |
| * @param {!cvox.Spannable} spannable |
| * @param {string|!cvox.Spannable} value |
| * @param {{ifEmpty: (boolean|undefined), |
| - * annotation: *}=} opt_options |
| + * annotation: *, |
| + * needsPrefix: (boolean|undefined)}=} opt_options |
| */ |
| addToSpannable_: function(spannable, value, opt_options) { |
| - opt_options = opt_options || {ifEmpty: false, annotation: undefined}; |
| + opt_options = opt_options || |
| + {ifEmpty: false, annotation: undefined, needsPrefix: false}; |
| if ((!value || value.length == 0) && !opt_options.annotation) |
| return; |
| @@ -794,7 +805,7 @@ Output.prototype = { |
| return; |
| // Figure out if we need to add the spacing prefix. |
| - var needsPrefix = this.formatOptions_.braille; |
| + var needsPrefix = this.formatOptions_.braille || opt_options.needsPrefix; |
| if (needsPrefix) { |
| needsPrefix = value instanceof cvox.Spannable ? |
| value.getLength() > 0 : value.length > 0; |