Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Provides output services for ChromeVox. | 6 * @fileoverview Provides output services for ChromeVox. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 goog.provide('Output'); | 9 goog.provide('Output'); |
| 10 goog.provide('Output.EventType'); | 10 goog.provide('Output.EventType'); |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 87 * @type {cvox.QueueMode} | 87 * @type {cvox.QueueMode} |
| 88 * @private | 88 * @private |
| 89 */ | 89 */ |
| 90 this.queueMode_ = cvox.QueueMode.QUEUE; | 90 this.queueMode_ = cvox.QueueMode.QUEUE; |
| 91 | 91 |
| 92 /** | 92 /** |
| 93 * @type {boolean} | 93 * @type {boolean} |
| 94 * @private | 94 * @private |
| 95 */ | 95 */ |
| 96 this.outputContextFirst_ = false; | 96 this.outputContextFirst_ = false; |
| 97 | |
| 98 /** | |
| 99 * @type {string} | |
| 100 * @private | |
| 101 */ | |
| 102 this.imageDataUrl_ = ''; | |
| 97 }; | 103 }; |
| 98 | 104 |
| 99 /** | 105 /** |
| 100 * Delimiter to use between output values. | 106 * Delimiter to use between output values. |
| 101 * @type {string} | 107 * @type {string} |
| 102 */ | 108 */ |
| 103 Output.SPACE = ' '; | 109 Output.SPACE = ' '; |
| 104 | 110 |
| 105 /** | 111 /** |
| 106 * Metadata about supported automation roles. | 112 * Metadata about supported automation roles. |
| (...skipping 827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 934 var startIndex = -1, endIndex = -1; | 940 var startIndex = -1, endIndex = -1; |
| 935 if (selSpan) { | 941 if (selSpan) { |
| 936 var valueStart = buff.getSpanStart(selSpan); | 942 var valueStart = buff.getSpanStart(selSpan); |
| 937 var valueEnd = buff.getSpanEnd(selSpan); | 943 var valueEnd = buff.getSpanEnd(selSpan); |
| 938 startIndex = valueStart + selSpan.startIndex; | 944 startIndex = valueStart + selSpan.startIndex; |
| 939 endIndex = valueStart + selSpan.endIndex; | 945 endIndex = valueStart + selSpan.endIndex; |
| 940 buff.setSpan(new cvox.ValueSpan(0), valueStart, valueEnd); | 946 buff.setSpan(new cvox.ValueSpan(0), valueStart, valueEnd); |
| 941 buff.setSpan(new cvox.ValueSelectionSpan(), startIndex, endIndex); | 947 buff.setSpan(new cvox.ValueSelectionSpan(), startIndex, endIndex); |
| 942 } | 948 } |
| 943 | 949 |
| 944 var output = new cvox.NavBraille({ | 950 if (this.imageDataUrl_) { |
| 945 text: buff, | 951 cvox.ChromeVox.braille.writeRawImage(this.imageDataUrl_); |
| 946 startIndex: startIndex, | 952 } else { |
| 947 endIndex: endIndex | 953 var output = new cvox.NavBraille({ |
| 948 }); | 954 text: buff, |
| 949 | 955 startIndex: startIndex, |
| 950 cvox.ChromeVox.braille.write(output); | 956 endIndex: endIndex |
| 957 }); | |
| 958 cvox.ChromeVox.braille.write(output); | |
| 959 } | |
| 951 } | 960 } |
| 952 | 961 |
| 953 // Display. | 962 // Display. |
| 954 if (this.speechCategory_ != cvox.TtsCategory.LIVE) | 963 if (this.speechCategory_ != cvox.TtsCategory.LIVE) |
| 955 chrome.accessibilityPrivate.setFocusRing(this.locations_); | 964 chrome.accessibilityPrivate.setFocusRing(this.locations_); |
| 956 }, | 965 }, |
| 957 | 966 |
| 958 /** | 967 /** |
| 959 * Renders the given range using optional context previous range and event | 968 * Renders the given range using optional context previous range and event |
| 960 * type. | 969 * type. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 996 * @param {string|!Object} format The output format either specified as an | 1005 * @param {string|!Object} format The output format either specified as an |
| 997 * output template string or a parsed output format tree. | 1006 * output template string or a parsed output format tree. |
| 998 * @param {!Array<Spannable>} buff Buffer to receive rendered output. | 1007 * @param {!Array<Spannable>} buff Buffer to receive rendered output. |
| 999 * @param {!AutomationNode=} opt_prevNode | 1008 * @param {!AutomationNode=} opt_prevNode |
| 1000 * @private | 1009 * @private |
| 1001 */ | 1010 */ |
| 1002 format_: function(node, format, buff, opt_prevNode) { | 1011 format_: function(node, format, buff, opt_prevNode) { |
| 1003 var tokens = []; | 1012 var tokens = []; |
| 1004 var args = null; | 1013 var args = null; |
| 1005 | 1014 |
| 1015 node.getImageData(0, 0); | |
|
dmazzoni
2016/12/05 17:29:41
This should be inside the if node != null.
Also,
ultimatedbz
2016/12/05 19:32:01
Done.
| |
| 1016 if (node != null) { | |
| 1017 this.imageDataUrl_ = node.imageDataUrl; | |
| 1018 } | |
| 1019 | |
| 1006 // Hacky way to support args. | 1020 // Hacky way to support args. |
| 1007 if (typeof(format) == 'string') { | 1021 if (typeof(format) == 'string') { |
| 1008 format = format.replace(/([,:])\W/g, '$1'); | 1022 format = format.replace(/([,:])\W/g, '$1'); |
| 1009 tokens = format.split(' '); | 1023 tokens = format.split(' '); |
| 1010 } else { | 1024 } else { |
| 1011 tokens = [format]; | 1025 tokens = [format]; |
| 1012 } | 1026 } |
| 1013 | 1027 |
| 1014 var speechProps = null; | 1028 var speechProps = null; |
| 1015 tokens.forEach(function(token) { | 1029 tokens.forEach(function(token) { |
| (...skipping 813 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1829 /** | 1843 /** |
| 1830 * Gets the output buffer for braille. | 1844 * Gets the output buffer for braille. |
| 1831 * @return {!Spannable} | 1845 * @return {!Spannable} |
| 1832 */ | 1846 */ |
| 1833 get brailleOutputForTest() { | 1847 get brailleOutputForTest() { |
| 1834 return this.mergeBraille_(this.brailleBuffer_); | 1848 return this.mergeBraille_(this.brailleBuffer_); |
| 1835 } | 1849 } |
| 1836 }; | 1850 }; |
| 1837 | 1851 |
| 1838 }); // goog.scope | 1852 }); // goog.scope |
| OLD | NEW |