OLD | NEW |
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 {?Array<!WebInspector.AccessibilityNode>} nodes |
36 */ | 37 */ |
37 accessibilityNodeCallback: function(nodes) | 38 accessibilityNodeCallback: function(nodes) |
38 { | 39 { |
39 if (!nodes) | 40 if (!nodes) |
40 return; | 41 return; |
41 | 42 |
42 var currentAXNode = nodes[0]; | 43 var currentAXNode = nodes[0]; |
43 if (currentAXNode.ignored) | 44 if (currentAXNode.ignored) |
44 this._sidebarPaneStack.removeView(this._ariaSubPane); | 45 this._sidebarPaneStack.removeView(this._ariaSubPane); |
45 else | 46 else |
46 this._sidebarPaneStack.showView(this._ariaSubPane, this._axNodeSubPa
ne); | 47 this._sidebarPaneStack.showView(this._ariaSubPane, this._axNodeSubPa
ne); |
47 | 48 |
48 if (this._axNodeSubPane) | 49 if (this._axNodeSubPane) |
49 this._axNodeSubPane.setAXNode(currentAXNode); | 50 this._axNodeSubPane.setAXNode(currentAXNode); |
50 if (this._treeSubPane) | 51 if (this._treeSubPane) |
51 this._treeSubPane.setAXNodeAndAncestors(nodes); | 52 this._treeSubPane.setAXNodeAndAncestors(nodes); |
52 }, | 53 }, |
53 | 54 |
54 /** | 55 /** |
55 * @override | 56 * @override |
56 * @protected | 57 * @protected |
57 * @return {!Promise.<?>} | 58 * @return {!Promise.<?>} |
58 */ | 59 */ |
59 doUpdate: function() | 60 doUpdate: function() |
60 { | 61 { |
61 var node = this.node(); | 62 var node = this.node(); |
62 this._treeSubPane.setNode(node); | 63 this._treeSubPane.setNode(node); |
63 this._axNodeSubPane.setNode(node); | 64 this._axNodeSubPane.setNode(node); |
64 this._ariaSubPane.setNode(node); | 65 this._ariaSubPane.setNode(node); |
65 return WebInspector.AccessibilityModel.fromTarget(node.target()).getAXNo
deChain(node.id) | 66 return WebInspector.AccessibilityModel.fromTarget(node.target()).getAXNo
deChain(node) |
66 .then((nodes) => { this.accessibilityNodeCallback(nodes); }); | 67 .then((nodes) => { this.accessibilityNodeCallback(nodes); }); |
67 }, | 68 }, |
68 | 69 |
69 /** | 70 /** |
70 * @override | 71 * @override |
71 */ | 72 */ |
72 wasShown: function() | 73 wasShown: function() |
73 { | 74 { |
74 WebInspector.ThrottledWidget.prototype.wasShown.call(this); | 75 WebInspector.ThrottledWidget.prototype.wasShown.call(this); |
75 | 76 |
(...skipping 14 matching lines...) Expand all Loading... |
90 { | 91 { |
91 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We
bInspector.DOMModel.Events.AttrModified, this._onAttrChange, this); | 92 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We
bInspector.DOMModel.Events.AttrModified, this._onAttrChange, this); |
92 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We
bInspector.DOMModel.Events.AttrRemoved, this._onAttrChange, this); | 93 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); | 94 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); | 95 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We
bInspector.DOMModel.Events.ChildNodeCountUpdated, this._onNodeChange, this); |
95 }, | 96 }, |
96 | 97 |
97 _pullNode: function() | 98 _pullNode: function() |
98 { | 99 { |
99 this._node = WebInspector.context.flavor(WebInspector.DOMNode); | 100 this._node = WebInspector.context.flavor(WebInspector.DOMNode); |
100 this._ariaSubPane.setNode(this._node); | |
101 this._axNodeSubPane.setNode(this._node); | |
102 this.update(); | 101 this.update(); |
103 }, | 102 }, |
104 | 103 |
105 /** | 104 /** |
106 * @param {!WebInspector.Event} event | 105 * @param {!WebInspector.Event} event |
107 */ | 106 */ |
108 _onAttrChange: function(event) | 107 _onAttrChange: function(event) |
109 { | 108 { |
110 if (!this.node()) | 109 if (!this.node()) |
111 return; | 110 return; |
(...skipping 28 matching lines...) Expand all Loading... |
140 WebInspector.AccessibilitySubPane = function(name) | 139 WebInspector.AccessibilitySubPane = function(name) |
141 { | 140 { |
142 WebInspector.SimpleView.call(this, name); | 141 WebInspector.SimpleView.call(this, name); |
143 | 142 |
144 this._axNode = null; | 143 this._axNode = null; |
145 this.registerRequiredCSS("accessibility/accessibilityNode.css"); | 144 this.registerRequiredCSS("accessibility/accessibilityNode.css"); |
146 } | 145 } |
147 | 146 |
148 WebInspector.AccessibilitySubPane.prototype = { | 147 WebInspector.AccessibilitySubPane.prototype = { |
149 /** | 148 /** |
150 * @param {?AccessibilityAgent.AXNode} axNode | 149 * @param {?WebInspector.AccessibilityNode} axNode |
151 * @protected | 150 * @protected |
152 */ | 151 */ |
153 setAXNode: function(axNode) | 152 setAXNode: function(axNode) |
154 { | 153 { |
155 }, | 154 }, |
156 | 155 |
157 /** | 156 /** |
158 * @return {?WebInspector.DOMNode} | 157 * @return {?WebInspector.DOMNode} |
159 */ | 158 */ |
160 node: function() | 159 node: function() |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 treeOutline.registerRequiredCSS("accessibility/accessibilityNode.css"); | 191 treeOutline.registerRequiredCSS("accessibility/accessibilityNode.css"); |
193 treeOutline.registerRequiredCSS("components/objectValue.css"); | 192 treeOutline.registerRequiredCSS("components/objectValue.css"); |
194 | 193 |
195 treeOutline.element.classList.add("hidden"); | 194 treeOutline.element.classList.add("hidden"); |
196 this.element.appendChild(treeOutline.element); | 195 this.element.appendChild(treeOutline.element); |
197 return treeOutline; | 196 return treeOutline; |
198 }, | 197 }, |
199 | 198 |
200 __proto__: WebInspector.SimpleView.prototype | 199 __proto__: WebInspector.SimpleView.prototype |
201 } | 200 } |
OLD | NEW |