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 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 238 } | 238 } |
| 239 if (endIndex >= textToBraille.length) { | 239 if (endIndex >= textToBraille.length) { |
| 240 // endIndex can't be past-the-end of the last cell unless | 240 // endIndex can't be past-the-end of the last cell unless |
| 241 // startIndex is too, so we don't have to do another | 241 // startIndex is too, so we don't have to do another |
| 242 // extension here. | 242 // extension here. |
| 243 translatedEndIndex = cells.byteLength; | 243 translatedEndIndex = cells.byteLength; |
| 244 } else { | 244 } else { |
| 245 translatedEndIndex = textToBraille[endIndex]; | 245 translatedEndIndex = textToBraille[endIndex]; |
| 246 } | 246 } |
| 247 this.translatedContent_ = cells; | 247 this.translatedContent_ = cells; |
| 248 // Copy the transalted content to a separate buffer and add the cursor | 248 // Copy the translated content to a separate buffer and add the cursor |
|
dmazzoni
2016/10/28 06:19:29
Thanks for fixing this!
ultimatedbz
2016/10/28 18:45:34
Woo!
| |
| 249 // to it. | 249 // to it. |
| 250 this.displayedContent_ = new ArrayBuffer(cells.byteLength); | 250 this.displayedContent_ = new ArrayBuffer(cells.byteLength); |
| 251 new Uint8Array(this.displayedContent_).set(new Uint8Array(cells)); | 251 new Uint8Array(this.displayedContent_).set(new Uint8Array(cells)); |
| 252 this.writeCursor_(this.displayedContent_, | 252 this.writeCursor_(this.displayedContent_, |
| 253 translatedStartIndex, translatedEndIndex); | 253 translatedStartIndex, translatedEndIndex); |
| 254 targetPosition = translatedStartIndex; | 254 targetPosition = translatedStartIndex; |
| 255 } else { | 255 } else { |
| 256 this.translatedContent_ = this.displayedContent_ = cells; | 256 this.translatedContent_ = this.displayedContent_ = cells; |
| 257 targetPosition = 0; | 257 targetPosition = 0; |
| 258 } | 258 } |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 387 */ | 387 */ |
| 388 cvox.BrailleDisplayManager.prototype.updatePanStrategy_ = function(wordWrap) { | 388 cvox.BrailleDisplayManager.prototype.updatePanStrategy_ = function(wordWrap) { |
| 389 var newStrategy = wordWrap ? new cvox.WrappingPanStrategy() : | 389 var newStrategy = wordWrap ? new cvox.WrappingPanStrategy() : |
| 390 new cvox.FixedPanStrategy(); | 390 new cvox.FixedPanStrategy(); |
| 391 newStrategy.setDisplaySize(this.displayState_.textCellCount || 0); | 391 newStrategy.setDisplaySize(this.displayState_.textCellCount || 0); |
| 392 newStrategy.setContent(this.translatedContent_, | 392 newStrategy.setContent(this.translatedContent_, |
| 393 this.panStrategy_.viewPort.start); | 393 this.panStrategy_.viewPort.start); |
| 394 this.panStrategy_ = newStrategy; | 394 this.panStrategy_ = newStrategy; |
| 395 this.refresh_(); | 395 this.refresh_(); |
| 396 }; | 396 }; |
| OLD | NEW |