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

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

Issue 2390783006: [DevTools] Accessibility: Show siblings and children of selected node (Closed)
Patch Set: Ready for a first look Created 4 years, 2 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._axNode = null;
13 this._sidebarPaneStack = WebInspector.viewManager.createStackLocation(); 14 this._sidebarPaneStack = WebInspector.viewManager.createStackLocation();
14 this._treeSubPane = new WebInspector.AXTreePane(); 15 this._treeSubPane = new WebInspector.AXTreePane();
15 this._sidebarPaneStack.showView(this._treeSubPane); 16 this._sidebarPaneStack.showView(this._treeSubPane);
16 this._ariaSubPane = new WebInspector.ARIAAttributesPane(); 17 this._ariaSubPane = new WebInspector.ARIAAttributesPane();
17 this._sidebarPaneStack.showView(this._ariaSubPane); 18 this._sidebarPaneStack.showView(this._ariaSubPane);
18 this._axNodeSubPane = new WebInspector.AXNodeSubPane(); 19 this._axNodeSubPane = new WebInspector.AXNodeSubPane();
19 this._sidebarPaneStack.showView(this._axNodeSubPane); 20 this._sidebarPaneStack.showView(this._axNodeSubPane);
20 this._sidebarPaneStack.widget().show(this.element); 21 this._sidebarPaneStack.widget().show(this.element);
21 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this._pul lNode, this); 22 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this._pul lNode, this);
22 this._pullNode(); 23 this._pullNode();
23 } 24 }
24 25
25 WebInspector.AccessibilitySidebarView.prototype = { 26 WebInspector.AccessibilitySidebarView.prototype = {
26 /** 27 /**
27 * @return {?WebInspector.DOMNode} 28 * @return {?WebInspector.DOMNode}
28 */ 29 */
29 node: function() 30 node: function()
30 { 31 {
31 return this._node; 32 return this._node;
32 }, 33 },
33 34
34 /** 35 /**
35 * @param {?Array<!AccessibilityAgent.AXNode>} nodes 36 * @param {?WebInspector.AccessibilityNode} axNode
36 */ 37 */
37 accessibilityNodeCallback: function(nodes) 38 accessibilityNodeCallback: function(axNode)
38 { 39 {
39 if (!nodes) 40 if (!axNode)
40 return; 41 return;
41 42
42 var currentAXNode = nodes[0]; 43 this._axNode = axNode;
43 if (currentAXNode.ignored) 44
45 if (axNode.ignored())
44 this._sidebarPaneStack.removeView(this._ariaSubPane); 46 this._sidebarPaneStack.removeView(this._ariaSubPane);
45 else 47 else
46 this._sidebarPaneStack.showView(this._ariaSubPane, this._axNodeSubPa ne); 48 this._sidebarPaneStack.showView(this._ariaSubPane, this._axNodeSubPa ne);
47 49
48 if (this._axNodeSubPane) 50 if (this._axNodeSubPane)
49 this._axNodeSubPane.setAXNode(currentAXNode); 51 this._axNodeSubPane.setAXNode(axNode);
50 if (this._treeSubPane) 52 if (this._treeSubPane)
51 this._treeSubPane.setAXNodeAndAncestors(nodes); 53 this._treeSubPane.setAXNode(axNode);
52 }, 54 },
53 55
54 /** 56 /**
55 * @override 57 * @override
56 * @protected 58 * @protected
57 * @return {!Promise.<?>} 59 * @return {!Promise.<?>}
58 */ 60 */
59 doUpdate: function() 61 doUpdate: function()
60 { 62 {
61 var node = this.node(); 63 var node = this.node();
62 this._treeSubPane.setNode(node); 64 this._treeSubPane.setNode(node);
63 this._axNodeSubPane.setNode(node); 65 this._axNodeSubPane.setNode(node);
64 this._ariaSubPane.setNode(node); 66 this._ariaSubPane.setNode(node);
65 return WebInspector.AccessibilityModel.fromTarget(node.target()).getAXNo deChain(node.id) 67 if (!node)
66 .then((nodes) => { this.accessibilityNodeCallback(nodes); }); 68 return Promise.resolve();
69 var accessibilityModel = WebInspector.AccessibilityModel.fromTarget(node .target());
70 return accessibilityModel.setDOMNode(node)
71 .then(accessibilityModel.resolveAllDOMNodes.bind(accessibilityModel) )
72 .then(accessibilityModel.getInspectedAXNode.bind(accessibilityModel) )
73 .then((axNode) => { this.accessibilityNodeCallback(axNode); });
67 }, 74 },
68 75
69 /** 76 /**
70 * @override 77 * @override
71 */ 78 */
72 wasShown: function() 79 wasShown: function()
73 { 80 {
74 WebInspector.ThrottledWidget.prototype.wasShown.call(this); 81 WebInspector.ThrottledWidget.prototype.wasShown.call(this);
75 82
76 this._treeSubPane.setNode(this.node()); 83 this._treeSubPane.setNode(this.node());
(...skipping 15 matching lines...) Expand all
92 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We bInspector.DOMModel.Events.AttrRemoved, this._onAttrChange, this); 99 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We bInspector.DOMModel.Events.AttrRemoved, this._onAttrChange, this);
93 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We bInspector.DOMModel.Events.CharacterDataModified, this._onNodeChange, this); 100 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We bInspector.DOMModel.Events.CharacterDataModified, this._onNodeChange, this);
94 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We bInspector.DOMModel.Events.ChildNodeCountUpdated, this._onNodeChange, this); 101 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We bInspector.DOMModel.Events.ChildNodeCountUpdated, this._onNodeChange, this);
95 }, 102 },
96 103
97 _pullNode: function() 104 _pullNode: function()
98 { 105 {
99 this._node = WebInspector.context.flavor(WebInspector.DOMNode); 106 this._node = WebInspector.context.flavor(WebInspector.DOMNode);
100 this._ariaSubPane.setNode(this._node); 107 this._ariaSubPane.setNode(this._node);
101 this._axNodeSubPane.setNode(this._node); 108 this._axNodeSubPane.setNode(this._node);
109 this._treeSubPane.setNode(this._node);
102 this.update(); 110 this.update();
103 }, 111 },
104 112
105 /** 113 /**
106 * @param {!WebInspector.Event} event 114 * @param {!WebInspector.Event} event
107 */ 115 */
108 _onAttrChange: function(event) 116 _onAttrChange: function(event)
109 { 117 {
110 if (!this.node()) 118 if (!this.node())
111 return; 119 return;
(...skipping 28 matching lines...) Expand all
140 WebInspector.AccessibilitySubPane = function(name) 148 WebInspector.AccessibilitySubPane = function(name)
141 { 149 {
142 WebInspector.SimpleView.call(this, name); 150 WebInspector.SimpleView.call(this, name);
143 151
144 this._axNode = null; 152 this._axNode = null;
145 this.registerRequiredCSS("accessibility/accessibilityNode.css"); 153 this.registerRequiredCSS("accessibility/accessibilityNode.css");
146 } 154 }
147 155
148 WebInspector.AccessibilitySubPane.prototype = { 156 WebInspector.AccessibilitySubPane.prototype = {
149 /** 157 /**
150 * @param {?AccessibilityAgent.AXNode} axNode 158 * @param {?WebInspector.AccessibilityNode} axNode
151 * @protected 159 * @protected
152 */ 160 */
153 setAXNode: function(axNode) 161 setAXNode: function(axNode)
154 { 162 {
155 }, 163 },
156 164
157 /** 165 /**
158 * @return {?WebInspector.DOMNode} 166 * @return {?WebInspector.DOMNode}
159 */ 167 */
160 node: function() 168 node: function()
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 treeOutline.registerRequiredCSS("accessibility/accessibilityNode.css"); 200 treeOutline.registerRequiredCSS("accessibility/accessibilityNode.css");
193 treeOutline.registerRequiredCSS("components/objectValue.css"); 201 treeOutline.registerRequiredCSS("components/objectValue.css");
194 202
195 treeOutline.element.classList.add("hidden"); 203 treeOutline.element.classList.add("hidden");
196 this.element.appendChild(treeOutline.element); 204 this.element.appendChild(treeOutline.element);
197 return treeOutline; 205 return treeOutline;
198 }, 206 },
199 207
200 __proto__: WebInspector.SimpleView.prototype 208 __proto__: WebInspector.SimpleView.prototype
201 } 209 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698