| 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 * @unrestricted | 5 * @unrestricted |
| 6 */ | 6 */ |
| 7 WebInspector.AccessibilitySidebarView = class extends WebInspector.ThrottledWidg
et { | 7 WebInspector.AccessibilitySidebarView = class extends WebInspector.ThrottledWidg
et { |
| 8 constructor() { | 8 constructor() { |
| 9 super(); | 9 super(); |
| 10 this._node = null; | 10 this._node = null; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 } | 22 } |
| 23 | 23 |
| 24 /** | 24 /** |
| 25 * @return {?WebInspector.DOMNode} | 25 * @return {?WebInspector.DOMNode} |
| 26 */ | 26 */ |
| 27 node() { | 27 node() { |
| 28 return this._node; | 28 return this._node; |
| 29 } | 29 } |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @param {?Array<!WebInspector.AccessibilityNode>} nodes | 32 * @param {?WebInspector.AccessibilityNode} axNode |
| 33 */ | 33 */ |
| 34 accessibilityNodeCallback(nodes) { | 34 accessibilityNodeCallback(axNode) { |
| 35 if (!nodes) | 35 if (!axNode) |
| 36 return; | 36 return; |
| 37 | 37 |
| 38 var currentAXNode = nodes[0]; | 38 this._axNode = axNode; |
| 39 if (currentAXNode.ignored) | 39 |
| 40 if (axNode.ignored()) |
| 40 this._sidebarPaneStack.removeView(this._ariaSubPane); | 41 this._sidebarPaneStack.removeView(this._ariaSubPane); |
| 41 else | 42 else |
| 42 this._sidebarPaneStack.showView(this._ariaSubPane, this._axNodeSubPane); | 43 this._sidebarPaneStack.showView(this._ariaSubPane, this._axNodeSubPane); |
| 43 | 44 |
| 44 if (this._axNodeSubPane) | 45 if (this._axNodeSubPane) |
| 45 this._axNodeSubPane.setAXNode(currentAXNode); | 46 this._axNodeSubPane.setAXNode(axNode); |
| 46 if (this._treeSubPane) | 47 if (this._treeSubPane) |
| 47 this._treeSubPane.setAXNodeAndAncestors(nodes); | 48 this._treeSubPane.setAXNode(axNode); |
| 48 } | 49 } |
| 49 | 50 |
| 50 /** | 51 /** |
| 51 * @override | 52 * @override |
| 52 * @protected | 53 * @protected |
| 53 * @return {!Promise.<?>} | 54 * @return {!Promise.<?>} |
| 54 */ | 55 */ |
| 55 doUpdate() { | 56 doUpdate() { |
| 56 var node = this.node(); | 57 var node = this.node(); |
| 57 this._treeSubPane.setNode(node); | 58 this._treeSubPane.setNode(node); |
| 58 this._axNodeSubPane.setNode(node); | 59 this._axNodeSubPane.setNode(node); |
| 59 this._ariaSubPane.setNode(node); | 60 this._ariaSubPane.setNode(node); |
| 60 return WebInspector.AccessibilityModel.fromTarget(node.target()).getAXNodeCh
ain(node).then((nodes) => { | 61 if (!node) |
| 61 this.accessibilityNodeCallback(nodes); | 62 return Promise.resolve(); |
| 62 }); | 63 var accessibilityModel = WebInspector.AccessibilityModel.fromTarget(node.tar
get()); |
| 64 accessibilityModel.clear(); |
| 65 return accessibilityModel.requestPartialAXTree(node) |
| 66 .then(() => { |
| 67 this.accessibilityNodeCallback(accessibilityModel.axNodeForDOMNode(nod
e)); |
| 68 }); |
| 63 } | 69 } |
| 64 | 70 |
| 65 /** | 71 /** |
| 66 * @override | 72 * @override |
| 67 */ | 73 */ |
| 68 wasShown() { | 74 wasShown() { |
| 69 super.wasShown(); | 75 super.wasShown(); |
| 70 | 76 |
| 71 this._treeSubPane.setNode(this.node()); | 77 this._treeSubPane.setNode(this.node()); |
| 72 this._axNodeSubPane.setNode(this.node()); | 78 this._axNodeSubPane.setNode(this.node()); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 createTreeOutline() { | 185 createTreeOutline() { |
| 180 var treeOutline = new TreeOutlineInShadow(); | 186 var treeOutline = new TreeOutlineInShadow(); |
| 181 treeOutline.registerRequiredCSS('accessibility/accessibilityNode.css'); | 187 treeOutline.registerRequiredCSS('accessibility/accessibilityNode.css'); |
| 182 treeOutline.registerRequiredCSS('components/objectValue.css'); | 188 treeOutline.registerRequiredCSS('components/objectValue.css'); |
| 183 | 189 |
| 184 treeOutline.element.classList.add('hidden'); | 190 treeOutline.element.classList.add('hidden'); |
| 185 this.element.appendChild(treeOutline.element); | 191 this.element.appendChild(treeOutline.element); |
| 186 return treeOutline; | 192 return treeOutline; |
| 187 } | 193 } |
| 188 }; | 194 }; |
| OLD | NEW |