OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 var AutomationEvent = require('automationEvent').AutomationEvent; | 5 var AutomationEvent = require('automationEvent').AutomationEvent; |
6 var automationInternal = | 6 var automationInternal = |
7 require('binding').Binding.create('automationInternal').generate(); | 7 require('binding').Binding.create('automationInternal').generate(); |
8 var exceptionHandler = require('uncaught_exception_handler'); | 8 var exceptionHandler = require('uncaught_exception_handler'); |
9 var IsInteractPermitted = | 9 var IsInteractPermitted = |
10 requireNative('automationInternal').IsInteractPermitted; | 10 requireNative('automationInternal').IsInteractPermitted; |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
231 */ | 231 */ |
232 var GetHtmlAttribute = requireNative('automationInternal').GetHtmlAttribute; | 232 var GetHtmlAttribute = requireNative('automationInternal').GetHtmlAttribute; |
233 | 233 |
234 /** | 234 /** |
235 * @param {number} axTreeID The id of the accessibility tree. | 235 * @param {number} axTreeID The id of the accessibility tree. |
236 * @param {number} nodeID The id of a node. | 236 * @param {number} nodeID The id of a node. |
237 * @return {automation.NameFromType} The source of the node's name. | 237 * @return {automation.NameFromType} The source of the node's name. |
238 */ | 238 */ |
239 var GetNameFrom = requireNative('automationInternal').GetNameFrom; | 239 var GetNameFrom = requireNative('automationInternal').GetNameFrom; |
240 | 240 |
241 var GetCustomActions = requireNative('automationInternal').GetCustomActions; | |
242 | |
241 var lastError = require('lastError'); | 243 var lastError = require('lastError'); |
242 var logging = requireNative('logging'); | 244 var logging = requireNative('logging'); |
243 var utils = require('utils'); | 245 var utils = require('utils'); |
244 | 246 |
245 /** | 247 /** |
246 * A single node in the Automation tree. | 248 * A single node in the Automation tree. |
247 * @param {AutomationRootNodeImpl} root The root of the tree. | 249 * @param {AutomationRootNodeImpl} root The root of the tree. |
248 * @constructor | 250 * @constructor |
249 */ | 251 */ |
250 function AutomationNodeImpl(root) { | 252 function AutomationNodeImpl(root) { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
373 parent = privates(parent).impl; | 375 parent = privates(parent).impl; |
374 var indexInParent = GetIndexInParent(this.treeID, this.id); | 376 var indexInParent = GetIndexInParent(this.treeID, this.id); |
375 return this.rootImpl.get( | 377 return this.rootImpl.get( |
376 GetChildIDAtIndex(parent.treeID, parent.id, indexInParent + 1)); | 378 GetChildIDAtIndex(parent.treeID, parent.id, indexInParent + 1)); |
377 }, | 379 }, |
378 | 380 |
379 get nameFrom() { | 381 get nameFrom() { |
380 return GetNameFrom(this.treeID, this.id); | 382 return GetNameFrom(this.treeID, this.id); |
381 }, | 383 }, |
382 | 384 |
385 get customActions() { | |
386 return GetCustomActions(this.treeID, this.id); | |
387 }, | |
388 | |
383 doDefault: function() { | 389 doDefault: function() { |
384 this.performAction_('doDefault'); | 390 this.performAction_('doDefault'); |
385 }, | 391 }, |
386 | 392 |
387 focus: function() { | 393 focus: function() { |
388 this.performAction_('focus'); | 394 this.performAction_('focus'); |
389 }, | 395 }, |
390 | 396 |
391 getImageData: function(maxWidth, maxHeight) { | 397 getImageData: function(maxWidth, maxHeight) { |
392 this.performAction_('getImageData', | 398 this.performAction_('getImageData', |
393 { maxWidth: maxWidth, | 399 { maxWidth: maxWidth, |
394 maxHeight: maxHeight }); | 400 maxHeight: maxHeight }); |
395 }, | 401 }, |
396 | 402 |
397 hitTest: function(x, y, eventToFire) { | 403 hitTest: function(x, y, eventToFire) { |
398 // Convert from global to tree-relative coordinates. | 404 // Convert from global to tree-relative coordinates. |
399 var location = GetLocation(this.treeID, GetRootID(this.treeID)); | 405 var location = GetLocation(this.treeID, GetRootID(this.treeID)); |
400 this.performAction_('hitTest', | 406 this.performAction_('hitTest', |
401 { x: Math.floor(x - location.left), | 407 { x: Math.floor(x - location.left), |
402 y: Math.floor(y - location.top), | 408 y: Math.floor(y - location.top), |
403 eventToFire: eventToFire }); | 409 eventToFire: eventToFire }); |
404 }, | 410 }, |
405 | 411 |
406 makeVisible: function() { | 412 makeVisible: function() { |
407 this.performAction_('makeVisible'); | 413 this.performAction_('makeVisible'); |
408 }, | 414 }, |
409 | 415 |
416 performCustomAction: function(customAction) { | |
417 if (!customAction.id) | |
418 return; | |
419 | |
420 this.performAction_('customAction', { customActionID: customAction.id }); | |
David Tseng
2017/06/08 17:21:59
customAction.description unused here.
| |
421 }, | |
422 | |
410 resumeMedia: function() { | 423 resumeMedia: function() { |
411 this.performAction_('resumeMedia'); | 424 this.performAction_('resumeMedia'); |
412 }, | 425 }, |
413 | 426 |
414 setSelection: function(startIndex, endIndex) { | 427 setSelection: function(startIndex, endIndex) { |
415 if (this.role == 'textField' || this.role == 'textBox') { | 428 if (this.role == 'textField' || this.role == 'textBox') { |
416 this.performAction_('setSelection', | 429 this.performAction_('setSelection', |
417 { focusNodeID: this.id, | 430 { focusNodeID: this.id, |
418 anchorOffset: startIndex, | 431 anchorOffset: startIndex, |
419 focusOffset: endIndex }); | 432 focusOffset: endIndex }); |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1100 utils.expose(AutomationNode, AutomationNodeImpl, { | 1113 utils.expose(AutomationNode, AutomationNodeImpl, { |
1101 functions: [ | 1114 functions: [ |
1102 'doDefault', | 1115 'doDefault', |
1103 'find', | 1116 'find', |
1104 'findAll', | 1117 'findAll', |
1105 'focus', | 1118 'focus', |
1106 'getImageData', | 1119 'getImageData', |
1107 'hitTest', | 1120 'hitTest', |
1108 'makeVisible', | 1121 'makeVisible', |
1109 'matches', | 1122 'matches', |
1123 'performCustomAction', | |
1110 'resumeMedia', | 1124 'resumeMedia', |
1111 'setSelection', | 1125 'setSelection', |
1112 'setSequentialFocusNavigationStartingPoint', | 1126 'setSequentialFocusNavigationStartingPoint', |
1113 'showContextMenu', | 1127 'showContextMenu', |
1114 'startDuckingMedia', | 1128 'startDuckingMedia', |
1115 'stopDuckingMedia', | 1129 'stopDuckingMedia', |
1116 'suspendMedia', | 1130 'suspendMedia', |
1117 'addEventListener', | 1131 'addEventListener', |
1118 'removeEventListener', | 1132 'removeEventListener', |
1119 'domQuerySelector', | 1133 'domQuerySelector', |
(...skipping 10 matching lines...) Expand all Loading... | |
1130 'isRootNode', | 1144 'isRootNode', |
1131 'role', | 1145 'role', |
1132 'checked', | 1146 'checked', |
1133 'state', | 1147 'state', |
1134 'location', | 1148 'location', |
1135 'indexInParent', | 1149 'indexInParent', |
1136 'lineStartOffsets', | 1150 'lineStartOffsets', |
1137 'root', | 1151 'root', |
1138 'htmlAttributes', | 1152 'htmlAttributes', |
1139 'nameFrom', | 1153 'nameFrom', |
1154 'customActions', | |
1140 ]), | 1155 ]), |
1141 }); | 1156 }); |
1142 | 1157 |
1143 function AutomationRootNode() { | 1158 function AutomationRootNode() { |
1144 privates(AutomationRootNode).constructPrivate(this, arguments); | 1159 privates(AutomationRootNode).constructPrivate(this, arguments); |
1145 } | 1160 } |
1146 utils.expose(AutomationRootNode, AutomationRootNodeImpl, { | 1161 utils.expose(AutomationRootNode, AutomationRootNodeImpl, { |
1147 superclass: AutomationNode, | 1162 superclass: AutomationNode, |
1148 readonly: [ | 1163 readonly: [ |
1149 'chromeChannel', | 1164 'chromeChannel', |
(...skipping 17 matching lines...) Expand all Loading... | |
1167 utils.defineProperty(AutomationRootNode, 'getOrCreate', function(treeID) { | 1182 utils.defineProperty(AutomationRootNode, 'getOrCreate', function(treeID) { |
1168 return AutomationRootNodeImpl.getOrCreate(treeID); | 1183 return AutomationRootNodeImpl.getOrCreate(treeID); |
1169 }); | 1184 }); |
1170 | 1185 |
1171 utils.defineProperty(AutomationRootNode, 'destroy', function(treeID) { | 1186 utils.defineProperty(AutomationRootNode, 'destroy', function(treeID) { |
1172 AutomationRootNodeImpl.destroy(treeID); | 1187 AutomationRootNodeImpl.destroy(treeID); |
1173 }); | 1188 }); |
1174 | 1189 |
1175 exports.$set('AutomationNode', AutomationNode); | 1190 exports.$set('AutomationNode', AutomationNode); |
1176 exports.$set('AutomationRootNode', AutomationRootNode); | 1191 exports.$set('AutomationRootNode', AutomationRootNode); |
OLD | NEW |