Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/common/earcon_util.js

Issue 1306773003: Make earcon ids strings instead of numbers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove_unused_earcons
Patch Set: Fixed test Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 Earcon utils. 6 * @fileoverview Earcon utils.
7 */ 7 */
8 8
9 goog.provide('cvox.EarconUtil'); 9 goog.provide('cvox.EarconUtil');
10 10
11 goog.require('cvox.AbstractEarcons'); 11 goog.require('cvox.AbstractEarcons');
12 goog.require('cvox.AriaUtil'); 12 goog.require('cvox.AriaUtil');
13 goog.require('cvox.DomUtil'); 13 goog.require('cvox.DomUtil');
14 14
15 /** 15 /**
16 * Returns the id of an earcon to play along with the description for a node. 16 * Returns the id of an earcon to play along with the description for a node.
17 * 17 *
18 * @param {Node} node The node to get the earcon for. 18 * @param {Node} node The node to get the earcon for.
19 * @return {number?} The earcon id, or null if none applies. 19 * @return {cvox.Earcon?} The earcon id, or null if none applies.
20 */ 20 */
21 cvox.EarconUtil.getEarcon = function(node) { 21 cvox.EarconUtil.getEarcon = function(node) {
22 var earcon = cvox.AriaUtil.getEarcon(node); 22 var earcon = cvox.AriaUtil.getEarcon(node);
23 if (earcon != null) { 23 if (earcon != null) {
24 return earcon; 24 return earcon;
25 } 25 }
26 26
27 switch (node.tagName) { 27 switch (node.tagName) {
28 case 'BUTTON': 28 case 'BUTTON':
29 return cvox.AbstractEarcons.BUTTON; 29 return cvox.Earcon.BUTTON;
30 case 'A': 30 case 'A':
31 if (node.hasAttribute('href')) { 31 if (node.hasAttribute('href')) {
32 return cvox.AbstractEarcons.LINK; 32 return cvox.Earcon.LINK;
33 } 33 }
34 break; 34 break;
35 case 'IMG': 35 case 'IMG':
36 if (cvox.DomUtil.hasLongDesc(node)) { 36 if (cvox.DomUtil.hasLongDesc(node)) {
37 return cvox.AbstractEarcons.LONG_DESC; 37 return cvox.Earcon.LONG_DESC;
38 } 38 }
39 break; 39 break;
40 case 'LI': 40 case 'LI':
41 return cvox.AbstractEarcons.LIST_ITEM; 41 return cvox.Earcon.LIST_ITEM;
42 case 'SELECT': 42 case 'SELECT':
43 return cvox.AbstractEarcons.LISTBOX; 43 return cvox.Earcon.LISTBOX;
44 case 'TEXTAREA': 44 case 'TEXTAREA':
45 return cvox.AbstractEarcons.EDITABLE_TEXT; 45 return cvox.Earcon.EDITABLE_TEXT;
46 case 'INPUT': 46 case 'INPUT':
47 switch (node.type) { 47 switch (node.type) {
48 case 'button': 48 case 'button':
49 case 'submit': 49 case 'submit':
50 case 'reset': 50 case 'reset':
51 return cvox.AbstractEarcons.BUTTON; 51 return cvox.Earcon.BUTTON;
52 case 'checkbox': 52 case 'checkbox':
53 case 'radio': 53 case 'radio':
54 if (node.checked) { 54 if (node.checked) {
55 return cvox.AbstractEarcons.CHECK_ON; 55 return cvox.Earcon.CHECK_ON;
56 } else { 56 } else {
57 return cvox.AbstractEarcons.CHECK_OFF; 57 return cvox.Earcon.CHECK_OFF;
58 } 58 }
59 default: 59 default:
60 if (cvox.DomUtil.isInputTypeText(node)) { 60 if (cvox.DomUtil.isInputTypeText(node)) {
61 // 'text', 'password', etc. 61 // 'text', 'password', etc.
62 return cvox.AbstractEarcons.EDITABLE_TEXT; 62 return cvox.Earcon.EDITABLE_TEXT;
63 } 63 }
64 } 64 }
65 } 65 }
66 return null; 66 return null;
67 }; 67 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698