| 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.ThrottledView} | 7 * @extends {WebInspector.ThrottledView} |
| 8 */ | 8 */ |
| 9 WebInspector.AccessibilitySidebarView = function() | 9 WebInspector.AccessibilitySidebarView = function() |
| 10 { | 10 { |
| 11 WebInspector.ThrottledView.call(this, WebInspector.UIString("Accessibility")
); | 11 WebInspector.ThrottledView.call(this, WebInspector.UIString("Accessibility")
); |
| 12 this._axNodeSubPane = null; | |
| 13 this._node = null; | 12 this._node = null; |
| 14 this._sidebarPaneStack = new WebInspector.View.ExpandableStackContainer(); | 13 this._sidebarPaneStack = new WebInspector.View.ExpandableStackContainer(); |
| 14 this._ariaSubPane = new WebInspector.ARIAAttributesPane(); |
| 15 this._sidebarPaneStack.appendView(this._ariaSubPane, true); |
| 15 this._axNodeSubPane = new WebInspector.AXNodeSubPane(); | 16 this._axNodeSubPane = new WebInspector.AXNodeSubPane(); |
| 16 this._sidebarPaneStack.appendView(this._axNodeSubPane, true); | 17 this._sidebarPaneStack.appendView(this._axNodeSubPane, true); |
| 17 this._sidebarPaneStack.show(this.element); | 18 this._sidebarPaneStack.show(this.element); |
| 18 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this._pul
lNode, this); | 19 WebInspector.context.addFlavorChangeListener(WebInspector.DOMNode, this._pul
lNode, this); |
| 19 this._pullNode(); | 20 this._pullNode(); |
| 20 } | 21 } |
| 21 | 22 |
| 22 WebInspector.AccessibilitySidebarView.prototype = { | 23 WebInspector.AccessibilitySidebarView.prototype = { |
| 23 /** | 24 /** |
| 24 * @return {?WebInspector.DOMNode} | 25 * @return {?WebInspector.DOMNode} |
| (...skipping 11 matching lines...) Expand all Loading... |
| 36 doUpdate: function() | 37 doUpdate: function() |
| 37 { | 38 { |
| 38 /** | 39 /** |
| 39 * @param {?AccessibilityAgent.AXNode} accessibilityNode | 40 * @param {?AccessibilityAgent.AXNode} accessibilityNode |
| 40 * @this {WebInspector.AccessibilitySidebarView} | 41 * @this {WebInspector.AccessibilitySidebarView} |
| 41 */ | 42 */ |
| 42 function accessibilityNodeCallback(accessibilityNode) | 43 function accessibilityNodeCallback(accessibilityNode) |
| 43 { | 44 { |
| 44 if (this._axNodeSubPane) | 45 if (this._axNodeSubPane) |
| 45 this._axNodeSubPane.setAXNode(accessibilityNode); | 46 this._axNodeSubPane.setAXNode(accessibilityNode); |
| 47 this._accessibilityNodeUpdatedForTest(); |
| 46 } | 48 } |
| 47 var node = this.node(); | 49 var node = this.node(); |
| 48 return WebInspector.AccessibilityModel.fromTarget(node.target()).getAXNo
de(node.id) | 50 return WebInspector.AccessibilityModel.fromTarget(node.target()).getAXNo
de(node.id) |
| 49 .then(accessibilityNodeCallback.bind(this)) | 51 .then(accessibilityNodeCallback.bind(this)) |
| 50 }, | 52 }, |
| 51 | 53 |
| 54 _accessibilityNodeUpdatedForTest: function() |
| 55 { |
| 56 // For sniffing in tests. |
| 57 }, |
| 58 |
| 52 /** | 59 /** |
| 53 * @override | 60 * @override |
| 54 */ | 61 */ |
| 55 wasShown: function() | 62 wasShown: function() |
| 56 { | 63 { |
| 57 WebInspector.ThrottledView.prototype.wasShown.call(this); | 64 WebInspector.ThrottledView.prototype.wasShown.call(this); |
| 58 | 65 |
| 59 this._axNodeSubPane.setNode(this.node()); | 66 this._axNodeSubPane.setNode(this.node()); |
| 67 this._ariaSubPane.setNode(this.node()); |
| 60 | 68 |
| 61 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn
spector.DOMModel.Events.AttrModified, this._onAttrChange, this); | 69 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn
spector.DOMModel.Events.AttrModified, this._onAttrChange, this); |
| 62 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn
spector.DOMModel.Events.AttrRemoved, this._onAttrChange, this); | 70 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn
spector.DOMModel.Events.AttrRemoved, this._onAttrChange, this); |
| 63 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn
spector.DOMModel.Events.CharacterDataModified, this._onNodeChange, this); | 71 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn
spector.DOMModel.Events.CharacterDataModified, this._onNodeChange, this); |
| 64 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn
spector.DOMModel.Events.ChildNodeCountUpdated, this._onNodeChange, this); | 72 WebInspector.targetManager.addModelListener(WebInspector.DOMModel, WebIn
spector.DOMModel.Events.ChildNodeCountUpdated, this._onNodeChange, this); |
| 65 }, | 73 }, |
| 66 | 74 |
| 67 /** | 75 /** |
| 68 * @override | 76 * @override |
| 69 */ | 77 */ |
| 70 willHide: function() | 78 willHide: function() |
| 71 { | 79 { |
| 72 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We
bInspector.DOMModel.Events.AttrModified, this._onAttrChange, this); | 80 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We
bInspector.DOMModel.Events.AttrModified, this._onAttrChange, this); |
| 73 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We
bInspector.DOMModel.Events.AttrRemoved, this._onAttrChange, this); | 81 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We
bInspector.DOMModel.Events.AttrRemoved, this._onAttrChange, this); |
| 74 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We
bInspector.DOMModel.Events.CharacterDataModified, this._onNodeChange, this); | 82 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We
bInspector.DOMModel.Events.CharacterDataModified, this._onNodeChange, this); |
| 75 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We
bInspector.DOMModel.Events.ChildNodeCountUpdated, this._onNodeChange, this); | 83 WebInspector.targetManager.removeModelListener(WebInspector.DOMModel, We
bInspector.DOMModel.Events.ChildNodeCountUpdated, this._onNodeChange, this); |
| 76 }, | 84 }, |
| 77 | 85 |
| 78 _pullNode: function() | 86 _pullNode: function() |
| 79 { | 87 { |
| 80 this._node = WebInspector.context.flavor(WebInspector.DOMNode); | 88 this._node = WebInspector.context.flavor(WebInspector.DOMNode); |
| 89 this._ariaSubPane.setNode(this._node); |
| 81 this._axNodeSubPane.setNode(this._node); | 90 this._axNodeSubPane.setNode(this._node); |
| 82 this.update(); | 91 this.update(); |
| 83 }, | 92 }, |
| 84 | 93 |
| 85 /** | 94 /** |
| 86 * @param {!WebInspector.Event} event | 95 * @param {!WebInspector.Event} event |
| 87 */ | 96 */ |
| 88 _onAttrChange: function(event) | 97 _onAttrChange: function(event) |
| 89 { | 98 { |
| 90 if (!this.node()) | 99 if (!this.node()) |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 treeOutline.registerRequiredCSS("accessibility/accessibilityNode.css"); | 181 treeOutline.registerRequiredCSS("accessibility/accessibilityNode.css"); |
| 173 treeOutline.registerRequiredCSS("components/objectValue.css"); | 182 treeOutline.registerRequiredCSS("components/objectValue.css"); |
| 174 | 183 |
| 175 treeOutline.element.classList.add("hidden"); | 184 treeOutline.element.classList.add("hidden"); |
| 176 this.element.appendChild(treeOutline.element); | 185 this.element.appendChild(treeOutline.element); |
| 177 return treeOutline; | 186 return treeOutline; |
| 178 }, | 187 }, |
| 179 | 188 |
| 180 __proto__: WebInspector.View.prototype | 189 __proto__: WebInspector.View.prototype |
| 181 } | 190 } |
| OLD | NEW |