OLD | NEW |
---|---|
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 22 matching lines...) Expand all Loading... | |
61 WebInspector.settings.showEditorInDrawer = WebInspector.settings.createSetti ng("showEditorInDrawer", true); | 63 WebInspector.settings.showEditorInDrawer = WebInspector.settings.createSetti ng("showEditorInDrawer", true); |
62 | 64 |
63 this._workspace = workspaceForTest || WebInspector.workspace; | 65 this._workspace = workspaceForTest || WebInspector.workspace; |
64 | 66 |
65 /** | 67 /** |
66 * @return {!WebInspector.View} | 68 * @return {!WebInspector.View} |
67 * @this {WebInspector.SourcesPanel} | 69 * @this {WebInspector.SourcesPanel} |
68 */ | 70 */ |
69 function viewGetter() | 71 function viewGetter() |
70 { | 72 { |
71 return this.visibleView; | 73 return this; |
72 } | 74 } |
73 WebInspector.GoToLineDialog.install(this, viewGetter.bind(this)); | 75 WebInspector.GoToLineDialog.install(this, viewGetter.bind(this)); |
74 | 76 |
75 var helpSection = WebInspector.shortcutsScreen.section(WebInspector.UIString ("Sources Panel")); | 77 var helpSection = WebInspector.shortcutsScreen.section(WebInspector.UIString ("Sources Panel")); |
76 this.debugToolbar = this._createDebugToolbar(); | 78 this.debugToolbar = this._createDebugToolbar(); |
77 | 79 |
78 const initialDebugSidebarWidth = 225; | 80 const initialDebugSidebarWidth = 225; |
79 const minimumDebugSidebarWidthPercent = 0.5; | 81 const minimumDebugSidebarWidthPercent = 0.5; |
80 this.createSidebarView(this.element, WebInspector.SidebarView.SidebarPositio n.End, initialDebugSidebarWidth); | 82 this.createSidebarView(this.element, WebInspector.SidebarView.SidebarPositio n.End, initialDebugSidebarWidth); |
81 this.splitView.element.id = "scripts-split-view"; | 83 this.splitView.element.id = "scripts-split-view"; |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 this.sidebarPanes.jsBreakpoints = new WebInspector.JavaScriptBreakpointsSide barPane(WebInspector.breakpointManager, this._showSourceLocation.bind(this)); | 136 this.sidebarPanes.jsBreakpoints = new WebInspector.JavaScriptBreakpointsSide barPane(WebInspector.breakpointManager, this._showSourceLocation.bind(this)); |
135 this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.cr eateProxy(this); | 137 this.sidebarPanes.domBreakpoints = WebInspector.domBreakpointsSidebarPane.cr eateProxy(this); |
136 this.sidebarPanes.xhrBreakpoints = new WebInspector.XHRBreakpointsSidebarPan e(); | 138 this.sidebarPanes.xhrBreakpoints = new WebInspector.XHRBreakpointsSidebarPan e(); |
137 this.sidebarPanes.eventListenerBreakpoints = new WebInspector.EventListenerB reakpointsSidebarPane(); | 139 this.sidebarPanes.eventListenerBreakpoints = new WebInspector.EventListenerB reakpointsSidebarPane(); |
138 | 140 |
139 if (Capabilities.canInspectWorkers && !WebInspector.WorkerManager.isWorkerFr ontend()) { | 141 if (Capabilities.canInspectWorkers && !WebInspector.WorkerManager.isWorkerFr ontend()) { |
140 WorkerAgent.enable(); | 142 WorkerAgent.enable(); |
141 this.sidebarPanes.workerList = new WebInspector.WorkersSidebarPane(WebIn spector.workerManager); | 143 this.sidebarPanes.workerList = new WebInspector.WorkersSidebarPane(WebIn spector.workerManager); |
142 } | 144 } |
143 | 145 |
146 /** | |
147 * @this {WebInspector.SourcesPanel} | |
148 */ | |
149 function currentSourceFrame() | |
150 { | |
151 var uiSourceCode = this.currentUISourceCode(); | |
152 if (!uiSourceCode) | |
153 return null; | |
154 return this._sourceFramesByUISourceCode.get(uiSourceCode); | |
155 } | |
156 | |
157 this._historyManager = new WebInspector.EditingLocationHistoryManager(this, currentSourceFrame.bind(this)); | |
158 this.registerShortcuts(WebInspector.SourcesPanelDescriptor.ShortcutKeys.Jump ToPreviousLocation, this._onJumpToPreviousLocation.bind(this)); | |
159 this.registerShortcuts(WebInspector.SourcesPanelDescriptor.ShortcutKeys.Jump ToNextLocation, this._onJumpToNextLocation.bind(this)); | |
160 | |
144 this.sidebarPanes.callstack.registerShortcuts(this.registerShortcuts.bind(th is)); | 161 this.sidebarPanes.callstack.registerShortcuts(this.registerShortcuts.bind(th is)); |
145 this.registerShortcuts(WebInspector.SourcesPanelDescriptor.ShortcutKeys.GoTo Member, this._showOutlineDialog.bind(this)); | 162 this.registerShortcuts(WebInspector.SourcesPanelDescriptor.ShortcutKeys.GoTo Member, this._showOutlineDialog.bind(this)); |
146 this.registerShortcuts(WebInspector.SourcesPanelDescriptor.ShortcutKeys.Togg leBreakpoint, this._toggleBreakpoint.bind(this)); | 163 this.registerShortcuts(WebInspector.SourcesPanelDescriptor.ShortcutKeys.Togg leBreakpoint, this._toggleBreakpoint.bind(this)); |
147 | 164 |
148 this._extensionSidebarPanes = []; | 165 this._extensionSidebarPanes = []; |
149 | 166 |
150 this._toggleFormatSourceButton = new WebInspector.StatusBarButton(WebInspect or.UIString("Pretty print"), "sources-toggle-pretty-print-status-bar-item"); | 167 this._toggleFormatSourceButton = new WebInspector.StatusBarButton(WebInspect or.UIString("Pretty print"), "sources-toggle-pretty-print-status-bar-item"); |
151 this._toggleFormatSourceButton.toggled = false; | 168 this._toggleFormatSourceButton.toggled = false; |
152 this._toggleFormatSourceButton.addEventListener("click", this._toggleFormatS ource, this); | 169 this._toggleFormatSourceButton.addEventListener("click", this._toggleFormatS ource, this); |
153 | 170 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
209 event.returnValue = WebInspector.UIString("DevTools have unsaved changes that will be permanently lost."); | 226 event.returnValue = WebInspector.UIString("DevTools have unsaved changes that will be permanently lost."); |
210 WebInspector.showPanel("sources"); | 227 WebInspector.showPanel("sources"); |
211 for (var i = 0; i < unsavedSourceCodes.length; ++i) | 228 for (var i = 0; i < unsavedSourceCodes.length; ++i) |
212 WebInspector.panels.sources.showUISourceCode(unsavedSourceCodes[i]); | 229 WebInspector.panels.sources.showUISourceCode(unsavedSourceCodes[i]); |
213 } | 230 } |
214 window.addEventListener("beforeunload", handleBeforeUnload.bind(this), true) ; | 231 window.addEventListener("beforeunload", handleBeforeUnload.bind(this), true) ; |
215 } | 232 } |
216 | 233 |
217 WebInspector.SourcesPanel.prototype = { | 234 WebInspector.SourcesPanel.prototype = { |
218 /** | 235 /** |
236 * @param {?Event=} event | |
237 */ | |
238 _onJumpToPreviousLocation: function(event) | |
239 { | |
240 this._historyManager.rollback(); | |
241 return true; | |
242 }, | |
243 | |
244 /** | |
245 * @param {?Event=} event | |
246 */ | |
247 _onJumpToNextLocation: function(event) | |
248 { | |
249 this._historyManager.rollover(); | |
250 return true; | |
251 }, | |
252 | |
253 /** | |
219 * @return {!Element} | 254 * @return {!Element} |
220 */ | 255 */ |
221 defaultFocusedElement: function() | 256 defaultFocusedElement: function() |
222 { | 257 { |
223 return this._editorContainer.view.defaultFocusedElement() || this._navig ator.view.defaultFocusedElement(); | 258 return this._editorContainer.view.defaultFocusedElement() || this._navig ator.view.defaultFocusedElement(); |
224 }, | 259 }, |
225 | 260 |
226 get paused() | 261 get paused() |
227 { | 262 { |
228 return this._paused; | 263 return this._paused; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
290 }, | 325 }, |
291 | 326 |
292 /** | 327 /** |
293 * @param {!Array.<!WebInspector.UISourceCode>} uiSourceCodes | 328 * @param {!Array.<!WebInspector.UISourceCode>} uiSourceCodes |
294 */ | 329 */ |
295 _removeUISourceCodes: function(uiSourceCodes) | 330 _removeUISourceCodes: function(uiSourceCodes) |
296 { | 331 { |
297 for (var i = 0; i < uiSourceCodes.length; ++i) { | 332 for (var i = 0; i < uiSourceCodes.length; ++i) { |
298 this._navigator.removeUISourceCode(uiSourceCodes[i]); | 333 this._navigator.removeUISourceCode(uiSourceCodes[i]); |
299 this._removeSourceFrame(uiSourceCodes[i]); | 334 this._removeSourceFrame(uiSourceCodes[i]); |
335 this._historyManager.removeHistoryForSourceCode(uiSourceCodes[i]); | |
300 } | 336 } |
301 this._editorContainer.removeUISourceCodes(uiSourceCodes); | 337 this._editorContainer.removeUISourceCodes(uiSourceCodes); |
302 }, | 338 }, |
303 | 339 |
304 _consoleCommandEvaluatedInSelectedCallFrame: function(event) | 340 _consoleCommandEvaluatedInSelectedCallFrame: function(event) |
305 { | 341 { |
306 this.sidebarPanes.scopechain.update(WebInspector.debuggerModel.selectedC allFrame()); | 342 this.sidebarPanes.scopechain.update(WebInspector.debuggerModel.selectedC allFrame()); |
307 }, | 343 }, |
308 | 344 |
309 _debuggerPaused: function() | 345 _debuggerPaused: function() |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
506 }, | 542 }, |
507 | 543 |
508 /** | 544 /** |
509 * @param {!WebInspector.UISourceCode} uiSourceCode | 545 * @param {!WebInspector.UISourceCode} uiSourceCode |
510 * @param {number=} lineNumber | 546 * @param {number=} lineNumber |
511 * @param {number=} columnNumber | 547 * @param {number=} columnNumber |
512 * @param {boolean=} forceShowInPanel | 548 * @param {boolean=} forceShowInPanel |
513 */ | 549 */ |
514 _showSourceLocation: function(uiSourceCode, lineNumber, columnNumber, forceS howInPanel) | 550 _showSourceLocation: function(uiSourceCode, lineNumber, columnNumber, forceS howInPanel) |
515 { | 551 { |
552 if (uiSourceCode === this._currentUISourceCode && typeof lineNumber === "number") { | |
553 this.highlightPosition(lineNumber, columnNumber); | |
vsevik
2014/01/17 13:00:23
remove this!
lushnikov
2014/01/17 13:28:45
Done.
| |
554 return; | |
555 } | |
516 this._showEditor(forceShowInPanel); | 556 this._showEditor(forceShowInPanel); |
557 this._historyManager.updateCurrentState(); | |
517 var sourceFrame = this._showFile(uiSourceCode); | 558 var sourceFrame = this._showFile(uiSourceCode); |
518 if (typeof lineNumber === "number") | 559 if (typeof lineNumber === "number") |
519 sourceFrame.highlightPosition(lineNumber, columnNumber); | 560 sourceFrame.highlightPosition(lineNumber, columnNumber); |
561 this._historyManager.pushNewState(); | |
520 sourceFrame.focus(); | 562 sourceFrame.focus(); |
521 | |
522 WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMet rics.UserAction, { | 563 WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMet rics.UserAction, { |
523 action: WebInspector.UserMetrics.UserActionNames.OpenSourceLink, | 564 action: WebInspector.UserMetrics.UserActionNames.OpenSourceLink, |
524 url: uiSourceCode.originURL(), | 565 url: uiSourceCode.originURL(), |
525 lineNumber: lineNumber | 566 lineNumber: lineNumber |
526 }); | 567 }); |
527 }, | 568 }, |
528 | 569 |
529 /** | 570 /** |
530 * @param {!WebInspector.UISourceCode} uiSourceCode | 571 * @param {!WebInspector.UISourceCode} uiSourceCode |
531 * @return {!WebInspector.SourceFrame} | 572 * @return {!WebInspector.SourceFrame} |
532 */ | 573 */ |
533 _showFile: function(uiSourceCode) | 574 _showFile: function(uiSourceCode) |
534 { | 575 { |
535 var sourceFrame = this._getOrCreateSourceFrame(uiSourceCode); | 576 var sourceFrame = this._getOrCreateSourceFrame(uiSourceCode); |
536 if (this._currentUISourceCode === uiSourceCode) | 577 if (this._currentUISourceCode === uiSourceCode) |
537 return sourceFrame; | 578 return sourceFrame; |
579 | |
538 this._currentUISourceCode = uiSourceCode; | 580 this._currentUISourceCode = uiSourceCode; |
539 if (!uiSourceCode.project().isServiceProject()) | 581 if (!uiSourceCode.project().isServiceProject()) |
540 this._navigator.revealUISourceCode(uiSourceCode, true); | 582 this._navigator.revealUISourceCode(uiSourceCode, true); |
583 | |
541 this._editorContainer.showFile(uiSourceCode); | 584 this._editorContainer.showFile(uiSourceCode); |
542 this._updateScriptViewStatusBarItems(); | 585 this._updateScriptViewStatusBarItems(); |
543 | 586 |
544 if (this._currentUISourceCode.project().type() === WebInspector.projectT ypes.Snippets) | 587 if (this._currentUISourceCode.project().type() === WebInspector.projectT ypes.Snippets) |
545 this._runSnippetButton.element.classList.remove("hidden"); | 588 this._runSnippetButton.element.classList.remove("hidden"); |
546 else | 589 else |
547 this._runSnippetButton.element.classList.add("hidden"); | 590 this._runSnippetButton.element.classList.add("hidden"); |
548 | 591 |
549 return sourceFrame; | 592 return sourceFrame; |
550 }, | 593 }, |
(...skipping 14 matching lines...) Expand all Loading... | |
565 break; | 608 break; |
566 case WebInspector.resourceTypes.Stylesheet: | 609 case WebInspector.resourceTypes.Stylesheet: |
567 sourceFrame = new WebInspector.CSSSourceFrame(uiSourceCode); | 610 sourceFrame = new WebInspector.CSSSourceFrame(uiSourceCode); |
568 break; | 611 break; |
569 default: | 612 default: |
570 sourceFrame = new WebInspector.UISourceCodeFrame(uiSourceCode); | 613 sourceFrame = new WebInspector.UISourceCodeFrame(uiSourceCode); |
571 break; | 614 break; |
572 } | 615 } |
573 sourceFrame.setHighlighterType(uiSourceCode.highlighterType()); | 616 sourceFrame.setHighlighterType(uiSourceCode.highlighterType()); |
574 this._sourceFramesByUISourceCode.put(uiSourceCode, sourceFrame); | 617 this._sourceFramesByUISourceCode.put(uiSourceCode, sourceFrame); |
618 this._historyManager.trackSourceFrameCursorJumps(sourceFrame); | |
575 return sourceFrame; | 619 return sourceFrame; |
576 }, | 620 }, |
577 | 621 |
578 /** | 622 /** |
579 * @param {!WebInspector.UISourceCode} uiSourceCode | 623 * @param {!WebInspector.UISourceCode} uiSourceCode |
580 * @return {!WebInspector.SourceFrame} | 624 * @return {!WebInspector.SourceFrame} |
581 */ | 625 */ |
582 _getOrCreateSourceFrame: function(uiSourceCode) | 626 _getOrCreateSourceFrame: function(uiSourceCode) |
583 { | 627 { |
584 return this._sourceFramesByUISourceCode.get(uiSourceCode) || this._creat eSourceFrame(uiSourceCode); | 628 return this._sourceFramesByUISourceCode.get(uiSourceCode) || this._creat eSourceFrame(uiSourceCode); |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
657 _executionLineChanged: function(uiLocation) | 701 _executionLineChanged: function(uiLocation) |
658 { | 702 { |
659 this._clearCurrentExecutionLine(); | 703 this._clearCurrentExecutionLine(); |
660 this._setExecutionLine(uiLocation); | 704 this._setExecutionLine(uiLocation); |
661 | 705 |
662 var uiSourceCode = uiLocation.uiSourceCode; | 706 var uiSourceCode = uiLocation.uiSourceCode; |
663 var scriptFile = this._currentUISourceCode ? this._currentUISourceCode.s criptFile() : null; | 707 var scriptFile = this._currentUISourceCode ? this._currentUISourceCode.s criptFile() : null; |
664 if (this._skipExecutionLineRevealing) | 708 if (this._skipExecutionLineRevealing) |
665 return; | 709 return; |
666 this._skipExecutionLineRevealing = true; | 710 this._skipExecutionLineRevealing = true; |
711 | |
712 this._historyManager.updateCurrentState(); | |
667 var sourceFrame = this._showFile(uiSourceCode); | 713 var sourceFrame = this._showFile(uiSourceCode); |
714 this._historyManager.pushNewState(); | |
vsevik
2014/01/17 13:00:23
one line below
lushnikov
2014/01/17 13:28:45
Moved to correct places
| |
715 | |
668 sourceFrame.revealLine(uiLocation.lineNumber); | 716 sourceFrame.revealLine(uiLocation.lineNumber); |
669 if (sourceFrame.canEditSource()) | 717 if (sourceFrame.canEditSource()) |
670 sourceFrame.setSelection(WebInspector.TextRange.createFromLocation(u iLocation.lineNumber, 0)); | 718 sourceFrame.setSelection(WebInspector.TextRange.createFromLocation(u iLocation.lineNumber, 0)); |
671 sourceFrame.focus(); | 719 sourceFrame.focus(); |
672 }, | 720 }, |
673 | 721 |
674 _callFrameSelected: function(event) | 722 _callFrameSelected: function(event) |
675 { | 723 { |
676 var callFrame = event.data; | 724 var callFrame = event.data; |
677 | 725 |
678 if (!callFrame) | 726 if (!callFrame) |
679 return; | 727 return; |
680 | 728 |
681 this.sidebarPanes.scopechain.update(callFrame); | 729 this.sidebarPanes.scopechain.update(callFrame); |
682 this.sidebarPanes.watchExpressions.refreshExpressions(); | 730 this.sidebarPanes.watchExpressions.refreshExpressions(); |
683 this.sidebarPanes.callstack.setSelectedCallFrame(callFrame); | 731 this.sidebarPanes.callstack.setSelectedCallFrame(callFrame); |
684 callFrame.createLiveLocation(this._executionLineChanged.bind(this)); | 732 callFrame.createLiveLocation(this._executionLineChanged.bind(this)); |
685 }, | 733 }, |
686 | 734 |
687 _editorClosed: function(event) | 735 _editorClosed: function(event) |
688 { | 736 { |
689 this._navigatorController.hideNavigatorOverlay(); | 737 this._navigatorController.hideNavigatorOverlay(); |
690 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data ); | 738 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data ); |
739 this._historyManager.removeHistoryForSourceCode(uiSourceCode); | |
691 | 740 |
692 if (this._currentUISourceCode === uiSourceCode) | 741 if (this._currentUISourceCode === uiSourceCode) |
693 delete this._currentUISourceCode; | 742 delete this._currentUISourceCode; |
694 | 743 |
695 // SourcesNavigator does not need to update on EditorClosed. | 744 // SourcesNavigator does not need to update on EditorClosed. |
696 this._updateScriptViewStatusBarItems(); | 745 this._updateScriptViewStatusBarItems(); |
697 this._searchableView.resetSearch(); | 746 this._searchableView.resetSearch(); |
698 }, | 747 }, |
699 | 748 |
700 _editorSelected: function(event) | 749 _editorSelected: function(event) |
701 { | 750 { |
702 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data ); | 751 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data .currentFile); |
752 var shouldUseHistoryManager = uiSourceCode !== this._currentUISourceCode && event.data.userGesture; | |
753 if (shouldUseHistoryManager) | |
754 this._historyManager.updateCurrentState(); | |
703 var sourceFrame = this._showFile(uiSourceCode); | 755 var sourceFrame = this._showFile(uiSourceCode); |
756 if (shouldUseHistoryManager) | |
757 this._historyManager.pushNewState(); | |
758 | |
704 this._navigatorController.hideNavigatorOverlay(); | 759 this._navigatorController.hideNavigatorOverlay(); |
705 if (!this._navigatorController.isNavigatorPinned()) | 760 if (!this._navigatorController.isNavigatorPinned()) |
706 sourceFrame.focus(); | 761 sourceFrame.focus(); |
707 this._searchableView.setCanReplace(!!sourceFrame && sourceFrame.canEditS ource()); | 762 this._searchableView.setCanReplace(!!sourceFrame && sourceFrame.canEditS ource()); |
708 this._searchableView.resetSearch(); | 763 this._searchableView.resetSearch(); |
709 }, | 764 }, |
710 | 765 |
711 _sourceSelected: function(event) | 766 _sourceSelected: function(event) |
712 { | 767 { |
713 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data .uiSourceCode); | 768 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data .uiSourceCode); |
769 | |
770 var shouldUseHistoryManager = uiSourceCode !== this._currentUISourceCode ; | |
771 | |
772 if (shouldUseHistoryManager) | |
773 this._historyManager.updateCurrentState(); | |
714 var sourceFrame = this._showFile(uiSourceCode); | 774 var sourceFrame = this._showFile(uiSourceCode); |
775 if (shouldUseHistoryManager) | |
776 this._historyManager.pushNewState(); | |
777 | |
715 this._navigatorController.hideNavigatorOverlay(); | 778 this._navigatorController.hideNavigatorOverlay(); |
716 if (sourceFrame && (!this._navigatorController.isNavigatorPinned() || ev ent.data.focusSource)) | 779 if (sourceFrame && (!this._navigatorController.isNavigatorPinned() || ev ent.data.focusSource)) |
717 sourceFrame.focus(); | 780 sourceFrame.focus(); |
718 }, | 781 }, |
719 | 782 |
720 _itemSearchStarted: function(event) | 783 _itemSearchStarted: function(event) |
721 { | 784 { |
722 var searchText = /** @type {string} */ (event.data); | 785 var searchText = /** @type {string} */ (event.data); |
723 WebInspector.OpenResourceDialog.show(this, this.editorView.mainElement() , searchText); | 786 WebInspector.OpenResourceDialog.show(this, this.editorView.mainElement() , searchText); |
724 }, | 787 }, |
(...skipping 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1623 }, | 1686 }, |
1624 | 1687 |
1625 /** | 1688 /** |
1626 * @param {number} line | 1689 * @param {number} line |
1627 * @param {number=} column | 1690 * @param {number=} column |
1628 */ | 1691 */ |
1629 highlightPosition: function(line, column) | 1692 highlightPosition: function(line, column) |
1630 { | 1693 { |
1631 if (!this.canHighlightPosition()) | 1694 if (!this.canHighlightPosition()) |
1632 return; | 1695 return; |
1696 this._historyManager.updateCurrentState(); | |
1633 this.visibleView.highlightPosition(line, column); | 1697 this.visibleView.highlightPosition(line, column); |
1698 this._historyManager.pushNewState(); | |
1634 }, | 1699 }, |
1635 | 1700 |
1636 /** | 1701 /** |
1637 * @param {string} id | 1702 * @param {string} id |
1638 * @param {!WebInspector.SidebarPane} pane | 1703 * @param {!WebInspector.SidebarPane} pane |
1639 */ | 1704 */ |
1640 addExtensionSidebarPane: function(id, pane) | 1705 addExtensionSidebarPane: function(id, pane) |
1641 { | 1706 { |
1642 this._extensionSidebarPanes.push(pane); | 1707 this._extensionSidebarPanes.push(pane); |
1643 this._extensionSidebarPanesContainer.addPane(pane); | 1708 this._extensionSidebarPanesContainer.addPane(pane); |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1726 WebInspector.DrawerEditorView = function() | 1791 WebInspector.DrawerEditorView = function() |
1727 { | 1792 { |
1728 WebInspector.View.call(this); | 1793 WebInspector.View.call(this); |
1729 this.element.id = "drawer-editor-view"; | 1794 this.element.id = "drawer-editor-view"; |
1730 this.element.classList.add("vbox"); | 1795 this.element.classList.add("vbox"); |
1731 } | 1796 } |
1732 | 1797 |
1733 WebInspector.DrawerEditorView.prototype = { | 1798 WebInspector.DrawerEditorView.prototype = { |
1734 __proto__: WebInspector.View.prototype | 1799 __proto__: WebInspector.View.prototype |
1735 } | 1800 } |
OLD | NEW |