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

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

Issue 2301833005: Get rid of AX_LINE_BREAKS attribute to improve performance. (Closed)
Patch Set: Re-worded comment. 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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 * @param {number} endIndex The end index of the range. 143 * @param {number} endIndex The end index of the range.
144 * @return {?automation.Rect} The bounding box of the subrange of this node, 144 * @return {?automation.Rect} The bounding box of the subrange of this node,
145 * or the location if there are no subranges, or undefined if 145 * or the location if there are no subranges, or undefined if
146 * the tree or node wasn't found. 146 * the tree or node wasn't found.
147 */ 147 */
148 var GetBoundsForRange = requireNative('automationInternal').GetBoundsForRange; 148 var GetBoundsForRange = requireNative('automationInternal').GetBoundsForRange;
149 149
150 /** 150 /**
151 * @param {number} axTreeID The id of the accessibility tree. 151 * @param {number} axTreeID The id of the accessibility tree.
152 * @param {number} nodeID The id of a node. 152 * @param {number} nodeID The id of a node.
153 * @return {!Array.<number>} The text offset where each line starts, or an empty
154 * array if this node has no text content, or undefined if the tree or node
155 * was not found.
156 */
157 var GetLineStartOffsets = requireNative(
158 'automationInternal').GetLineStartOffsets;
159
160 /**
161 * @param {number} axTreeID The id of the accessibility tree.
162 * @param {number} nodeID The id of a node.
153 * @param {string} attr The name of a string attribute. 163 * @param {string} attr The name of a string attribute.
154 * @return {?string} The value of this attribute, or undefined if the tree, 164 * @return {?string} The value of this attribute, or undefined if the tree,
155 * node, or attribute wasn't found. 165 * node, or attribute wasn't found.
156 */ 166 */
157 var GetStringAttribute = requireNative('automationInternal').GetStringAttribute; 167 var GetStringAttribute = requireNative('automationInternal').GetStringAttribute;
158 168
159 /** 169 /**
160 * @param {number} axTreeID The id of the accessibility tree. 170 * @param {number} axTreeID The id of the accessibility tree.
161 * @param {number} nodeID The id of a node. 171 * @param {number} nodeID The id of a node.
162 * @param {string} attr The name of an attribute. 172 * @param {string} attr The name of an attribute.
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 }, 270 },
261 271
262 boundsForRange: function(startIndex, endIndex) { 272 boundsForRange: function(startIndex, endIndex) {
263 return GetBoundsForRange(this.treeID, this.id, startIndex, endIndex); 273 return GetBoundsForRange(this.treeID, this.id, startIndex, endIndex);
264 }, 274 },
265 275
266 get indexInParent() { 276 get indexInParent() {
267 return GetIndexInParent(this.treeID, this.id); 277 return GetIndexInParent(this.treeID, this.id);
268 }, 278 },
269 279
280 get lineStartOffsets() {
281 return GetLineStartOffsets(this.treeID, this.id);
282 },
283
270 get childTree() { 284 get childTree() {
271 var childTreeID = GetIntAttribute(this.treeID, this.id, 'childTreeId'); 285 var childTreeID = GetIntAttribute(this.treeID, this.id, 'childTreeId');
272 if (childTreeID) 286 if (childTreeID)
273 return AutomationRootNodeImpl.get(childTreeID); 287 return AutomationRootNodeImpl.get(childTreeID);
274 }, 288 },
275 289
276 get firstChild() { 290 get firstChild() {
277 if (!this.rootImpl) 291 if (!this.rootImpl)
278 return undefined; 292 return undefined;
279 if (this.childTree) 293 if (this.childTree)
(...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 694
681 var nodeRefAttributes = [ 695 var nodeRefAttributes = [
682 ['activedescendantId', 'activeDescendant'], 696 ['activedescendantId', 'activeDescendant'],
683 ['tableColumnHeaderId', 'tableColumnHeader'], 697 ['tableColumnHeaderId', 'tableColumnHeader'],
684 ['tableHeaderId', 'tableHeader'], 698 ['tableHeaderId', 'tableHeader'],
685 ['tableRowHeaderId', 'tableRowHeader'], 699 ['tableRowHeaderId', 'tableRowHeader'],
686 ['titleUiElement', 'titleUIElement']]; 700 ['titleUiElement', 'titleUIElement']];
687 701
688 var intListAttributes = [ 702 var intListAttributes = [
689 'characterOffsets', 703 'characterOffsets',
690 'lineBreaks',
691 'markerEnds', 704 'markerEnds',
692 'markerStarts', 705 'markerStarts',
693 'markerTypes', 706 'markerTypes',
694 'wordEnds', 707 'wordEnds',
695 'wordStarts']; 708 'wordStarts'];
696 709
697 var nodeRefListAttributes = [ 710 var nodeRefListAttributes = [
698 ['cellIds', 'cells'], 711 ['cellIds', 'cells'],
699 ['controlsIds', 'controls'], 712 ['controlsIds', 'controls'],
700 ['describedbyIds', 'describedBy'], 713 ['describedbyIds', 'describedBy'],
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 'firstChild', 1043 'firstChild',
1031 'lastChild', 1044 'lastChild',
1032 'children', 1045 'children',
1033 'previousSibling', 1046 'previousSibling',
1034 'nextSibling', 1047 'nextSibling',
1035 'isRootNode', 1048 'isRootNode',
1036 'role', 1049 'role',
1037 'state', 1050 'state',
1038 'location', 1051 'location',
1039 'indexInParent', 1052 'indexInParent',
1053 'lineStartOffsets',
1040 'root', 1054 'root',
1041 'htmlAttributes', 1055 'htmlAttributes',
1042 ]), 1056 ]),
1043 }); 1057 });
1044 1058
1045 function AutomationRootNode() { 1059 function AutomationRootNode() {
1046 privates(AutomationRootNode).constructPrivate(this, arguments); 1060 privates(AutomationRootNode).constructPrivate(this, arguments);
1047 } 1061 }
1048 utils.expose(AutomationRootNode, AutomationRootNodeImpl, { 1062 utils.expose(AutomationRootNode, AutomationRootNodeImpl, {
1049 superclass: AutomationNode, 1063 superclass: AutomationNode,
(...skipping 16 matching lines...) Expand all
1066 utils.defineProperty(AutomationRootNode, 'getOrCreate', function(treeID) { 1080 utils.defineProperty(AutomationRootNode, 'getOrCreate', function(treeID) {
1067 return AutomationRootNodeImpl.getOrCreate(treeID); 1081 return AutomationRootNodeImpl.getOrCreate(treeID);
1068 }); 1082 });
1069 1083
1070 utils.defineProperty(AutomationRootNode, 'destroy', function(treeID) { 1084 utils.defineProperty(AutomationRootNode, 'destroy', function(treeID) {
1071 AutomationRootNodeImpl.destroy(treeID); 1085 AutomationRootNodeImpl.destroy(treeID);
1072 }); 1086 });
1073 1087
1074 exports.$set('AutomationNode', AutomationNode); 1088 exports.$set('AutomationNode', AutomationNode);
1075 exports.$set('AutomationRootNode', AutomationRootNode); 1089 exports.$set('AutomationRootNode', AutomationRootNode);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698