summaryrefslogtreecommitdiff
path: root/chromium/chrome/browser/resources/chromeos/chromevox/walkers/character_walker.js
blob: 32621a67bdef0b82551b8cb8e26b1e8a1982e26b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

/**
 * @fileoverview A class for walking one character at a time.
 */


goog.provide('cvox.CharacterWalker');

goog.require('cvox.AbstractSelectionWalker');
goog.require('cvox.TraverseContent');

/**
 * @constructor
 * @extends {cvox.AbstractSelectionWalker}
 */
cvox.CharacterWalker = function() {
  cvox.AbstractSelectionWalker.call(this);
  this.grain = cvox.TraverseContent.kCharacter;
};
goog.inherits(cvox.CharacterWalker, cvox.AbstractSelectionWalker);

/**
 * @override
 */
cvox.CharacterWalker.prototype.getDescription = function(prevSel, sel) {
  var desc = goog.base(this, 'getDescription', prevSel, sel);
  desc.forEach(function(item) {
    if (!item.personality) {
      item.personality = {};
    }
    item.personality['phoneticCharacters'] = true;
  });
  return desc;
};

/**
 * @override
 */
cvox.CharacterWalker.prototype.getGranularityMsg = function() {
  return Msgs.getMsg('character_granularity');
};