| 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 * @constructor | 6 * @constructor |
| 7 * @implements {WebInspector.TargetManager.Observer} | 7 * @implements {WebInspector.TargetManager.Observer} |
| 8 * @param {!WebInspector.TargetManager} targetManager | 8 * @param {!WebInspector.TargetManager} targetManager |
| 9 * @param {!WebInspector.Workspace} workspace | 9 * @param {!WebInspector.Workspace} workspace |
| 10 * @param {!WebInspector.NetworkMapping} networkMapping | 10 * @param {!WebInspector.NetworkMapping} networkMapping |
| 11 */ | 11 */ |
| 12 WebInspector.CSSWorkspaceBinding = function(targetManager, workspace, networkMap
ping) | 12 WebInspector.CSSWorkspaceBinding = function(targetManager, workspace, networkMap
ping) |
| 13 { | 13 { |
| 14 this._workspace = workspace; | 14 this._workspace = workspace; |
| 15 this._networkMapping = networkMapping; | 15 this._networkMapping = networkMapping; |
| 16 | 16 |
| 17 /** @type {!Map.<!WebInspector.CSSModel, !WebInspector.CSSWorkspaceBinding.T
argetInfo>} */ | 17 /** @type {!Map.<!WebInspector.CSSModel, !WebInspector.CSSWorkspaceBinding.T
argetInfo>} */ |
| 18 this._modelToTargetInfo = new Map(); | 18 this._modelToTargetInfo = new Map(); |
| 19 targetManager.observeTargets(this); | 19 targetManager.observeTargets(this); |
| 20 } | 20 }; |
| 21 | 21 |
| 22 WebInspector.CSSWorkspaceBinding.prototype = { | 22 WebInspector.CSSWorkspaceBinding.prototype = { |
| 23 /** | 23 /** |
| 24 * @override | 24 * @override |
| 25 * @param {!WebInspector.Target} target | 25 * @param {!WebInspector.Target} target |
| 26 */ | 26 */ |
| 27 targetAdded: function(target) | 27 targetAdded: function(target) |
| 28 { | 28 { |
| 29 var cssModel = WebInspector.CSSModel.fromTarget(target); | 29 var cssModel = WebInspector.CSSModel.fromTarget(target); |
| 30 if (cssModel) | 30 if (cssModel) |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 rawLocationToUILocation: function(rawLocation) | 136 rawLocationToUILocation: function(rawLocation) |
| 137 { | 137 { |
| 138 if (!rawLocation) | 138 if (!rawLocation) |
| 139 return null; | 139 return null; |
| 140 var header = rawLocation.cssModel().styleSheetHeaderForId(rawLocation.st
yleSheetId); | 140 var header = rawLocation.cssModel().styleSheetHeaderForId(rawLocation.st
yleSheetId); |
| 141 if (!header) | 141 if (!header) |
| 142 return null; | 142 return null; |
| 143 var targetInfo = this._targetInfo(header); | 143 var targetInfo = this._targetInfo(header); |
| 144 return targetInfo ? targetInfo._rawLocationToUILocation(header, rawLocat
ion.lineNumber, rawLocation.columnNumber) : null; | 144 return targetInfo ? targetInfo._rawLocationToUILocation(header, rawLocat
ion.lineNumber, rawLocation.columnNumber) : null; |
| 145 } | 145 } |
| 146 } | 146 }; |
| 147 | 147 |
| 148 /** | 148 /** |
| 149 * @constructor | 149 * @constructor |
| 150 * @param {!WebInspector.CSSModel} cssModel | 150 * @param {!WebInspector.CSSModel} cssModel |
| 151 * @param {!WebInspector.Workspace} workspace | 151 * @param {!WebInspector.Workspace} workspace |
| 152 * @param {!WebInspector.NetworkMapping} networkMapping | 152 * @param {!WebInspector.NetworkMapping} networkMapping |
| 153 */ | 153 */ |
| 154 WebInspector.CSSWorkspaceBinding.TargetInfo = function(cssModel, workspace, netw
orkMapping) | 154 WebInspector.CSSWorkspaceBinding.TargetInfo = function(cssModel, workspace, netw
orkMapping) |
| 155 { | 155 { |
| 156 this._cssModel = cssModel; | 156 this._cssModel = cssModel; |
| 157 this._stylesSourceMapping = new WebInspector.StylesSourceMapping(cssModel, w
orkspace, networkMapping); | 157 this._stylesSourceMapping = new WebInspector.StylesSourceMapping(cssModel, w
orkspace, networkMapping); |
| 158 this._sassSourceMapping = new WebInspector.SASSSourceMapping(cssModel, netwo
rkMapping, WebInspector.NetworkProject.forTarget(cssModel.target())); | 158 this._sassSourceMapping = new WebInspector.SASSSourceMapping(cssModel, netwo
rkMapping, WebInspector.NetworkProject.forTarget(cssModel.target())); |
| 159 | 159 |
| 160 /** @type {!Multimap<!WebInspector.CSSStyleSheetHeader, !WebInspector.LiveLo
cation>} */ | 160 /** @type {!Multimap<!WebInspector.CSSStyleSheetHeader, !WebInspector.LiveLo
cation>} */ |
| 161 this._locations = new Multimap(); | 161 this._locations = new Multimap(); |
| 162 } | 162 }; |
| 163 | 163 |
| 164 WebInspector.CSSWorkspaceBinding.TargetInfo.prototype = { | 164 WebInspector.CSSWorkspaceBinding.TargetInfo.prototype = { |
| 165 /** | 165 /** |
| 166 * @param {!WebInspector.CSSWorkspaceBinding.LiveLocation} location | 166 * @param {!WebInspector.CSSWorkspaceBinding.LiveLocation} location |
| 167 */ | 167 */ |
| 168 _addLocation: function(location) | 168 _addLocation: function(location) |
| 169 { | 169 { |
| 170 var header = location._header; | 170 var header = location._header; |
| 171 this._locations.set(header, location); | 171 this._locations.set(header, location); |
| 172 location.update(); | 172 location.update(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 202 uiLocation = uiLocation || this._sassSourceMapping.rawLocationToUILocati
on(rawLocation); | 202 uiLocation = uiLocation || this._sassSourceMapping.rawLocationToUILocati
on(rawLocation); |
| 203 uiLocation = uiLocation || this._stylesSourceMapping.rawLocationToUILoca
tion(rawLocation); | 203 uiLocation = uiLocation || this._stylesSourceMapping.rawLocationToUILoca
tion(rawLocation); |
| 204 return uiLocation; | 204 return uiLocation; |
| 205 }, | 205 }, |
| 206 | 206 |
| 207 _dispose: function() | 207 _dispose: function() |
| 208 { | 208 { |
| 209 this._stylesSourceMapping.dispose(); | 209 this._stylesSourceMapping.dispose(); |
| 210 this._sassSourceMapping.dispose(); | 210 this._sassSourceMapping.dispose(); |
| 211 } | 211 } |
| 212 } | 212 }; |
| 213 | 213 |
| 214 /** | 214 /** |
| 215 * @constructor | 215 * @constructor |
| 216 * @extends {WebInspector.LiveLocationWithPool} | 216 * @extends {WebInspector.LiveLocationWithPool} |
| 217 * @param {!WebInspector.CSSModel} cssModel | 217 * @param {!WebInspector.CSSModel} cssModel |
| 218 * @param {?WebInspector.CSSStyleSheetHeader} header | 218 * @param {?WebInspector.CSSStyleSheetHeader} header |
| 219 * @param {!WebInspector.CSSLocation} rawLocation | 219 * @param {!WebInspector.CSSLocation} rawLocation |
| 220 * @param {!WebInspector.CSSWorkspaceBinding} binding | 220 * @param {!WebInspector.CSSWorkspaceBinding} binding |
| 221 * @param {function(!WebInspector.LiveLocation)} updateDelegate | 221 * @param {function(!WebInspector.LiveLocation)} updateDelegate |
| 222 * @param {!WebInspector.LiveLocationPool} locationPool | 222 * @param {!WebInspector.LiveLocationPool} locationPool |
| 223 */ | 223 */ |
| 224 WebInspector.CSSWorkspaceBinding.LiveLocation = function(cssModel, header, rawLo
cation, binding, updateDelegate, locationPool) | 224 WebInspector.CSSWorkspaceBinding.LiveLocation = function(cssModel, header, rawLo
cation, binding, updateDelegate, locationPool) |
| 225 { | 225 { |
| 226 WebInspector.LiveLocationWithPool.call(this, updateDelegate, locationPool); | 226 WebInspector.LiveLocationWithPool.call(this, updateDelegate, locationPool); |
| 227 this._cssModel = cssModel; | 227 this._cssModel = cssModel; |
| 228 this._rawLocation = rawLocation; | 228 this._rawLocation = rawLocation; |
| 229 this._binding = binding; | 229 this._binding = binding; |
| 230 if (!header) | 230 if (!header) |
| 231 this._clearStyleSheet(); | 231 this._clearStyleSheet(); |
| 232 else | 232 else |
| 233 this._setStyleSheet(header); | 233 this._setStyleSheet(header); |
| 234 } | 234 }; |
| 235 | 235 |
| 236 WebInspector.CSSWorkspaceBinding.LiveLocation.prototype = { | 236 WebInspector.CSSWorkspaceBinding.LiveLocation.prototype = { |
| 237 /** | 237 /** |
| 238 * @param {!WebInspector.Event} event | 238 * @param {!WebInspector.Event} event |
| 239 */ | 239 */ |
| 240 _styleSheetAdded: function(event) | 240 _styleSheetAdded: function(event) |
| 241 { | 241 { |
| 242 console.assert(!this._header); | 242 console.assert(!this._header); |
| 243 var header = /** @type {!WebInspector.CSSStyleSheetHeader} */ (event.dat
a); | 243 var header = /** @type {!WebInspector.CSSStyleSheetHeader} */ (event.dat
a); |
| 244 if (header.sourceURL && header.sourceURL === this._rawLocation.url) | 244 if (header.sourceURL && header.sourceURL === this._rawLocation.url) |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 /** | 308 /** |
| 309 * @override | 309 * @override |
| 310 * @return {boolean} | 310 * @return {boolean} |
| 311 */ | 311 */ |
| 312 isBlackboxed: function() | 312 isBlackboxed: function() |
| 313 { | 313 { |
| 314 return false; | 314 return false; |
| 315 }, | 315 }, |
| 316 | 316 |
| 317 __proto__: WebInspector.LiveLocationWithPool.prototype | 317 __proto__: WebInspector.LiveLocationWithPool.prototype |
| 318 } | 318 }; |
| 319 | 319 |
| 320 /** | 320 /** |
| 321 * @type {!WebInspector.CSSWorkspaceBinding} | 321 * @type {!WebInspector.CSSWorkspaceBinding} |
| 322 */ | 322 */ |
| 323 WebInspector.cssWorkspaceBinding; | 323 WebInspector.cssWorkspaceBinding; |
| OLD | NEW |