object_walker.js revision cedac228d2dd51db4b79ea1e72c7f249408ee061
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 JavaScript class for walking the leaf nodes of the dom. 7 */ 8 9 10goog.provide('cvox.ObjectWalker'); 11 12goog.require('cvox.AbstractNodeWalker'); 13goog.require('cvox.BrailleUtil'); 14goog.require('cvox.DescriptionUtil'); 15 16/** 17 * @constructor 18 * @extends {cvox.AbstractNodeWalker} 19 */ 20cvox.ObjectWalker = function() { 21 goog.base(this); 22}; 23goog.inherits(cvox.ObjectWalker, cvox.AbstractNodeWalker); 24 25/** 26 * @override 27 */ 28cvox.ObjectWalker.prototype.stopNodeDescent = function(node) { 29 return cvox.DomUtil.isLeafNode(node); 30}; 31 32// TODO(dtseng): Causes a circular dependency if put into AbstractNodeWalker. 33/** 34 * @override 35 */ 36cvox.AbstractNodeWalker.prototype.getDescription = function(prevSel, sel) { 37 return cvox.DescriptionUtil.getDescriptionFromNavigation( 38 prevSel.end.node, 39 sel.start.node, 40 true, 41 cvox.ChromeVox.verbosity); 42}; 43 44/** 45 * @override 46 */ 47cvox.ObjectWalker.prototype.getBraille = function(prevSel, sel) { 48 throw 'getBraille is unsupported'; 49}; 50 51/** 52 * @override 53 */ 54cvox.ObjectWalker.prototype.getGranularityMsg = function() { 55 return cvox.ChromeVox.msgs.getMsg('object_strategy'); 56}; 57