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 A set of classes to support aural CSS. | 6 * @fileoverview A set of classes to support aural CSS. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 goog.provide('cvox.AuralProperty'); | 10 goog.provide('cvox.AuralProperty'); |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 */ | 48 */ |
49 cvox.AuralStyleConverter.identity = function(value) { | 49 cvox.AuralStyleConverter.identity = function(value) { |
50 return value; | 50 return value; |
51 }; | 51 }; |
52 | 52 |
53 | 53 |
54 /** | 54 /** |
55 * Conversion from an aural style property to Chrome TTS property. | 55 * Conversion from an aural style property to Chrome TTS property. |
56 * TODO(dtseng): no-op's below need to be supported by the extension API itself | 56 * TODO(dtseng): no-op's below need to be supported by the extension API itself |
57 * or by ChromeVox. | 57 * or by ChromeVox. |
58 * @type {Object.<cvox.AuralProperty, string>} | 58 * @type {Object<cvox.AuralProperty, string>} |
59 */ | 59 */ |
60 cvox.AuralStyleConverter.propertyTable = { | 60 cvox.AuralStyleConverter.propertyTable = { |
61 VOLUME: 'volume', | 61 VOLUME: 'volume', |
62 SPEAK: 'no-op', | 62 SPEAK: 'no-op', |
63 PAUSE_BEFORE: 'no-op', | 63 PAUSE_BEFORE: 'no-op', |
64 PAUSE_AFTER: 'no-op', | 64 PAUSE_AFTER: 'no-op', |
65 PAUSE: 'no-op', | 65 PAUSE: 'no-op', |
66 CUE_BEFORE: 'no-op', | 66 CUE_BEFORE: 'no-op', |
67 CUE_AFTER: 'no-op', | 67 CUE_AFTER: 'no-op', |
68 CUE: 'no-op', | 68 CUE: 'no-op', |
(...skipping 10 matching lines...) Expand all Loading... |
79 SPEAK_NUMERIAL: 'no-op', | 79 SPEAK_NUMERIAL: 'no-op', |
80 SPEAK_HEADER: 'no-op', | 80 SPEAK_HEADER: 'no-op', |
81 NONE: 'no-op' | 81 NONE: 'no-op' |
82 }; | 82 }; |
83 | 83 |
84 | 84 |
85 /** | 85 /** |
86 * Conversion from an aural style value to Chrome TTS value. | 86 * Conversion from an aural style value to Chrome TTS value. |
87 * TODO(dtseng): Conversion of aural CSS values is incomplete; everything is an | 87 * TODO(dtseng): Conversion of aural CSS values is incomplete; everything is an |
88 * identity conversion at the moment. | 88 * identity conversion at the moment. |
89 * @type {Object.<cvox.AuralProperty, function(*)>} | 89 * @type {Object<cvox.AuralProperty, function(*)>} |
90 */ | 90 */ |
91 cvox.AuralStyleConverter.valueTable = { | 91 cvox.AuralStyleConverter.valueTable = { |
92 VOLUME: cvox.AuralStyleConverter.identity, | 92 VOLUME: cvox.AuralStyleConverter.identity, |
93 SPEAK: cvox.AuralStyleConverter.identity, | 93 SPEAK: cvox.AuralStyleConverter.identity, |
94 PAUSE_BEFORE: cvox.AuralStyleConverter.identity, | 94 PAUSE_BEFORE: cvox.AuralStyleConverter.identity, |
95 PAUSE_AFTER: cvox.AuralStyleConverter.identity, | 95 PAUSE_AFTER: cvox.AuralStyleConverter.identity, |
96 PAUSE: cvox.AuralStyleConverter.identity, | 96 PAUSE: cvox.AuralStyleConverter.identity, |
97 CUE_BEFORE: cvox.AuralStyleConverter.identity, | 97 CUE_BEFORE: cvox.AuralStyleConverter.identity, |
98 CUE_AFTER: cvox.AuralStyleConverter.identity, | 98 CUE_AFTER: cvox.AuralStyleConverter.identity, |
99 CUE: cvox.AuralStyleConverter.identity, | 99 CUE: cvox.AuralStyleConverter.identity, |
(...skipping 22 matching lines...) Expand all Loading... |
122 cvox.AuralStyleConverter.convertRule = function(property, value) { | 122 cvox.AuralStyleConverter.convertRule = function(property, value) { |
123 return { | 123 return { |
124 property: cvox.AuralStyleConverter.propertyTable[property], | 124 property: cvox.AuralStyleConverter.propertyTable[property], |
125 value: cvox.AuralStyleConverter.valueTable[property](value) | 125 value: cvox.AuralStyleConverter.valueTable[property](value) |
126 }; | 126 }; |
127 }; | 127 }; |
128 | 128 |
129 | 129 |
130 /** | 130 /** |
131 * Converts an aural CSS style block to a TTS property object. | 131 * Converts an aural CSS style block to a TTS property object. |
132 * @param {Object.<cvox.AuralProperty, *>} style The style. | 132 * @param {Object<cvox.AuralProperty, *>} style The style. |
133 * @return {Object} The tts property object. | 133 * @return {Object} The tts property object. |
134 */ | 134 */ |
135 cvox.AuralStyleConverter.convertStyle = function(style) { | 135 cvox.AuralStyleConverter.convertStyle = function(style) { |
136 var ttsProperties = {}; | 136 var ttsProperties = {}; |
137 for (var property in style) { | 137 for (var property in style) { |
138 var ttsProperty = | 138 var ttsProperty = |
139 cvox.AuralStyleConverter.convertRule(property, style[property]); | 139 cvox.AuralStyleConverter.convertRule(property, style[property]); |
140 ttsProperties[ttsProperty.property] = ttsProperty.value; | 140 ttsProperties[ttsProperty.property] = ttsProperty.value; |
141 } | 141 } |
142 return ttsProperties; | 142 return ttsProperties; |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 'NAV': { | 200 'NAV': { |
201 PITCH: -0.1 | 201 PITCH: -0.1 |
202 }, | 202 }, |
203 'SECTION': { | 203 'SECTION': { |
204 PITCH: -0.1 | 204 PITCH: -0.1 |
205 }, | 205 }, |
206 'TIME': { | 206 'TIME': { |
207 PITCH: -0.1 | 207 PITCH: -0.1 |
208 } | 208 } |
209 }; | 209 }; |
OLD | NEW |