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 Puts text on a braille display. | 6 * @fileoverview Puts text on a braille display. |
| 7 * | 7 * |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 goog.provide('cvox.BrailleDisplayManager'); | 10 goog.provide('cvox.BrailleDisplayManager'); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 150 }; | 150 }; |
| 151 | 151 |
| 152 | 152 |
| 153 /** | 153 /** |
| 154 * @param {!cvox.BrailleDisplayState} newState Display state reported | 154 * @param {!cvox.BrailleDisplayState} newState Display state reported |
| 155 * by the extension API. | 155 * by the extension API. |
| 156 * @private | 156 * @private |
| 157 */ | 157 */ |
| 158 cvox.BrailleDisplayManager.prototype.refreshDisplayState_ = function( | 158 cvox.BrailleDisplayManager.prototype.refreshDisplayState_ = function( |
| 159 newState) { | 159 newState) { |
| 160 var oldSize = this.displayState_.textCellCount || 0; | 160 var oldSize = this.displayState_.textCellCount || 0; |
|
dmazzoni
2016/10/11 17:15:39
You replaced textCellCount with textRowCount and t
ultimatedbz
2016/10/16 01:12:39
Done.
| |
| 161 this.realDisplayState_ = newState; | 161 this.realDisplayState_ = newState; |
| 162 if (newState.available) { | 162 if (newState.available) { |
| 163 this.displayState_ = newState; | 163 this.displayState_ = newState; |
| 164 } else { | 164 } else { |
| 165 this.displayState_ = | 165 this.displayState_ = |
| 166 cvox.BrailleCaptionsBackground.getVirtualDisplayState(); | 166 cvox.BrailleCaptionsBackground.getVirtualDisplayState(); |
| 167 } | 167 } |
| 168 var newSize = this.displayState_.textCellCount || 0; | 168 var newSize = this.displayState_.textCellCount || 0; |
| 169 if (oldSize != newSize) { | 169 if (oldSize != newSize) { |
| 170 this.panStrategy_.setDisplaySize(newSize); | 170 this.panStrategy_.setDisplaySize(newSize); |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 186 | 186 |
| 187 | 187 |
| 188 /** @private */ | 188 /** @private */ |
| 189 cvox.BrailleDisplayManager.prototype.refresh_ = function() { | 189 cvox.BrailleDisplayManager.prototype.refresh_ = function() { |
| 190 if (!this.displayState_.available) { | 190 if (!this.displayState_.available) { |
| 191 return; | 191 return; |
| 192 } | 192 } |
| 193 var viewPort = this.panStrategy_.viewPort; | 193 var viewPort = this.panStrategy_.viewPort; |
| 194 var buf = this.displayedContent_.slice(viewPort.start, viewPort.end); | 194 var buf = this.displayedContent_.slice(viewPort.start, viewPort.end); |
| 195 if (this.realDisplayState_.available) { | 195 if (this.realDisplayState_.available) { |
| 196 chrome.brailleDisplayPrivate.writeDots(buf); | 196 chrome.brailleDisplayPrivate.writeDots(buf, 1, buf.byteLength); |
|
dmazzoni
2016/10/11 17:15:39
Ideally you can change all of the code inside Chro
| |
| 197 } | 197 } |
| 198 if (cvox.BrailleCaptionsBackground.isEnabled()) { | 198 if (cvox.BrailleCaptionsBackground.isEnabled()) { |
| 199 var start = this.brailleToTextPosition_(viewPort.start); | 199 var start = this.brailleToTextPosition_(viewPort.start); |
| 200 var end = this.brailleToTextPosition_(viewPort.end); | 200 var end = this.brailleToTextPosition_(viewPort.end); |
| 201 cvox.BrailleCaptionsBackground.setContent( | 201 cvox.BrailleCaptionsBackground.setContent( |
| 202 this.content_.text.toString().substring(start, end), buf); | 202 this.content_.text.toString().substring(start, end), buf); |
| 203 } | 203 } |
| 204 }; | 204 }; |
| 205 | 205 |
| 206 | 206 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 386 */ | 386 */ |
| 387 cvox.BrailleDisplayManager.prototype.updatePanStrategy_ = function(wordWrap) { | 387 cvox.BrailleDisplayManager.prototype.updatePanStrategy_ = function(wordWrap) { |
| 388 var newStrategy = wordWrap ? new cvox.WrappingPanStrategy() : | 388 var newStrategy = wordWrap ? new cvox.WrappingPanStrategy() : |
| 389 new cvox.FixedPanStrategy(); | 389 new cvox.FixedPanStrategy(); |
| 390 newStrategy.setDisplaySize(this.displayState_.textCellCount || 0); | 390 newStrategy.setDisplaySize(this.displayState_.textCellCount || 0); |
| 391 newStrategy.setContent(this.translatedContent_, | 391 newStrategy.setContent(this.translatedContent_, |
| 392 this.panStrategy_.viewPort.start); | 392 this.panStrategy_.viewPort.start); |
| 393 this.panStrategy_ = newStrategy; | 393 this.panStrategy_ = newStrategy; |
| 394 this.refresh_(); | 394 this.refresh_(); |
| 395 }; | 395 }; |
| OLD | NEW |