Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(325)

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/accessibility/AXTreePane.js

Issue 2614553002: Don't sync DOM selection for root a11y node (Closed)
Patch Set: Use arrow function Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilitySidebarView.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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.AXTreePane = class extends Accessibility.AccessibilitySubPane { 7 Accessibility.AXTreePane = class extends Accessibility.AccessibilitySubPane {
8 constructor() { 8 /**
9 * @param {!Accessibility.AccessibilitySidebarView} axSidebarView
10 */
11 constructor(axSidebarView) {
9 super(Common.UIString('Accessibility Tree')); 12 super(Common.UIString('Accessibility Tree'));
10 13
14 this._axSidebarView = axSidebarView;
11 this._treeOutline = this.createTreeOutline(); 15 this._treeOutline = this.createTreeOutline();
12 16
13 this.element.classList.add('accessibility-computed'); 17 this.element.classList.add('accessibility-computed');
14 18
15 this._expandedNodes = new Set(); 19 this._expandedNodes = new Set();
16 } 20 }
17 21
18 /** 22 /**
19 * @param {?Accessibility.AccessibilityNode} axNode 23 * @param {?Accessibility.AccessibilityNode} axNode
20 * @override 24 * @override
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 74 }
71 75
72 inspectedNodeTreeElement.selectable = true; 76 inspectedNodeTreeElement.selectable = true;
73 inspectedNodeTreeElement.select(!this._selectedByUser /* omitFocus */, false ); 77 inspectedNodeTreeElement.select(!this._selectedByUser /* omitFocus */, false );
74 if (this.isExpanded(axNode.backendDOMNodeId())) 78 if (this.isExpanded(axNode.backendDOMNodeId()))
75 inspectedNodeTreeElement.expand(); 79 inspectedNodeTreeElement.expand();
76 this.clearSelectedByUser(); 80 this.clearSelectedByUser();
77 } 81 }
78 82
79 /** 83 /**
84 * @param {!Accessibility.AccessibilityNode} axNode
85 */
86 setSelectedNode(axNode) {
87 if (axNode.parentNode()) {
88 Common.Revealer.reveal(axNode.deferredDOMNode());
89 } else {
90 // Only set the node for the accessibility panel, not the Elements tree.
91 var axSidebarView = this._axSidebarView;
92 axNode.deferredDOMNode().resolve((node) => {
93 axSidebarView.setNode(node);
94 });
95 }
96 }
97
98 /**
80 * @param {boolean} selectedByUser 99 * @param {boolean} selectedByUser
81 */ 100 */
82 setSelectedByUser(selectedByUser) { 101 setSelectedByUser(selectedByUser) {
83 this._selectedByUser = true; 102 this._selectedByUser = true;
84 } 103 }
85 104
86 clearSelectedByUser() { 105 clearSelectedByUser() {
87 delete this._selectedByUser; 106 delete this._selectedByUser;
88 } 107 }
89 108
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 149
131 this.element = UI.Icon.create('smallicon-arrow-in-circle', 'inspect-dom-node '); 150 this.element = UI.Icon.create('smallicon-arrow-in-circle', 'inspect-dom-node ');
132 this.element.addEventListener('mousedown', this._handleMouseDown.bind(this)) ; 151 this.element.addEventListener('mousedown', this._handleMouseDown.bind(this)) ;
133 } 152 }
134 153
135 /** 154 /**
136 * @param {!Event} event 155 * @param {!Event} event
137 */ 156 */
138 _handleMouseDown(event) { 157 _handleMouseDown(event) {
139 this._treePane.setSelectedByUser(true); 158 this._treePane.setSelectedByUser(true);
140 Common.Revealer.reveal(this._axNode.deferredDOMNode()); 159 this._treePane.setSelectedNode(this._axNode);
141 } 160 }
142 }; 161 };
143 162
144 /** 163 /**
145 * @unrestricted 164 * @unrestricted
146 */ 165 */
147 Accessibility.AXNodeTreeElement = class extends UI.TreeElement { 166 Accessibility.AXNodeTreeElement = class extends UI.TreeElement {
148 /** 167 /**
149 * @param {!Accessibility.AccessibilityNode} axNode 168 * @param {!Accessibility.AccessibilityNode} axNode
150 * @param {!Accessibility.AXTreePane} treePane 169 * @param {!Accessibility.AXTreePane} treePane
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 * @param {!Event} event 217 * @param {!Event} event
199 * @return {boolean} 218 * @return {boolean}
200 */ 219 */
201 ondblclick(event) { 220 ondblclick(event) {
202 this.inspectDOMNode(); 221 this.inspectDOMNode();
203 return true; 222 return true;
204 } 223 }
205 224
206 inspectDOMNode() { 225 inspectDOMNode() {
207 this._treePane.setSelectedByUser(true); 226 this._treePane.setSelectedByUser(true);
208 Common.Revealer.reveal(this._axNode.deferredDOMNode()); 227 this._treePane.setSelectedNode(this._axNode);
209 } 228 }
210 229
211 /** 230 /**
212 * @override 231 * @override
213 */ 232 */
214 onattach() { 233 onattach() {
215 this._update(); 234 this._update();
216 } 235 }
217 236
218 _update() { 237 _update() {
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 continue; 428 continue;
410 } 429 }
411 siblingTreeElement = new Accessibility.AXNodeTreeElement(sibling, this._tr eePane); 430 siblingTreeElement = new Accessibility.AXNodeTreeElement(sibling, this._tr eePane);
412 if (foundInspectedNode) 431 if (foundInspectedNode)
413 this.appendChild(siblingTreeElement); 432 this.appendChild(siblingTreeElement);
414 else 433 else
415 this.insertChild(siblingTreeElement, nextIndex++); 434 this.insertChild(siblingTreeElement, nextIndex++);
416 } 435 }
417 } 436 }
418 }; 437 };
OLDNEW
« no previous file with comments | « no previous file | third_party/WebKit/Source/devtools/front_end/accessibility/AccessibilitySidebarView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698