Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(125)

Side by Side Diff: chrome/renderer/resources/extensions/automation/automation_node.js

Issue 2080573003: Track all changed nodes during an update (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make suggested change. Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 } 402 }
403 }, 403 },
404 404
405 toJSON: function() { 405 toJSON: function() {
406 return { treeID: this.treeID, 406 return { treeID: this.treeID,
407 id: this.id, 407 id: this.id,
408 role: this.role, 408 role: this.role,
409 attributes: this.attributes }; 409 attributes: this.attributes };
410 }, 410 },
411 411
412 dispatchEvent: function(eventType) { 412 dispatchEvent: function(eventType, eventFrom) {
413 var path = []; 413 var path = [];
414 var parent = this.parent; 414 var parent = this.parent;
415 while (parent) { 415 while (parent) {
416 $Array.push(path, parent); 416 $Array.push(path, parent);
417 parent = parent.parent; 417 parent = parent.parent;
418 } 418 }
419 var event = new AutomationEvent(eventType, this.wrapper); 419 var event = new AutomationEvent(eventType, this.wrapper, eventFrom);
420 420
421 // Dispatch the event through the propagation path in three phases: 421 // Dispatch the event through the propagation path in three phases:
422 // - capturing: starting from the root and going down to the target's parent 422 // - capturing: starting from the root and going down to the target's parent
423 // - targeting: dispatching the event on the target itself 423 // - targeting: dispatching the event on the target itself
424 // - bubbling: starting from the target's parent, going back up to the root. 424 // - bubbling: starting from the target's parent, going back up to the root.
425 // At any stage, a listener may call stopPropagation() on the event, which 425 // At any stage, a listener may call stopPropagation() on the event, which
426 // will immediately stop event propagation through this path. 426 // will immediately stop event propagation through this path.
427 if (this.dispatchEventAtCapturing_(event, path)) { 427 if (this.dispatchEventAtCapturing_(event, path)) {
428 if (this.dispatchEventAtTargeting_(event, path)) 428 if (this.dispatchEventAtTargeting_(event, path))
429 this.dispatchEventAtBubbling_(event, path); 429 this.dispatchEventAtBubbling_(event, path);
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
956 return obj; 956 return obj;
957 }, 957 },
958 958
959 remove: function(id) { 959 remove: function(id) {
960 if (this.axNodeDataCache_[id]) 960 if (this.axNodeDataCache_[id])
961 privates(this.axNodeDataCache_[id]).impl.detach(); 961 privates(this.axNodeDataCache_[id]).impl.detach();
962 delete this.axNodeDataCache_[id]; 962 delete this.axNodeDataCache_[id];
963 }, 963 },
964 964
965 destroy: function() { 965 destroy: function() {
966 this.dispatchEvent(schema.EventType.destroyed); 966 this.dispatchEvent(schema.EventType.destroyed, 'none');
967 for (var id in this.axNodeDataCache_) 967 for (var id in this.axNodeDataCache_)
968 this.remove(id); 968 this.remove(id);
969 this.detach(); 969 this.detach();
970 }, 970 },
971 971
972 setHostNode(hostNode) { 972 setHostNode(hostNode) {
973 this.hostNode_ = hostNode; 973 this.hostNode_ = hostNode;
974 }, 974 },
975 975
976 onAccessibilityEvent: function(eventParams) { 976 onAccessibilityEvent: function(eventParams) {
977 var targetNode = this.get(eventParams.targetID); 977 var targetNode = this.get(eventParams.targetID);
978 if (targetNode) { 978 if (targetNode) {
979 var targetNodeImpl = privates(targetNode).impl; 979 var targetNodeImpl = privates(targetNode).impl;
980 targetNodeImpl.dispatchEvent(eventParams.eventType); 980 targetNodeImpl.dispatchEvent(
981 eventParams.eventType, eventParams.eventFrom);
981 } else { 982 } else {
982 logging.WARNING('Got ' + eventParams.eventType + 983 logging.WARNING('Got ' + eventParams.eventType +
983 ' event on unknown node: ' + eventParams.targetID + 984 ' event on unknown node: ' + eventParams.targetID +
984 '; this: ' + this.id); 985 '; this: ' + this.id);
985 } 986 }
986 return true; 987 return true;
987 }, 988 },
988 989
989 toString: function() { 990 toString: function() {
990 function toStringInternal(nodeImpl, indent) { 991 function toStringInternal(nodeImpl, indent) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 utils.defineProperty(AutomationRootNode, 'getOrCreate', function(treeID) { 1066 utils.defineProperty(AutomationRootNode, 'getOrCreate', function(treeID) {
1066 return AutomationRootNodeImpl.getOrCreate(treeID); 1067 return AutomationRootNodeImpl.getOrCreate(treeID);
1067 }); 1068 });
1068 1069
1069 utils.defineProperty(AutomationRootNode, 'destroy', function(treeID) { 1070 utils.defineProperty(AutomationRootNode, 'destroy', function(treeID) {
1070 AutomationRootNodeImpl.destroy(treeID); 1071 AutomationRootNodeImpl.destroy(treeID);
1071 }); 1072 });
1072 1073
1073 exports.$set('AutomationNode', AutomationNode); 1074 exports.$set('AutomationNode', AutomationNode);
1074 exports.$set('AutomationRootNode', AutomationRootNode); 1075 exports.$set('AutomationRootNode', AutomationRootNode);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698