WebInspector.AccessibilityModel=function(target) {WebInspector.SDKModel.call(this,WebInspector.AccessibilityModel,target);this._agent=target.accessibilityAgent();};WebInspector.AccessibilityModel.prototype={getAXNode:function(nodeId,userCallback) {var wrappedCallback=InspectorBackend.wrapClientCallback(userCallback,"AccessibilityAgent.getAXNode(): ");this._agent.getAXNode(nodeId,wrappedCallback);},__proto__:WebInspector.SDKModel.prototype} WebInspector.AccessibilityModel._symbol=Symbol("AccessibilityModel");WebInspector.AccessibilityModel.fromTarget=function(target) {if(!target[WebInspector.AccessibilityModel._symbol]) target[WebInspector.AccessibilityModel._symbol]=new WebInspector.AccessibilityModel(target);return target[WebInspector.AccessibilityModel._symbol];};WebInspector.AccessibilitySidebarView=function() {WebInspector.ThrottledWidget.call(this);this._computedTextSubPane=null;this._axNodeSubPane=null;this._node=null;this._sidebarPaneStack=null;WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode,this._pullNode,this);this._pullNode();} WebInspector.AccessibilitySidebarView.prototype={node:function() {return this._node;},doUpdate:function(finishCallback) {function accessibilityNodeCallback(accessibilityNode) {if(this._computedTextSubPane) this._computedTextSubPane.setAXNode(accessibilityNode);if(this._axNodeSubPane) this._axNodeSubPane.setAXNode(accessibilityNode);finishCallback();} var node=this.node();WebInspector.AccessibilityModel.fromTarget(node.target()).getAXNode(node.id,accessibilityNodeCallback.bind(this));},wasShown:function() {WebInspector.ThrottledWidget.prototype.wasShown.call(this);if(!this._sidebarPaneStack){this._computedTextSubPane=new WebInspector.AXComputedTextSubPane();this._computedTextSubPane.setNode(this.node());this._computedTextSubPane.show(this.element);this._computedTextSubPane.expand();this._axNodeSubPane=new WebInspector.AXNodeSubPane();this._axNodeSubPane.setNode(this.node());this._axNodeSubPane.show(this.element);this._axNodeSubPane.expand();this._sidebarPaneStack=new WebInspector.SidebarPaneStack();this._sidebarPaneStack.element.classList.add("flex-auto");this._sidebarPaneStack.show(this.element);this._sidebarPaneStack.addPane(this._computedTextSubPane);this._sidebarPaneStack.addPane(this._axNodeSubPane);} WebInspector.targetManager.addModelListener(WebInspector.DOMModel,WebInspector.DOMModel.Events.AttrModified,this._onAttrChange,this);WebInspector.targetManager.addModelListener(WebInspector.DOMModel,WebInspector.DOMModel.Events.AttrRemoved,this._onAttrChange,this);WebInspector.targetManager.addModelListener(WebInspector.DOMModel,WebInspector.DOMModel.Events.CharacterDataModified,this._onNodeChange,this);WebInspector.targetManager.addModelListener(WebInspector.DOMModel,WebInspector.DOMModel.Events.ChildNodeCountUpdated,this._onNodeChange,this);},willHide:function() {WebInspector.targetManager.removeModelListener(WebInspector.DOMModel,WebInspector.DOMModel.Events.AttrModified,this._onAttrChange,this);WebInspector.targetManager.removeModelListener(WebInspector.DOMModel,WebInspector.DOMModel.Events.AttrRemoved,this._onAttrChange,this);WebInspector.targetManager.removeModelListener(WebInspector.DOMModel,WebInspector.DOMModel.Events.CharacterDataModified,this._onNodeChange,this);WebInspector.targetManager.removeModelListener(WebInspector.DOMModel,WebInspector.DOMModel.Events.ChildNodeCountUpdated,this._onNodeChange,this);},_pullNode:function() {this._node=WebInspector.context.flavor(WebInspector.DOMNode);if(this._computedTextSubPane) this._computedTextSubPane.setNode(this._node);if(this._axNodeSubPane) this._axNodeSubPane.setNode(this._node);this.update();},_onAttrChange:function(event) {if(!this.node()) return;var node=event.data.node;if(this.node()!==node) return;this.update();},_onNodeChange:function(event) {if(!this.node()) return;var node=event.data;if(this.node()!==node) return;this.update();},__proto__:WebInspector.ThrottledWidget.prototype};WebInspector.AccessibilitySubPane=function(name) {WebInspector.SidebarPane.call(this,name);this._axNode=null;this.registerRequiredCSS("accessibility/accessibilityNode.css");} WebInspector.AccessibilitySubPane.prototype={setAXNode:function(axNode) {},node:function() {return this._node;},setNode:function(node) {this._node=node;},createInfo:function(textContent,className) {var classNameOrDefault=className||"info";var info=createElementWithClass("div",classNameOrDefault);info.textContent=textContent;this.element.appendChild(info);return info;},createTreeOutline:function(className) {var treeOutline=new TreeOutlineInShadow(className);treeOutline.registerRequiredCSS("accessibility/accessibilityNode.css");treeOutline.registerRequiredCSS("components/objectValue.css");treeOutline.element.classList.add("hidden");this.element.appendChild(treeOutline.element);return treeOutline;},__proto__:WebInspector.SidebarPane.prototype} WebInspector.AXComputedTextSubPane=function() {WebInspector.AccessibilitySubPane.call(this,WebInspector.UIString("Computed Text"));this._computedTextElement=this.element.createChild("div","ax-computed-text hidden");this._noTextInfo=this.createInfo(WebInspector.UIString("Node has no text alternative."));this._treeOutline=this.createTreeOutline();};WebInspector.AXComputedTextSubPane.prototype={setAXNode:function(axNode) {if(this._axNode===axNode) return;this._axNode=axNode;var treeOutline=this._treeOutline;treeOutline.removeChildren();var target=this.node().target();if(!axNode||axNode.ignored){this._computedTextElement.classList.add("hidden");treeOutline.element.classList.add("hidden");this._noTextInfo.classList.remove("hidden");return;} this._computedTextElement.removeChildren();this._computedTextElement.classList.toggle("hidden",!axNode.name||!axNode.name.value);if(axNode.name&&axNode.name.value) this._computedTextElement.createChild("div").textContent=axNode.name.value;var foundProperty=false;function addProperty(property) {foundProperty=true;treeOutline.appendChild(new WebInspector.AXNodePropertyTreeElement(property,target));} if("value"in axNode&&axNode.value.type==="string") addProperty(({name:"value",value:axNode.value}));var propertiesArray=(axNode.properties);for(var property of propertiesArray){if(property.name==AccessibilityAgent.AXWidgetAttributes.Valuetext){addProperty(property);break;}} treeOutline.element.classList.toggle("hidden",!foundProperty) this._noTextInfo.classList.toggle("hidden",!treeOutline.element.classList.contains("hidden")||!this._computedTextElement.classList.contains("hidden"));},__proto__:WebInspector.AccessibilitySubPane.prototype};WebInspector.AXNodeSubPane=function() {WebInspector.AccessibilitySubPane.call(this,WebInspector.UIString("Accessibility Node"));this._noNodeInfo=this.createInfo(WebInspector.UIString("No accessibility node"));this._ignoredInfo=this.createInfo(WebInspector.UIString("Accessibility node not exposed"),"ax-ignored-info hidden");this._treeOutline=this.createTreeOutline();this._ignoredReasonsTree=this.createTreeOutline();};WebInspector.AXNodeSubPane.prototype={setAXNode:function(axNode) {if(this._axNode===axNode) return;this._axNode=axNode;var treeOutline=this._treeOutline;treeOutline.removeChildren();var ignoredReasons=this._ignoredReasonsTree;ignoredReasons.removeChildren();var target=this.node().target();if(!axNode){treeOutline.element.classList.add("hidden");this._ignoredInfo.classList.add("hidden");ignoredReasons.element.classList.add("hidden");this._noNodeInfo.classList.remove("hidden");this.element.classList.add("ax-ignored-node-pane");return;}else if(axNode.ignored){this._noNodeInfo.classList.add("hidden");treeOutline.element.classList.add("hidden");this.element.classList.add("ax-ignored-node-pane");this._ignoredInfo.classList.remove("hidden");ignoredReasons.element.classList.remove("hidden");function addIgnoredReason(property) {ignoredReasons.appendChild(new WebInspector.AXNodeIgnoredReasonTreeElement(property,axNode,target));} var ignoredReasonsArray=(axNode.ignoredReasons);for(var reason of ignoredReasonsArray) addIgnoredReason(reason);if(!ignoredReasons.firstChild()) ignoredReasons.element.classList.add("hidden");return;} this.element.classList.remove("ax-ignored-node-pane");this._ignoredInfo.classList.add("hidden");ignoredReasons.element.classList.add("hidden");this._noNodeInfo.classList.add("hidden");treeOutline.element.classList.remove("hidden");function addProperty(property) {treeOutline.appendChild(new WebInspector.AXNodePropertyTreeElement(property,target));} for(var propertyName of["name","description","help","value"]){if(propertyName in axNode){var defaultProperty=({name:propertyName,value:axNode[propertyName]});addProperty(defaultProperty);}} var roleProperty=({name:"role",value:axNode.role});addProperty(roleProperty);var propertyMap={};var propertiesArray=(axNode.properties);for(var property of propertiesArray) propertyMap[property.name]=property;for(var propertySet of[AccessibilityAgent.AXWidgetAttributes,AccessibilityAgent.AXWidgetStates,AccessibilityAgent.AXGlobalStates,AccessibilityAgent.AXLiveRegionAttributes,AccessibilityAgent.AXRelationshipAttributes]){for(var propertyKey in propertySet){var property=propertySet[propertyKey];if(property in propertyMap) addProperty(propertyMap[property]);}}},__proto__:WebInspector.AccessibilitySubPane.prototype};WebInspector.AXNodePropertyTreeElement=function(property,target) {this._property=property;this._target=target;TreeElement.call(this,"");this.toggleOnClick=true;this.selectable=false;} WebInspector.AXNodePropertyTreeElement.prototype={onattach:function() {this._update();},_update:function() {this._nameElement=WebInspector.AXNodePropertyTreeElement.createNameElement(this._property.name);var value=this._property.value;if(value.type==="idref"){this._valueElement=WebInspector.AXNodePropertyTreeElement.createRelationshipValueElement(value,this._target);}else if(value.type==="idrefList"){var relatedNodes=value.relatedNodeArrayValue;var numNodes=relatedNodes.length;var description="("+numNodes+(numNodes==1?" node":" nodes")+")";value.value=description;for(var i=0;i