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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/elements/ClassesPaneWidget.js

Issue 2778283002: [DevTools] Do not inherit SDK.DOMNode from SDK.SDKObject (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) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 Elements.ClassesPaneWidget = class extends UI.Widget { 7 Elements.ClassesPaneWidget = class extends UI.Widget {
8 constructor() { 8 constructor() {
9 super(); 9 super();
10 this.element.className = 'styles-element-classes-pane'; 10 this.element.className = 'styles-element-classes-pane';
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 219
220 /** 220 /**
221 * @param {!SDK.DOMNode} selectedNode 221 * @param {!SDK.DOMNode} selectedNode
222 * @return {!Promise.<!Array.<string>>} 222 * @return {!Promise.<!Array.<string>>}
223 */ 223 */
224 _getClassNames(selectedNode) { 224 _getClassNames(selectedNode) {
225 var promises = []; 225 var promises = [];
226 var completions = new Set(); 226 var completions = new Set();
227 this._selectedFrameId = selectedNode.frameId(); 227 this._selectedFrameId = selectedNode.frameId();
228 228
229 var cssModel = SDK.CSSModel.fromNode(selectedNode); 229 var cssModel = selectedNode.domModel().cssModel();
230 var allStyleSheets = cssModel.allStyleSheets(); 230 var allStyleSheets = cssModel.allStyleSheets();
231 for (var stylesheet of allStyleSheets) { 231 for (var stylesheet of allStyleSheets) {
232 if (stylesheet.frameId !== this._selectedFrameId) 232 if (stylesheet.frameId !== this._selectedFrameId)
233 continue; 233 continue;
234 var cssPromise = cssModel.classNamesPromise(stylesheet.id).then(classes => completions.addAll(classes)); 234 var cssPromise = cssModel.classNamesPromise(stylesheet.id).then(classes => completions.addAll(classes));
235 promises.push(cssPromise); 235 promises.push(cssPromise);
236 } 236 }
237 237
238 var domPromise = selectedNode.domModel() 238 var domPromise = selectedNode.domModel()
239 .classNamesPromise(selectedNode.ownerDocument.id) 239 .classNamesPromise(selectedNode.ownerDocument.id)
(...skipping 19 matching lines...) Expand all
259 if (!this._classNamesPromise || this._selectedFrameId !== selectedNode.frame Id()) 259 if (!this._classNamesPromise || this._selectedFrameId !== selectedNode.frame Id())
260 this._classNamesPromise = this._getClassNames(selectedNode); 260 this._classNamesPromise = this._getClassNames(selectedNode);
261 261
262 return this._classNamesPromise.then(completions => { 262 return this._classNamesPromise.then(completions => {
263 if (prefix[0] === '.') 263 if (prefix[0] === '.')
264 completions = completions.map(value => '.' + value); 264 completions = completions.map(value => '.' + value);
265 return completions.filter(value => value.startsWith(prefix)).map(completio n => ({text: completion})); 265 return completions.filter(value => value.startsWith(prefix)).map(completio n => ({text: completion}));
266 }); 266 });
267 } 267 }
268 }; 268 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698