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

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

Issue 2611993003: [DevTools] Accessibility pane: Sync highlight between a11y pane and DOM pane (Closed)
Patch Set: rebase Created 3 years, 10 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
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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.AccessibilityNode = class extends SDK.SDKObject { 7 Accessibility.AccessibilityNode = class extends SDK.SDKObject {
8 /** 8 /**
9 * @param {!Accessibility.AccessibilityModel} accessibilityModel 9 * @param {!Accessibility.AccessibilityModel} accessibilityModel
10 * @param {!Protocol.Accessibility.AXNode} payload 10 * @param {!Protocol.Accessibility.AXNode} payload
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 return this._backendDOMNodeId; 132 return this._backendDOMNodeId;
133 } 133 }
134 134
135 /** 135 /**
136 * @return {?SDK.DeferredDOMNode} 136 * @return {?SDK.DeferredDOMNode}
137 */ 137 */
138 deferredDOMNode() { 138 deferredDOMNode() {
139 return this._deferredDOMNode; 139 return this._deferredDOMNode;
140 } 140 }
141 141
142 highlightDOMNode() {
143 if (!this.isDOMNode())
144 return;
145 this.deferredDOMNode().resolvePromise().then((node) => {
146 SDK.DOMModel.fromTarget(this.target()).nodeHighlightRequested(node.id);
147 });
148 }
149
142 /** 150 /**
143 * @return {!Array<!Accessibility.AccessibilityNode>} 151 * @return {!Array<!Accessibility.AccessibilityNode>}
144 */ 152 */
145 children() { 153 children() {
146 var children = []; 154 var children = [];
147 if (!this._childIds) 155 if (!this._childIds)
148 return children; 156 return children;
149 157
150 for (var childId of this._childIds) { 158 for (var childId of this._childIds) {
151 var child = this._accessibilityModel.axNodeForId(childId); 159 var child = this._accessibilityModel.axNodeForId(childId);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 */ 308 */
301 logTree(inspectedNode) { 309 logTree(inspectedNode) {
302 var rootNode = inspectedNode; 310 var rootNode = inspectedNode;
303 while (rootNode.parentNode()) 311 while (rootNode.parentNode())
304 rootNode = rootNode.parentNode(); 312 rootNode = rootNode.parentNode();
305 console.log(rootNode.printSelfAndChildren(inspectedNode)); // eslint-disabl e-line no-console 313 console.log(rootNode.printSelfAndChildren(inspectedNode)); // eslint-disabl e-line no-console
306 } 314 }
307 }; 315 };
308 316
309 Accessibility.AccessibilityModel._symbol = Symbol('AccessibilityModel'); 317 Accessibility.AccessibilityModel._symbol = Symbol('AccessibilityModel');
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698