| 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 |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 | |
| 163 cssModel.addEventListener(WebInspector.CSSModel.Events.StyleSheetAdded, this
._styleSheetAdded, this); | |
| 164 cssModel.addEventListener(WebInspector.CSSModel.Events.StyleSheetRemoved, th
is._styleSheetRemoved, this); | |
| 165 } | 162 } |
| 166 | 163 |
| 167 WebInspector.CSSWorkspaceBinding.TargetInfo.prototype = { | 164 WebInspector.CSSWorkspaceBinding.TargetInfo.prototype = { |
| 168 /** | 165 /** |
| 169 * @param {!WebInspector.Event} event | |
| 170 */ | |
| 171 _styleSheetAdded: function(event) | |
| 172 { | |
| 173 var header = /** @type {!WebInspector.CSSStyleSheetHeader} */ (event.dat
a); | |
| 174 this._stylesSourceMapping.addHeader(header); | |
| 175 this._sassSourceMapping.addHeader(header); | |
| 176 }, | |
| 177 | |
| 178 /** | |
| 179 * @param {!WebInspector.Event} event | |
| 180 */ | |
| 181 _styleSheetRemoved: function(event) | |
| 182 { | |
| 183 var header = /** @type {!WebInspector.CSSStyleSheetHeader} */ (event.dat
a); | |
| 184 this._stylesSourceMapping.removeHeader(header); | |
| 185 this._sassSourceMapping.removeHeader(header); | |
| 186 }, | |
| 187 | |
| 188 /** | |
| 189 * @param {!WebInspector.CSSWorkspaceBinding.LiveLocation} location | 166 * @param {!WebInspector.CSSWorkspaceBinding.LiveLocation} location |
| 190 */ | 167 */ |
| 191 _addLocation: function(location) | 168 _addLocation: function(location) |
| 192 { | 169 { |
| 193 var header = location._header; | 170 var header = location._header; |
| 194 this._locations.set(header, location); | 171 this._locations.set(header, location); |
| 195 location.update(); | 172 location.update(); |
| 196 }, | 173 }, |
| 197 | 174 |
| 198 /** | 175 /** |
| (...skipping 23 matching lines...) Expand all Loading... |
| 222 { | 199 { |
| 223 var rawLocation = new WebInspector.CSSLocation(header, lineNumber, colum
nNumber); | 200 var rawLocation = new WebInspector.CSSLocation(header, lineNumber, colum
nNumber); |
| 224 var uiLocation = null; | 201 var uiLocation = null; |
| 225 uiLocation = uiLocation || this._sassSourceMapping.rawLocationToUILocati
on(rawLocation); | 202 uiLocation = uiLocation || this._sassSourceMapping.rawLocationToUILocati
on(rawLocation); |
| 226 uiLocation = uiLocation || this._stylesSourceMapping.rawLocationToUILoca
tion(rawLocation); | 203 uiLocation = uiLocation || this._stylesSourceMapping.rawLocationToUILoca
tion(rawLocation); |
| 227 return uiLocation; | 204 return uiLocation; |
| 228 }, | 205 }, |
| 229 | 206 |
| 230 _dispose: function() | 207 _dispose: function() |
| 231 { | 208 { |
| 232 this._cssModel.removeEventListener(WebInspector.CSSModel.Events.StyleShe
etAdded, this._styleSheetAdded, this); | 209 this._stylesSourceMapping.dispose(); |
| 233 this._cssModel.removeEventListener(WebInspector.CSSModel.Events.StyleShe
etRemoved, this._styleSheetRemoved, this); | 210 this._sassSourceMapping.dispose(); |
| 234 } | 211 } |
| 235 } | 212 } |
| 236 | 213 |
| 237 /** | 214 /** |
| 238 * @constructor | 215 * @constructor |
| 239 * @extends {WebInspector.LiveLocationWithPool} | 216 * @extends {WebInspector.LiveLocationWithPool} |
| 240 * @param {!WebInspector.CSSModel} cssModel | 217 * @param {!WebInspector.CSSModel} cssModel |
| 241 * @param {?WebInspector.CSSStyleSheetHeader} header | 218 * @param {?WebInspector.CSSStyleSheetHeader} header |
| 242 * @param {!WebInspector.CSSLocation} rawLocation | 219 * @param {!WebInspector.CSSLocation} rawLocation |
| 243 * @param {!WebInspector.CSSWorkspaceBinding} binding | 220 * @param {!WebInspector.CSSWorkspaceBinding} binding |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 return false; | 314 return false; |
| 338 }, | 315 }, |
| 339 | 316 |
| 340 __proto__: WebInspector.LiveLocationWithPool.prototype | 317 __proto__: WebInspector.LiveLocationWithPool.prototype |
| 341 } | 318 } |
| 342 | 319 |
| 343 /** | 320 /** |
| 344 * @type {!WebInspector.CSSWorkspaceBinding} | 321 * @type {!WebInspector.CSSWorkspaceBinding} |
| 345 */ | 322 */ |
| 346 WebInspector.cssWorkspaceBinding; | 323 WebInspector.cssWorkspaceBinding; |
| OLD | NEW |