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. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 */ | 48 */ |
49 cvox.TableWalker.prototype.sync = function(sel) { | 49 cvox.TableWalker.prototype.sync = function(sel) { |
50 return this.goTo_(sel, goog.bind(function(position) { | 50 return this.goTo_(sel, goog.bind(function(position) { |
51 return this.tt.goToCell(position); | 51 return this.tt.goToCell(position); |
52 }, this)); | 52 }, this)); |
53 }; | 53 }; |
54 | 54 |
55 /** | 55 /** |
56 * @override | 56 * @override |
57 * @suppress {checkTypes} actual parameter 2 of | 57 * @suppress {checkTypes} actual parameter 2 of |
58 * cvox.AbstractMsgs.prototype.getMsg does not match formal parameter | 58 * cvox.Msgs.prototype.getMsg does not match formal parameter |
59 * found : Array.<number> | 59 * found : Array.<number> |
60 * required: (Array.<string>|null|undefined) | 60 * required: (Array.<string>|null|undefined) |
61 */ | 61 */ |
62 cvox.TableWalker.prototype.getDescription = function(prevSel, sel) { | 62 cvox.TableWalker.prototype.getDescription = function(prevSel, sel) { |
63 var position = this.syncPosition_(sel); | 63 var position = this.syncPosition_(sel); |
64 if (!position) { | 64 if (!position) { |
65 return []; | 65 return []; |
66 } | 66 } |
67 this.tt.goToCell(position); | 67 this.tt.goToCell(position); |
68 var descs = cvox.DescriptionUtil.getCollectionDescription(prevSel, sel); | 68 var descs = cvox.DescriptionUtil.getCollectionDescription(prevSel, sel); |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
260 this.getRowHeaderText_(position) + | 260 this.getRowHeaderText_(position) + |
261 ' ' + | 261 ' ' + |
262 this.getColHeaderText_(position)); | 262 this.getColHeaderText_(position)); |
263 }; | 263 }; |
264 | 264 |
265 /** | 265 /** |
266 * Returns the location description. | 266 * Returns the location description. |
267 * @param {!cvox.CursorSelection} sel A valid selection. | 267 * @param {!cvox.CursorSelection} sel A valid selection. |
268 * @return {Array.<cvox.NavDescription>} The location description. | 268 * @return {Array.<cvox.NavDescription>} The location description. |
269 * @suppress {checkTypes} actual parameter 2 of | 269 * @suppress {checkTypes} actual parameter 2 of |
270 * cvox.AbstractMsgs.prototype.getMsg does not match | 270 * cvox.Msgs.prototype.getMsg does not match |
271 * formal parameter | 271 * formal parameter |
272 * found : Array.<number> | 272 * found : Array.<number> |
273 * required: (Array.<string>|null|undefined) | 273 * required: (Array.<string>|null|undefined) |
274 * @private | 274 * @private |
275 */ | 275 */ |
276 cvox.TableWalker.prototype.getLocationDescription_ = function(sel) { | 276 cvox.TableWalker.prototype.getLocationDescription_ = function(sel) { |
277 var locationInfo = this.getLocationInfo(sel); | 277 var locationInfo = this.getLocationInfo(sel); |
278 if (locationInfo == null) { | 278 if (locationInfo == null) { |
279 return null; | 279 return null; |
280 } | 280 } |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
412 * @return {Array.<number>} The position [x, y] of the selection. | 412 * @return {Array.<number>} The position [x, y] of the selection. |
413 * @private | 413 * @private |
414 */ | 414 */ |
415 cvox.TableWalker.prototype.syncPosition_ = function(sel) { | 415 cvox.TableWalker.prototype.syncPosition_ = function(sel) { |
416 var tableNode = this.getTableNode_(sel); | 416 var tableNode = this.getTableNode_(sel); |
417 this.tt.initialize(tableNode); | 417 this.tt.initialize(tableNode); |
418 // we need to align the TraverseTable with our sel because our walker | 418 // 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) | 419 // uses parts of it (for example isSpanned relies on being at a specific cell) |
420 return this.tt.findNearestCursor(sel.end.node); | 420 return this.tt.findNearestCursor(sel.end.node); |
421 }; | 421 }; |
OLD | NEW |