| 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); | |
| 16 this._ariaSubPane = new WebInspector.ARIAAttributesPane(); | 14 this._ariaSubPane = new WebInspector.ARIAAttributesPane(); |
| 17 this._sidebarPaneStack.showView(this._ariaSubPane); | 15 this._sidebarPaneStack.showView(this._ariaSubPane); |
| 18 this._axNodeSubPane = new WebInspector.AXNodeSubPane(); | 16 this._axNodeSubPane = new WebInspector.AXNodeSubPane(); |
| 19 this._sidebarPaneStack.showView(this._axNodeSubPane); | 17 this._sidebarPaneStack.showView(this._axNodeSubPane); |
| 20 this._sidebarPaneStack.widget().show(this.element); | 18 this._sidebarPaneStack.widget().show(this.element); |
| 21 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this._pul
lNode, this); | 19 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this._pul
lNode, this); |
| 22 this._pullNode(); | 20 this._pullNode(); |
| 23 } | 21 } |
| 24 | 22 |
| 25 WebInspector.AccessibilitySidebarView.prototype = { | 23 WebInspector.AccessibilitySidebarView.prototype = { |
| 26 /** | 24 /** |
| 27 * @return {?WebInspector.DOMNode} | 25 * @return {?WebInspector.DOMNode} |
| 28 */ | 26 */ |
| 29 node: function() | 27 node: function() |
| 30 { | 28 { |
| 31 return this._node; | 29 return this._node; |
| 32 }, | 30 }, |
| 33 | 31 |
| 34 /** | 32 /** |
| 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 /** | |
| 56 * @override | 33 * @override |
| 57 * @protected | 34 * @protected |
| 58 * @return {!Promise.<?>} | 35 * @return {!Promise.<?>} |
| 59 */ | 36 */ |
| 60 doUpdate: function() | 37 doUpdate: function() |
| 61 { | 38 { |
| 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 } |
| 62 var node = this.node(); | 48 var node = this.node(); |
| 63 this._treeSubPane.setNode(node); | |
| 64 this._axNodeSubPane.setNode(node); | |
| 65 this._ariaSubPane.setNode(node); | 49 this._ariaSubPane.setNode(node); |
| 66 return WebInspector.AccessibilityModel.fromTarget(node.target()).getAXNo
deChain(node.id) | 50 return WebInspector.AccessibilityModel.fromTarget(node.target()).getAXNo
de(node.id) |
| 67 .then((nodes) => { this.accessibilityNodeCallback(nodes); }); | 51 .then(accessibilityNodeCallback.bind(this)); |
| 68 }, | 52 }, |
| 69 | 53 |
| 70 /** | 54 /** |
| 71 * @override | 55 * @override |
| 72 */ | 56 */ |
| 73 wasShown: function() | 57 wasShown: function() |
| 74 { | 58 { |
| 75 WebInspector.ThrottledWidget.prototype.wasShown.call(this); | 59 WebInspector.ThrottledWidget.prototype.wasShown.call(this); |
| 76 | 60 |
| 77 this._treeSubPane.setNode(this.node()); | |
| 78 this._axNodeSubPane.setNode(this.node()); | 61 this._axNodeSubPane.setNode(this.node()); |
| 79 this._ariaSubPane.setNode(this.node()); | 62 this._ariaSubPane.setNode(this.node()); |
| 80 | 63 |
| 81 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn
spector.DOMModel.Events.AttrModified, this._onAttrChange, this); | 64 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn
spector.DOMModel.Events.AttrModified, this._onAttrChange, this); |
| 82 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn
spector.DOMModel.Events.AttrRemoved, this._onAttrChange, this); | 65 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn
spector.DOMModel.Events.AttrRemoved, this._onAttrChange, this); |
| 83 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn
spector.DOMModel.Events.CharacterDataModified, this._onNodeChange, this); | 66 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn
spector.DOMModel.Events.CharacterDataModified, this._onNodeChange, this); |
| 84 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn
spector.DOMModel.Events.ChildNodeCountUpdated, this._onNodeChange, this); | 67 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn
spector.DOMModel.Events.ChildNodeCountUpdated, this._onNodeChange, this); |
| 85 }, | 68 }, |
| 86 | 69 |
| 87 /** | 70 /** |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 treeOutline.registerRequiredCSS("accessibility/accessibilityNode.css"); | 176 treeOutline.registerRequiredCSS("accessibility/accessibilityNode.css"); |
| 194 treeOutline.registerRequiredCSS("components/objectValue.css"); | 177 treeOutline.registerRequiredCSS("components/objectValue.css"); |
| 195 | 178 |
| 196 treeOutline.element.classList.add("hidden"); | 179 treeOutline.element.classList.add("hidden"); |
| 197 this.element.appendChild(treeOutline.element); | 180 this.element.appendChild(treeOutline.element); |
| 198 return treeOutline; | 181 return treeOutline; |
| 199 }, | 182 }, |
| 200 | 183 |
| 201 __proto__: WebInspector.SimpleView.prototype | 184 __proto__: WebInspector.SimpleView.prototype |
| 202 } | 185 } |
| OLD | NEW |