| Index: chrome/renderer/resources/extensions/automation/automation_node.js
|
| diff --git a/chrome/renderer/resources/extensions/automation/automation_node.js b/chrome/renderer/resources/extensions/automation/automation_node.js
|
| index 15b722570a53cce1a08e750c559672d4226247d3..1f9a44271be13c1e52e03600118e9f1ac07124b1 100644
|
| --- a/chrome/renderer/resources/extensions/automation/automation_node.js
|
| +++ b/chrome/renderer/resources/extensions/automation/automation_node.js
|
| @@ -79,10 +79,11 @@ var GetFocusAffinity = requireNative('automationInternal').GetFocusAffinity;
|
| /**
|
| * @param {number} axTreeID The id of the accessibility tree.
|
| * @param {number} nodeID The id of a node.
|
| - * @return {?number} The id of the node's parent, or undefined if it's the
|
| + * @return {?Array<number>} An array containing the tree id and node id
|
| + * of the node's parent, or undefined if it's the
|
| * root of its tree or if the tree or node wasn't found.
|
| */
|
| -var GetParentID = requireNative('automationInternal').GetParentID;
|
| +var GetParent = requireNative('automationInternal').GetParent;
|
|
|
| /**
|
| * @param {number} axTreeID The id of the accessibility tree.
|
| @@ -242,7 +243,6 @@ var utils = require('utils');
|
| */
|
| function AutomationNodeImpl(root) {
|
| this.rootImpl = root;
|
| - this.hostNode_ = null;
|
| this.listeners = {__proto__: null};
|
| }
|
|
|
| @@ -254,7 +254,6 @@ AutomationNodeImpl.prototype = {
|
|
|
| detach: function() {
|
| this.rootImpl = null;
|
| - this.hostNode_ = null;
|
| this.listeners = {__proto__: null};
|
| },
|
|
|
| @@ -265,10 +264,17 @@ AutomationNodeImpl.prototype = {
|
| get parent() {
|
| if (!this.rootImpl)
|
| return undefined;
|
| - if (this.hostNode_)
|
| - return this.hostNode_;
|
| - var parentID = GetParentID(this.treeID, this.id);
|
| - return this.rootImpl.get(parentID);
|
| + var parentTreeIDAndNodeID = GetParent(this.treeID, this.id);
|
| + if (!parentTreeIDAndNodeID)
|
| + return undefined;
|
| + var parentTreeID = parentTreeIDAndNodeID[0];
|
| + var parentNodeID = parentTreeIDAndNodeID[1];
|
| + if (parentTreeID == this.treeID)
|
| + return this.rootImpl.get(parentNodeID);
|
| + var tree = AutomationRootNodeImpl.get(parentTreeID);
|
| + if (!tree)
|
| + return undefined;
|
| + return tree.get(parentNodeID);
|
| },
|
|
|
| get htmlAttributes() {
|
| @@ -495,7 +501,6 @@ AutomationNodeImpl.prototype = {
|
| },
|
|
|
| toString: function() {
|
| - var parentID = GetParentID(this.treeID, this.id);
|
| var childTreeID = GetIntAttribute(this.treeID, this.id, 'childTreeId');
|
| var count = GetChildCount(this.treeID, this.id);
|
| var childIDs = [];
|
| @@ -507,13 +512,7 @@ AutomationNodeImpl.prototype = {
|
| var result = 'node id=' + this.id +
|
| ' role=' + this.role +
|
| ' state=' + $JSON.stringify(this.state) +
|
| - ' parentID=' + parentID +
|
| ' childIds=' + $JSON.stringify(childIDs);
|
| - if (this.hostNode_) {
|
| - var hostNodeImpl = privates(this.hostNode_).impl;
|
| - result += ' host treeID=' + hostNodeImpl.treeID +
|
| - ' host nodeID=' + hostNodeImpl.id;
|
| - }
|
| if (childTreeID)
|
| result += ' childTreeID=' + childTreeID;
|
| return result;
|
| @@ -914,13 +913,6 @@ AutomationRootNodeImpl.prototype = {
|
| treeID: -1,
|
|
|
| /**
|
| - * The parent of this node from a different tree.
|
| - * @type {?AutomationNode}
|
| - * @private
|
| - */
|
| - hostNode_: null,
|
| -
|
| - /**
|
| * A map from id to AutomationNode.
|
| * @type {Object.<number, AutomationNode>}
|
| * @private
|
| @@ -1030,10 +1022,6 @@ AutomationRootNodeImpl.prototype = {
|
| this.detach();
|
| },
|
|
|
| - setHostNode(hostNode) {
|
| - this.hostNode_ = hostNode;
|
| - },
|
| -
|
| onAccessibilityEvent: function(eventParams) {
|
| var targetNode = this.get(eventParams.targetID);
|
| if (targetNode) {
|
|
|