Chromium Code Reviews| 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 return accessibilityModel.setDOMNode(node) | |
|
dgozman
2016/11/03 22:07:29
Instead of this, I propose to:
- call accessibilit
aboxhall
2016/11/04 22:31:17
Done, I think. Was this what you had in mind?
| |
| 65 .then(accessibilityModel.resolveAllDOMNodes.bind(accessibilityModel)) | |
| 66 .then(accessibilityModel.getInspectedAXNode.bind(accessibilityModel)) | |
| 67 .then((axNode) => { | |
| 68 this.accessibilityNodeCallback(axNode); | |
| 69 }); | |
| 63 } | 70 } |
| 64 | 71 |
| 65 /** | 72 /** |
| 66 * @override | 73 * @override |
| 67 */ | 74 */ |
| 68 wasShown() { | 75 wasShown() { |
| 69 super.wasShown(); | 76 super.wasShown(); |
| 70 | 77 |
| 71 this._treeSubPane.setNode(this.node()); | 78 this._treeSubPane.setNode(this.node()); |
| 72 this._axNodeSubPane.setNode(this.node()); | 79 this._axNodeSubPane.setNode(this.node()); |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 179 createTreeOutline() { | 186 createTreeOutline() { |
| 180 var treeOutline = new TreeOutlineInShadow(); | 187 var treeOutline = new TreeOutlineInShadow(); |
| 181 treeOutline.registerRequiredCSS('accessibility/accessibilityNode.css'); | 188 treeOutline.registerRequiredCSS('accessibility/accessibilityNode.css'); |
| 182 treeOutline.registerRequiredCSS('components/objectValue.css'); | 189 treeOutline.registerRequiredCSS('components/objectValue.css'); |
| 183 | 190 |
| 184 treeOutline.element.classList.add('hidden'); | 191 treeOutline.element.classList.add('hidden'); |
| 185 this.element.appendChild(treeOutline.element); | 192 this.element.appendChild(treeOutline.element); |
| 186 return treeOutline; | 193 return treeOutline; |
| 187 } | 194 } |
| 188 }; | 195 }; |
| OLD | NEW |