chrome 100 percent

chrome 100 percent


DisciplinaPedagogia116.850 materiais673.795 seguidores
Pré-visualização50 páginas
function(params) {
 var srcAttributeName = params[0];
 var dstAttributeName = params[1];
 $Array.push(publicAttributes, dstAttributeName);
 $Object.defineProperty(AutomationNodeImpl.prototype, dstAttributeName, {
 __proto__: null,
 get: function() {
 return GetHtmlAttribute(this.treeID, this.id, srcAttributeName);
 }
 });
});
/**
 * AutomationRootNode.
 *
 * An AutomationRootNode is the javascript end of an AXTree living in the
 * browser. AutomationRootNode handles unserializing incremental updates from
 * the source AXTree. Each update contains node data that form a complete tree
 * after applying the update.
 *
 * A brief note about ids used through this class. The source AXTree assigns
 * unique ids per node and we use these ids to build a hash to the actual
 * AutomationNode object.
 * Thus, tree traversals amount to a lookup in our hash.
 *
 * The tree itself is identified by the accessibility tree id of the
 * renderer widget host.
 * @constructor
 */
function AutomationRootNodeImpl(treeID) {
 $Function.call(AutomationNodeImpl, this, this);
 this.treeID = treeID;
 this.axNodeDataCache_ = {__proto__: null};
 this.actionRequestIDToCallback_ = {__proto__: null};
}
utils.defineProperty(AutomationRootNodeImpl, 'idToAutomationRootNode_',
 {__proto__: null});
