| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 if (!node) | 61 if (!node) |
| 62 return; | 62 return; |
| 63 | 63 |
| 64 var prevRange = global.backgroundObj.currentRange; | 64 var prevRange = global.backgroundObj.currentRange; |
| 65 | 65 |
| 66 global.backgroundObj.currentRange = cursors.Range.fromNode(node); | 66 global.backgroundObj.currentRange = cursors.Range.fromNode(node); |
| 67 | 67 |
| 68 // Check to see if we've crossed roots. Continue if we've crossed roots or | 68 // Check to see if we've crossed roots. Continue if we've crossed roots or |
| 69 // are not within web content. | 69 // are not within web content. |
| 70 if (node.root.role == 'desktop' || | 70 if (node.root.role == RoleType.desktop || |
| 71 !prevRange || | 71 !prevRange || |
| 72 prevRange.start.node.root != node.root) | 72 prevRange.start.node.root != node.root) |
| 73 global.backgroundObj.refreshMode(node.root.docUrl || ''); | 73 global.backgroundObj.refreshMode(node.root.docUrl || ''); |
| 74 | 74 |
| 75 // Don't process nodes inside of web content if ChromeVox Next is inactive. | 75 // Don't process nodes inside of web content if ChromeVox Next is inactive. |
| 76 if (node.root.role != RoleType.desktop && | 76 if (node.root.role != RoleType.desktop && |
| 77 global.backgroundObj.mode === ChromeVoxMode.CLASSIC) { | 77 global.backgroundObj.mode === ChromeVoxMode.CLASSIC) { |
| 78 chrome.accessibilityPrivate.setFocusRing([]); | 78 chrome.accessibilityPrivate.setFocusRing([]); |
| 79 return; | 79 return; |
| 80 } | 80 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 var node = evt.target; | 121 var node = evt.target; |
| 122 | 122 |
| 123 // Discard focus events on embeddedObject nodes. | 123 // Discard focus events on embeddedObject nodes. |
| 124 if (node.role == RoleType.embeddedObject) | 124 if (node.role == RoleType.embeddedObject) |
| 125 return; | 125 return; |
| 126 | 126 |
| 127 // It almost never makes sense to place focus directly on a rootWebArea. | 127 // It almost never makes sense to place focus directly on a rootWebArea. |
| 128 if (node.role == RoleType.rootWebArea) { | 128 if (node.role == RoleType.rootWebArea) { |
| 129 // Discard focus events for root web areas when focus was previously | 129 // Discard focus events for root web areas when focus was previously |
| 130 // placed on a descendant. | 130 // placed on a descendant. |
| 131 if (global.backgroundObj.currentRange.start.node.root == node) | 131 var currentRange = global.backgroundObj.currentRange; |
| 132 if (currentRange && currentRange.start.node.root == node) |
| 132 return; | 133 return; |
| 133 | 134 |
| 134 // Discard focused root nodes without focused state set. | 135 // Discard focused root nodes without focused state set. |
| 135 if (!node.state.focused) | 136 if (!node.state.focused) |
| 136 return; | 137 return; |
| 137 | 138 |
| 138 // Try to find a focusable descendant. | 139 // Try to find a focusable descendant. |
| 139 node = node.find({state: {focused: true}}) || node; | 140 node = node.find({state: {focused: true}}) || node; |
| 140 } | 141 } |
| 141 | 142 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 if (cvox.ChromeVox.isMac) | 284 if (cvox.ChromeVox.isMac) |
| 284 return; | 285 return; |
| 285 chrome.automation.getDesktop(function(desktop) { | 286 chrome.automation.getDesktop(function(desktop) { |
| 286 global.desktopAutomationHandler = new DesktopAutomationHandler(desktop); | 287 global.desktopAutomationHandler = new DesktopAutomationHandler(desktop); |
| 287 }); | 288 }); |
| 288 }; | 289 }; |
| 289 | 290 |
| 290 DesktopAutomationHandler.init_(); | 291 DesktopAutomationHandler.init_(); |
| 291 | 292 |
| 292 }); // goog.scope | 293 }); // goog.scope |
| OLD | NEW |