Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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._workspace = workspace; | |
| 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 Loading... | |
| 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 header = rawLocation.header(); | |
| 236 if (!header) | |
| 237 return null; | |
| 238 var uiSourceCode = Bindings.NetworkProject.uiSourceCodeForResourceURL( | |
|
dgozman
2017/05/17 16:46:20
Should we have a ResourceMapping which will do thi
lushnikov
2017/05/20 01:24:18
Done - introduced here: https://codereview.chromiu
| |
| 239 header.cssModel().target(), this._workspace, rawLocation.url, header.fra meId); | |
| 240 if (!uiSourceCode) | |
| 241 return null; | |
| 242 return uiSourceCode.uiLocation(rawLocation.lineNumber, rawLocation.columnNum ber); | |
| 233 } | 243 } |
| 234 | 244 |
| 235 /** | 245 /** |
| 236 * @param {!Workspace.UILocation} uiLocation | 246 * @param {!Workspace.UILocation} uiLocation |
| 237 * @return {!Array<!SDK.CSSLocation>} | 247 * @return {!Array<!SDK.CSSLocation>} |
| 238 */ | 248 */ |
| 239 _uiLocationToRawLocations(uiLocation) { | 249 _uiLocationToRawLocations(uiLocation) { |
| 240 var rawLocations = this._sassSourceMapping.uiLocationToRawLocations(uiLocati on); | 250 var rawLocations = this._sassSourceMapping.uiLocationToRawLocations(uiLocati on); |
| 241 if (rawLocations.length) | 251 if (rawLocations.length) |
| 242 return rawLocations; | 252 return rawLocations; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 295 */ | 305 */ |
| 296 isBlackboxed() { | 306 isBlackboxed() { |
| 297 return false; | 307 return false; |
| 298 } | 308 } |
| 299 }; | 309 }; |
| 300 | 310 |
| 301 /** | 311 /** |
| 302 * @type {!Bindings.CSSWorkspaceBinding} | 312 * @type {!Bindings.CSSWorkspaceBinding} |
| 303 */ | 313 */ |
| 304 Bindings.cssWorkspaceBinding; | 314 Bindings.cssWorkspaceBinding; |
| OLD | NEW |