Commit e61bdf47 authored by aboxhall's avatar aboxhall Committed by Commit bot

DevTools: Flesh out AccessibilityModel and use SDK objects instead of protocol objects

BUG=

Review-Url: https://chromiumcodereview.appspot.com/2436703003
Cr-Commit-Position: refs/heads/master@{#426537}
parent 3d8adf8d
...@@ -31,7 +31,7 @@ InspectorTest.dumpSelectedElementAccessibilityNode = function() ...@@ -31,7 +31,7 @@ InspectorTest.dumpSelectedElementAccessibilityNode = function()
} }
/** /**
* @param {!AccessibilityAgent.AXNode} accessibilityNode * @param {!WebInspector.AccessibilityNode} accessibilityNode
*/ */
InspectorTest.dumpAccessibilityNode = function(accessibilityNode) InspectorTest.dumpAccessibilityNode = function(accessibilityNode)
{ {
...@@ -42,11 +42,11 @@ InspectorTest.dumpAccessibilityNode = function(accessibilityNode) ...@@ -42,11 +42,11 @@ InspectorTest.dumpAccessibilityNode = function(accessibilityNode)
} }
var builder = []; var builder = [];
builder.push(accessibilityNode.role.value); builder.push(accessibilityNode.role().value);
builder.push(accessibilityNode.name ? '"' + accessibilityNode.name.value + '"' builder.push(accessibilityNode.name() ? '"' + accessibilityNode.name().value + '"'
: "<undefined>"); : "<undefined>");
if ("properties" in accessibilityNode) { if (accessibilityNode.properties()) {
for (var property of accessibilityNode.properties) { for (var property of accessibilityNode.properties()) {
if ("value" in property) if ("value" in property)
builder.push(property.name + '="' + property.value.value + '"'); builder.push(property.name + '="' + property.value.value + '"');
} }
......
...@@ -46,14 +46,14 @@ WebInspector.ARIAAttributesPane.prototype = { ...@@ -46,14 +46,14 @@ WebInspector.ARIAAttributesPane.prototype = {
/** /**
* @constructor * @constructor
* @extends {WebInspector.AXNodePropertyTreeElement} * @extends {TreeElement}
* @param {!WebInspector.ARIAAttributesPane} parentPane * @param {!WebInspector.ARIAAttributesPane} parentPane
* @param {!WebInspector.DOMNode.Attribute} attribute * @param {!WebInspector.DOMNode.Attribute} attribute
* @param {!WebInspector.Target} target * @param {!WebInspector.Target} target
*/ */
WebInspector.ARIAAttributesTreeElement = function(parentPane, attribute, target) WebInspector.ARIAAttributesTreeElement = function(parentPane, attribute, target)
{ {
WebInspector.AXNodePropertyTreeElement.call(this, target); TreeElement.call(this, "");
this._parentPane = parentPane; this._parentPane = parentPane;
this._attribute = attribute; this._attribute = attribute;
...@@ -80,7 +80,6 @@ WebInspector.ARIAAttributesTreeElement.prototype = { ...@@ -80,7 +80,6 @@ WebInspector.ARIAAttributesTreeElement.prototype = {
}, },
/** /**
* @override
* @param {string} name * @param {string} name
*/ */
appendNameElement: function(name) appendNameElement: function(name)
...@@ -192,7 +191,7 @@ WebInspector.ARIAAttributesTreeElement.prototype = { ...@@ -192,7 +191,7 @@ WebInspector.ARIAAttributesTreeElement.prototype = {
} }
}, },
__proto__: WebInspector.AXNodePropertyTreeElement.prototype __proto__: TreeElement.prototype
}; };
/** /**
......
...@@ -18,7 +18,7 @@ WebInspector.AXTreePane = function() ...@@ -18,7 +18,7 @@ WebInspector.AXTreePane = function()
WebInspector.AXTreePane.prototype = { WebInspector.AXTreePane.prototype = {
/** /**
* @param {!Array<!AccessibilityAgent.AXNode>} nodes * @param {!Array<!WebInspector.AccessibilityNode>} nodes
*/ */
setAXNodeAndAncestors: function(nodes) setAXNodeAndAncestors: function(nodes)
{ {
...@@ -46,12 +46,12 @@ WebInspector.AXTreePane.prototype = { ...@@ -46,12 +46,12 @@ WebInspector.AXTreePane.prototype = {
/** /**
* @constructor * @constructor
* @extends {TreeElement} * @extends {TreeElement}
* @param {!AccessibilityAgent.AXNode} axNode * @param {!WebInspector.AccessibilityNode} axNode
* @param {!WebInspector.Target} target * @param {!WebInspector.Target} target
*/ */
WebInspector.AXNodeTreeElement = function(axNode, target) WebInspector.AXNodeTreeElement = function(axNode, target)
{ {
/** @type {!AccessibilityAgent.AXNode} */ /** @type {!WebInspector.AccessibilityNode} */
this._axNode = axNode; this._axNode = axNode;
/** @type {!WebInspector.Target} */ /** @type {!WebInspector.Target} */
...@@ -82,13 +82,13 @@ WebInspector.AXNodeTreeElement.prototype = { ...@@ -82,13 +82,13 @@ WebInspector.AXNodeTreeElement.prototype = {
{ {
this.listItemElement.removeChildren(); this.listItemElement.removeChildren();
if (this._axNode.ignored) { if (this._axNode.ignored()) {
this._appendIgnoredNodeElement(); this._appendIgnoredNodeElement();
} else { } else {
this._appendRoleElement(this._axNode.role); this._appendRoleElement(this._axNode.role());
if ("name" in this._axNode && this._axNode.name.value) { if ("name" in this._axNode && this._axNode.name().value) {
this.listItemElement.createChild("span", "separator").textContent = "\u00A0"; this.listItemElement.createChild("span", "separator").textContent = "\u00A0";
this._appendNameElement(/** @type {string} */ (this._axNode.name.value)); this._appendNameElement(/** @type {string} */ (this._axNode.name().value));
} }
} }
}, },
...@@ -105,7 +105,7 @@ WebInspector.AXNodeTreeElement.prototype = { ...@@ -105,7 +105,7 @@ WebInspector.AXNodeTreeElement.prototype = {
}, },
/** /**
* @param {!AccessibilityAgent.AXValue=} role * @param {?AccessibilityAgent.AXValue} role
*/ */
_appendRoleElement: function(role) _appendRoleElement: function(role)
{ {
......
...@@ -2,6 +2,121 @@ ...@@ -2,6 +2,121 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
/**
* @constructor
* @extends {WebInspector.SDKObject}
* @param {!WebInspector.AccessibilityModel} accessibilityModel
* @param {!AccessibilityAgent.AXNode} payload
*/
WebInspector.AccessibilityNode = function(accessibilityModel, payload)
{
WebInspector.SDKObject.call(this, accessibilityModel.target());
this._accessibilityModel = accessibilityModel;
this._agent = accessibilityModel._agent;
this._id = payload.nodeId;
accessibilityModel._setAXNodeForAXId(this._id, this);
this._ignored = payload.ignored;
if (this._ignored && "ignoredReasons" in payload)
this._ignoredReasons = payload.ignoredReasons;
this._role = payload.role || null;
this._name = payload.name || null;
this._description = payload.description || null;
this._value = payload.value || null;
this._properties = payload.properties || null;
this._parentId = payload.parentId || null;
this._childIds = payload.childIds || null;
this._domNodeId = payload.domNodeId || null;
};
WebInspector.AccessibilityNode.prototype = {
/**
* @return {boolean}
*/
ignored: function()
{
return this._ignored;
},
/**
* @return {?Array<!AccessibilityAgent.AXProperty>}
*/
ignoredReasons: function()
{
return this._ignoredReasons || null;
},
/**
* @return {?AccessibilityAgent.AXValue}
*/
role: function()
{
return this._role || null;
},
/**
* @return {!Array<!AccessibilityAgent.AXProperty>}
*/
coreProperties: function()
{
var properties = [];
if (this._name)
properties.push(/** @type {!AccessibilityAgent.AXProperty} */ ({name: "name", value: this._name}));
if (this._description)
properties.push(/** @type {!AccessibilityAgent.AXProperty} */ ({name: "description", value: this._description}));
if (this._value)
properties.push(/** @type {!AccessibilityAgent.AXProperty} */ ({name: "value", value: this._value}));
return properties;
},
/**
* @return {?AccessibilityAgent.AXValue}
*/
name: function()
{
return this._name || null;
},
/**
* @return {?AccessibilityAgent.AXValue}
*/
description: function()
{
return this._description || null;
},
/**
* @return {?AccessibilityAgent.AXValue}
*/
value: function()
{
return this._value || null;
},
/**
* @return {?Array<!AccessibilityAgent.AXProperty>}
*/
properties: function()
{
return this._properties || null;
},
/**
* @return {?WebInspector.AccessibilityNode}
*/
parentNode: function()
{
if (!this._parentId)
return null;
return this._accessibilityModel.axNodeForId(this._parentId);
},
__proto__: WebInspector.SDKObject.prototype
};
/** /**
* @constructor * @constructor
...@@ -12,31 +127,66 @@ WebInspector.AccessibilityModel = function(target) ...@@ -12,31 +127,66 @@ WebInspector.AccessibilityModel = function(target)
{ {
WebInspector.SDKModel.call(this, WebInspector.AccessibilityModel, target); WebInspector.SDKModel.call(this, WebInspector.AccessibilityModel, target);
this._agent = target.accessibilityAgent(); this._agent = target.accessibilityAgent();
/** @type {!Map<string, !WebInspector.AccessibilityNode>} */
this._axIdToAXNode = new Map();
}; };
WebInspector.AccessibilityModel.prototype = { WebInspector.AccessibilityModel.prototype = {
/**
* @param {string} axId
* @return {?WebInspector.AccessibilityNode}
*/
axNodeForId: function(axId)
{
return this._axIdToAXNode.get(axId);
},
/** /**
* @param {!DOMAgent.NodeId} nodeId * @param {string} axId
* @return {!Promise.<?Array<!AccessibilityAgent.AXNode>>} * @param {!WebInspector.AccessibilityNode} axNode
*/ */
getAXNodeChain: function(nodeId) _setAXNodeForAXId: function(axId, axNode)
{ {
this._axIdToAXNode.set(axId, axNode);
},
/** /**
* @param {!WebInspector.DOMNode} node
* @return {!Promise<?Array<!WebInspector.AccessibilityNode>>}
*/
getAXNodeChain: function(node)
{
this._axIdToAXNode.clear();
/**
* @this {WebInspector.AccessibilityModel}
* @param {?string} error * @param {?string} error
* @param {!Array<!AccessibilityAgent.AXNode>=} nodes * @param {!Array<!AccessibilityAgent.AXNode>=} payloads
* @return {?Array<!AccessibilityAgent.AXNode>} * @return {?Array<!WebInspector.AccessibilityNode>}
*/ */
function parsePayload(error, nodes) function parsePayload(error, payloads)
{ {
if (error) if (error) {
console.error("AccessibilityAgent.getAXNodeChain(): " + error); console.error("AccessibilityAgent.getAXNodeChain(): " + error);
return nodes || null; return null;
} }
return this._agent.getAXNodeChain(nodeId, true, parsePayload);
if (!payloads)
return null;
var nodes = [];
for (var payload of payloads)
nodes.push(new WebInspector.AccessibilityNode(this, payload));
return nodes;
}
return this._agent.getAXNodeChain(node.id, true, parsePayload.bind(this));
}, },
__proto__: WebInspector.SDKModel.prototype __proto__: WebInspector.SDKModel.prototype
} };
WebInspector.AccessibilityModel._symbol = Symbol("AccessibilityModel"); WebInspector.AccessibilityModel._symbol = Symbol("AccessibilityModel");
/** /**
......
...@@ -22,7 +22,7 @@ WebInspector.AXNodeSubPane = function() ...@@ -22,7 +22,7 @@ WebInspector.AXNodeSubPane = function()
WebInspector.AXNodeSubPane.prototype = { WebInspector.AXNodeSubPane.prototype = {
/** /**
* @param {?AccessibilityAgent.AXNode} axNode * @param {?WebInspector.AccessibilityNode} axNode
* @override * @override
*/ */
setAXNode: function(axNode) setAXNode: function(axNode)
...@@ -35,7 +35,6 @@ WebInspector.AXNodeSubPane.prototype = { ...@@ -35,7 +35,6 @@ WebInspector.AXNodeSubPane.prototype = {
treeOutline.removeChildren(); treeOutline.removeChildren();
var ignoredReasons = this._ignoredReasonsTree; var ignoredReasons = this._ignoredReasonsTree;
ignoredReasons.removeChildren(); ignoredReasons.removeChildren();
var target = this.node().target();
if (!axNode) { if (!axNode) {
treeOutline.element.classList.add("hidden"); treeOutline.element.classList.add("hidden");
...@@ -46,7 +45,9 @@ WebInspector.AXNodeSubPane.prototype = { ...@@ -46,7 +45,9 @@ WebInspector.AXNodeSubPane.prototype = {
this.element.classList.add("ax-ignored-node-pane"); this.element.classList.add("ax-ignored-node-pane");
return; return;
} else if (axNode.ignored) { }
if (axNode.ignored()) {
this._noNodeInfo.classList.add("hidden"); this._noNodeInfo.classList.add("hidden");
treeOutline.element.classList.add("hidden"); treeOutline.element.classList.add("hidden");
this.element.classList.add("ax-ignored-node-pane"); this.element.classList.add("ax-ignored-node-pane");
...@@ -58,9 +59,9 @@ WebInspector.AXNodeSubPane.prototype = { ...@@ -58,9 +59,9 @@ WebInspector.AXNodeSubPane.prototype = {
*/ */
function addIgnoredReason(property) function addIgnoredReason(property)
{ {
ignoredReasons.appendChild(new WebInspector.AXNodeIgnoredReasonTreeElement(property, axNode, target)); ignoredReasons.appendChild(new WebInspector.AXNodeIgnoredReasonTreeElement(property, /** @type {!WebInspector.AccessibilityNode} */ (axNode)));
} }
var ignoredReasonsArray = /** @type {!Array<!AccessibilityAgent.AXProperty>} */(axNode.ignoredReasons); var ignoredReasonsArray = /** @type {!Array<!AccessibilityAgent.AXProperty>} */(axNode.ignoredReasons());
for (var reason of ignoredReasonsArray) for (var reason of ignoredReasonsArray)
addIgnoredReason(reason); addIgnoredReason(reason);
if (!ignoredReasons.firstChild()) if (!ignoredReasons.firstChild())
...@@ -80,21 +81,17 @@ WebInspector.AXNodeSubPane.prototype = { ...@@ -80,21 +81,17 @@ WebInspector.AXNodeSubPane.prototype = {
*/ */
function addProperty(property) function addProperty(property)
{ {
treeOutline.appendChild(new WebInspector.AXNodePropertyTreePropertyElement(property, target)); treeOutline.appendChild(new WebInspector.AXNodePropertyTreePropertyElement(property, /** @type {!WebInspector.AccessibilityNode} */ (axNode)));
} }
for (var propertyName of ["name", "description", "help", "value"]) { for (var property of axNode.coreProperties())
if (propertyName in axNode) { addProperty(property);
var defaultProperty = /** @type {!AccessibilityAgent.AXProperty} */ ({name: propertyName, value: axNode[propertyName]});
addProperty(defaultProperty);
}
}
var roleProperty = /** @type {!AccessibilityAgent.AXProperty} */ ({name: "role", value: axNode.role}); var roleProperty = /** @type {!AccessibilityAgent.AXProperty} */ ({name: "role", value: axNode.role()});
addProperty(roleProperty); addProperty(roleProperty);
var propertyMap = {}; var propertyMap = {};
var propertiesArray = /** @type {!Array.<!AccessibilityAgent.AXProperty>} */ (axNode.properties); var propertiesArray = /** @type {!Array.<!AccessibilityAgent.AXProperty>} */ (axNode.properties());
for (var property of propertiesArray) for (var property of propertiesArray)
propertyMap[property.name] = property; propertyMap[property.name] = property;
...@@ -122,12 +119,12 @@ WebInspector.AXNodeSubPane.prototype = { ...@@ -122,12 +119,12 @@ WebInspector.AXNodeSubPane.prototype = {
/** /**
* @constructor * @constructor
* @param {!WebInspector.AccessibilityNode} axNode
* @extends {TreeElement} * @extends {TreeElement}
* @param {!WebInspector.Target} target
*/ */
WebInspector.AXNodePropertyTreeElement = function(target) WebInspector.AXNodePropertyTreeElement = function(axNode)
{ {
this._target = target; this._axNode = axNode;
// Pass an empty title, the title gets made later in onattach. // Pass an empty title, the title gets made later in onattach.
TreeElement.call(this, ""); TreeElement.call(this, "");
...@@ -239,7 +236,7 @@ WebInspector.AXNodePropertyTreeElement.prototype = { ...@@ -239,7 +236,7 @@ WebInspector.AXNodePropertyTreeElement.prototype = {
var sources = value.sources; var sources = value.sources;
for (var i = 0; i < sources.length; i++) { for (var i = 0; i < sources.length; i++) {
var source = sources[i]; var source = sources[i];
var child = new WebInspector.AXValueSourceTreeElement(source, this._target); var child = new WebInspector.AXValueSourceTreeElement(source, this._axNode);
this.appendChild(child); this.appendChild(child);
} }
this.expand(); this.expand();
...@@ -255,7 +252,7 @@ WebInspector.AXNodePropertyTreeElement.prototype = { ...@@ -255,7 +252,7 @@ WebInspector.AXNodePropertyTreeElement.prototype = {
*/ */
appendRelatedNode: function(relatedNode, index) appendRelatedNode: function(relatedNode, index)
{ {
var deferredNode = new WebInspector.DeferredDOMNode(this._target, relatedNode.backendNodeId); var deferredNode = new WebInspector.DeferredDOMNode(this._axNode.target(), relatedNode.backendNodeId);
var nodeTreeElement = new WebInspector.AXRelatedNodeSourceTreeElement({ deferredNode: deferredNode }, relatedNode); var nodeTreeElement = new WebInspector.AXRelatedNodeSourceTreeElement({ deferredNode: deferredNode }, relatedNode);
this.appendChild(nodeTreeElement); this.appendChild(nodeTreeElement);
}, },
...@@ -265,7 +262,7 @@ WebInspector.AXNodePropertyTreeElement.prototype = { ...@@ -265,7 +262,7 @@ WebInspector.AXNodePropertyTreeElement.prototype = {
*/ */
appendRelatedNodeInline: function(relatedNode) appendRelatedNodeInline: function(relatedNode)
{ {
var deferredNode = new WebInspector.DeferredDOMNode(this._target, relatedNode.backendNodeId); var deferredNode = new WebInspector.DeferredDOMNode(this._axNode.target(), relatedNode.backendNodeId);
var linkedNode = new WebInspector.AXRelatedNodeElement({ deferredNode: deferredNode }, relatedNode); var linkedNode = new WebInspector.AXRelatedNodeElement({ deferredNode: deferredNode }, relatedNode);
this.listItemElement.appendChild(linkedNode.render()); this.listItemElement.appendChild(linkedNode.render());
}, },
...@@ -294,15 +291,15 @@ WebInspector.AXNodePropertyTreeElement.prototype = { ...@@ -294,15 +291,15 @@ WebInspector.AXNodePropertyTreeElement.prototype = {
* @constructor * @constructor
* @extends {WebInspector.AXNodePropertyTreeElement} * @extends {WebInspector.AXNodePropertyTreeElement}
* @param {!AccessibilityAgent.AXProperty} property * @param {!AccessibilityAgent.AXProperty} property
* @param {!WebInspector.Target} target * @param {!WebInspector.AccessibilityNode} axNode
*/ */
WebInspector.AXNodePropertyTreePropertyElement = function(property, target) WebInspector.AXNodePropertyTreePropertyElement = function(property, axNode)
{ {
this._property = property; this._property = property;
this.toggleOnClick = true; this.toggleOnClick = true;
this.selectable = false; this.selectable = false;
WebInspector.AXNodePropertyTreeElement.call(this, target); WebInspector.AXNodePropertyTreeElement.call(this, axNode);
this.listItemElement.classList.add("property"); this.listItemElement.classList.add("property");
} }
...@@ -335,12 +332,12 @@ WebInspector.AXNodePropertyTreePropertyElement.prototype = { ...@@ -335,12 +332,12 @@ WebInspector.AXNodePropertyTreePropertyElement.prototype = {
* @constructor * @constructor
* @extends {WebInspector.AXNodePropertyTreeElement} * @extends {WebInspector.AXNodePropertyTreeElement}
* @param {!AccessibilityAgent.AXValueSource} source * @param {!AccessibilityAgent.AXValueSource} source
* @param {!WebInspector.Target} target * @param {!WebInspector.AccessibilityNode} axNode
*/ */
WebInspector.AXValueSourceTreeElement = function(source, target) WebInspector.AXValueSourceTreeElement = function(source, axNode)
{ {
this._source = source; this._source = source;
WebInspector.AXNodePropertyTreeElement.call(this, target); WebInspector.AXNodePropertyTreeElement.call(this, axNode);
this.selectable = false; this.selectable = false;
} }
...@@ -360,7 +357,7 @@ WebInspector.AXValueSourceTreeElement.prototype = { ...@@ -360,7 +357,7 @@ WebInspector.AXValueSourceTreeElement.prototype = {
*/ */
appendRelatedNodeWithIdref: function(relatedNode, index, idref) appendRelatedNodeWithIdref: function(relatedNode, index, idref)
{ {
var deferredNode = new WebInspector.DeferredDOMNode(this._target, relatedNode.backendNodeId); var deferredNode = new WebInspector.DeferredDOMNode(this._axNode.target(), relatedNode.backendNodeId);
var nodeTreeElement = new WebInspector.AXRelatedNodeSourceTreeElement({ deferredNode: deferredNode, idref: idref }, relatedNode); var nodeTreeElement = new WebInspector.AXRelatedNodeSourceTreeElement({ deferredNode: deferredNode, idref: idref }, relatedNode);
this.appendChild(nodeTreeElement); this.appendChild(nodeTreeElement);
}, },
...@@ -593,15 +590,14 @@ WebInspector.AXRelatedNodeElement.prototype = { ...@@ -593,15 +590,14 @@ WebInspector.AXRelatedNodeElement.prototype = {
* @constructor * @constructor
* @extends {WebInspector.AXNodePropertyTreeElement} * @extends {WebInspector.AXNodePropertyTreeElement}
* @param {!AccessibilityAgent.AXProperty} property * @param {!AccessibilityAgent.AXProperty} property
* @param {?AccessibilityAgent.AXNode} axNode * @param {!WebInspector.AccessibilityNode} axNode
* @param {!WebInspector.Target} target
*/ */
WebInspector.AXNodeIgnoredReasonTreeElement = function(property, axNode, target) WebInspector.AXNodeIgnoredReasonTreeElement = function(property, axNode)
{ {
this._property = property; this._property = property;
this._axNode = axNode; this._axNode = axNode;
WebInspector.AXNodePropertyTreeElement.call(this, target); WebInspector.AXNodePropertyTreeElement.call(this, axNode);
this.toggleOnClick = true; this.toggleOnClick = true;
this.selectable = false; this.selectable = false;
} }
...@@ -627,7 +623,7 @@ WebInspector.AXNodeIgnoredReasonTreeElement.prototype = { ...@@ -627,7 +623,7 @@ WebInspector.AXNodeIgnoredReasonTreeElement.prototype = {
/** /**
* @param {?string} reason * @param {?string} reason
* @param {?AccessibilityAgent.AXNode} axNode * @param {?WebInspector.AccessibilityNode} axNode
* @return {?Element} * @return {?Element}
*/ */
WebInspector.AXNodeIgnoredReasonTreeElement.createReasonElement = function(reason, axNode) WebInspector.AXNodeIgnoredReasonTreeElement.createReasonElement = function(reason, axNode)
...@@ -678,7 +674,7 @@ WebInspector.AXNodeIgnoredReasonTreeElement.createReasonElement = function(reaso ...@@ -678,7 +674,7 @@ WebInspector.AXNodeIgnoredReasonTreeElement.createReasonElement = function(reaso
reasonElement = WebInspector.formatLocalized("Element is not visible.", []); reasonElement = WebInspector.formatLocalized("Element is not visible.", []);
break; break;
case "presentationalRole": case "presentationalRole":
var rolePresentationSpan = createElement("span", "source-code").textContent = "role=" + axNode.role.value; var rolePresentationSpan = createElement("span", "source-code").textContent = "role=" + axNode.role().value;
reasonElement = WebInspector.formatLocalized("Element has %s.", [ rolePresentationSpan ]); reasonElement = WebInspector.formatLocalized("Element has %s.", [ rolePresentationSpan ]);
break; break;
case "probablyPresentational": case "probablyPresentational":
......
...@@ -10,6 +10,7 @@ WebInspector.AccessibilitySidebarView = function() ...@@ -10,6 +10,7 @@ WebInspector.AccessibilitySidebarView = function()
{ {
WebInspector.ThrottledWidget.call(this); WebInspector.ThrottledWidget.call(this);
this._node = null; this._node = null;
this._axNode = null;
this._sidebarPaneStack = WebInspector.viewManager.createStackLocation(); this._sidebarPaneStack = WebInspector.viewManager.createStackLocation();
this._treeSubPane = new WebInspector.AXTreePane(); this._treeSubPane = new WebInspector.AXTreePane();
this._sidebarPaneStack.showView(this._treeSubPane); this._sidebarPaneStack.showView(this._treeSubPane);
...@@ -32,7 +33,7 @@ WebInspector.AccessibilitySidebarView.prototype = { ...@@ -32,7 +33,7 @@ WebInspector.AccessibilitySidebarView.prototype = {
}, },
/** /**
* @param {?Array<!AccessibilityAgent.AXNode>} nodes * @param {?Array<!WebInspector.AccessibilityNode>} nodes
*/ */
accessibilityNodeCallback: function(nodes) accessibilityNodeCallback: function(nodes)
{ {
...@@ -62,7 +63,7 @@ WebInspector.AccessibilitySidebarView.prototype = { ...@@ -62,7 +63,7 @@ WebInspector.AccessibilitySidebarView.prototype = {
this._treeSubPane.setNode(node); this._treeSubPane.setNode(node);
this._axNodeSubPane.setNode(node); this._axNodeSubPane.setNode(node);
this._ariaSubPane.setNode(node); this._ariaSubPane.setNode(node);
return WebInspector.AccessibilityModel.fromTarget(node.target()).getAXNodeChain(node.id) return WebInspector.AccessibilityModel.fromTarget(node.target()).getAXNodeChain(node)
.then((nodes) => { this.accessibilityNodeCallback(nodes); }); .then((nodes) => { this.accessibilityNodeCallback(nodes); });
}, },
...@@ -97,8 +98,6 @@ WebInspector.AccessibilitySidebarView.prototype = { ...@@ -97,8 +98,6 @@ WebInspector.AccessibilitySidebarView.prototype = {
_pullNode: function() _pullNode: function()
{ {
this._node = WebInspector.context.flavor(WebInspector.DOMNode); this._node = WebInspector.context.flavor(WebInspector.DOMNode);
this._ariaSubPane.setNode(this._node);
this._axNodeSubPane.setNode(this._node);
this.update(); this.update();
}, },
...@@ -147,7 +146,7 @@ WebInspector.AccessibilitySubPane = function(name) ...@@ -147,7 +146,7 @@ WebInspector.AccessibilitySubPane = function(name)
WebInspector.AccessibilitySubPane.prototype = { WebInspector.AccessibilitySubPane.prototype = {
/** /**
* @param {?AccessibilityAgent.AXNode} axNode * @param {?WebInspector.AccessibilityNode} axNode
* @protected * @protected
*/ */
setAXNode: function(axNode) setAXNode: function(axNode)
......
...@@ -220,6 +220,10 @@ WebInspector.AccessibilityStrings.AXNativeSourceTypes = { ...@@ -220,6 +220,10 @@ WebInspector.AccessibilityStrings.AXNativeSourceTypes = {
name: "From caption", name: "From caption",
description: "Value from table caption." description: "Value from table caption."
}, },
"title": {
"name": "From title",
"description": "Value from title attribute."
},
"other": { "other": {
name: "From native HTML", name: "From native HTML",
description: "Value from native HTML (unknown source)." description: "Value from native HTML (unknown source)."
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment