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._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 if (currentAXNode.ignored) | |
44 this._ariaSubPane.parentWidget().contentElement.classList.add("sideb ar-hidden-override" | |
45 ); | |
dgozman
2016/09/15 17:45:44
strange formatting
aboxhall
2016/09/15 20:30:08
Editors are fun
| |
46 else | |
47 this._ariaSubPane.parentWidget().contentElement.classList.remove("si debar-hidden-override"); | |
dgozman
2016/09/15 17:45:44
Let's instead call showView()/removeView() on the
aboxhall
2016/09/15 20:30:08
Won't that change the order?
dgozman
2016/09/17 00:36:23
There is a second parameter |insertBefore|.
aboxhall
2016/09/17 01:12:34
As discussed, will follow up as this is non-trivia
| |
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 deForDOMNode(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 Loading... | |
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 } |
OLD | NEW |