| 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 class for walking tables. | 6 * @fileoverview A class for walking tables. |
| 7 * NOTE: This class has a very different interface than the other walkers. | 7 * NOTE: This class has a very different interface than the other walkers. |
| 8 * This means it does not lend itself easily to e.g. decorators. | 8 * This means it does not lend itself easily to e.g. decorators. |
| 9 * TODO (stoarca): This might be able to be fixed by breaking it up into | 9 * TODO (stoarca): This might be able to be fixed by breaking it up into |
| 10 * separate walkers for cell, row and column. | 10 * separate walkers for cell, row and column. |
| 11 */ | 11 */ |
| 12 | 12 |
| 13 | 13 |
| 14 goog.provide('cvox.TableWalker'); | 14 goog.provide('cvox.TableWalker'); |
| 15 | 15 |
| 16 goog.require('cvox.AbstractWalker'); | 16 goog.require('cvox.AbstractWalker'); |
| 17 goog.require('cvox.BrailleUtil'); | 17 goog.require('cvox.BrailleUtil'); |
| 18 goog.require('cvox.DescriptionUtil'); | 18 goog.require('cvox.DescriptionUtil'); |
| 19 goog.require('cvox.DomUtil'); | 19 goog.require('cvox.DomUtil'); |
| 20 goog.require('cvox.NavDescription'); | 20 goog.require('cvox.NavDescription'); |
| 21 goog.require('cvox.QueueMode'); |
| 21 goog.require('cvox.TraverseTable'); | 22 goog.require('cvox.TraverseTable'); |
| 22 | 23 |
| 23 /** | 24 /** |
| 24 * @constructor | 25 * @constructor |
| 25 * @extends {cvox.AbstractWalker} | 26 * @extends {cvox.AbstractWalker} |
| 26 */ | 27 */ |
| 27 cvox.TableWalker = function() { | 28 cvox.TableWalker = function() { |
| 28 cvox.AbstractWalker.call(this); | 29 cvox.AbstractWalker.call(this); |
| 29 | 30 |
| 30 /** | 31 /** |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 }, this)); | 198 }, this)); |
| 198 }; | 199 }; |
| 199 | 200 |
| 200 /** | 201 /** |
| 201 * @param {!cvox.CursorSelection} sel The current selection. | 202 * @param {!cvox.CursorSelection} sel The current selection. |
| 202 * @return {cvox.CursorSelection} The resulting selection. | 203 * @return {cvox.CursorSelection} The resulting selection. |
| 203 * @expose | 204 * @expose |
| 204 */ | 205 */ |
| 205 cvox.TableWalker.prototype.announceHeaders = function(sel) { | 206 cvox.TableWalker.prototype.announceHeaders = function(sel) { |
| 206 cvox.ChromeVox.tts.speak(this.getHeaderText_(sel), | 207 cvox.ChromeVox.tts.speak(this.getHeaderText_(sel), |
| 207 cvox.AbstractTts.QUEUE_MODE_FLUSH, | 208 cvox.QueueMode.FLUSH, |
| 208 cvox.AbstractTts.PERSONALITY_ANNOTATION); | 209 cvox.AbstractTts.PERSONALITY_ANNOTATION); |
| 209 return sel; | 210 return sel; |
| 210 }; | 211 }; |
| 211 | 212 |
| 212 /** | 213 /** |
| 213 * @param {!cvox.CursorSelection} sel The current selection. | 214 * @param {!cvox.CursorSelection} sel The current selection. |
| 214 * @return {cvox.CursorSelection} The resulting selection. | 215 * @return {cvox.CursorSelection} The resulting selection. |
| 215 * @expose | 216 * @expose |
| 216 */ | 217 */ |
| 217 cvox.TableWalker.prototype.speakTableLocation = function(sel) { | 218 cvox.TableWalker.prototype.speakTableLocation = function(sel) { |
| 218 cvox.ChromeVox.navigationManager.speakDescriptionArray( | 219 cvox.ChromeVox.navigationManager.speakDescriptionArray( |
| 219 this.getLocationDescription_(sel), | 220 this.getLocationDescription_(sel), |
| 220 cvox.AbstractTts.QUEUE_MODE_FLUSH, | 221 cvox.QueueMode.FLUSH, |
| 221 null); | 222 null); |
| 222 return sel; | 223 return sel; |
| 223 }; | 224 }; |
| 224 | 225 |
| 225 | 226 |
| 226 /** | 227 /** |
| 227 * @param {!cvox.CursorSelection} sel The current selection. | 228 * @param {!cvox.CursorSelection} sel The current selection. |
| 228 * @return {cvox.CursorSelection} The resulting selection. | 229 * @return {cvox.CursorSelection} The resulting selection. |
| 229 * @expose | 230 * @expose |
| 230 */ | 231 */ |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 412 * @return {Array.<number>} The position [x, y] of the selection. | 413 * @return {Array.<number>} The position [x, y] of the selection. |
| 413 * @private | 414 * @private |
| 414 */ | 415 */ |
| 415 cvox.TableWalker.prototype.syncPosition_ = function(sel) { | 416 cvox.TableWalker.prototype.syncPosition_ = function(sel) { |
| 416 var tableNode = this.getTableNode_(sel); | 417 var tableNode = this.getTableNode_(sel); |
| 417 this.tt.initialize(tableNode); | 418 this.tt.initialize(tableNode); |
| 418 // we need to align the TraverseTable with our sel because our walker | 419 // we need to align the TraverseTable with our sel because our walker |
| 419 // uses parts of it (for example isSpanned relies on being at a specific cell) | 420 // uses parts of it (for example isSpanned relies on being at a specific cell) |
| 420 return this.tt.findNearestCursor(sel.end.node); | 421 return this.tt.findNearestCursor(sel.end.node); |
| 421 }; | 422 }; |
| OLD | NEW |