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 3 // found in the LICENSE file. 4 5 /** 6 * @fileoverview A class for walking "groups". Groups, intuitively, are logical 7 * collections of dom elements. See AbstractNodeWalker and the 8 * stopNodeDescent() method here for how groups are defined. 9 */ 10 11 12 goog.provide('cvox.GroupWalker'); 13 14 goog.require('cvox.AbstractNodeWalker'); 15 goog.require('cvox.BrailleUtil'); 16 goog.require('cvox.CursorSelection'); 17 goog.require('cvox.DescriptionUtil'); 18 goog.require('cvox.DomUtil'); 19 goog.require('cvox.GroupUtil'); 20 21 22 /** 23 * @constructor 24 * @extends {cvox.AbstractNodeWalker} 25 */ 26 cvox.GroupWalker = function() { 27 cvox.AbstractNodeWalker.call(this); 28 }; 29 goog.inherits(cvox.GroupWalker, cvox.AbstractNodeWalker); 30 31 32 /** 33 * @override 34 */ 35 cvox.GroupWalker.prototype.getDescription = function(prevSel, sel) { 36 return cvox.DescriptionUtil.getCollectionDescription(prevSel, sel); 37 }; 38 39 40 /** 41 * @override 42 */ 43 cvox.GroupWalker.prototype.getBraille = function(prevSel, sel) { 44 throw 'getBraille is unsupported'; 45 }; 46 47 /** 48 * @override 49 */ 50 cvox.GroupWalker.prototype.getGranularityMsg = function() { 51 return cvox.ChromeVox.msgs.getMsg('group_strategy'); 52 }; 53 54 /** 55 * @override 56 */ 57 cvox.GroupWalker.prototype.stopNodeDescent = function(node) { 58 return cvox.GroupUtil.isLeafNode(node); 59 }; 60