utils.defineProperty(AutomationRootNodeImpl, 'get', function(treeID) {
 var result = AutomationRootNodeImpl.idToAutomationRootNode_[treeID];
 return result || undefined;
});
utils.defineProperty(AutomationRootNodeImpl, 'getOrCreate', function(treeID) {
 if (AutomationRootNodeImpl.idToAutomationRootNode_[treeID])
 return AutomationRootNodeImpl.idToAutomationRootNode_[treeID];
 var result = new AutomationRootNode(treeID);
 AutomationRootNodeImpl.idToAutomationRootNode_[treeID] = result;
 return result;
});
utils.defineProperty(AutomationRootNodeImpl, 'destroy', function(treeID) {
 delete AutomationRootNodeImpl.idToAutomationRootNode_[treeID];
});
AutomationRootNodeImpl.prototype = {
 __proto__: AutomationNodeImpl.prototype,
 /**
 * @type {boolean}
 */
 isRootNode: true,
 /**
 * @type {number}
 */
 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
 */
 axNodeDataCache_: null,
 actionRequestCounter_: 0,
 actionRequestIDToCallback_: null,
 get id() {
 var result = GetRootID(this.treeID);
 // Don't return undefined, because the id is often passed directly
 // as an argument to a native binding that expects only a valid number.
 if (result === undefined)
 return -1;
 return result;
 },
 get chromeChannel() {
 return GetStringAttribute(this.treeID, this.id, 'chromeChannel');
 },
 get docUrl() {
 return GetDocURL(this.treeID);
 },
 get docTitle() {
 return GetDocTitle(this.treeID);
 },
 get docLoaded() {
 return GetDocLoaded(this.treeID);
 },
 get docLoadingProgress() {
 return GetDocLoadingProgress(this.treeID);
 },
 get anchorObject() {
 var id = GetAnchorObjectID(this.treeID);
 if (id && id != -1)
 return this.get(id);
 else
 return undefined;
 },
 get anchorOffset() {
 var id = GetAnchorObjectID(this.treeID);
 if (id && id != -1)
 return GetAnchorOffset(this.treeID);
 },
 get anchorAffinity() {
 var id = GetAnchorObjectID(this.treeID);
 if (id && id != -1)
 return GetAnchorAffinity(this.treeID);
 },
 get focusObject() {
 var id = GetFocusObjectID(this.treeID);
 if (id && id != -1)
 return this.get(id);
 else
 return undefined;
 },
 get focusOffset() {
 var id = GetFocusObjectID(this.treeID);
 if (id && id != -1)
 return GetFocusOffset(this.treeID);
 },
 get focusAffinity() {
 var id = GetFocusObjectID(this.treeID);
 if (id && id != -1)
 return GetFocusAffinity(this.treeID);
 },
 get: function(id) {
 if (id == undefined)
 return undefined;
 if (id == this.id)
 return this.wrapper;
 var obj = this.axNodeDataCache_[id];
 if (obj)
 return obj;
 obj = new AutomationNode(this);
 privates(obj).impl.treeID = this.treeID;
 privates(obj).impl.id = id;
 this.axNodeDataCache_[id] = obj;
 return obj;
 },
 remove: function(id) {
 if (this.axNodeDataCache_[id])
 privates(this.axNodeDataCache_[id]).impl.detach();
 delete this.axNodeDataCache_[id];
 },
 destroy: function() {
 this.dispatchEvent('destroyed', 'none');
 for (var id in this.axNodeDataCache_)
 this.remove(id);
 this.detach();
 },
 setHostNode(hostNode) {
 this.hostNode_ = hostNode;
 },
 onAccessibilityEvent: function(eventParams) {
 var targetNode = this.get(eventParams.targetID);
 if (targetNode) {
 var targetNodeImpl = privates(targetNode).impl;
 targetNodeImpl.dispatchEvent(
 eventParams.eventType, eventParams.eventFrom,
 eventParams.mouseX, eventParams.mouseY);
 } else {
 logging.WARNING('Got ' + eventParams.eventType +
 ' event on unknown node: ' + eventParams.targetID +
 '; this: ' + this.id);
 }
 return true;
 },
 addActionResultCallback: function(callback) {
 this.actionRequestIDToCallback_[++this.actionRequestCounter_] = callback;
 return this.actionRequestCounter_;
 },
 onActionResult: function(requestID, result) {
 if (requestID in this.actionRequestIDToCallback_) {
 this.actionRequestIDToCallback_[requestID](result);
 delete this.actionRequestIDToCallback_[requestID];
 }
 },
 toString: function() {
 function toStringInternal(nodeImpl, indent) {
 if (!nodeImpl)
 return '';
 var output = '';
 if (nodeImpl.isRootNode)
 output += indent + 'tree id=' + nodeImpl.treeID + '\n';
 output += indent +
 $Function.call(AutomationNodeImpl.prototype.toString, nodeImpl) + '\n';
 indent += ' ';
 var children = nodeImpl.children;
 for (var i = 0; i < children.length; ++i)
 output += toStringInternal(privates(children[i]).impl, indent);
 return output;
 }
 return toStringInternal(this, '');
 },
};
function AutomationNode() {
 privates(AutomationNode).constructPrivate(this, arguments);
}
utils.expose(AutomationNode, AutomationNodeImpl, {
 functions: [
 'doDefault',
 'find',
 'findAll',
 'focus',
 'getImageData',
 'hitTest',
 'makeVisible',
 'matches',
 'performCustomAction',
 'resumeMedia',
 'scrollBackward',
 'scrollForward',
 'scrollUp',
 'scrollDown',
 'scrollLeft',
 'scrollRight',
 'setSelection',
 'setSequentialFocusNavigationStartingPoint',
 'showContextMenu',
 'startDuckingMedia',
 'stopDuckingMedia',
 'suspendMedia',
 'addEventListener',
 'removeEventListener',
 'domQuerySelector',
 'toString',
 'boundsForRange',
 ],
 readonly: $Array.concat(publicAttributes, [
 'parent',
 'firstChild',
 'lastChild',
 'children',
 'previousSibling',
 'nextSibling',
 'isRootNode',
 'role',
 'checked',
 'restriction',
 'state',
 'location',
 'indexInParent',
 'lineStartOffsets',
 'root',
 'htmlAttributes',
 'nameFrom',
 'bold',
 'italic',
 'underline',
 'lineThrough',
 'customActions',
 ]),
});
function AutomationRootNode() {
 privates(AutomationRootNode).constructPrivate(this, arguments);
}
utils.expose(AutomationRootNode, AutomationRootNodeImpl, {
 superclass: AutomationNode,
 readonly: [
 'chromeChannel',
 'docTitle',
 'docUrl',