| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 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 20 matching lines...) Expand all Loading... |
| 31 /** | 31 /** |
| 32 * @constructor | 32 * @constructor |
| 33 * @param {!WebInspector.SourcesView} sourcesView | 33 * @param {!WebInspector.SourcesView} sourcesView |
| 34 * @param {function():?WebInspector.SourceFrame} currentSourceFrameCallback | 34 * @param {function():?WebInspector.SourceFrame} currentSourceFrameCallback |
| 35 */ | 35 */ |
| 36 WebInspector.EditingLocationHistoryManager = function(sourcesView, currentSource
FrameCallback) | 36 WebInspector.EditingLocationHistoryManager = function(sourcesView, currentSource
FrameCallback) |
| 37 { | 37 { |
| 38 this._sourcesView = sourcesView; | 38 this._sourcesView = sourcesView; |
| 39 this._historyManager = new WebInspector.SimpleHistoryManager(WebInspector.Ed
itingLocationHistoryManager.HistoryDepth); | 39 this._historyManager = new WebInspector.SimpleHistoryManager(WebInspector.Ed
itingLocationHistoryManager.HistoryDepth); |
| 40 this._currentSourceFrameCallback = currentSourceFrameCallback; | 40 this._currentSourceFrameCallback = currentSourceFrameCallback; |
| 41 } | 41 }; |
| 42 | 42 |
| 43 WebInspector.EditingLocationHistoryManager.HistoryDepth = 20; | 43 WebInspector.EditingLocationHistoryManager.HistoryDepth = 20; |
| 44 | 44 |
| 45 WebInspector.EditingLocationHistoryManager.prototype = { | 45 WebInspector.EditingLocationHistoryManager.prototype = { |
| 46 /** | 46 /** |
| 47 * @param {!WebInspector.UISourceCodeFrame} sourceFrame | 47 * @param {!WebInspector.UISourceCodeFrame} sourceFrame |
| 48 */ | 48 */ |
| 49 trackSourceFrameCursorJumps: function(sourceFrame) | 49 trackSourceFrameCursorJumps: function(sourceFrame) |
| 50 { | 50 { |
| 51 sourceFrame.textEditor.addEventListener(WebInspector.SourcesTextEditor.E
vents.JumpHappened, this._onJumpHappened.bind(this)); | 51 sourceFrame.textEditor.addEventListener(WebInspector.SourcesTextEditor.E
vents.JumpHappened, this._onJumpHappened.bind(this)); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 */ | 120 */ |
| 121 removeHistoryForSourceCode: function(uiSourceCode) | 121 removeHistoryForSourceCode: function(uiSourceCode) |
| 122 { | 122 { |
| 123 function filterOut(entry) | 123 function filterOut(entry) |
| 124 { | 124 { |
| 125 return entry._projectId === uiSourceCode.project().id() && entry._ur
l === uiSourceCode.url(); | 125 return entry._projectId === uiSourceCode.project().id() && entry._ur
l === uiSourceCode.url(); |
| 126 } | 126 } |
| 127 | 127 |
| 128 this._historyManager.filterOut(filterOut); | 128 this._historyManager.filterOut(filterOut); |
| 129 }, | 129 }, |
| 130 } | 130 }; |
| 131 | 131 |
| 132 | 132 |
| 133 /** | 133 /** |
| 134 * @constructor | 134 * @constructor |
| 135 * @implements {WebInspector.HistoryEntry} | 135 * @implements {WebInspector.HistoryEntry} |
| 136 * @param {!WebInspector.SourcesView} sourcesView | 136 * @param {!WebInspector.SourcesView} sourcesView |
| 137 * @param {!WebInspector.EditingLocationHistoryManager} editingLocationManager | 137 * @param {!WebInspector.EditingLocationHistoryManager} editingLocationManager |
| 138 * @param {!WebInspector.SourceFrame} sourceFrame | 138 * @param {!WebInspector.SourceFrame} sourceFrame |
| 139 * @param {!WebInspector.TextRange} selection | 139 * @param {!WebInspector.TextRange} selection |
| 140 */ | 140 */ |
| 141 WebInspector.EditingLocationHistoryEntry = function(sourcesView, editingLocation
Manager, sourceFrame, selection) | 141 WebInspector.EditingLocationHistoryEntry = function(sourcesView, editingLocation
Manager, sourceFrame, selection) |
| 142 { | 142 { |
| 143 this._sourcesView = sourcesView; | 143 this._sourcesView = sourcesView; |
| 144 this._editingLocationManager = editingLocationManager; | 144 this._editingLocationManager = editingLocationManager; |
| 145 var uiSourceCode = sourceFrame.uiSourceCode(); | 145 var uiSourceCode = sourceFrame.uiSourceCode(); |
| 146 this._projectId = uiSourceCode.project().id(); | 146 this._projectId = uiSourceCode.project().id(); |
| 147 this._url = uiSourceCode.url(); | 147 this._url = uiSourceCode.url(); |
| 148 | 148 |
| 149 var position = this._positionFromSelection(selection); | 149 var position = this._positionFromSelection(selection); |
| 150 this._positionHandle = sourceFrame.textEditor.textEditorPositionHandle(posit
ion.lineNumber, position.columnNumber); | 150 this._positionHandle = sourceFrame.textEditor.textEditorPositionHandle(posit
ion.lineNumber, position.columnNumber); |
| 151 } | 151 }; |
| 152 | 152 |
| 153 WebInspector.EditingLocationHistoryEntry.prototype = { | 153 WebInspector.EditingLocationHistoryEntry.prototype = { |
| 154 /** | 154 /** |
| 155 * @param {!WebInspector.HistoryEntry} entry | 155 * @param {!WebInspector.HistoryEntry} entry |
| 156 */ | 156 */ |
| 157 merge: function(entry) | 157 merge: function(entry) |
| 158 { | 158 { |
| 159 if (this._projectId !== entry._projectId || this._url !== entry._url) | 159 if (this._projectId !== entry._projectId || this._url !== entry._url) |
| 160 return; | 160 return; |
| 161 this._positionHandle = entry._positionHandle; | 161 this._positionHandle = entry._positionHandle; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 190 reveal: function() | 190 reveal: function() |
| 191 { | 191 { |
| 192 var position = this._positionHandle.resolve(); | 192 var position = this._positionHandle.resolve(); |
| 193 var uiSourceCode = WebInspector.workspace.uiSourceCode(this._projectId,
this._url); | 193 var uiSourceCode = WebInspector.workspace.uiSourceCode(this._projectId,
this._url); |
| 194 if (!position || !uiSourceCode) | 194 if (!position || !uiSourceCode) |
| 195 return; | 195 return; |
| 196 | 196 |
| 197 this._editingLocationManager.updateCurrentState(); | 197 this._editingLocationManager.updateCurrentState(); |
| 198 this._sourcesView.showSourceLocation(uiSourceCode, position.lineNumber,
position.columnNumber); | 198 this._sourcesView.showSourceLocation(uiSourceCode, position.lineNumber,
position.columnNumber); |
| 199 } | 199 } |
| 200 } | 200 }; |
| OLD | NEW |