Commit 8b79607f authored by aboxhall's avatar aboxhall Committed by Commit bot

Remove attributes and methods which should not be part of the public API

BUG=309681

Review URL: https://codereview.chromium.org/514363002

Cr-Commit-Position: refs/heads/master@{#292835}
parent 95af6d45
...@@ -197,7 +197,7 @@ AutomationNodeImpl.prototype = { ...@@ -197,7 +197,7 @@ AutomationNodeImpl.prototype = {
// Not yet initialized. // Not yet initialized.
if (this.rootImpl.processID === undefined || if (this.rootImpl.processID === undefined ||
this.rootImpl.routingID === undefined || this.rootImpl.routingID === undefined ||
this.wrapper.id === undefined) { this.id === undefined) {
return; return;
} }
...@@ -209,7 +209,7 @@ AutomationNodeImpl.prototype = { ...@@ -209,7 +209,7 @@ AutomationNodeImpl.prototype = {
automationInternal.performAction({ processID: this.rootImpl.processID, automationInternal.performAction({ processID: this.rootImpl.processID,
routingID: this.rootImpl.routingID, routingID: this.rootImpl.routingID,
automationNodeID: this.wrapper.id, automationNodeID: this.id,
actionType: actionType }, actionType: actionType },
opt_args || {}); opt_args || {});
} }
...@@ -329,8 +329,9 @@ AutomationRootNodeImpl.prototype = { ...@@ -329,8 +329,9 @@ AutomationRootNodeImpl.prototype = {
var children = nodeToClear.children(); var children = nodeToClear.children();
for (var i = 0; i < children.length; i++) for (var i = 0; i < children.length; i++)
this.invalidate_(children[i]); this.invalidate_(children[i]);
privates(nodeToClear).impl.childIds = [] var nodeToClearImpl = privates(nodeToClear).impl;
updateState.pendingNodes[nodeToClear.id] = nodeToClear; nodeToClearImpl.childIds = []
updateState.pendingNodes[nodeToClearImpl.id] = nodeToClear;
} }
} }
...@@ -402,7 +403,7 @@ AutomationRootNodeImpl.prototype = { ...@@ -402,7 +403,7 @@ AutomationRootNodeImpl.prototype = {
// This object is not accessible outside of bindings code, but we can access // This object is not accessible outside of bindings code, but we can access
// it here. // it here.
var nodeImpl = privates(node).impl; var nodeImpl = privates(node).impl;
var id = node.id; var id = nodeImpl.id;
for (var key in AutomationAttributeDefaults) { for (var key in AutomationAttributeDefaults) {
nodeImpl[key] = AutomationAttributeDefaults[key]; nodeImpl[key] = AutomationAttributeDefaults[key];
} }
...@@ -427,8 +428,8 @@ AutomationRootNodeImpl.prototype = { ...@@ -427,8 +428,8 @@ AutomationRootNodeImpl.prototype = {
for (var i = 0; i < newChildIds.length; i++) { for (var i = 0; i < newChildIds.length; i++) {
var childId = newChildIds[i]; var childId = newChildIds[i];
if (newChildIdSet[childId]) { if (newChildIdSet[childId]) {
logging.WARNING('Node ' + node.id + ' has duplicate child id ' + logging.WARNING('Node ' + privates(node).impl.id +
childId); ' has duplicate child id ' + childId);
lastError.set('automation', lastError.set('automation',
'Bad update received on automation tree', 'Bad update received on automation tree',
null, null,
...@@ -463,13 +464,16 @@ AutomationRootNodeImpl.prototype = { ...@@ -463,13 +464,16 @@ AutomationRootNodeImpl.prototype = {
var childNode = this.axNodeDataCache_[childId]; var childNode = this.axNodeDataCache_[childId];
if (childNode) { if (childNode) {
if (childNode.parent() != node) { if (childNode.parent() != node) {
var parentId = 0; var parentId = -1;
if (childNode.parent()) parentId = childNode.parent().id; if (childNode.parent()) {
var parentImpl = privates(childNode.parent()).impl;
parentId = parentImpl.id;
}
// This is a serious error - nodes should never be reparented. // This is a serious error - nodes should never be reparented.
// If this case occurs, continue so this node isn't left in an // If this case occurs, continue so this node isn't left in an
// inconsistent state, but return failure at the end. // inconsistent state, but return failure at the end.
logging.WARNING('Node ' + childId + ' reparented from ' + logging.WARNING('Node ' + childId + ' reparented from ' +
parentId + ' to ' + node.id); parentId + ' to ' + privates(node).impl.id);
lastError.set('automation', lastError.set('automation',
'Bad update received on automation tree', 'Bad update received on automation tree',
null, null,
...@@ -481,11 +485,11 @@ AutomationRootNodeImpl.prototype = { ...@@ -481,11 +485,11 @@ AutomationRootNodeImpl.prototype = {
childNode = new AutomationNode(this); childNode = new AutomationNode(this);
this.axNodeDataCache_[childId] = childNode; this.axNodeDataCache_[childId] = childNode;
privates(childNode).impl.id = childId; privates(childNode).impl.id = childId;
updateState.pendingNodes[childNode.id] = childNode; updateState.pendingNodes[childId] = childNode;
updateState.newNodes[childNode.id] = childNode; updateState.newNodes[childId] = childNode;
} }
privates(childNode).impl.indexInParent = i; privates(childNode).impl.indexInParent = i;
privates(childNode).impl.parentID = node.id; privates(childNode).impl.parentID = privates(node).impl.id;
} }
return success; return success;
...@@ -548,7 +552,7 @@ AutomationRootNodeImpl.prototype = { ...@@ -548,7 +552,7 @@ AutomationRootNodeImpl.prototype = {
var node = this.axNodeDataCache_[nodeData.id]; var node = this.axNodeDataCache_[nodeData.id];
var didUpdateRoot = false; var didUpdateRoot = false;
if (node) { if (node) {
delete updateState.pendingNodes[node.id]; delete updateState.pendingNodes[privates(node).impl.id];
} else { } else {
if (nodeData.role != schema.RoleType.rootWebArea && if (nodeData.role != schema.RoleType.rootWebArea &&
nodeData.role != schema.RoleType.desktop) { nodeData.role != schema.RoleType.desktop) {
...@@ -582,7 +586,7 @@ AutomationRootNodeImpl.prototype = { ...@@ -582,7 +586,7 @@ AutomationRootNodeImpl.prototype = {
nodeData.childIds, nodeData.childIds,
updateState); updateState);
nodeImpl.childIds = nodeData.childIds; nodeImpl.childIds = nodeData.childIds;
this.axNodeDataCache_[node.id] = node; this.axNodeDataCache_[nodeImpl.id] = node;
return success; return success;
} }
...@@ -602,16 +606,13 @@ var AutomationNode = utils.expose('AutomationNode', ...@@ -602,16 +606,13 @@ var AutomationNode = utils.expose('AutomationNode',
'makeVisible', 'makeVisible',
'setSelection', 'setSelection',
'addEventListener', 'addEventListener',
'removeEventListener', 'removeEventListener'],
'toString'],
readonly: ['isRootNode', readonly: ['isRootNode',
'id',
'role', 'role',
'state', 'state',
'location', 'location',
'attributes', 'attributes',
'root', 'root'] });
'toString'] });
var AutomationRootNode = utils.expose('AutomationRootNode', var AutomationRootNode = utils.expose('AutomationRootNode',
AutomationRootNodeImpl, AutomationRootNodeImpl,
......
...@@ -45,37 +45,38 @@ var tests = [ ...@@ -45,37 +45,38 @@ var tests = [
{ {
'id': 5, 'role': 'div', 'id': 5, 'role': 'div',
'childIds': [], 'childIds': [],
'htmlAttributes': {'aria-activedescendant': 'target'}, 'htmlAttributes': {'aria-activedescendant': 'target',
'id': 'activedescendant'},
'intAttributes': {'activedescendantId': 11}, 'intAttributes': {'activedescendantId': 11},
}, },
{ {
'id': 6, 'role': 'div', 'id': 6, 'role': 'div',
'childIds': [], 'childIds': [],
'htmlAttributes': {'aria-controls': 'target'}, 'htmlAttributes': {'aria-controls': 'target', 'id': 'controlledBy'},
'intlistAttributes': {'controlsIds': [11]}, 'intlistAttributes': {'controlsIds': [11]},
}, },
{ {
'id': 7, 'role': 'div', 'id': 7, 'role': 'div',
'childIds': [], 'childIds': [],
'htmlAttributes': {'aria-describedby': 'target'}, 'htmlAttributes': {'aria-describedby': 'target', 'id': 'describedBy'},
'intlistAttributes': {'describedbyIds': [11, 6]}, 'intlistAttributes': {'describedbyIds': [11, 6]},
}, },
{ {
'id': 8, 'role': 'div', 'id': 8, 'role': 'div',
'childIds': [], 'childIds': [],
'htmlAttributes': {'aria-flowto': 'target'}, 'htmlAttributes': {'aria-flowto': 'target', 'id': 'flowTo'},
'intlistAttributes': {'flowtoIds': [11]}, 'intlistAttributes': {'flowtoIds': [11]},
}, },
{ {
'id': 9, 'role': 'div', 'id': 9, 'role': 'div',
'childIds': [], 'childIds': [],
'htmlAttributes': {'aria-labelledby': 'target'}, 'htmlAttributes': {'aria-labelledby': 'target', 'id': 'labelledBy'},
'intlistAttributes': {'labelledbyIds': [11]} 'intlistAttributes': {'labelledbyIds': [11]}
}, },
{ {
'id': 10, 'role': 'div', 'id': 10, 'role': 'div',
'childIds': [], 'childIds': [],
'htmlAttributes': {'aria-owns': 'target'}, 'htmlAttributes': {'aria-owns': 'target', 'id': 'owns'},
'intlistAttributes': {'ownsIds': [11]}, 'intlistAttributes': {'ownsIds': [11]},
} }
]} ]}
...@@ -86,43 +87,50 @@ var tests = [ ...@@ -86,43 +87,50 @@ var tests = [
var activedescendant = tree.firstChild(); var activedescendant = tree.firstChild();
assertIsDef(activedescendant); assertIsDef(activedescendant);
assertEq(5, activedescendant.id); assertEq('activedescendant', activedescendant.attributes.id);
assertEq(11, activedescendant.attributes['aria-activedescendant'].id); assertEq(
'target',
activedescendant.attributes['aria-activedescendant'].attributes.id);
assertIsNotDef(activedescendant.attributes.activedescendantId); assertIsNotDef(activedescendant.attributes.activedescendantId);
var controlledBy = activedescendant.nextSibling(); var controlledBy = activedescendant.nextSibling();
assertIsDef(controlledBy); assertIsDef(controlledBy);
assertEq(6, controlledBy.id); assertEq('controlledBy', controlledBy.attributes.id);
assertEq(11, controlledBy.attributes['aria-controls'][0].id); assertEq('target',
controlledBy.attributes['aria-controls'][0].attributes.id);
assertEq(1, controlledBy.attributes['aria-controls'].length); assertEq(1, controlledBy.attributes['aria-controls'].length);
assertIsNotDef(controlledBy.attributes.controlledbyIds); assertIsNotDef(controlledBy.attributes.controlledbyIds);
var describedBy = controlledBy.nextSibling(); var describedBy = controlledBy.nextSibling();
assertIsDef(describedBy); assertIsDef(describedBy);
assertEq(7, describedBy.id); assertEq('describedBy', describedBy.attributes.id);
assertEq(11, describedBy.attributes['aria-describedby'][0].id); assertEq('target',
assertEq(6, describedBy.attributes['aria-describedby'][1].id); describedBy.attributes['aria-describedby'][0].attributes.id);
assertEq('controlledBy',
describedBy.attributes['aria-describedby'][1].attributes.id);
assertEq(2, describedBy.attributes['aria-describedby'].length); assertEq(2, describedBy.attributes['aria-describedby'].length);
assertIsNotDef(describedBy.attributes.describedbyIds); assertIsNotDef(describedBy.attributes.describedbyIds);
var flowTo = describedBy.nextSibling(); var flowTo = describedBy.nextSibling();
assertIsDef(flowTo); assertIsDef(flowTo);
assertEq(8, flowTo.id); assertEq('flowTo', flowTo.attributes.id);
assertEq(11, flowTo.attributes['aria-flowto'][0].id); assertEq('target',
flowTo.attributes['aria-flowto'][0].attributes.id);
assertEq(1, flowTo.attributes['aria-flowto'].length); assertEq(1, flowTo.attributes['aria-flowto'].length);
assertIsNotDef(flowTo.attributes.flowtoIds); assertIsNotDef(flowTo.attributes.flowtoIds);
var labelledBy = flowTo.nextSibling(); var labelledBy = flowTo.nextSibling();
assertIsDef(labelledBy); assertIsDef(labelledBy);
assertEq(9, labelledBy.id); assertEq('labelledBy', labelledBy.attributes.id);
assertEq(11, labelledBy.attributes['aria-labelledby'][0].id); assertEq('target',
labelledBy.attributes['aria-labelledby'][0].attributes.id);
assertEq(1, labelledBy.attributes['aria-labelledby'].length); assertEq(1, labelledBy.attributes['aria-labelledby'].length);
assertIsNotDef(labelledBy.attributes.labelledbyIds); assertIsNotDef(labelledBy.attributes.labelledbyIds);
var owns = labelledBy.nextSibling(); var owns = labelledBy.nextSibling();
assertIsDef(owns); assertIsDef(owns);
assertEq(10, owns.id); assertEq('owns', owns.attributes.id);
assertEq(11, owns.attributes['aria-owns'][0].id); assertEq('target', owns.attributes['aria-owns'][0].attributes.id);
assertEq(1, owns.attributes['aria-owns'].length); assertEq(1, owns.attributes['aria-owns'].length);
assertIsNotDef(owns.attributes.ownsIds); assertIsNotDef(owns.attributes.ownsIds);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment