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 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
420 DesktopAutomationHandler.init_ = function() { | 430 DesktopAutomationHandler.init_ = function() { |
421 chrome.automation.getDesktop(function(desktop) { | 431 chrome.automation.getDesktop(function(desktop) { |
422 ChromeVoxState.desktopAutomationHandler = | 432 ChromeVoxState.desktopAutomationHandler = |
423 new DesktopAutomationHandler(desktop); | 433 new DesktopAutomationHandler(desktop); |
424 }); | 434 }); |
425 }; | 435 }; |
426 | 436 |
427 DesktopAutomationHandler.init_(); | 437 DesktopAutomationHandler.init_(); |
428 | 438 |
429 }); // goog.scope | 439 }); // goog.scope |
OLD | NEW |