chrome 100 percent

chrome 100 percent


DisciplinaPedagogia116.669 materiais672.644 seguidores
Pré-visualização50 páginas
return;
 }
 // Check permissions.
 if (!IsInteractPermitted()) {
 throw new Error(actionType + ' requires {"desktop": true} or' +
 ' {"interact": true} in the "automation" manifest key.');
 }
 var requestID = -1;
 if (opt_callback) {
 requestID = this.rootImpl.addActionResultCallback(opt_callback);
 }
 automationInternal.performAction({ treeID: this.rootImpl.treeID,
 automationNodeID: this.id,
 actionType: actionType,
 requestID: requestID},
 opt_args || {});
 },
 domQuerySelectorCallback_: function(userCallback, resultAutomationNodeID) {
 // resultAutomationNodeID could be zero or undefined or (unlikely) null;
 // they all amount to the same thing here, which is that no node was
 // returned.
 if (!resultAutomationNodeID || !this.rootImpl) {
 userCallback(null);
 return;
 }
 var resultNode = this.rootImpl.get(resultAutomationNodeID);
 if (!resultNode) {
 logging.WARNING('Query selector result not in tree: ' +
 resultAutomationNodeID);
 userCallback(null);
 }
 userCallback(resultNode);
 },
 findInternal_: function(params, opt_results) {
 var result = null;
 this.forAllDescendants_(function(node) {
 if (privates(node).impl.matchInternal_(params)) {
 if (opt_results)
 $Array.push(opt_results, node);
 else
 result = node;
 return !opt_results;
 }
 });
 if (opt_results)
 return opt_results;
 return result;
 },
 /**
 * Executes a closure for all of this node's descendants, in pre-order.
 * Early-outs if the closure returns true.
 * @param {Function(AutomationNode):boolean} closure Closure to be executed
 * for each node. Return true to early-out the traversal.
 */
 forAllDescendants_: function(closure) {
 var stack = $Array.reverse(this.wrapper.children);
 while (stack.length > 0) {
 var node = $Array.pop(stack);
 if (closure(node))
 return;
 var children = node.children;
 for (var i = children.length - 1; i >= 0; i--)
 $Array.push(stack, children[i]);
 }
 },
 matchInternal_: function(params) {
 if ($Object.keys(params).length === 0)
 return false;
 if ('role' in params && this.role != params.role)
 return false;
 if ('state' in params) {
 for (var state in params.state) {
 if (params.state[state] != (state in this.state))
 return false;
 }
 }
 if ('attributes' in params) {
 for (var attribute in params.attributes) {
 var attrValue = params.attributes[attribute];
 if (typeof attrValue != 'object') {
 if (this[attribute] !== attrValue)
 return false;
 } else if (attrValue instanceof $RegExp.self) {
 if (typeof this[attribute] != 'string')
 return false;
 if (!attrValue.test(this[attribute]))
 return false;
 } else {
 // TODO(aboxhall): handle intlist case.
 return false;
 }
 }
 }
 return true;
 }
};
var stringAttributes = [
 'accessKey',
 'ariaInvalidValue',
 'containerLiveRelevant',
 'containerLiveStatus',
 'description',
 'display',
 'htmlTag',
 'imageDataUrl',
 'language',
 'liveRelevant',
 'liveStatus',
 'name',
 'placeholder',
 'roleDescription',
 'textInputType',
 'url',
 'value'];
var boolAttributes = [
 'busy',
 'containerLiveAtomic',
 'containerLiveBusy',
 'liveAtomic',
 'scrollable'
];
var intAttributes = [
 'backgroundColor',
 'color',
 'colorValue',
 'hierarchicalLevel',
 'posInSet',
 'scrollX',
 'scrollXMax',
 'scrollXMin',
 'scrollY',
 'scrollYMax',
 'scrollYMin',
 'setSize',
 'tableCellColumnIndex',
 'ariaCellColumnIndex',
 'tableCellColumnSpan',
 'tableCellRowIndex',
 'ariaCellRowIndex',
 'tableCellRowSpan',
 'tableColumnCount',
 'ariaColumnCount',
 'tableColumnIndex',
 'tableRowCount',
 'ariaRowCount',
 'tableRowIndex',
 'textSelEnd',
 'textSelStart'];
