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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilitySidebarView.js

Issue 2322413003: Show ancestor hierarchy in accessibility panel (Closed)
Patch Set: Add new test for ancestors 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 /** 5 /**
6 * @constructor 6 * @constructor
7 * @extends {WebInspector.ThrottledWidget} 7 * @extends {WebInspector.ThrottledWidget}
8 */ 8 */
9 WebInspector.AccessibilitySidebarView = function() 9 WebInspector.AccessibilitySidebarView = function()
10 { 10 {
11 WebInspector.ThrottledWidget.call(this); 11 WebInspector.ThrottledWidget.call(this);
12 this._node = null; 12 this._node = null;
13 this._sidebarPaneStack = WebInspector.viewManager.createStackLocation(); 13 this._sidebarPaneStack = WebInspector.viewManager.createStackLocation();
14 this._treeSubPane = new WebInspector.AXTreePane();
15 this._sidebarPaneStack.showView(this._treeSubPane);
14 this._ariaSubPane = new WebInspector.ARIAAttributesPane(); 16 this._ariaSubPane = new WebInspector.ARIAAttributesPane();
15 this._sidebarPaneStack.showView(this._ariaSubPane); 17 this._sidebarPaneStack.showView(this._ariaSubPane);
16 this._axNodeSubPane = new WebInspector.AXNodeSubPane(); 18 this._axNodeSubPane = new WebInspector.AXNodeSubPane();
17 this._sidebarPaneStack.showView(this._axNodeSubPane); 19 this._sidebarPaneStack.showView(this._axNodeSubPane);
18 this._sidebarPaneStack.widget().show(this.element); 20 this._sidebarPaneStack.widget().show(this.element);
19 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this._pul lNode, this); 21 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this._pul lNode, this);
20 this._pullNode(); 22 this._pullNode();
21 } 23 }
22 24
23 WebInspector.AccessibilitySidebarView.prototype = { 25 WebInspector.AccessibilitySidebarView.prototype = {
24 /** 26 /**
25 * @return {?WebInspector.DOMNode} 27 * @return {?WebInspector.DOMNode}
26 */ 28 */
27 node: function() 29 node: function()
28 { 30 {
29 return this._node; 31 return this._node;
30 }, 32 },
31 33
32 /** 34 /**
35 * @param {?Array<!AccessibilityAgent.AXNode>} nodes
36 */
37 accessibilityNodeCallback: function(nodes)
38 {
39 if (!nodes)
40 return;
41
42 var currentAXNode = nodes[0];
43 // TODO(aboxhall): implement hideView() in WebInspector.ViewLocation and use it here.
44 if (currentAXNode.ignored)
45 this._ariaSubPane.parentWidget().contentElement.classList.add("sideb ar-hidden-override");
46 else
47 this._ariaSubPane.parentWidget().contentElement.classList.remove("si debar-hidden-override");
48
49 if (this._axNodeSubPane)
50 this._axNodeSubPane.setAXNode(currentAXNode);
51 if (this._treeSubPane)
52 this._treeSubPane.setAXNodeAndAncestors(nodes);
53 },
54
55 /**
33 * @override 56 * @override
34 * @protected 57 * @protected
35 * @return {!Promise.<?>} 58 * @return {!Promise.<?>}
36 */ 59 */
37 doUpdate: function() 60 doUpdate: function()
38 { 61 {
39 /**
40 * @param {?AccessibilityAgent.AXNode} accessibilityNode
41 * @this {WebInspector.AccessibilitySidebarView}
42 */
43 function accessibilityNodeCallback(accessibilityNode)
44 {
45 if (this._axNodeSubPane)
46 this._axNodeSubPane.setAXNode(accessibilityNode);
47 }
48 var node = this.node(); 62 var node = this.node();
63 this._treeSubPane.setNode(node);
64 this._axNodeSubPane.setNode(node);
49 this._ariaSubPane.setNode(node); 65 this._ariaSubPane.setNode(node);
50 return WebInspector.AccessibilityModel.fromTarget(node.target()).getAXNo de(node.id) 66 return WebInspector.AccessibilityModel.fromTarget(node.target()).getAXNo deChain(node.id)
51 .then(accessibilityNodeCallback.bind(this)); 67 .then((nodes) => { this.accessibilityNodeCallback(nodes); });
52 }, 68 },
53 69
54 /** 70 /**
55 * @override 71 * @override
56 */ 72 */
57 wasShown: function() 73 wasShown: function()
58 { 74 {
59 WebInspector.ThrottledWidget.prototype.wasShown.call(this); 75 WebInspector.ThrottledWidget.prototype.wasShown.call(this);
60 76
77 this._treeSubPane.setNode(this.node());
61 this._axNodeSubPane.setNode(this.node()); 78 this._axNodeSubPane.setNode(this.node());
62 this._ariaSubPane.setNode(this.node()); 79 this._ariaSubPane.setNode(this.node());
63 80
64 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn spector.DOMModel.Events.AttrModified, this._onAttrChange, this); 81 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn spector.DOMModel.Events.AttrModified, this._onAttrChange, this);
65 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn spector.DOMModel.Events.AttrRemoved, this._onAttrChange, this); 82 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn spector.DOMModel.Events.AttrRemoved, this._onAttrChange, this);
66 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn spector.DOMModel.Events.CharacterDataModified, this._onNodeChange, this); 83 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn spector.DOMModel.Events.CharacterDataModified, this._onNodeChange, this);
67 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn spector.DOMModel.Events.ChildNodeCountUpdated, this._onNodeChange, this); 84 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn spector.DOMModel.Events.ChildNodeCountUpdated, this._onNodeChange, this);
68 }, 85 },
69 86
70 /** 87 /**
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 treeOutline.registerRequiredCSS("accessibility/accessibilityNode.css"); 193 treeOutline.registerRequiredCSS("accessibility/accessibilityNode.css");
177 treeOutline.registerRequiredCSS("components/objectValue.css"); 194 treeOutline.registerRequiredCSS("components/objectValue.css");
178 195
179 treeOutline.element.classList.add("hidden"); 196 treeOutline.element.classList.add("hidden");
180 this.element.appendChild(treeOutline.element); 197 this.element.appendChild(treeOutline.element);
181 return treeOutline; 198 return treeOutline;
182 }, 199 },
183 200
184 __proto__: WebInspector.SimpleView.prototype 201 __proto__: WebInspector.SimpleView.prototype
185 } 202 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698