| 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 else |
| 46 this._ariaSubPane.parentWidget().contentElement.classList.remove("si
debar-hidden-override"); |
| 47 |
| 48 if (this._axNodeSubPane) |
| 49 this._axNodeSubPane.setAXNode(currentAXNode); |
| 50 if (this._treeSubPane) |
| 51 this._treeSubPane.setAXNodeAndAncestors(nodes); |
| 52 }, |
| 53 |
| 54 /** |
| 33 * @override | 55 * @override |
| 34 * @protected | 56 * @protected |
| 35 * @return {!Promise.<?>} | 57 * @return {!Promise.<?>} |
| 36 */ | 58 */ |
| 37 doUpdate: function() | 59 doUpdate: function() |
| 38 { | 60 { |
| 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(); | 61 var node = this.node(); |
| 62 this._treeSubPane.setNode(node); |
| 63 this._axNodeSubPane.setNode(node); |
| 49 this._ariaSubPane.setNode(node); | 64 this._ariaSubPane.setNode(node); |
| 50 return WebInspector.AccessibilityModel.fromTarget(node.target()).getAXNo
de(node.id) | 65 return WebInspector.AccessibilityModel.fromTarget(node.target()).getAXNo
deChain(node.id) |
| 51 .then(accessibilityNodeCallback.bind(this)); | 66 .then((nodes) => { this.accessibilityNodeCallback(nodes); }); |
| 52 }, | 67 }, |
| 53 | 68 |
| 54 /** | 69 /** |
| 55 * @override | 70 * @override |
| 56 */ | 71 */ |
| 57 wasShown: function() | 72 wasShown: function() |
| 58 { | 73 { |
| 59 WebInspector.ThrottledWidget.prototype.wasShown.call(this); | 74 WebInspector.ThrottledWidget.prototype.wasShown.call(this); |
| 60 | 75 |
| 76 this._treeSubPane.setNode(this.node()); |
| 61 this._axNodeSubPane.setNode(this.node()); | 77 this._axNodeSubPane.setNode(this.node()); |
| 62 this._ariaSubPane.setNode(this.node()); | 78 this._ariaSubPane.setNode(this.node()); |
| 63 | 79 |
| 64 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn
spector.DOMModel.Events.AttrModified, this._onAttrChange, this); | 80 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); | 81 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); | 82 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); | 83 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn
spector.DOMModel.Events.ChildNodeCountUpdated, this._onNodeChange, this); |
| 68 }, | 84 }, |
| 69 | 85 |
| 70 /** | 86 /** |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 treeOutline.registerRequiredCSS("accessibility/accessibilityNode.css"); | 192 treeOutline.registerRequiredCSS("accessibility/accessibilityNode.css"); |
| 177 treeOutline.registerRequiredCSS("components/objectValue.css"); | 193 treeOutline.registerRequiredCSS("components/objectValue.css"); |
| 178 | 194 |
| 179 treeOutline.element.classList.add("hidden"); | 195 treeOutline.element.classList.add("hidden"); |
| 180 this.element.appendChild(treeOutline.element); | 196 this.element.appendChild(treeOutline.element); |
| 181 return treeOutline; | 197 return treeOutline; |
| 182 }, | 198 }, |
| 183 | 199 |
| 184 __proto__: WebInspector.SimpleView.prototype | 200 __proto__: WebInspector.SimpleView.prototype |
| 185 } | 201 } |
| OLD | NEW |