var nodeRefAttributes = [
 ['activedescendantId', 'activeDescendant'],
 ['inPageLinkTargetId', 'inPageLinkTarget'],
 ['nextOnLineId', 'nextOnLine'],
 ['previousOnLineId', 'previousOnLine'],
 ['tableColumnHeaderId', 'tableColumnHeader'],
 ['tableHeaderId', 'tableHeader'],
 ['tableRowHeaderId', 'tableRowHeader']];
var intListAttributes = [
 'lineBreaks',
 'markerEnds',
 'markerStarts',
 'markerTypes',
 'wordEnds',
 'wordStarts'];
var nodeRefListAttributes = [
 ['controlsIds', 'controls'],
 ['describedbyIds', 'describedBy'],
 ['flowtoIds', 'flowTo'],
 ['labelledbyIds', 'labelledBy']];
var floatAttributes = [
 'valueForRange',
 'minValueForRange',
 'maxValueForRange'];
var htmlAttributes = [
 ['type', 'inputType']];
var publicAttributes = [];
$Array.forEach(stringAttributes, function(attributeName) {
 $Array.push(publicAttributes, attributeName);
 $Object.defineProperty(AutomationNodeImpl.prototype, attributeName, {
 __proto__: null,
 get: function() {
 return GetStringAttribute(this.treeID, this.id, attributeName);
 }
 });
});
$Array.forEach(boolAttributes, function(attributeName) {
 $Array.push(publicAttributes, attributeName);
 $Object.defineProperty(AutomationNodeImpl.prototype, attributeName, {
 __proto__: null,
 get: function() {
 return GetBoolAttribute(this.treeID, this.id, attributeName);
 }
 });
});
$Array.forEach(intAttributes, function(attributeName) {
 $Array.push(publicAttributes, attributeName);
 $Object.defineProperty(AutomationNodeImpl.prototype, attributeName, {
 __proto__: null,
 get: function() {
 return GetIntAttribute(this.treeID, this.id, attributeName);
 }
 });
});
$Array.forEach(nodeRefAttributes, function(params) {
 var srcAttributeName = params[0];
 var dstAttributeName = params[1];
 $Array.push(publicAttributes, dstAttributeName);
 $Object.defineProperty(AutomationNodeImpl.prototype, dstAttributeName, {
 __proto__: null,
 get: function() {
 var id = GetIntAttribute(this.treeID, this.id, srcAttributeName);
 if (id && this.rootImpl)
 return this.rootImpl.get(id);
 else
 return undefined;
 }
 });
});
$Array.forEach(intListAttributes, function(attributeName) {
 $Array.push(publicAttributes, attributeName);
 $Object.defineProperty(AutomationNodeImpl.prototype, attributeName, {
 __proto__: null,
 get: function() {
 return GetIntListAttribute(this.treeID, this.id, attributeName);
 }
 });
});
$Array.forEach(nodeRefListAttributes, function(params) {
 var srcAttributeName = params[0];
 var dstAttributeName = params[1];
 $Array.push(publicAttributes, dstAttributeName);
 $Object.defineProperty(AutomationNodeImpl.prototype, dstAttributeName, {
 __proto__: null,
 get: function() {
 var ids = GetIntListAttribute(this.treeID, this.id, srcAttributeName);
 if (!ids || !this.rootImpl)
 return undefined;
 var result = [];
 for (var i = 0; i < ids.length; ++i) {
 var node = this.rootImpl.get(ids[i]);
 if (node)
 $Array.push(result, node);
 }
 return result;
 }
 });
});
$Array.forEach(floatAttributes, function(attributeName) {
 $Array.push(publicAttributes, attributeName);
 $Object.defineProperty(AutomationNodeImpl.prototype, attributeName, {
 __proto__: null,
 get: function() {
 return GetFloatAttribute(this.treeID, this.id, attributeName);
 }
 });
});
$Array.forEach(htmlAttributes,