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

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

Issue 2059533003: Expose html attributes in automation tree. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 * @param {number} nodeID The id of a node. 85 * @param {number} nodeID The id of a node.
86 * @param {number} childIndex An index of a child of this node. 86 * @param {number} childIndex An index of a child of this node.
87 * @return {?number} The id of the child at the given index, or undefined 87 * @return {?number} The id of the child at the given index, or undefined
88 * if the tree or node or child at that index wasn't found. 88 * if the tree or node or child at that index wasn't found.
89 */ 89 */
90 var GetChildIDAtIndex = requireNative('automationInternal').GetChildIDAtIndex; 90 var GetChildIDAtIndex = requireNative('automationInternal').GetChildIDAtIndex;
91 91
92 /** 92 /**
93 * @param {number} axTreeID The id of the accessibility tree. 93 * @param {number} axTreeID The id of the accessibility tree.
94 * @param {number} nodeID The id of a node. 94 * @param {number} nodeID The id of a node.
95 * @return {?Object} An object mapping html attributes to values.
96 */
97 var GetHtmlAttributes = requireNative('automationInternal').GetHtmlAttributes;
98
99 /**
100 * @param {number} axTreeID The id of the accessibility tree.
101 * @param {number} nodeID The id of a node.
95 * @return {?number} The index of this node in its parent, or undefined if 102 * @return {?number} The index of this node in its parent, or undefined if
96 * the tree or node or node parent wasn't found. 103 * the tree or node or node parent wasn't found.
97 */ 104 */
98 var GetIndexInParent = requireNative('automationInternal').GetIndexInParent; 105 var GetIndexInParent = requireNative('automationInternal').GetIndexInParent;
99 106
100 /** 107 /**
101 * @param {number} axTreeID The id of the accessibility tree. 108 * @param {number} axTreeID The id of the accessibility tree.
102 * @param {number} nodeID The id of a node. 109 * @param {number} nodeID The id of a node.
103 * @return {?Object} An object with a string key for every state flag set, 110 * @return {?Object} An object with a string key for every state flag set,
104 * or undefined if the tree or node or node parent wasn't found. 111 * or undefined if the tree or node or node parent wasn't found.
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 228
222 get parent() { 229 get parent() {
223 if (!this.rootImpl) 230 if (!this.rootImpl)
224 return undefined; 231 return undefined;
225 if (this.hostNode_) 232 if (this.hostNode_)
226 return this.hostNode_; 233 return this.hostNode_;
227 var parentID = GetParentID(this.treeID, this.id); 234 var parentID = GetParentID(this.treeID, this.id);
228 return this.rootImpl.get(parentID); 235 return this.rootImpl.get(parentID);
229 }, 236 },
230 237
238 get htmlAttributes() {
239 return GetHtmlAttributes(this.treeID, this.id) || {};
240 },
241
231 get state() { 242 get state() {
232 return GetState(this.treeID, this.id) || {}; 243 return GetState(this.treeID, this.id) || {};
233 }, 244 },
234 245
235 get role() { 246 get role() {
236 return GetRole(this.treeID, this.id); 247 return GetRole(this.treeID, this.id);
237 }, 248 },
238 249
239 get location() { 250 get location() {
240 return GetLocation(this.treeID, this.id); 251 return GetLocation(this.treeID, this.id);
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
1004 'lastChild', 1015 'lastChild',
1005 'children', 1016 'children',
1006 'previousSibling', 1017 'previousSibling',
1007 'nextSibling', 1018 'nextSibling',
1008 'isRootNode', 1019 'isRootNode',
1009 'role', 1020 'role',
1010 'state', 1021 'state',
1011 'location', 1022 'location',
1012 'indexInParent', 1023 'indexInParent',
1013 'root', 1024 'root',
1025 'htmlAttributes',
1014 ]), 1026 ]),
1015 }); 1027 });
1016 1028
1017 function AutomationRootNode() { 1029 function AutomationRootNode() {
1018 privates(AutomationRootNode).constructPrivate(this, arguments); 1030 privates(AutomationRootNode).constructPrivate(this, arguments);
1019 } 1031 }
1020 utils.expose(AutomationRootNode, AutomationRootNodeImpl, { 1032 utils.expose(AutomationRootNode, AutomationRootNodeImpl, {
1021 superclass: AutomationNode, 1033 superclass: AutomationNode,
1022 readonly: [ 1034 readonly: [
1023 'docTitle', 1035 'docTitle',
(...skipping 14 matching lines...) Expand all
1038 utils.defineProperty(AutomationRootNode, 'getOrCreate', function(treeID) { 1050 utils.defineProperty(AutomationRootNode, 'getOrCreate', function(treeID) {
1039 return AutomationRootNodeImpl.getOrCreate(treeID); 1051 return AutomationRootNodeImpl.getOrCreate(treeID);
1040 }); 1052 });
1041 1053
1042 utils.defineProperty(AutomationRootNode, 'destroy', function(treeID) { 1054 utils.defineProperty(AutomationRootNode, 'destroy', function(treeID) {
1043 AutomationRootNodeImpl.destroy(treeID); 1055 AutomationRootNodeImpl.destroy(treeID);
1044 }); 1056 });
1045 1057
1046 exports.$set('AutomationNode', AutomationNode); 1058 exports.$set('AutomationNode', AutomationNode);
1047 exports.$set('AutomationRootNode', AutomationRootNode); 1059 exports.$set('AutomationRootNode', AutomationRootNode);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698