| Index: Source/devtools/front_end/SourcesPanel.js
|
| diff --git a/Source/devtools/front_end/SourcesPanel.js b/Source/devtools/front_end/SourcesPanel.js
|
| index 7b2709ace9e8ee1314c5212c53b722067c560fae..73cd8c6d773ce44cbebe5b7c90ce477bc73e284f 100644
|
| --- a/Source/devtools/front_end/SourcesPanel.js
|
| +++ b/Source/devtools/front_end/SourcesPanel.js
|
| @@ -26,6 +26,8 @@
|
|
|
| importScript("BreakpointsSidebarPane.js");
|
| importScript("CallStackSidebarPane.js");
|
| +importScript("SimpleHistoryManager.js");
|
| +importScript("EditingLocationHistoryManager.js");
|
| importScript("FilePathScoreFunction.js");
|
| importScript("FilteredItemSelectionDialog.js");
|
| importScript("UISourceCodeFrame.js");
|
| @@ -69,7 +71,7 @@ WebInspector.SourcesPanel = function(workspaceForTest)
|
| */
|
| function viewGetter()
|
| {
|
| - return this.visibleView;
|
| + return this;
|
| }
|
| WebInspector.GoToLineDialog.install(this, viewGetter.bind(this));
|
|
|
| @@ -142,6 +144,21 @@ WebInspector.SourcesPanel = function(workspaceForTest)
|
| this.sidebarPanes.workerList = new WebInspector.WorkersSidebarPane(WebInspector.workerManager);
|
| }
|
|
|
| + /**
|
| + * @this {WebInspector.SourcesPanel}
|
| + */
|
| + function currentSourceFrame()
|
| + {
|
| + var uiSourceCode = this.currentUISourceCode();
|
| + if (!uiSourceCode)
|
| + return null;
|
| + return this._sourceFramesByUISourceCode.get(uiSourceCode);
|
| + }
|
| +
|
| + this._historyManager = new WebInspector.EditingLocationHistoryManager(this, currentSourceFrame.bind(this));
|
| + this.registerShortcuts(WebInspector.SourcesPanelDescriptor.ShortcutKeys.JumpToPreviousLocation, this._onJumpToPreviousLocation.bind(this));
|
| + this.registerShortcuts(WebInspector.SourcesPanelDescriptor.ShortcutKeys.JumpToNextLocation, this._onJumpToNextLocation.bind(this));
|
| +
|
| this.sidebarPanes.callstack.registerShortcuts(this.registerShortcuts.bind(this));
|
| this.registerShortcuts(WebInspector.SourcesPanelDescriptor.ShortcutKeys.GoToMember, this._showOutlineDialog.bind(this));
|
| this.registerShortcuts(WebInspector.SourcesPanelDescriptor.ShortcutKeys.ToggleBreakpoint, this._toggleBreakpoint.bind(this));
|
| @@ -224,6 +241,24 @@ WebInspector.SourcesPanel.PauseOnExceptionsStates = [
|
|
|
| WebInspector.SourcesPanel.prototype = {
|
| /**
|
| + * @param {?Event=} event
|
| + */
|
| + _onJumpToPreviousLocation: function(event)
|
| + {
|
| + this._historyManager.rollback();
|
| + return true;
|
| + },
|
| +
|
| + /**
|
| + * @param {?Event=} event
|
| + */
|
| + _onJumpToNextLocation: function(event)
|
| + {
|
| + this._historyManager.rollover();
|
| + return true;
|
| + },
|
| +
|
| + /**
|
| * @return {!Element}
|
| */
|
| defaultFocusedElement: function()
|
| @@ -305,6 +340,7 @@ WebInspector.SourcesPanel.prototype = {
|
| for (var i = 0; i < uiSourceCodes.length; ++i) {
|
| this._navigator.removeUISourceCode(uiSourceCodes[i]);
|
| this._removeSourceFrame(uiSourceCodes[i]);
|
| + this._historyManager.removeHistoryForSourceCode(uiSourceCodes[i]);
|
| }
|
| this._editorContainer.removeUISourceCodes(uiSourceCodes);
|
| },
|
| @@ -522,11 +558,12 @@ WebInspector.SourcesPanel.prototype = {
|
| _showSourceLocation: function(uiSourceCode, lineNumber, columnNumber, forceShowInPanel)
|
| {
|
| this._showEditor(forceShowInPanel);
|
| + this._historyManager.updateCurrentState();
|
| var sourceFrame = this._showFile(uiSourceCode);
|
| if (typeof lineNumber === "number")
|
| sourceFrame.highlightPosition(lineNumber, columnNumber);
|
| + this._historyManager.pushNewState();
|
| sourceFrame.focus();
|
| -
|
| WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMetrics.UserAction, {
|
| action: WebInspector.UserMetrics.UserActionNames.OpenSourceLink,
|
| url: uiSourceCode.originURL(),
|
| @@ -543,9 +580,11 @@ WebInspector.SourcesPanel.prototype = {
|
| var sourceFrame = this._getOrCreateSourceFrame(uiSourceCode);
|
| if (this._currentUISourceCode === uiSourceCode)
|
| return sourceFrame;
|
| +
|
| this._currentUISourceCode = uiSourceCode;
|
| if (!uiSourceCode.project().isServiceProject())
|
| this._navigator.revealUISourceCode(uiSourceCode, true);
|
| +
|
| this._editorContainer.showFile(uiSourceCode);
|
| this._updateScriptViewStatusBarItems();
|
|
|
| @@ -580,6 +619,7 @@ WebInspector.SourcesPanel.prototype = {
|
| }
|
| sourceFrame.setHighlighterType(uiSourceCode.highlighterType());
|
| this._sourceFramesByUISourceCode.put(uiSourceCode, sourceFrame);
|
| + this._historyManager.trackSourceFrameCursorJumps(sourceFrame);
|
| return sourceFrame;
|
| },
|
|
|
| @@ -664,6 +704,7 @@ WebInspector.SourcesPanel.prototype = {
|
|
|
| _executionLineChanged: function(uiLocation)
|
| {
|
| + this._historyManager.updateCurrentState();
|
| this._clearCurrentExecutionLine();
|
| this._setExecutionLine(uiLocation);
|
|
|
| @@ -672,8 +713,11 @@ WebInspector.SourcesPanel.prototype = {
|
| if (this._skipExecutionLineRevealing)
|
| return;
|
| this._skipExecutionLineRevealing = true;
|
| +
|
| var sourceFrame = this._showFile(uiSourceCode);
|
| sourceFrame.revealLine(uiLocation.lineNumber);
|
| + this._historyManager.pushNewState();
|
| +
|
| if (sourceFrame.canEditSource())
|
| sourceFrame.setSelection(WebInspector.TextRange.createFromLocation(uiLocation.lineNumber, 0));
|
| sourceFrame.focus();
|
| @@ -696,6 +740,7 @@ WebInspector.SourcesPanel.prototype = {
|
| {
|
| this._navigatorController.hideNavigatorOverlay();
|
| var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data);
|
| + this._historyManager.removeHistoryForSourceCode(uiSourceCode);
|
|
|
| if (this._currentUISourceCode === uiSourceCode)
|
| delete this._currentUISourceCode;
|
| @@ -707,8 +752,14 @@ WebInspector.SourcesPanel.prototype = {
|
|
|
| _editorSelected: function(event)
|
| {
|
| - var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data);
|
| + var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data.currentFile);
|
| + var shouldUseHistoryManager = uiSourceCode !== this._currentUISourceCode && event.data.userGesture;
|
| + if (shouldUseHistoryManager)
|
| + this._historyManager.updateCurrentState();
|
| var sourceFrame = this._showFile(uiSourceCode);
|
| + if (shouldUseHistoryManager)
|
| + this._historyManager.pushNewState();
|
| +
|
| this._navigatorController.hideNavigatorOverlay();
|
| if (!this._navigatorController.isNavigatorPinned())
|
| sourceFrame.focus();
|
| @@ -719,7 +770,15 @@ WebInspector.SourcesPanel.prototype = {
|
| _sourceSelected: function(event)
|
| {
|
| var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data.uiSourceCode);
|
| +
|
| + var shouldUseHistoryManager = uiSourceCode !== this._currentUISourceCode;
|
| +
|
| + if (shouldUseHistoryManager)
|
| + this._historyManager.updateCurrentState();
|
| var sourceFrame = this._showFile(uiSourceCode);
|
| + if (shouldUseHistoryManager)
|
| + this._historyManager.pushNewState();
|
| +
|
| this._navigatorController.hideNavigatorOverlay();
|
| if (sourceFrame && (!this._navigatorController.isNavigatorPinned() || event.data.focusSource))
|
| sourceFrame.focus();
|
| @@ -1694,7 +1753,9 @@ WebInspector.SourcesPanel.prototype = {
|
| {
|
| if (!this.canHighlightPosition())
|
| return;
|
| + this._historyManager.updateCurrentState();
|
| this.visibleView.highlightPosition(line, column);
|
| + this._historyManager.pushNewState();
|
| },
|
|
|
| /**
|
|
|