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

Side by Side Diff: chrome/browser/resources/chromeos/chromevox/cvox2/background/editing.js

Issue 2813743002: Switch to selected 8-dot braille table in email and url text fields (Closed)
Patch Set: Address feedback. Created 3 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 Processes events related to editing text and emits the 6 * @fileoverview Processes events related to editing text and emits the
7 * appropriate spoken and braille feedback. 7 * appropriate spoken and braille feedback.
8 */ 8 */
9 9
10 goog.provide('editing.TextEditHandler'); 10 goog.provide('editing.TextEditHandler');
11 11
12 goog.require('AutomationTreeWalker'); 12 goog.require('AutomationTreeWalker');
13 goog.require('AutomationUtil'); 13 goog.require('AutomationUtil');
14 goog.require('Output'); 14 goog.require('Output');
15 goog.require('Output.EventType'); 15 goog.require('Output.EventType');
16 goog.require('cursors.Cursor'); 16 goog.require('cursors.Cursor');
17 goog.require('cursors.Range'); 17 goog.require('cursors.Range');
18 goog.require('cvox.BrailleBackground');
18 goog.require('cvox.ChromeVoxEditableTextBase'); 19 goog.require('cvox.ChromeVoxEditableTextBase');
19 20
20 goog.scope(function() { 21 goog.scope(function() {
21 var AutomationEvent = chrome.automation.AutomationEvent; 22 var AutomationEvent = chrome.automation.AutomationEvent;
22 var AutomationNode = chrome.automation.AutomationNode; 23 var AutomationNode = chrome.automation.AutomationNode;
23 var Cursor = cursors.Cursor; 24 var Cursor = cursors.Cursor;
24 var Dir = AutomationUtil.Dir; 25 var Dir = AutomationUtil.Dir;
25 var EventType = chrome.automation.EventType; 26 var EventType = chrome.automation.EventType;
26 var Range = cursors.Range; 27 var Range = cursors.Range;
27 var RoleType = chrome.automation.RoleType; 28 var RoleType = chrome.automation.RoleType;
28 var StateType = chrome.automation.StateType; 29 var StateType = chrome.automation.StateType;
29 var Movement = cursors.Movement; 30 var Movement = cursors.Movement;
30 var Unit = cursors.Unit; 31 var Unit = cursors.Unit;
31 32
32 /** 33 /**
33 * A handler for automation events in a focused text field or editable root 34 * A handler for automation events in a focused text field or editable root
34 * such as a |contenteditable| subtree. 35 * such as a |contenteditable| subtree.
35 * @constructor 36 * @constructor
36 * @param {!AutomationNode} node 37 * @param {!AutomationNode} node
37 */ 38 */
38 editing.TextEditHandler = function(node) { 39 editing.TextEditHandler = function(node) {
39 /** @const {!AutomationNode} @private */ 40 /** @const {!AutomationNode} @private */
40 this.node_ = node; 41 this.node_ = node;
42
43 // Refresh braille translation.
44 if (node.inputType == 'email' || node.inputType == 'url') {
45 cvox.BrailleBackground.getInstance().getTranslatorManager().refresh(
46 localStorage['brailleTable8']);
47 }
41 }; 48 };
42 49
43 editing.TextEditHandler.prototype = { 50 editing.TextEditHandler.prototype = {
44 /** @return {!AutomationNode} */ 51 /** @return {!AutomationNode} */
45 get node() { 52 get node() {
46 return this.node_; 53 return this.node_;
47 }, 54 },
48 55
49 /** 56 /**
57 * Invalidates this handler. A caller must invalidate this handler for it to
58 * properly reset any intermediate actions it took on behalf of a user.
59 */
60 invalidate: function() {
61 // Refresh back to user's table selection.
62 cvox.BrailleBackground.getInstance().getTranslatorManager().refresh(
63 localStorage['brailleTable']);
64 },
65
66 /**
50 * Receives the following kinds of events when the node provided to the 67 * Receives the following kinds of events when the node provided to the
51 * constructor is focuse: |focus|, |textChanged|, |textSelectionChanged| and 68 * constructor is focuse: |focus|, |textChanged|, |textSelectionChanged| and
52 * |valueChanged|. 69 * |valueChanged|.
53 * An implementation of this method should emit the appropritate braille and 70 * An implementation of this method should emit the appropritate braille and
54 * spoken feedback for the event. 71 * spoken feedback for the event.
55 * @param {!(AutomationEvent|CustomAutomationEvent)} evt 72 * @param {!(AutomationEvent|CustomAutomationEvent)} evt
56 */ 73 */
57 onEvent: goog.abstractMethod, 74 onEvent: goog.abstractMethod,
58 }; 75 };
59 76
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 testNode = testNode.parent; 230 testNode = testNode.parent;
214 } while (testNode); 231 } while (testNode);
215 232
216 if (rootFocusedEditable) 233 if (rootFocusedEditable)
217 return new TextFieldTextEditHandler(rootFocusedEditable); 234 return new TextFieldTextEditHandler(rootFocusedEditable);
218 235
219 return null; 236 return null;
220 }; 237 };
221 238
222 }); 239 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698