Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(367)

Side by Side Diff: Source/devtools/front_end/SourcesPanel.js

Issue 23474010: DevTools: "Jump between editing locations" experiment (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: address @vsevik comments Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved.
3 * Copyright (C) 2011 Google Inc. All rights reserved. 3 * Copyright (C) 2011 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in the 11 * notice, this list of conditions and the following disclaimer in the
12 * documentation and/or other materials provided with the distribution. 12 * documentation and/or other materials provided with the distribution.
13 * 13 *
14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY 14 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 15 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR 17 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, 18 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, 19 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 20 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY 21 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 22 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 importScript("BreakpointsSidebarPane.js"); 27 importScript("BreakpointsSidebarPane.js");
28 importScript("CallStackSidebarPane.js"); 28 importScript("CallStackSidebarPane.js");
29 importScript("SimpleHistoryManager.js");
30 importScript("EditingLocationHistoryManager.js");
29 importScript("FilePathScoreFunction.js"); 31 importScript("FilePathScoreFunction.js");
30 importScript("FilteredItemSelectionDialog.js"); 32 importScript("FilteredItemSelectionDialog.js");
31 importScript("UISourceCodeFrame.js"); 33 importScript("UISourceCodeFrame.js");
32 importScript("JavaScriptSourceFrame.js"); 34 importScript("JavaScriptSourceFrame.js");
33 importScript("CSSSourceFrame.js"); 35 importScript("CSSSourceFrame.js");
34 importScript("NavigatorOverlayController.js"); 36 importScript("NavigatorOverlayController.js");
35 importScript("NavigatorView.js"); 37 importScript("NavigatorView.js");
36 importScript("RevisionHistoryView.js"); 38 importScript("RevisionHistoryView.js");
37 importScript("ScopeChainSidebarPane.js"); 39 importScript("ScopeChainSidebarPane.js");
38 importScript("SourcesNavigator.js"); 40 importScript("SourcesNavigator.js");
(...skipping 23 matching lines...) Expand all
62 WebInspector.settings.showEditorInDrawer = WebInspector.settings.createSetti ng("showEditorInDrawer", true); 64 WebInspector.settings.showEditorInDrawer = WebInspector.settings.createSetti ng("showEditorInDrawer", true);
63 65
64 this._workspace = workspaceForTest || WebInspector.workspace; 66 this._workspace = workspaceForTest || WebInspector.workspace;
65 67
66 /** 68 /**
67 * @return {!WebInspector.View} 69 * @return {!WebInspector.View}
68 * @this {WebInspector.SourcesPanel} 70 * @this {WebInspector.SourcesPanel}
69 */ 71 */
70 function viewGetter() 72 function viewGetter()
71 { 73 {
72 return this.visibleView; 74 return this;
73 } 75 }
74 WebInspector.GoToLineDialog.install(this, viewGetter.bind(this)); 76 WebInspector.GoToLineDialog.install(this, viewGetter.bind(this));
75 77
76 var helpSection = WebInspector.shortcutsScreen.section(WebInspector.UIString ("Sources Panel")); 78 var helpSection = WebInspector.shortcutsScreen.section(WebInspector.UIString ("Sources Panel"));
77 this.debugToolbar = this._createDebugToolbar(); 79 this.debugToolbar = this._createDebugToolbar();
78 80
79 const initialDebugSidebarWidth = 225; 81 const initialDebugSidebarWidth = 225;
80 const minimumDebugSidebarWidthPercent = 0.5; 82 const minimumDebugSidebarWidthPercent = 0.5;
81 this.createSidebarView(this.element, WebInspector.SidebarView.SidebarPositio n.End, initialDebugSidebarWidth); 83 this.createSidebarView(this.element, WebInspector.SidebarView.SidebarPositio n.End, initialDebugSidebarWidth);
82 this.splitView.element.id = "scripts-split-view"; 84 this.splitView.element.id = "scripts-split-view";
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 this.sidebarPanes.jsBreakpoints = new WebInspector.JavaScriptBreakpointsSide barPane(WebInspector.breakpointManager, this._showSourceLocation.bind(this)); 137 this.sidebarPanes.jsBreakpoints = new WebInspector.JavaScriptBreakpointsSide barPane(WebInspector.breakpointManager, this._showSourceLocation.bind(this));
136 this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.cr eateProxy(this); 138 this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.cr eateProxy(this);
137 this.sidebarPanes.xhrBreakpoints = new WebInspector.XHRBreakpointsSidebarPan e(); 139 this.sidebarPanes.xhrBreakpoints = new WebInspector.XHRBreakpointsSidebarPan e();
138 this.sidebarPanes.eventListenerBreakpoints = new WebInspector.EventListenerB reakpointsSidebarPane(); 140 this.sidebarPanes.eventListenerBreakpoints = new WebInspector.EventListenerB reakpointsSidebarPane();
139 141
140 if (Capabilities.canInspectWorkers && !WebInspector.WorkerManager.isWorkerFr ontend()) { 142 if (Capabilities.canInspectWorkers && !WebInspector.WorkerManager.isWorkerFr ontend()) {
141 WorkerAgent.enable(); 143 WorkerAgent.enable();
142 this.sidebarPanes.workerList = new WebInspector.WorkersSidebarPane(WebIn spector.workerManager); 144 this.sidebarPanes.workerList = new WebInspector.WorkersSidebarPane(WebIn spector.workerManager);
143 } 145 }
144 146
147 /**
148 * @this {WebInspector.SourcesPanel}
149 */
150 function currentSourceFrame()
151 {
152 var uiSourceCode = this.currentUISourceCode();
153 if (!uiSourceCode)
154 return null;
155 return this._sourceFramesByUISourceCode.get(uiSourceCode);
156 }
157
158 this._historyManager = new WebInspector.EditingLocationHistoryManager(this, currentSourceFrame.bind(this));
159 this.registerShortcuts(WebInspector.SourcesPanelDescriptor.ShortcutKeys.Jump ToPreviousLocation, this._onJumpToPreviousLocation.bind(this));
160 this.registerShortcuts(WebInspector.SourcesPanelDescriptor.ShortcutKeys.Jump ToNextLocation, this._onJumpToNextLocation.bind(this));
161
145 this.sidebarPanes.callstack.registerShortcuts(this.registerShortcuts.bind(th is)); 162 this.sidebarPanes.callstack.registerShortcuts(this.registerShortcuts.bind(th is));
146 this.registerShortcuts(WebInspector.SourcesPanelDescriptor.ShortcutKeys.GoTo Member, this._showOutlineDialog.bind(this)); 163 this.registerShortcuts(WebInspector.SourcesPanelDescriptor.ShortcutKeys.GoTo Member, this._showOutlineDialog.bind(this));
147 this.registerShortcuts(WebInspector.SourcesPanelDescriptor.ShortcutKeys.Togg leBreakpoint, this._toggleBreakpoint.bind(this)); 164 this.registerShortcuts(WebInspector.SourcesPanelDescriptor.ShortcutKeys.Togg leBreakpoint, this._toggleBreakpoint.bind(this));
148 165
149 this._extensionSidebarPanes = []; 166 this._extensionSidebarPanes = [];
150 167
151 this._toggleFormatSourceButton = new WebInspector.StatusBarButton(WebInspect or.UIString("Pretty print"), "sources-toggle-pretty-print-status-bar-item"); 168 this._toggleFormatSourceButton = new WebInspector.StatusBarButton(WebInspect or.UIString("Pretty print"), "sources-toggle-pretty-print-status-bar-item");
152 this._toggleFormatSourceButton.toggled = false; 169 this._toggleFormatSourceButton.toggled = false;
153 this._toggleFormatSourceButton.addEventListener("click", this._toggleFormatS ource, this); 170 this._toggleFormatSourceButton.addEventListener("click", this._toggleFormatS ource, this);
154 171
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 234
218 /** @type {!Array.<!WebInspector.DebuggerModel.PauseOnExceptionsState>} */ 235 /** @type {!Array.<!WebInspector.DebuggerModel.PauseOnExceptionsState>} */
219 WebInspector.SourcesPanel.PauseOnExceptionsStates = [ 236 WebInspector.SourcesPanel.PauseOnExceptionsStates = [
220 WebInspector.DebuggerModel.PauseOnExceptionsState.DontPauseOnExceptions, 237 WebInspector.DebuggerModel.PauseOnExceptionsState.DontPauseOnExceptions,
221 WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnUncaughtExceptions, 238 WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnUncaughtExceptions,
222 WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnAllExceptions 239 WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnAllExceptions
223 ]; 240 ];
224 241
225 WebInspector.SourcesPanel.prototype = { 242 WebInspector.SourcesPanel.prototype = {
226 /** 243 /**
244 * @param {?Event=} event
245 */
246 _onJumpToPreviousLocation: function(event)
247 {
248 this._historyManager.rollback();
249 return true;
250 },
251
252 /**
253 * @param {?Event=} event
254 */
255 _onJumpToNextLocation: function(event)
256 {
257 this._historyManager.rollover();
258 return true;
259 },
260
261 /**
227 * @return {!Element} 262 * @return {!Element}
228 */ 263 */
229 defaultFocusedElement: function() 264 defaultFocusedElement: function()
230 { 265 {
231 return this._editorContainer.view.defaultFocusedElement() || this._navig ator.view.defaultFocusedElement(); 266 return this._editorContainer.view.defaultFocusedElement() || this._navig ator.view.defaultFocusedElement();
232 }, 267 },
233 268
234 get paused() 269 get paused()
235 { 270 {
236 return this._paused; 271 return this._paused;
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 }, 333 },
299 334
300 /** 335 /**
301 * @param {!Array.<!WebInspector.UISourceCode>} uiSourceCodes 336 * @param {!Array.<!WebInspector.UISourceCode>} uiSourceCodes
302 */ 337 */
303 _removeUISourceCodes: function(uiSourceCodes) 338 _removeUISourceCodes: function(uiSourceCodes)
304 { 339 {
305 for (var i = 0; i < uiSourceCodes.length; ++i) { 340 for (var i = 0; i < uiSourceCodes.length; ++i) {
306 this._navigator.removeUISourceCode(uiSourceCodes[i]); 341 this._navigator.removeUISourceCode(uiSourceCodes[i]);
307 this._removeSourceFrame(uiSourceCodes[i]); 342 this._removeSourceFrame(uiSourceCodes[i]);
343 this._historyManager.removeHistoryForSourceCode(uiSourceCodes[i]);
308 } 344 }
309 this._editorContainer.removeUISourceCodes(uiSourceCodes); 345 this._editorContainer.removeUISourceCodes(uiSourceCodes);
310 }, 346 },
311 347
312 _consoleCommandEvaluatedInSelectedCallFrame: function(event) 348 _consoleCommandEvaluatedInSelectedCallFrame: function(event)
313 { 349 {
314 this.sidebarPanes.scopechain.update(WebInspector.debuggerModel.selectedC allFrame()); 350 this.sidebarPanes.scopechain.update(WebInspector.debuggerModel.selectedC allFrame());
315 }, 351 },
316 352
317 _debuggerPaused: function() 353 _debuggerPaused: function()
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 551
516 /** 552 /**
517 * @param {!WebInspector.UISourceCode} uiSourceCode 553 * @param {!WebInspector.UISourceCode} uiSourceCode
518 * @param {number=} lineNumber 554 * @param {number=} lineNumber
519 * @param {number=} columnNumber 555 * @param {number=} columnNumber
520 * @param {boolean=} forceShowInPanel 556 * @param {boolean=} forceShowInPanel
521 */ 557 */
522 _showSourceLocation: function(uiSourceCode, lineNumber, columnNumber, forceS howInPanel) 558 _showSourceLocation: function(uiSourceCode, lineNumber, columnNumber, forceS howInPanel)
523 { 559 {
524 this._showEditor(forceShowInPanel); 560 this._showEditor(forceShowInPanel);
561 this._historyManager.updateCurrentState();
525 var sourceFrame = this._showFile(uiSourceCode); 562 var sourceFrame = this._showFile(uiSourceCode);
526 if (typeof lineNumber === "number") 563 if (typeof lineNumber === "number")
527 sourceFrame.highlightPosition(lineNumber, columnNumber); 564 sourceFrame.highlightPosition(lineNumber, columnNumber);
565 this._historyManager.pushNewState();
528 sourceFrame.focus(); 566 sourceFrame.focus();
529
530 WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMet rics.UserAction, { 567 WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMet rics.UserAction, {
531 action: WebInspector.UserMetrics.UserActionNames.OpenSourceLink, 568 action: WebInspector.UserMetrics.UserActionNames.OpenSourceLink,
532 url: uiSourceCode.originURL(), 569 url: uiSourceCode.originURL(),
533 lineNumber: lineNumber 570 lineNumber: lineNumber
534 }); 571 });
535 }, 572 },
536 573
537 /** 574 /**
538 * @param {!WebInspector.UISourceCode} uiSourceCode 575 * @param {!WebInspector.UISourceCode} uiSourceCode
539 * @return {!WebInspector.SourceFrame} 576 * @return {!WebInspector.SourceFrame}
540 */ 577 */
541 _showFile: function(uiSourceCode) 578 _showFile: function(uiSourceCode)
542 { 579 {
543 var sourceFrame = this._getOrCreateSourceFrame(uiSourceCode); 580 var sourceFrame = this._getOrCreateSourceFrame(uiSourceCode);
544 if (this._currentUISourceCode === uiSourceCode) 581 if (this._currentUISourceCode === uiSourceCode)
545 return sourceFrame; 582 return sourceFrame;
583
546 this._currentUISourceCode = uiSourceCode; 584 this._currentUISourceCode = uiSourceCode;
547 if (!uiSourceCode.project().isServiceProject()) 585 if (!uiSourceCode.project().isServiceProject())
548 this._navigator.revealUISourceCode(uiSourceCode, true); 586 this._navigator.revealUISourceCode(uiSourceCode, true);
587
549 this._editorContainer.showFile(uiSourceCode); 588 this._editorContainer.showFile(uiSourceCode);
550 this._updateScriptViewStatusBarItems(); 589 this._updateScriptViewStatusBarItems();
551 590
552 if (this._currentUISourceCode.project().type() === WebInspector.projectT ypes.Snippets) 591 if (this._currentUISourceCode.project().type() === WebInspector.projectT ypes.Snippets)
553 this._runSnippetButton.element.classList.remove("hidden"); 592 this._runSnippetButton.element.classList.remove("hidden");
554 else 593 else
555 this._runSnippetButton.element.classList.add("hidden"); 594 this._runSnippetButton.element.classList.add("hidden");
556 595
557 return sourceFrame; 596 return sourceFrame;
558 }, 597 },
(...skipping 14 matching lines...) Expand all
573 break; 612 break;
574 case WebInspector.resourceTypes.Stylesheet: 613 case WebInspector.resourceTypes.Stylesheet:
575 sourceFrame = new WebInspector.CSSSourceFrame(uiSourceCode); 614 sourceFrame = new WebInspector.CSSSourceFrame(uiSourceCode);
576 break; 615 break;
577 default: 616 default:
578 sourceFrame = new WebInspector.UISourceCodeFrame(uiSourceCode); 617 sourceFrame = new WebInspector.UISourceCodeFrame(uiSourceCode);
579 break; 618 break;
580 } 619 }
581 sourceFrame.setHighlighterType(uiSourceCode.highlighterType()); 620 sourceFrame.setHighlighterType(uiSourceCode.highlighterType());
582 this._sourceFramesByUISourceCode.put(uiSourceCode, sourceFrame); 621 this._sourceFramesByUISourceCode.put(uiSourceCode, sourceFrame);
622 this._historyManager.trackSourceFrameCursorJumps(sourceFrame);
583 return sourceFrame; 623 return sourceFrame;
584 }, 624 },
585 625
586 /** 626 /**
587 * @param {!WebInspector.UISourceCode} uiSourceCode 627 * @param {!WebInspector.UISourceCode} uiSourceCode
588 * @return {!WebInspector.SourceFrame} 628 * @return {!WebInspector.SourceFrame}
589 */ 629 */
590 _getOrCreateSourceFrame: function(uiSourceCode) 630 _getOrCreateSourceFrame: function(uiSourceCode)
591 { 631 {
592 return this._sourceFramesByUISourceCode.get(uiSourceCode) || this._creat eSourceFrame(uiSourceCode); 632 return this._sourceFramesByUISourceCode.get(uiSourceCode) || this._creat eSourceFrame(uiSourceCode);
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 _setExecutionLine: function(uiLocation) 697 _setExecutionLine: function(uiLocation)
658 { 698 {
659 var callFrame = WebInspector.debuggerModel.selectedCallFrame() 699 var callFrame = WebInspector.debuggerModel.selectedCallFrame()
660 var sourceFrame = this._getOrCreateSourceFrame(uiLocation.uiSourceCode); 700 var sourceFrame = this._getOrCreateSourceFrame(uiLocation.uiSourceCode);
661 sourceFrame.setExecutionLine(uiLocation.lineNumber, callFrame); 701 sourceFrame.setExecutionLine(uiLocation.lineNumber, callFrame);
662 this._executionSourceFrame = sourceFrame; 702 this._executionSourceFrame = sourceFrame;
663 }, 703 },
664 704
665 _executionLineChanged: function(uiLocation) 705 _executionLineChanged: function(uiLocation)
666 { 706 {
707 this._historyManager.updateCurrentState();
667 this._clearCurrentExecutionLine(); 708 this._clearCurrentExecutionLine();
668 this._setExecutionLine(uiLocation); 709 this._setExecutionLine(uiLocation);
669 710
670 var uiSourceCode = uiLocation.uiSourceCode; 711 var uiSourceCode = uiLocation.uiSourceCode;
671 var scriptFile = this._currentUISourceCode ? this._currentUISourceCode.s criptFile() : null; 712 var scriptFile = this._currentUISourceCode ? this._currentUISourceCode.s criptFile() : null;
672 if (this._skipExecutionLineRevealing) 713 if (this._skipExecutionLineRevealing)
673 return; 714 return;
674 this._skipExecutionLineRevealing = true; 715 this._skipExecutionLineRevealing = true;
716
675 var sourceFrame = this._showFile(uiSourceCode); 717 var sourceFrame = this._showFile(uiSourceCode);
676 sourceFrame.revealLine(uiLocation.lineNumber); 718 sourceFrame.revealLine(uiLocation.lineNumber);
719 this._historyManager.pushNewState();
720
677 if (sourceFrame.canEditSource()) 721 if (sourceFrame.canEditSource())
678 sourceFrame.setSelection(WebInspector.TextRange.createFromLocation(u iLocation.lineNumber, 0)); 722 sourceFrame.setSelection(WebInspector.TextRange.createFromLocation(u iLocation.lineNumber, 0));
679 sourceFrame.focus(); 723 sourceFrame.focus();
680 }, 724 },
681 725
682 _callFrameSelected: function(event) 726 _callFrameSelected: function(event)
683 { 727 {
684 var callFrame = event.data; 728 var callFrame = event.data;
685 729
686 if (!callFrame) 730 if (!callFrame)
687 return; 731 return;
688 732
689 this.sidebarPanes.scopechain.update(callFrame); 733 this.sidebarPanes.scopechain.update(callFrame);
690 this.sidebarPanes.watchExpressions.refreshExpressions(); 734 this.sidebarPanes.watchExpressions.refreshExpressions();
691 this.sidebarPanes.callstack.setSelectedCallFrame(callFrame); 735 this.sidebarPanes.callstack.setSelectedCallFrame(callFrame);
692 callFrame.createLiveLocation(this._executionLineChanged.bind(this)); 736 callFrame.createLiveLocation(this._executionLineChanged.bind(this));
693 }, 737 },
694 738
695 _editorClosed: function(event) 739 _editorClosed: function(event)
696 { 740 {
697 this._navigatorController.hideNavigatorOverlay(); 741 this._navigatorController.hideNavigatorOverlay();
698 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data ); 742 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data );
743 this._historyManager.removeHistoryForSourceCode(uiSourceCode);
699 744
700 if (this._currentUISourceCode === uiSourceCode) 745 if (this._currentUISourceCode === uiSourceCode)
701 delete this._currentUISourceCode; 746 delete this._currentUISourceCode;
702 747
703 // SourcesNavigator does not need to update on EditorClosed. 748 // SourcesNavigator does not need to update on EditorClosed.
704 this._updateScriptViewStatusBarItems(); 749 this._updateScriptViewStatusBarItems();
705 this._searchableView.resetSearch(); 750 this._searchableView.resetSearch();
706 }, 751 },
707 752
708 _editorSelected: function(event) 753 _editorSelected: function(event)
709 { 754 {
710 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data ); 755 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data .currentFile);
756 var shouldUseHistoryManager = uiSourceCode !== this._currentUISourceCode && event.data.userGesture;
757 if (shouldUseHistoryManager)
758 this._historyManager.updateCurrentState();
711 var sourceFrame = this._showFile(uiSourceCode); 759 var sourceFrame = this._showFile(uiSourceCode);
760 if (shouldUseHistoryManager)
761 this._historyManager.pushNewState();
762
712 this._navigatorController.hideNavigatorOverlay(); 763 this._navigatorController.hideNavigatorOverlay();
713 if (!this._navigatorController.isNavigatorPinned()) 764 if (!this._navigatorController.isNavigatorPinned())
714 sourceFrame.focus(); 765 sourceFrame.focus();
715 this._searchableView.setReplaceable(!!sourceFrame && sourceFrame.canEdit Source()); 766 this._searchableView.setReplaceable(!!sourceFrame && sourceFrame.canEdit Source());
716 this._searchableView.resetSearch(); 767 this._searchableView.resetSearch();
717 }, 768 },
718 769
719 _sourceSelected: function(event) 770 _sourceSelected: function(event)
720 { 771 {
721 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data .uiSourceCode); 772 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data .uiSourceCode);
773
774 var shouldUseHistoryManager = uiSourceCode !== this._currentUISourceCode ;
775
776 if (shouldUseHistoryManager)
777 this._historyManager.updateCurrentState();
722 var sourceFrame = this._showFile(uiSourceCode); 778 var sourceFrame = this._showFile(uiSourceCode);
779 if (shouldUseHistoryManager)
780 this._historyManager.pushNewState();
781
723 this._navigatorController.hideNavigatorOverlay(); 782 this._navigatorController.hideNavigatorOverlay();
724 if (sourceFrame && (!this._navigatorController.isNavigatorPinned() || ev ent.data.focusSource)) 783 if (sourceFrame && (!this._navigatorController.isNavigatorPinned() || ev ent.data.focusSource))
725 sourceFrame.focus(); 784 sourceFrame.focus();
726 }, 785 },
727 786
728 _itemSearchStarted: function(event) 787 _itemSearchStarted: function(event)
729 { 788 {
730 var searchText = /** @type {string} */ (event.data); 789 var searchText = /** @type {string} */ (event.data);
731 WebInspector.OpenResourceDialog.show(this, this.editorView.mainElement() , searchText); 790 WebInspector.OpenResourceDialog.show(this, this.editorView.mainElement() , searchText);
732 }, 791 },
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after
1687 }, 1746 },
1688 1747
1689 /** 1748 /**
1690 * @param {number} line 1749 * @param {number} line
1691 * @param {number=} column 1750 * @param {number=} column
1692 */ 1751 */
1693 highlightPosition: function(line, column) 1752 highlightPosition: function(line, column)
1694 { 1753 {
1695 if (!this.canHighlightPosition()) 1754 if (!this.canHighlightPosition())
1696 return; 1755 return;
1756 this._historyManager.updateCurrentState();
1697 this.visibleView.highlightPosition(line, column); 1757 this.visibleView.highlightPosition(line, column);
1758 this._historyManager.pushNewState();
1698 }, 1759 },
1699 1760
1700 /** 1761 /**
1701 * @param {string} id 1762 * @param {string} id
1702 * @param {!WebInspector.SidebarPane} pane 1763 * @param {!WebInspector.SidebarPane} pane
1703 */ 1764 */
1704 addExtensionSidebarPane: function(id, pane) 1765 addExtensionSidebarPane: function(id, pane)
1705 { 1766 {
1706 this._extensionSidebarPanes.push(pane); 1767 this._extensionSidebarPanes.push(pane);
1707 this._extensionSidebarPanesContainer.addPane(pane); 1768 this._extensionSidebarPanesContainer.addPane(pane);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
1790 WebInspector.DrawerEditorView = function() 1851 WebInspector.DrawerEditorView = function()
1791 { 1852 {
1792 WebInspector.View.call(this); 1853 WebInspector.View.call(this);
1793 this.element.id = "drawer-editor-view"; 1854 this.element.id = "drawer-editor-view";
1794 this.element.classList.add("vbox"); 1855 this.element.classList.add("vbox");
1795 } 1856 }
1796 1857
1797 WebInspector.DrawerEditorView.prototype = { 1858 WebInspector.DrawerEditorView.prototype = {
1798 __proto__: WebInspector.View.prototype 1859 __proto__: WebInspector.View.prototype
1799 } 1860 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698