| OLD | NEW |
| 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; |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 rootFocusedEditable = testNode; | 213 rootFocusedEditable = testNode; |
| 213 testNode = testNode.parent; | 214 testNode = testNode.parent; |
| 214 } while (testNode); | 215 } while (testNode); |
| 215 | 216 |
| 216 if (rootFocusedEditable) | 217 if (rootFocusedEditable) |
| 217 return new TextFieldTextEditHandler(rootFocusedEditable); | 218 return new TextFieldTextEditHandler(rootFocusedEditable); |
| 218 | 219 |
| 219 return null; | 220 return null; |
| 220 }; | 221 }; |
| 221 | 222 |
| 223 /** |
| 224 * An observer that reacts to ChromeVox range changes that modifies braille |
| 225 * table output when over email or url text fields. |
| 226 * @constructor |
| 227 * @implements {ChromeVoxStateObserver} |
| 228 */ |
| 229 editing.EditingChromeVoxStateObserver = function() { |
| 230 ChromeVoxState.addObserver(this); |
| 231 }; |
| 232 |
| 233 editing.EditingChromeVoxStateObserver.prototype = { |
| 234 __proto__: ChromeVoxStateObserver, |
| 235 |
| 236 /** @override */ |
| 237 onCurrentRangeChanged: function(range) { |
| 238 var inputType = range && range.start.node.inputType; |
| 239 if (inputType == 'email' || inputType == 'url') { |
| 240 cvox.BrailleBackground.getInstance().getTranslatorManager().refresh( |
| 241 localStorage['brailleTable8']); |
| 242 return; |
| 243 } |
| 244 cvox.BrailleBackground.getInstance().getTranslatorManager().refresh( |
| 245 localStorage['brailleTable']); |
| 246 } |
| 247 }; |
| 248 |
| 249 /** |
| 250 * @private {ChromeVoxStateObserver} |
| 251 */ |
| 252 editing.observer_ = new editing.EditingChromeVoxStateObserver(); |
| 253 |
| 222 }); | 254 }); |
| OLD | NEW |