Chromium Code Reviews| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 135 anchor.title = anchor.__fallbackAnchor.title; | 135 anchor.title = anchor.__fallbackAnchor.title; |
| 136 anchor.className = anchor.__fallbackAnchor.className; | 136 anchor.className = anchor.__fallbackAnchor.className; |
| 137 anchor.textContent = anchor.__fallbackAnchor.textContent; | 137 anchor.textContent = anchor.__fallbackAnchor.textContent; |
| 138 } | 138 } |
| 139 liveLocations[i].location.dispose(); | 139 liveLocations[i].location.dispose(); |
| 140 } | 140 } |
| 141 }, | 141 }, |
| 142 | 142 |
| 143 /** | 143 /** |
| 144 * @param {?WebInspector.Target} target | 144 * @param {?WebInspector.Target} target |
| 145 * @param {string} scriptId | 145 * @param {?string} scriptId |
| 146 * @param {string} sourceURL | 146 * @param {string} sourceURL |
| 147 * @param {number} lineNumber | 147 * @param {number} lineNumber |
| 148 * @param {number=} columnNumber | 148 * @param {number=} columnNumber |
| 149 * @param {string=} classes | 149 * @param {string=} classes |
| 150 * @return {?Element} | 150 * @return {!Element} |
| 151 */ | 151 */ |
| 152 linkifyLocationByScriptId: function(target, scriptId, sourceURL, lineNumber, columnNumber, classes) | 152 linkifyLocationByScriptId: function(target, scriptId, sourceURL, lineNumber, columnNumber, classes) |
| 153 { | 153 { |
| 154 var rawLocation = target ? target.debuggerModel.createRawLocationByScrip tId(scriptId, sourceURL, lineNumber, columnNumber || 0) : null; | 154 var rawLocation = target && !target.isDead() ? target.debuggerModel.crea teRawLocationByScriptId(scriptId, sourceURL, lineNumber, columnNumber || 0) : nu ll; |
| 155 var fallbackAnchor = WebInspector.linkifyResourceAsNode(sourceURL, lineN umber, classes); | 155 var fallbackAnchor = WebInspector.linkifyResourceAsNode(sourceURL, lineN umber, classes); |
| 156 if (!rawLocation) | 156 if (!rawLocation) |
| 157 return fallbackAnchor; | 157 return fallbackAnchor; |
| 158 | 158 |
| 159 var anchor = this.linkifyRawLocation(rawLocation, classes); | 159 var anchor = this._createAnchor(classes); |
| 160 var liveLocation = rawLocation.createLiveLocation(this._updateAnchor.bin d(this, anchor)); | |
| 161 this._liveLocationsByTarget.get(rawLocation.target()).push({anchor: anch or, location: liveLocation}); | |
| 160 anchor.__fallbackAnchor = fallbackAnchor; | 162 anchor.__fallbackAnchor = fallbackAnchor; |
| 161 return anchor; | 163 return anchor; |
| 162 | |
| 163 }, | 164 }, |
| 164 | 165 |
| 165 /** | 166 /** |
| 166 * @param {!WebInspector.Target} target | 167 * @param {?WebInspector.Target} target |
| 167 * @param {string} sourceURL | 168 * @param {string} sourceURL |
| 168 * @param {number} lineNumber | 169 * @param {number} lineNumber |
| 169 * @param {number=} columnNumber | 170 * @param {number=} columnNumber |
| 170 * @param {string=} classes | 171 * @param {string=} classes |
| 171 * @return {?Element} | 172 * @return {!Element} |
| 172 */ | 173 */ |
| 173 linkifyLocation: function(target, sourceURL, lineNumber, columnNumber, class es) | 174 linkifyLocation: function(target, sourceURL, lineNumber, columnNumber, class es) |
|
vsevik
2014/07/21 06:54:46
This method seems confusing now, should we remove
sergeyv
2014/07/21 12:06:54
Done.
| |
| 174 { | 175 { |
| 175 var rawLocation = target.debuggerModel.createRawLocationByURL(sourceURL, lineNumber, columnNumber || 0); | 176 return this.linkifyLocationByScriptId(target, null, sourceURL, lineNumbe r, columnNumber, classes); |
| 176 if (!rawLocation) | |
| 177 return WebInspector.linkifyResourceAsNode(sourceURL, lineNumber, cla sses); | |
| 178 return this.linkifyRawLocation(rawLocation, classes); | |
| 179 }, | 177 }, |
| 180 | 178 |
| 181 /** | 179 /** |
| 182 * @param {!WebInspector.DebuggerModel.Location} rawLocation | |
| 183 * @param {string=} classes | |
| 184 * @return {?Element} | |
| 185 */ | |
| 186 linkifyRawLocation: function(rawLocation, classes) | |
|
vsevik
2014/07/21 07:24:28
Could we keep this method and add sourceURL to raw
| |
| 187 { | |
| 188 // FIXME: this check should not be here. | |
| 189 var script = rawLocation.target().debuggerModel.scriptForId(rawLocation. scriptId); | |
| 190 if (!script) | |
| 191 return null; | |
| 192 var anchor = this._createAnchor(classes); | |
| 193 var liveLocation = rawLocation.createLiveLocation(this._updateAnchor.bin d(this, anchor)); | |
| 194 this._liveLocationsByTarget.get(rawLocation.target()).push({anchor: anch or, location: liveLocation}); | |
| 195 return anchor; | |
| 196 }, | |
| 197 | |
| 198 /** | |
| 199 * @param {?CSSAgent.StyleSheetId} styleSheetId | 180 * @param {?CSSAgent.StyleSheetId} styleSheetId |
| 200 * @param {!WebInspector.CSSLocation} rawLocation | 181 * @param {!WebInspector.CSSLocation} rawLocation |
| 201 * @param {string=} classes | 182 * @param {string=} classes |
| 202 * @return {?Element} | 183 * @return {?Element} |
| 203 */ | 184 */ |
| 204 linkifyCSSLocation: function(styleSheetId, rawLocation, classes) | 185 linkifyCSSLocation: function(styleSheetId, rawLocation, classes) |
| 205 { | 186 { |
| 206 var anchor = this._createAnchor(classes); | 187 var anchor = this._createAnchor(classes); |
| 207 var liveLocation = rawLocation.createLiveLocation(styleSheetId, this._up dateAnchor.bind(this, anchor)); | 188 var liveLocation = rawLocation.createLiveLocation(styleSheetId, this._up dateAnchor.bind(this, anchor)); |
| 208 if (!liveLocation) | 189 if (!liveLocation) |
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 344 * @return {string} | 325 * @return {string} |
| 345 */ | 326 */ |
| 346 WebInspector.Linkifier.liveLocationText = function(target, scriptId, lineNumber, columnNumber) | 327 WebInspector.Linkifier.liveLocationText = function(target, scriptId, lineNumber, columnNumber) |
| 347 { | 328 { |
| 348 var script = target.debuggerModel.scriptForId(scriptId); | 329 var script = target.debuggerModel.scriptForId(scriptId); |
| 349 if (!script) | 330 if (!script) |
| 350 return ""; | 331 return ""; |
| 351 var uiLocation = script.rawLocationToUILocation(lineNumber, columnNumber); | 332 var uiLocation = script.rawLocationToUILocation(lineNumber, columnNumber); |
| 352 return uiLocation.linkText(); | 333 return uiLocation.linkText(); |
| 353 } | 334 } |
| OLD | NEW |