| 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 | 133 |
| 134 /** | 134 /** |
| 135 * @param {!AutomationEvent} evt | 135 * @param {!AutomationEvent} evt |
| 136 */ | 136 */ |
| 137 onEventIfInRange: function(evt) { | 137 onEventIfInRange: function(evt) { |
| 138 if (evt.target.root.role != RoleType.desktop && | 138 if (evt.target.root.role != RoleType.desktop && |
| 139 ChromeVoxState.instance.mode === ChromeVoxMode.CLASSIC) | 139 ChromeVoxState.instance.mode === ChromeVoxMode.CLASSIC) |
| 140 return; | 140 return; |
| 141 | 141 |
| 142 var prev = ChromeVoxState.instance.currentRange; | 142 var prev = ChromeVoxState.instance.currentRange; |
| 143 if (AutomationUtil.isDescendantOf(prev.start.node, evt.target) || | 143 if (prev.contentEquals(cursors.Range.fromNode(evt.target)) || |
| 144 AutomationUtil.isDescendantOf(evt.target, prev.start.node) || | |
| 145 evt.target.state.focused) { | 144 evt.target.state.focused) { |
| 146 // Intentionally skip setting range. | 145 // Intentionally skip setting range. |
| 147 new Output() | 146 new Output() |
| 148 .withRichSpeechAndBraille(cursors.Range.fromNode(evt.target), | 147 .withRichSpeechAndBraille(cursors.Range.fromNode(evt.target), |
| 149 prev, | 148 prev, |
| 150 Output.EventType.NAVIGATE) | 149 Output.EventType.NAVIGATE) |
| 151 .go(); | 150 .go(); |
| 152 } | 151 } |
| 153 }, | 152 }, |
| 154 | 153 |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 DesktopAutomationHandler.init_ = function() { | 454 DesktopAutomationHandler.init_ = function() { |
| 456 chrome.automation.getDesktop(function(desktop) { | 455 chrome.automation.getDesktop(function(desktop) { |
| 457 ChromeVoxState.desktopAutomationHandler = | 456 ChromeVoxState.desktopAutomationHandler = |
| 458 new DesktopAutomationHandler(desktop); | 457 new DesktopAutomationHandler(desktop); |
| 459 }); | 458 }); |
| 460 }; | 459 }; |
| 461 | 460 |
| 462 DesktopAutomationHandler.init_(); | 461 DesktopAutomationHandler.init_(); |
| 463 | 462 |
| 464 }); // goog.scope | 463 }); // goog.scope |
| OLD | NEW |