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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/bindings/CSSWorkspaceBinding.js

Issue 2893073002: DevTools: introduce ResourceMapping (Closed)
Patch Set: cleanup test Created 3 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 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 /** 5 /**
6 * @implements {SDK.SDKModelObserver<!SDK.CSSModel>} 6 * @implements {SDK.SDKModelObserver<!SDK.CSSModel>}
7 */ 7 */
8 Bindings.CSSWorkspaceBinding = class { 8 Bindings.CSSWorkspaceBinding = class {
9 /** 9 /**
10 * @param {!SDK.TargetManager} targetManager 10 * @param {!SDK.TargetManager} targetManager
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 */ 133 */
134 uiLocationToRawLocations(uiLocation) {}, 134 uiLocationToRawLocations(uiLocation) {},
135 }; 135 };
136 136
137 Bindings.CSSWorkspaceBinding.ModelInfo = class { 137 Bindings.CSSWorkspaceBinding.ModelInfo = class {
138 /** 138 /**
139 * @param {!SDK.CSSModel} cssModel 139 * @param {!SDK.CSSModel} cssModel
140 * @param {!Workspace.Workspace} workspace 140 * @param {!Workspace.Workspace} workspace
141 */ 141 */
142 constructor(cssModel, workspace) { 142 constructor(cssModel, workspace) {
143 this._target = cssModel.target();
143 this._eventListeners = [ 144 this._eventListeners = [
144 cssModel.addEventListener(SDK.CSSModel.Events.StyleSheetAdded, this._style SheetAdded, this), 145 cssModel.addEventListener(SDK.CSSModel.Events.StyleSheetAdded, this._style SheetAdded, this),
145 cssModel.addEventListener(SDK.CSSModel.Events.StyleSheetRemoved, this._sty leSheetRemoved, this) 146 cssModel.addEventListener(SDK.CSSModel.Events.StyleSheetRemoved, this._sty leSheetRemoved, this)
146 ]; 147 ];
147 148
148 this._stylesSourceMapping = new Bindings.StylesSourceMapping(cssModel, works pace); 149 this._stylesSourceMapping = new Bindings.StylesSourceMapping(cssModel, works pace);
149 var sourceMapManager = cssModel.sourceMapManager(); 150 var sourceMapManager = cssModel.sourceMapManager();
150 this._sassSourceMapping = new Bindings.SASSSourceMapping(cssModel.target(), sourceMapManager, workspace); 151 this._sassSourceMapping = new Bindings.SASSSourceMapping(cssModel.target(), sourceMapManager, workspace);
151 152
152 /** @type {!Multimap<!SDK.CSSStyleSheetHeader, !Bindings.CSSWorkspaceBinding .LiveLocation>} */ 153 /** @type {!Multimap<!SDK.CSSStyleSheetHeader, !Bindings.CSSWorkspaceBinding .LiveLocation>} */
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 } 223 }
223 224
224 /** 225 /**
225 * @param {!SDK.CSSLocation} rawLocation 226 * @param {!SDK.CSSLocation} rawLocation
226 * @return {?Workspace.UILocation} 227 * @return {?Workspace.UILocation}
227 */ 228 */
228 _rawLocationToUILocation(rawLocation) { 229 _rawLocationToUILocation(rawLocation) {
229 var uiLocation = null; 230 var uiLocation = null;
230 uiLocation = uiLocation || this._sassSourceMapping.rawLocationToUILocation(r awLocation); 231 uiLocation = uiLocation || this._sassSourceMapping.rawLocationToUILocation(r awLocation);
231 uiLocation = uiLocation || this._stylesSourceMapping.rawLocationToUILocation (rawLocation); 232 uiLocation = uiLocation || this._stylesSourceMapping.rawLocationToUILocation (rawLocation);
232 return uiLocation; 233 if (uiLocation)
234 return uiLocation;
235 var resourceBinding = Bindings.ResourceBinding.forTarget(this._target);
236 var uiSourceCode = resourceBinding ? resourceBinding.uiSourceCodeForURL(rawL ocation.url) : null;
dgozman 2017/05/19 23:51:05 Bindings.ResourceBinding.uiSourceCodeForURL(this._
lushnikov 2017/06/09 01:29:07 Done.
237 return uiSourceCode ? uiSourceCode.uiLocation(rawLocation.lineNumber, rawLoc ation.columnNumber) : null;
233 } 238 }
234 239
235 /** 240 /**
236 * @param {!Workspace.UILocation} uiLocation 241 * @param {!Workspace.UILocation} uiLocation
237 * @return {!Array<!SDK.CSSLocation>} 242 * @return {!Array<!SDK.CSSLocation>}
238 */ 243 */
239 _uiLocationToRawLocations(uiLocation) { 244 _uiLocationToRawLocations(uiLocation) {
240 var rawLocations = this._sassSourceMapping.uiLocationToRawLocations(uiLocati on); 245 var rawLocations = this._sassSourceMapping.uiLocationToRawLocations(uiLocati on);
241 if (rawLocations.length) 246 if (rawLocations.length)
242 return rawLocations; 247 return rawLocations;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 */ 300 */
296 isBlackboxed() { 301 isBlackboxed() {
297 return false; 302 return false;
298 } 303 }
299 }; 304 };
300 305
301 /** 306 /**
302 * @type {!Bindings.CSSWorkspaceBinding} 307 * @type {!Bindings.CSSWorkspaceBinding}
303 */ 308 */
304 Bindings.cssWorkspaceBinding; 309 Bindings.cssWorkspaceBinding;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698