| 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 Handles automation from a desktop automation node. | 6 * @fileoverview Handles automation from a desktop automation node. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 goog.provide('DesktopAutomationHandler'); | 9 goog.provide('DesktopAutomationHandler'); |
| 10 | 10 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 // Delegate event handling to the text edit handler for braille. | 122 // Delegate event handling to the text edit handler for braille. |
| 123 this.textEditHandler_.onEvent(evt); | 123 this.textEditHandler_.onEvent(evt); |
| 124 } | 124 } |
| 125 output.go(); | 125 output.go(); |
| 126 }, | 126 }, |
| 127 | 127 |
| 128 /** | 128 /** |
| 129 * @param {!AutomationEvent} evt | 129 * @param {!AutomationEvent} evt |
| 130 */ | 130 */ |
| 131 onEventIfInRange: function(evt) { | 131 onEventIfInRange: function(evt) { |
| 132 // TODO(dtseng): Consider the end of the current range as well. | 132 if (evt.target.root.role != RoleType.desktop && |
| 133 if (AutomationUtil.isDescendantOf( | 133 ChromeVoxState.instance.mode === ChromeVoxMode.CLASSIC) |
| 134 ChromeVoxState.instance.currentRange.start.node, evt.target) || | 134 return; |
| 135 evt.target.state.focused) | 135 |
| 136 this.onEventDefault(evt); | 136 var prev = ChromeVoxState.instance.currentRange; |
| 137 if (AutomationUtil.isDescendantOf(prev.start.node, evt.target) || |
| 138 AutomationUtil.isDescendantOf(evt.target, prev.start.node) || |
| 139 evt.target.state.focused) { |
| 140 // Intentionally skip setting range. |
| 141 new Output() |
| 142 .withRichSpeechAndBraille(cursors.Range.fromNode(evt.target), |
| 143 prev, |
| 144 Output.EventType.NAVIGATE) |
| 145 .go(); |
| 146 } |
| 137 }, | 147 }, |
| 138 | 148 |
| 139 /** | 149 /** |
| 140 * @param {!AutomationEvent} evt | 150 * @param {!AutomationEvent} evt |
| 141 */ | 151 */ |
| 142 onEventIfSelected: function(evt) { | 152 onEventIfSelected: function(evt) { |
| 143 if (evt.target.state.selected) | 153 if (evt.target.state.selected) |
| 144 this.onEventDefault(evt); | 154 this.onEventDefault(evt); |
| 145 }, | 155 }, |
| 146 | 156 |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 DesktopAutomationHandler.init_ = function() { | 425 DesktopAutomationHandler.init_ = function() { |
| 416 chrome.automation.getDesktop(function(desktop) { | 426 chrome.automation.getDesktop(function(desktop) { |
| 417 ChromeVoxState.desktopAutomationHandler = | 427 ChromeVoxState.desktopAutomationHandler = |
| 418 new DesktopAutomationHandler(desktop); | 428 new DesktopAutomationHandler(desktop); |
| 419 }); | 429 }); |
| 420 }; | 430 }; |
| 421 | 431 |
| 422 DesktopAutomationHandler.init_(); | 432 DesktopAutomationHandler.init_(); |
| 423 | 433 |
| 424 }); // goog.scope | 434 }); // goog.scope |
| OLD | NEW |