| 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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 } | 420 } |
| 421 }, | 421 }, |
| 422 | 422 |
| 423 toJSON: function() { | 423 toJSON: function() { |
| 424 return { treeID: this.treeID, | 424 return { treeID: this.treeID, |
| 425 id: this.id, | 425 id: this.id, |
| 426 role: this.role, | 426 role: this.role, |
| 427 attributes: this.attributes }; | 427 attributes: this.attributes }; |
| 428 }, | 428 }, |
| 429 | 429 |
| 430 dispatchEvent: function(eventType, eventFrom) { | 430 dispatchEvent: function(eventType, eventFrom, mouseX, mouseY) { |
| 431 var path = []; | 431 var path = []; |
| 432 var parent = this.parent; | 432 var parent = this.parent; |
| 433 while (parent) { | 433 while (parent) { |
| 434 $Array.push(path, parent); | 434 $Array.push(path, parent); |
| 435 parent = parent.parent; | 435 parent = parent.parent; |
| 436 } | 436 } |
| 437 var event = new AutomationEvent(eventType, this.wrapper, eventFrom); | 437 var event = new AutomationEvent(eventType, this.wrapper, eventFrom); |
| 438 event.mouseX = mouseX; |
| 439 event.mouseY = mouseY; |
| 438 | 440 |
| 439 // Dispatch the event through the propagation path in three phases: | 441 // Dispatch the event through the propagation path in three phases: |
| 440 // - capturing: starting from the root and going down to the target's parent | 442 // - capturing: starting from the root and going down to the target's parent |
| 441 // - targeting: dispatching the event on the target itself | 443 // - targeting: dispatching the event on the target itself |
| 442 // - bubbling: starting from the target's parent, going back up to the root. | 444 // - bubbling: starting from the target's parent, going back up to the root. |
| 443 // At any stage, a listener may call stopPropagation() on the event, which | 445 // At any stage, a listener may call stopPropagation() on the event, which |
| 444 // will immediately stop event propagation through this path. | 446 // will immediately stop event propagation through this path. |
| 445 if (this.dispatchEventAtCapturing_(event, path)) { | 447 if (this.dispatchEventAtCapturing_(event, path)) { |
| 446 if (this.dispatchEventAtTargeting_(event, path)) | 448 if (this.dispatchEventAtTargeting_(event, path)) |
| 447 this.dispatchEventAtBubbling_(event, path); | 449 this.dispatchEventAtBubbling_(event, path); |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 990 | 992 |
| 991 setHostNode(hostNode) { | 993 setHostNode(hostNode) { |
| 992 this.hostNode_ = hostNode; | 994 this.hostNode_ = hostNode; |
| 993 }, | 995 }, |
| 994 | 996 |
| 995 onAccessibilityEvent: function(eventParams) { | 997 onAccessibilityEvent: function(eventParams) { |
| 996 var targetNode = this.get(eventParams.targetID); | 998 var targetNode = this.get(eventParams.targetID); |
| 997 if (targetNode) { | 999 if (targetNode) { |
| 998 var targetNodeImpl = privates(targetNode).impl; | 1000 var targetNodeImpl = privates(targetNode).impl; |
| 999 targetNodeImpl.dispatchEvent( | 1001 targetNodeImpl.dispatchEvent( |
| 1000 eventParams.eventType, eventParams.eventFrom); | 1002 eventParams.eventType, eventParams.eventFrom, |
| 1003 eventParams.mouseX, eventParams.mouseY); |
| 1001 } else { | 1004 } else { |
| 1002 logging.WARNING('Got ' + eventParams.eventType + | 1005 logging.WARNING('Got ' + eventParams.eventType + |
| 1003 ' event on unknown node: ' + eventParams.targetID + | 1006 ' event on unknown node: ' + eventParams.targetID + |
| 1004 '; this: ' + this.id); | 1007 '; this: ' + this.id); |
| 1005 } | 1008 } |
| 1006 return true; | 1009 return true; |
| 1007 }, | 1010 }, |
| 1008 | 1011 |
| 1009 toString: function() { | 1012 toString: function() { |
| 1010 function toStringInternal(nodeImpl, indent) { | 1013 function toStringInternal(nodeImpl, indent) { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1087 utils.defineProperty(AutomationRootNode, 'getOrCreate', function(treeID) { | 1090 utils.defineProperty(AutomationRootNode, 'getOrCreate', function(treeID) { |
| 1088 return AutomationRootNodeImpl.getOrCreate(treeID); | 1091 return AutomationRootNodeImpl.getOrCreate(treeID); |
| 1089 }); | 1092 }); |
| 1090 | 1093 |
| 1091 utils.defineProperty(AutomationRootNode, 'destroy', function(treeID) { | 1094 utils.defineProperty(AutomationRootNode, 'destroy', function(treeID) { |
| 1092 AutomationRootNodeImpl.destroy(treeID); | 1095 AutomationRootNodeImpl.destroy(treeID); |
| 1093 }); | 1096 }); |
| 1094 | 1097 |
| 1095 exports.$set('AutomationNode', AutomationNode); | 1098 exports.$set('AutomationNode', AutomationNode); |
| 1096 exports.$set('AutomationRootNode', AutomationRootNode); | 1099 exports.$set('AutomationRootNode', AutomationRootNode); |
| OLD | NEW |