| 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 Accessibility.AccessibilitySidebarView = class extends UI.ThrottledWidget { | 7 Accessibility.AccessibilitySidebarView = class extends UI.ThrottledWidget { |
| 8 constructor() { | 8 constructor() { |
| 9 super(); | 9 super(); |
| 10 this._node = null; | 10 this._node = null; |
| 11 this._axNode = null; | 11 this._axNode = null; |
| 12 this._sidebarPaneStack = UI.viewManager.createStackLocation(); | 12 this._sidebarPaneStack = UI.viewManager.createStackLocation(); |
| 13 this._treeSubPane = new Accessibility.AXTreePane(); | 13 this._treeSubPane = new Accessibility.AXTreePane(this); |
| 14 this._sidebarPaneStack.showView(this._treeSubPane); | 14 this._sidebarPaneStack.showView(this._treeSubPane); |
| 15 this._ariaSubPane = new Accessibility.ARIAAttributesPane(); | 15 this._ariaSubPane = new Accessibility.ARIAAttributesPane(); |
| 16 this._sidebarPaneStack.showView(this._ariaSubPane); | 16 this._sidebarPaneStack.showView(this._ariaSubPane); |
| 17 this._axNodeSubPane = new Accessibility.AXNodeSubPane(); | 17 this._axNodeSubPane = new Accessibility.AXNodeSubPane(); |
| 18 this._sidebarPaneStack.showView(this._axNodeSubPane); | 18 this._sidebarPaneStack.showView(this._axNodeSubPane); |
| 19 this._sidebarPaneStack.widget().show(this.element); | 19 this._sidebarPaneStack.widget().show(this.element); |
| 20 UI.context.addFlavorChangeListener(SDK.DOMNode, this._pullNode, this); | 20 UI.context.addFlavorChangeListener(SDK.DOMNode, this._pullNode, this); |
| 21 this._pullNode(); | 21 this._pullNode(); |
| 22 } | 22 } |
| 23 | 23 |
| 24 /** | 24 /** |
| 25 * @return {?SDK.DOMNode} | 25 * @return {?SDK.DOMNode} |
| 26 */ | 26 */ |
| 27 node() { | 27 node() { |
| 28 return this._node; | 28 return this._node; |
| 29 } | 29 } |
| 30 | 30 |
| 31 /** | 31 /** |
| 32 * @param {?SDK.DOMNode} node |
| 33 */ |
| 34 setNode(node) { |
| 35 this._node = node; |
| 36 this.update(); |
| 37 } |
| 38 |
| 39 /** |
| 32 * @param {?Accessibility.AccessibilityNode} axNode | 40 * @param {?Accessibility.AccessibilityNode} axNode |
| 33 */ | 41 */ |
| 34 accessibilityNodeCallback(axNode) { | 42 accessibilityNodeCallback(axNode) { |
| 35 if (!axNode) | 43 if (!axNode) |
| 36 return; | 44 return; |
| 37 | 45 |
| 38 this._axNode = axNode; | 46 this._axNode = axNode; |
| 39 | 47 |
| 40 if (axNode.ignored()) | 48 if (axNode.ignored()) |
| 41 this._sidebarPaneStack.removeView(this._ariaSubPane); | 49 this._sidebarPaneStack.removeView(this._ariaSubPane); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 willHide() { | 99 willHide() { |
| 92 SDK.targetManager.removeModelListener(SDK.DOMModel, SDK.DOMModel.Events.Attr
Modified, this._onAttrChange, this); | 100 SDK.targetManager.removeModelListener(SDK.DOMModel, SDK.DOMModel.Events.Attr
Modified, this._onAttrChange, this); |
| 93 SDK.targetManager.removeModelListener(SDK.DOMModel, SDK.DOMModel.Events.Attr
Removed, this._onAttrChange, this); | 101 SDK.targetManager.removeModelListener(SDK.DOMModel, SDK.DOMModel.Events.Attr
Removed, this._onAttrChange, this); |
| 94 SDK.targetManager.removeModelListener( | 102 SDK.targetManager.removeModelListener( |
| 95 SDK.DOMModel, SDK.DOMModel.Events.CharacterDataModified, this._onNodeCha
nge, this); | 103 SDK.DOMModel, SDK.DOMModel.Events.CharacterDataModified, this._onNodeCha
nge, this); |
| 96 SDK.targetManager.removeModelListener( | 104 SDK.targetManager.removeModelListener( |
| 97 SDK.DOMModel, SDK.DOMModel.Events.ChildNodeCountUpdated, this._onNodeCha
nge, this); | 105 SDK.DOMModel, SDK.DOMModel.Events.ChildNodeCountUpdated, this._onNodeCha
nge, this); |
| 98 } | 106 } |
| 99 | 107 |
| 100 _pullNode() { | 108 _pullNode() { |
| 101 this._node = UI.context.flavor(SDK.DOMNode); | 109 this.setNode(UI.context.flavor(SDK.DOMNode)); |
| 102 this.update(); | |
| 103 } | 110 } |
| 104 | 111 |
| 105 /** | 112 /** |
| 106 * @param {!Common.Event} event | 113 * @param {!Common.Event} event |
| 107 */ | 114 */ |
| 108 _onAttrChange(event) { | 115 _onAttrChange(event) { |
| 109 if (!this.node()) | 116 if (!this.node()) |
| 110 return; | 117 return; |
| 111 var node = event.data.node; | 118 var node = event.data.node; |
| 112 if (this.node() !== node) | 119 if (this.node() !== node) |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 createTreeOutline() { | 187 createTreeOutline() { |
| 181 var treeOutline = new UI.TreeOutlineInShadow(); | 188 var treeOutline = new UI.TreeOutlineInShadow(); |
| 182 treeOutline.registerRequiredCSS('accessibility/accessibilityNode.css'); | 189 treeOutline.registerRequiredCSS('accessibility/accessibilityNode.css'); |
| 183 treeOutline.registerRequiredCSS('components/objectValue.css'); | 190 treeOutline.registerRequiredCSS('components/objectValue.css'); |
| 184 | 191 |
| 185 treeOutline.element.classList.add('hidden'); | 192 treeOutline.element.classList.add('hidden'); |
| 186 this.element.appendChild(treeOutline.element); | 193 this.element.appendChild(treeOutline.element); |
| 187 return treeOutline; | 194 return treeOutline; |
| 188 } | 195 } |
| 189 }; | 196 }; |
| OLD | NEW |