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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/host/interface/abstract_tts.js

Issue 1696443002: Re-land: Implement ChromeVox Next menus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 Base class for Text-to-Speech engines that actually transform 6 * @fileoverview Base class for Text-to-Speech engines that actually transform
7 * text to speech. 7 * text to speech.
8 * 8 *
9 */ 9 */
10 10
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 cvox.AbstractTts.prototype.increaseOrDecreaseProperty = 136 cvox.AbstractTts.prototype.increaseOrDecreaseProperty =
137 function(propertyName, increase) { 137 function(propertyName, increase) {
138 var min = this.propertyMin[propertyName]; 138 var min = this.propertyMin[propertyName];
139 var max = this.propertyMax[propertyName]; 139 var max = this.propertyMax[propertyName];
140 var step = this.propertyStep[propertyName]; 140 var step = this.propertyStep[propertyName];
141 var current = this.ttsProperties[propertyName]; 141 var current = this.ttsProperties[propertyName];
142 current = increase ? current + step : current - step; 142 current = increase ? current + step : current - step;
143 this.ttsProperties[propertyName] = Math.max(Math.min(current, max), min); 143 this.ttsProperties[propertyName] = Math.max(Math.min(current, max), min);
144 }; 144 };
145 145
146 /**
147 * Converts an engine property value to a percentage from 0.00 to 1.00.
148 * @param {string} property The property to convert.
149 * @return {?number} The percentage of the property.
150 */
151 cvox.AbstractTts.prototype.propertyToPercentage = function(property) {
152 return (this.ttsProperties[property] - this.propertyMin[property]) /
153 Math.abs(this.propertyMax[property] - this.propertyMin[property]);
154 };
146 155
147 /** 156 /**
148 * Merges the given properties with the default ones. Always returns a 157 * Merges the given properties with the default ones. Always returns a
149 * new object, so that you can safely modify the result of mergeProperties 158 * new object, so that you can safely modify the result of mergeProperties
150 * without worrying that you're modifying an object used elsewhere. 159 * without worrying that you're modifying an object used elsewhere.
151 * @param {Object=} properties The properties to merge with the current ones. 160 * @param {Object=} properties The properties to merge with the current ones.
152 * @return {Object} The merged properties. 161 * @return {Object} The merged properties.
153 * @protected 162 * @protected
154 */ 163 */
155 cvox.AbstractTts.prototype.mergeProperties = function(properties) { 164 cvox.AbstractTts.prototype.mergeProperties = function(properties) {
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 .format({'COUNT': count}) + ' '; 567 .format({'COUNT': count}) + ' ';
559 }; 568 };
560 569
561 570
562 /** 571 /**
563 * @override 572 * @override
564 */ 573 */
565 cvox.AbstractTts.prototype.getDefaultProperty = function(property) { 574 cvox.AbstractTts.prototype.getDefaultProperty = function(property) {
566 return this.propertyDefault[property]; 575 return this.propertyDefault[property];
567 }; 576 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698