| 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.DebuggerSourceMapping} | 7 * @implements {WebInspector.DebuggerSourceMapping} |
| 8 * @param {!WebInspector.DebuggerModel} debuggerModel | 8 * @param {!WebInspector.DebuggerModel} debuggerModel |
| 9 * @param {!WebInspector.ScriptFormatterEditorAction} editorAction | 9 * @param {!WebInspector.ScriptFormatterEditorAction} editorAction |
| 10 */ | 10 */ |
| 11 WebInspector.FormatterScriptMapping = function(debuggerModel, editorAction) | 11 WebInspector.FormatterScriptMapping = function(debuggerModel, editorAction) |
| 12 { | 12 { |
| 13 this._debuggerModel = debuggerModel; | 13 this._debuggerModel = debuggerModel; |
| 14 this._editorAction = editorAction; | 14 this._editorAction = editorAction; |
| 15 } | 15 } |
| 16 | 16 |
| 17 WebInspector.FormatterScriptMapping.prototype = { | 17 WebInspector.FormatterScriptMapping.prototype = { |
| 18 /** | 18 /** |
| 19 * @override | 19 * @override |
| 20 * @param {!WebInspector.DebuggerModel.Location} rawLocation | 20 * @param {!WebInspector.DebuggerModel.Location} rawLocation |
| 21 * @return {?WebInspector.UILocation} | 21 * @return {?WebInspector.UILocation} |
| 22 */ | 22 */ |
| 23 rawLocationToUILocation: function(rawLocation) | 23 rawLocationToUILocation: function(rawLocation) |
| 24 { | 24 { |
| 25 var debuggerModelLocation = /** @type {!WebInspector.DebuggerModel.Locat
ion} */ (rawLocation); | 25 var debuggerModelLocation = /** @type {!WebInspector.DebuggerModel.Locat
ion} */ (rawLocation); |
| 26 var script = debuggerModelLocation.script(); | 26 var script = debuggerModelLocation.script(); |
| 27 if (!script) |
| 28 return null; |
| 27 var uiSourceCode = this._editorAction._uiSourceCodes.get(script); | 29 var uiSourceCode = this._editorAction._uiSourceCodes.get(script); |
| 28 if (!uiSourceCode) | 30 if (!uiSourceCode) |
| 29 return null; | 31 return null; |
| 30 | 32 |
| 31 var formatData = this._editorAction._formatData.get(uiSourceCode); | 33 var formatData = this._editorAction._formatData.get(uiSourceCode); |
| 32 if (!formatData) | 34 if (!formatData) |
| 33 return null; | 35 return null; |
| 34 var mapping = formatData.mapping; | 36 var mapping = formatData.mapping; |
| 35 var lineNumber = debuggerModelLocation.lineNumber; | 37 var lineNumber = debuggerModelLocation.lineNumber; |
| 36 var columnNumber = debuggerModelLocation.columnNumber || 0; | 38 var columnNumber = debuggerModelLocation.columnNumber || 0; |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 | 387 |
| 386 var targets = WebInspector.targetManager.targets(); | 388 var targets = WebInspector.targetManager.targets(); |
| 387 for (var i = 0; i < targets.length; ++i) { | 389 for (var i = 0; i < targets.length; ++i) { |
| 388 var scriptMapping = /** @type {!WebInspector.FormatterScriptMapp
ing} */(this._scriptMappingByTarget.get(targets[i])); | 390 var scriptMapping = /** @type {!WebInspector.FormatterScriptMapp
ing} */(this._scriptMappingByTarget.get(targets[i])); |
| 389 WebInspector.debuggerWorkspaceBinding.setSourceMapping(targets[i
], formattedUISourceCode, scriptMapping); | 391 WebInspector.debuggerWorkspaceBinding.setSourceMapping(targets[i
], formattedUISourceCode, scriptMapping); |
| 390 } | 392 } |
| 391 this._showIfNeeded(uiSourceCode, formattedUISourceCode, formatterMap
ping); | 393 this._showIfNeeded(uiSourceCode, formattedUISourceCode, formatterMap
ping); |
| 392 } | 394 } |
| 393 } | 395 } |
| 394 } | 396 } |
| OLD | NEW |