| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 var script = rawLocation.target().debuggerModel.scriptForId(rawLocation.
scriptId); | 189 var script = rawLocation.target().debuggerModel.scriptForId(rawLocation.
scriptId); |
| 190 if (!script) | 190 if (!script) |
| 191 return null; | 191 return null; |
| 192 var anchor = this._createAnchor(classes); | 192 var anchor = this._createAnchor(classes); |
| 193 var liveLocation = rawLocation.createLiveLocation(this._updateAnchor.bin
d(this, anchor)); | 193 var liveLocation = rawLocation.createLiveLocation(this._updateAnchor.bin
d(this, anchor)); |
| 194 this._liveLocationsByTarget.get(rawLocation.target()).push({anchor: anch
or, location: liveLocation}); | 194 this._liveLocationsByTarget.get(rawLocation.target()).push({anchor: anch
or, location: liveLocation}); |
| 195 return anchor; | 195 return anchor; |
| 196 }, | 196 }, |
| 197 | 197 |
| 198 /** | 198 /** |
| 199 * @param {?CSSAgent.StyleSheetId} styleSheetId | |
| 200 * @param {!WebInspector.CSSLocation} rawLocation | 199 * @param {!WebInspector.CSSLocation} rawLocation |
| 201 * @param {string=} classes | 200 * @param {string=} classes |
| 202 * @return {?Element} | 201 * @return {?Element} |
| 203 */ | 202 */ |
| 204 linkifyCSSLocation: function(styleSheetId, rawLocation, classes) | 203 linkifyCSSLocation: function(rawLocation, classes) |
| 205 { | 204 { |
| 206 var anchor = this._createAnchor(classes); | 205 var anchor = this._createAnchor(classes); |
| 207 var liveLocation = rawLocation.createLiveLocation(styleSheetId, this._up
dateAnchor.bind(this, anchor)); | 206 var liveLocation = rawLocation.createLiveLocation(this._updateAnchor.bin
d(this, anchor)); |
| 208 if (!liveLocation) | 207 if (!liveLocation) |
| 209 return null; | 208 return null; |
| 210 this._liveLocationsByTarget.get(rawLocation.target()).push({anchor: anch
or, location: liveLocation}); | 209 this._liveLocationsByTarget.get(rawLocation.target()).push({anchor: anch
or, location: liveLocation}); |
| 211 return anchor; | 210 return anchor; |
| 212 }, | 211 }, |
| 213 | 212 |
| 214 /** | 213 /** |
| 214 * @param {!WebInspector.CSSMedia} media |
| 215 * @return {?Element} |
| 216 */ |
| 217 linkifyMedia: function(media) |
| 218 { |
| 219 var location = media.rawLocation(); |
| 220 if (location) |
| 221 return this.linkifyCSSLocation(location); |
| 222 |
| 223 // The "linkedStylesheet" case. |
| 224 return WebInspector.linkifyResourceAsNode(media.sourceURL, undefined, "s
ubtitle", media.sourceURL); |
| 225 }, |
| 226 |
| 227 /** |
| 215 * @param {string=} classes | 228 * @param {string=} classes |
| 216 * @return {!Element} | 229 * @return {!Element} |
| 217 */ | 230 */ |
| 218 _createAnchor: function(classes) | 231 _createAnchor: function(classes) |
| 219 { | 232 { |
| 220 var anchor = document.createElement("a"); | 233 var anchor = document.createElement("a"); |
| 221 anchor.className = (classes || "") + " webkit-html-resource-link"; | 234 anchor.className = (classes || "") + " webkit-html-resource-link"; |
| 222 | 235 |
| 223 /** | 236 /** |
| 224 * @param {!Event} event | 237 * @param {!Event} event |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 * @return {string} | 357 * @return {string} |
| 345 */ | 358 */ |
| 346 WebInspector.Linkifier.liveLocationText = function(target, scriptId, lineNumber,
columnNumber) | 359 WebInspector.Linkifier.liveLocationText = function(target, scriptId, lineNumber,
columnNumber) |
| 347 { | 360 { |
| 348 var script = target.debuggerModel.scriptForId(scriptId); | 361 var script = target.debuggerModel.scriptForId(scriptId); |
| 349 if (!script) | 362 if (!script) |
| 350 return ""; | 363 return ""; |
| 351 var uiLocation = script.rawLocationToUILocation(lineNumber, columnNumber); | 364 var uiLocation = script.rawLocationToUILocation(lineNumber, columnNumber); |
| 352 return uiLocation.linkText(); | 365 return uiLocation.linkText(); |
| 353 } | 366 } |
| OLD | NEW |