OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 /** @fileoverview Logic for panning a braille display within a line of braille | 5 /** @fileoverview Logic for panning a braille display within a line of braille |
6 * content that might not fit on a single display. | 6 * content that might not fit on a single display. |
7 */ | 7 */ |
8 | 8 |
9 goog.provide('cvox.PanStrategy'); | 9 goog.provide('cvox.PanStrategy'); |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 */ | 21 */ |
22 this.displaySize_ = 0; | 22 this.displaySize_ = 0; |
23 /** | 23 /** |
24 * @type {number} | 24 * @type {number} |
25 * @private | 25 * @private |
26 */ | 26 */ |
27 this.contentLength_ = 0; | 27 this.contentLength_ = 0; |
28 /** | 28 /** |
29 * Points before which it is desirable to break content if it doesn't fit | 29 * Points before which it is desirable to break content if it doesn't fit |
30 * on the display. | 30 * on the display. |
31 * @type {!Array.<number>} | 31 * @type {!Array<number>} |
32 * @private | 32 * @private |
33 */ | 33 */ |
34 this.breakPoints_ = []; | 34 this.breakPoints_ = []; |
35 /** | 35 /** |
36 * @type {!cvox.PanStrategy.Range} | 36 * @type {!cvox.PanStrategy.Range} |
37 * @private | 37 * @private |
38 */ | 38 */ |
39 this.viewPort_ = {start: 0, end: 0}; | 39 this.viewPort_ = {start: 0, end: 0}; |
40 }; | 40 }; |
41 | 41 |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 result = this.breakPoints_[pos]; | 151 result = this.breakPoints_[pos]; |
152 pos++; | 152 pos++; |
153 } | 153 } |
154 return result; | 154 return result; |
155 }, | 155 }, |
156 | 156 |
157 /** | 157 /** |
158 * Overridden by subclasses to provide breakpoints given translated | 158 * Overridden by subclasses to provide breakpoints given translated |
159 * braille cell content. | 159 * braille cell content. |
160 * @param {!ArrayBuffer} content New display content. | 160 * @param {!ArrayBuffer} content New display content. |
161 * @return {!Array.<number>} The points before which it is desirable to break | 161 * @return {!Array<number>} The points before which it is desirable to break |
162 * content if needed or the empty array if no points are more desirable | 162 * content if needed or the empty array if no points are more desirable |
163 * than any position. | 163 * than any position. |
164 * @private | 164 * @private |
165 */ | 165 */ |
166 calculateBreakPoints_: function(content) {return [];}, | 166 calculateBreakPoints_: function(content) {return [];}, |
167 | 167 |
168 /** | 168 /** |
169 * Moves the viewport so that it overlaps a target position without taking | 169 * Moves the viewport so that it overlaps a target position without taking |
170 * the current viewport position into consideration. | 170 * the current viewport position into consideration. |
171 * @param {number} position Target position. | 171 * @param {number} position Target position. |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
211 var lastCellWasBlank = false; | 211 var lastCellWasBlank = false; |
212 for (var pos = 0; pos < view.length; ++pos) { | 212 for (var pos = 0; pos < view.length; ++pos) { |
213 if (lastCellWasBlank && view[pos] != 0) { | 213 if (lastCellWasBlank && view[pos] != 0) { |
214 result.push(pos); | 214 result.push(pos); |
215 } | 215 } |
216 lastCellWasBlank = (view[pos] == 0); | 216 lastCellWasBlank = (view[pos] == 0); |
217 } | 217 } |
218 return result; | 218 return result; |
219 }, | 219 }, |
220 }; | 220 }; |
OLD | NEW |