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

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

Issue 2782773002: [DevTools] Remove SDKModels' fromTarget methods (Closed)
Patch Set: Created 3 years, 8 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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
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() { 142 highlightDOMNode() {
143 if (!this.isDOMNode()) 143 if (!this.isDOMNode())
144 return; 144 return;
145 this.deferredDOMNode().resolvePromise().then(node => { 145 this.deferredDOMNode().resolvePromise().then(node => {
146 SDK.DOMModel.fromTarget(this.target()).nodeHighlightRequested(node.id); 146 this.target().model(SDK.DOMModel).nodeHighlightRequested(node.id);
caseq 2017/03/29 17:48:42 just do this.deferredDOMNode().highlight() instead
dgozman 2017/04/01 00:22:44 Done.
147 }); 147 });
148 } 148 }
149 149
150 /** 150 /**
151 * @return {!Array<!Accessibility.AccessibilityNode>} 151 * @return {!Array<!Accessibility.AccessibilityNode>}
152 */ 152 */
153 children() { 153 children() {
154 var children = []; 154 var children = [];
155 if (!this._childIds) 155 if (!this._childIds)
156 return children; 156 return children;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 */ 216 */
217 constructor(target) { 217 constructor(target) {
218 super(target); 218 super(target);
219 this._agent = target.accessibilityAgent(); 219 this._agent = target.accessibilityAgent();
220 220
221 /** @type {!Map<string, !Accessibility.AccessibilityNode>} */ 221 /** @type {!Map<string, !Accessibility.AccessibilityNode>} */
222 this._axIdToAXNode = new Map(); 222 this._axIdToAXNode = new Map();
223 this._backendDOMNodeIdToAXNode = new Map(); 223 this._backendDOMNodeIdToAXNode = new Map();
224 } 224 }
225 225
226 /**
227 * @param {!SDK.Target} target
228 * @return {?Accessibility.AccessibilityModel}
229 */
230 static fromTarget(target) {
231 return target.model(Accessibility.AccessibilityModel);
232 }
233
234 clear() { 226 clear() {
235 this._axIdToAXNode.clear(); 227 this._axIdToAXNode.clear();
236 } 228 }
237 229
238 /** 230 /**
239 * @param {!SDK.DOMNode} node 231 * @param {!SDK.DOMNode} node
240 * @return {!Promise} 232 * @return {!Promise}
241 */ 233 */
242 requestPartialAXTree(node) { 234 requestPartialAXTree(node) {
243 /** 235 /**
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 */ 297 */
306 logTree(inspectedNode) { 298 logTree(inspectedNode) {
307 var rootNode = inspectedNode; 299 var rootNode = inspectedNode;
308 while (rootNode.parentNode()) 300 while (rootNode.parentNode())
309 rootNode = rootNode.parentNode(); 301 rootNode = rootNode.parentNode();
310 console.log(rootNode.printSelfAndChildren(inspectedNode)); // eslint-disabl e-line no-console 302 console.log(rootNode.printSelfAndChildren(inspectedNode)); // eslint-disabl e-line no-console
311 } 303 }
312 }; 304 };
313 305
314 SDK.SDKModel.register(Accessibility.AccessibilityModel, SDK.Target.Capability.DO M, false); 306 SDK.SDKModel.register(Accessibility.AccessibilityModel, SDK.Target.Capability.DO M, false);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698