| 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 23 matching lines...) Expand all Loading... |
| 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 Loading... |
| 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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 215 | 232 |
| 216 /** @type {!Array.<!WebInspector.DebuggerModel.PauseOnExceptionsState>} */ | 233 /** @type {!Array.<!WebInspector.DebuggerModel.PauseOnExceptionsState>} */ |
| 217 WebInspector.SourcesPanel.PauseOnExceptionsStates = [ | 234 WebInspector.SourcesPanel.PauseOnExceptionsStates = [ |
| 218 WebInspector.DebuggerModel.PauseOnExceptionsState.DontPauseOnExceptions, | 235 WebInspector.DebuggerModel.PauseOnExceptionsState.DontPauseOnExceptions, |
| 219 WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnUncaughtExceptions, | 236 WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnUncaughtExceptions, |
| 220 WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnAllExceptions | 237 WebInspector.DebuggerModel.PauseOnExceptionsState.PauseOnAllExceptions |
| 221 ]; | 238 ]; |
| 222 | 239 |
| 223 WebInspector.SourcesPanel.prototype = { | 240 WebInspector.SourcesPanel.prototype = { |
| 224 /** | 241 /** |
| 242 * @param {?Event=} event |
| 243 */ |
| 244 _onJumpToPreviousLocation: function(event) |
| 245 { |
| 246 this._historyManager.rollback(); |
| 247 return true; |
| 248 }, |
| 249 |
| 250 /** |
| 251 * @param {?Event=} event |
| 252 */ |
| 253 _onJumpToNextLocation: function(event) |
| 254 { |
| 255 this._historyManager.rollover(); |
| 256 return true; |
| 257 }, |
| 258 |
| 259 /** |
| 225 * @return {!Element} | 260 * @return {!Element} |
| 226 */ | 261 */ |
| 227 defaultFocusedElement: function() | 262 defaultFocusedElement: function() |
| 228 { | 263 { |
| 229 return this._editorContainer.view.defaultFocusedElement() || this._navig
ator.view.defaultFocusedElement(); | 264 return this._editorContainer.view.defaultFocusedElement() || this._navig
ator.view.defaultFocusedElement(); |
| 230 }, | 265 }, |
| 231 | 266 |
| 232 get paused() | 267 get paused() |
| 233 { | 268 { |
| 234 return this._paused; | 269 return this._paused; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 }, | 331 }, |
| 297 | 332 |
| 298 /** | 333 /** |
| 299 * @param {!Array.<!WebInspector.UISourceCode>} uiSourceCodes | 334 * @param {!Array.<!WebInspector.UISourceCode>} uiSourceCodes |
| 300 */ | 335 */ |
| 301 _removeUISourceCodes: function(uiSourceCodes) | 336 _removeUISourceCodes: function(uiSourceCodes) |
| 302 { | 337 { |
| 303 for (var i = 0; i < uiSourceCodes.length; ++i) { | 338 for (var i = 0; i < uiSourceCodes.length; ++i) { |
| 304 this._navigator.removeUISourceCode(uiSourceCodes[i]); | 339 this._navigator.removeUISourceCode(uiSourceCodes[i]); |
| 305 this._removeSourceFrame(uiSourceCodes[i]); | 340 this._removeSourceFrame(uiSourceCodes[i]); |
| 341 this._historyManager.removeHistoryForSourceCode(uiSourceCodes[i]); |
| 306 } | 342 } |
| 307 this._editorContainer.removeUISourceCodes(uiSourceCodes); | 343 this._editorContainer.removeUISourceCodes(uiSourceCodes); |
| 308 }, | 344 }, |
| 309 | 345 |
| 310 _consoleCommandEvaluatedInSelectedCallFrame: function(event) | 346 _consoleCommandEvaluatedInSelectedCallFrame: function(event) |
| 311 { | 347 { |
| 312 this.sidebarPanes.scopechain.update(WebInspector.debuggerModel.selectedC
allFrame()); | 348 this.sidebarPanes.scopechain.update(WebInspector.debuggerModel.selectedC
allFrame()); |
| 313 }, | 349 }, |
| 314 | 350 |
| 315 _debuggerPaused: function() | 351 _debuggerPaused: function() |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 | 549 |
| 514 /** | 550 /** |
| 515 * @param {!WebInspector.UISourceCode} uiSourceCode | 551 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 516 * @param {number=} lineNumber | 552 * @param {number=} lineNumber |
| 517 * @param {number=} columnNumber | 553 * @param {number=} columnNumber |
| 518 * @param {boolean=} forceShowInPanel | 554 * @param {boolean=} forceShowInPanel |
| 519 */ | 555 */ |
| 520 _showSourceLocation: function(uiSourceCode, lineNumber, columnNumber, forceS
howInPanel) | 556 _showSourceLocation: function(uiSourceCode, lineNumber, columnNumber, forceS
howInPanel) |
| 521 { | 557 { |
| 522 this._showEditor(forceShowInPanel); | 558 this._showEditor(forceShowInPanel); |
| 559 this._historyManager.updateCurrentState(); |
| 523 var sourceFrame = this._showFile(uiSourceCode); | 560 var sourceFrame = this._showFile(uiSourceCode); |
| 524 if (typeof lineNumber === "number") | 561 if (typeof lineNumber === "number") |
| 525 sourceFrame.highlightPosition(lineNumber, columnNumber); | 562 sourceFrame.highlightPosition(lineNumber, columnNumber); |
| 563 this._historyManager.pushNewState(); |
| 526 sourceFrame.focus(); | 564 sourceFrame.focus(); |
| 527 | |
| 528 WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMet
rics.UserAction, { | 565 WebInspector.notifications.dispatchEventToListeners(WebInspector.UserMet
rics.UserAction, { |
| 529 action: WebInspector.UserMetrics.UserActionNames.OpenSourceLink, | 566 action: WebInspector.UserMetrics.UserActionNames.OpenSourceLink, |
| 530 url: uiSourceCode.originURL(), | 567 url: uiSourceCode.originURL(), |
| 531 lineNumber: lineNumber | 568 lineNumber: lineNumber |
| 532 }); | 569 }); |
| 533 }, | 570 }, |
| 534 | 571 |
| 535 /** | 572 /** |
| 536 * @param {!WebInspector.UISourceCode} uiSourceCode | 573 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 537 * @return {!WebInspector.SourceFrame} | 574 * @return {!WebInspector.SourceFrame} |
| 538 */ | 575 */ |
| 539 _showFile: function(uiSourceCode) | 576 _showFile: function(uiSourceCode) |
| 540 { | 577 { |
| 541 var sourceFrame = this._getOrCreateSourceFrame(uiSourceCode); | 578 var sourceFrame = this._getOrCreateSourceFrame(uiSourceCode); |
| 542 if (this._currentUISourceCode === uiSourceCode) | 579 if (this._currentUISourceCode === uiSourceCode) |
| 543 return sourceFrame; | 580 return sourceFrame; |
| 581 |
| 544 this._currentUISourceCode = uiSourceCode; | 582 this._currentUISourceCode = uiSourceCode; |
| 545 if (!uiSourceCode.project().isServiceProject()) | 583 if (!uiSourceCode.project().isServiceProject()) |
| 546 this._navigator.revealUISourceCode(uiSourceCode, true); | 584 this._navigator.revealUISourceCode(uiSourceCode, true); |
| 585 |
| 547 this._editorContainer.showFile(uiSourceCode); | 586 this._editorContainer.showFile(uiSourceCode); |
| 548 this._updateScriptViewStatusBarItems(); | 587 this._updateScriptViewStatusBarItems(); |
| 549 | 588 |
| 550 if (this._currentUISourceCode.project().type() === WebInspector.projectT
ypes.Snippets) | 589 if (this._currentUISourceCode.project().type() === WebInspector.projectT
ypes.Snippets) |
| 551 this._runSnippetButton.element.classList.remove("hidden"); | 590 this._runSnippetButton.element.classList.remove("hidden"); |
| 552 else | 591 else |
| 553 this._runSnippetButton.element.classList.add("hidden"); | 592 this._runSnippetButton.element.classList.add("hidden"); |
| 554 | 593 |
| 555 return sourceFrame; | 594 return sourceFrame; |
| 556 }, | 595 }, |
| (...skipping 14 matching lines...) Expand all Loading... |
| 571 break; | 610 break; |
| 572 case WebInspector.resourceTypes.Stylesheet: | 611 case WebInspector.resourceTypes.Stylesheet: |
| 573 sourceFrame = new WebInspector.CSSSourceFrame(uiSourceCode); | 612 sourceFrame = new WebInspector.CSSSourceFrame(uiSourceCode); |
| 574 break; | 613 break; |
| 575 default: | 614 default: |
| 576 sourceFrame = new WebInspector.UISourceCodeFrame(uiSourceCode); | 615 sourceFrame = new WebInspector.UISourceCodeFrame(uiSourceCode); |
| 577 break; | 616 break; |
| 578 } | 617 } |
| 579 sourceFrame.setHighlighterType(uiSourceCode.highlighterType()); | 618 sourceFrame.setHighlighterType(uiSourceCode.highlighterType()); |
| 580 this._sourceFramesByUISourceCode.put(uiSourceCode, sourceFrame); | 619 this._sourceFramesByUISourceCode.put(uiSourceCode, sourceFrame); |
| 620 this._historyManager.trackSourceFrameCursorJumps(sourceFrame); |
| 581 return sourceFrame; | 621 return sourceFrame; |
| 582 }, | 622 }, |
| 583 | 623 |
| 584 /** | 624 /** |
| 585 * @param {!WebInspector.UISourceCode} uiSourceCode | 625 * @param {!WebInspector.UISourceCode} uiSourceCode |
| 586 * @return {!WebInspector.SourceFrame} | 626 * @return {!WebInspector.SourceFrame} |
| 587 */ | 627 */ |
| 588 _getOrCreateSourceFrame: function(uiSourceCode) | 628 _getOrCreateSourceFrame: function(uiSourceCode) |
| 589 { | 629 { |
| 590 return this._sourceFramesByUISourceCode.get(uiSourceCode) || this._creat
eSourceFrame(uiSourceCode); | 630 return this._sourceFramesByUISourceCode.get(uiSourceCode) || this._creat
eSourceFrame(uiSourceCode); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 _setExecutionLine: function(uiLocation) | 695 _setExecutionLine: function(uiLocation) |
| 656 { | 696 { |
| 657 var callFrame = WebInspector.debuggerModel.selectedCallFrame() | 697 var callFrame = WebInspector.debuggerModel.selectedCallFrame() |
| 658 var sourceFrame = this._getOrCreateSourceFrame(uiLocation.uiSourceCode); | 698 var sourceFrame = this._getOrCreateSourceFrame(uiLocation.uiSourceCode); |
| 659 sourceFrame.setExecutionLine(uiLocation.lineNumber, callFrame); | 699 sourceFrame.setExecutionLine(uiLocation.lineNumber, callFrame); |
| 660 this._executionSourceFrame = sourceFrame; | 700 this._executionSourceFrame = sourceFrame; |
| 661 }, | 701 }, |
| 662 | 702 |
| 663 _executionLineChanged: function(uiLocation) | 703 _executionLineChanged: function(uiLocation) |
| 664 { | 704 { |
| 705 this._historyManager.updateCurrentState(); |
| 665 this._clearCurrentExecutionLine(); | 706 this._clearCurrentExecutionLine(); |
| 666 this._setExecutionLine(uiLocation); | 707 this._setExecutionLine(uiLocation); |
| 667 | 708 |
| 668 var uiSourceCode = uiLocation.uiSourceCode; | 709 var uiSourceCode = uiLocation.uiSourceCode; |
| 669 var scriptFile = this._currentUISourceCode ? this._currentUISourceCode.s
criptFile() : null; | 710 var scriptFile = this._currentUISourceCode ? this._currentUISourceCode.s
criptFile() : null; |
| 670 if (this._skipExecutionLineRevealing) | 711 if (this._skipExecutionLineRevealing) |
| 671 return; | 712 return; |
| 672 this._skipExecutionLineRevealing = true; | 713 this._skipExecutionLineRevealing = true; |
| 714 |
| 673 var sourceFrame = this._showFile(uiSourceCode); | 715 var sourceFrame = this._showFile(uiSourceCode); |
| 674 sourceFrame.revealLine(uiLocation.lineNumber); | 716 sourceFrame.revealLine(uiLocation.lineNumber); |
| 717 this._historyManager.pushNewState(); |
| 718 |
| 675 if (sourceFrame.canEditSource()) | 719 if (sourceFrame.canEditSource()) |
| 676 sourceFrame.setSelection(WebInspector.TextRange.createFromLocation(u
iLocation.lineNumber, 0)); | 720 sourceFrame.setSelection(WebInspector.TextRange.createFromLocation(u
iLocation.lineNumber, 0)); |
| 677 sourceFrame.focus(); | 721 sourceFrame.focus(); |
| 678 }, | 722 }, |
| 679 | 723 |
| 680 _callFrameSelected: function(event) | 724 _callFrameSelected: function(event) |
| 681 { | 725 { |
| 682 var callFrame = event.data; | 726 var callFrame = event.data; |
| 683 | 727 |
| 684 if (!callFrame) | 728 if (!callFrame) |
| 685 return; | 729 return; |
| 686 | 730 |
| 687 this.sidebarPanes.scopechain.update(callFrame); | 731 this.sidebarPanes.scopechain.update(callFrame); |
| 688 this.sidebarPanes.watchExpressions.refreshExpressions(); | 732 this.sidebarPanes.watchExpressions.refreshExpressions(); |
| 689 this.sidebarPanes.callstack.setSelectedCallFrame(callFrame); | 733 this.sidebarPanes.callstack.setSelectedCallFrame(callFrame); |
| 690 callFrame.createLiveLocation(this._executionLineChanged.bind(this)); | 734 callFrame.createLiveLocation(this._executionLineChanged.bind(this)); |
| 691 }, | 735 }, |
| 692 | 736 |
| 693 _editorClosed: function(event) | 737 _editorClosed: function(event) |
| 694 { | 738 { |
| 695 this._navigatorController.hideNavigatorOverlay(); | 739 this._navigatorController.hideNavigatorOverlay(); |
| 696 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data
); | 740 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data
); |
| 741 this._historyManager.removeHistoryForSourceCode(uiSourceCode); |
| 697 | 742 |
| 698 if (this._currentUISourceCode === uiSourceCode) | 743 if (this._currentUISourceCode === uiSourceCode) |
| 699 delete this._currentUISourceCode; | 744 delete this._currentUISourceCode; |
| 700 | 745 |
| 701 // SourcesNavigator does not need to update on EditorClosed. | 746 // SourcesNavigator does not need to update on EditorClosed. |
| 702 this._updateScriptViewStatusBarItems(); | 747 this._updateScriptViewStatusBarItems(); |
| 703 this._searchableView.resetSearch(); | 748 this._searchableView.resetSearch(); |
| 704 }, | 749 }, |
| 705 | 750 |
| 706 _editorSelected: function(event) | 751 _editorSelected: function(event) |
| 707 { | 752 { |
| 708 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data
); | 753 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data
.currentFile); |
| 754 var shouldUseHistoryManager = uiSourceCode !== this._currentUISourceCode
&& event.data.userGesture; |
| 755 if (shouldUseHistoryManager) |
| 756 this._historyManager.updateCurrentState(); |
| 709 var sourceFrame = this._showFile(uiSourceCode); | 757 var sourceFrame = this._showFile(uiSourceCode); |
| 758 if (shouldUseHistoryManager) |
| 759 this._historyManager.pushNewState(); |
| 760 |
| 710 this._navigatorController.hideNavigatorOverlay(); | 761 this._navigatorController.hideNavigatorOverlay(); |
| 711 if (!this._navigatorController.isNavigatorPinned()) | 762 if (!this._navigatorController.isNavigatorPinned()) |
| 712 sourceFrame.focus(); | 763 sourceFrame.focus(); |
| 713 this._searchableView.setReplaceable(!!sourceFrame && sourceFrame.canEdit
Source()); | 764 this._searchableView.setReplaceable(!!sourceFrame && sourceFrame.canEdit
Source()); |
| 714 this._searchableView.resetSearch(); | 765 this._searchableView.resetSearch(); |
| 715 }, | 766 }, |
| 716 | 767 |
| 717 _sourceSelected: function(event) | 768 _sourceSelected: function(event) |
| 718 { | 769 { |
| 719 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data
.uiSourceCode); | 770 var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (event.data
.uiSourceCode); |
| 771 |
| 772 var shouldUseHistoryManager = uiSourceCode !== this._currentUISourceCode
; |
| 773 |
| 774 if (shouldUseHistoryManager) |
| 775 this._historyManager.updateCurrentState(); |
| 720 var sourceFrame = this._showFile(uiSourceCode); | 776 var sourceFrame = this._showFile(uiSourceCode); |
| 777 if (shouldUseHistoryManager) |
| 778 this._historyManager.pushNewState(); |
| 779 |
| 721 this._navigatorController.hideNavigatorOverlay(); | 780 this._navigatorController.hideNavigatorOverlay(); |
| 722 if (sourceFrame && (!this._navigatorController.isNavigatorPinned() || ev
ent.data.focusSource)) | 781 if (sourceFrame && (!this._navigatorController.isNavigatorPinned() || ev
ent.data.focusSource)) |
| 723 sourceFrame.focus(); | 782 sourceFrame.focus(); |
| 724 }, | 783 }, |
| 725 | 784 |
| 726 _itemSearchStarted: function(event) | 785 _itemSearchStarted: function(event) |
| 727 { | 786 { |
| 728 var searchText = /** @type {string} */ (event.data); | 787 var searchText = /** @type {string} */ (event.data); |
| 729 WebInspector.OpenResourceDialog.show(this, this.editorView.mainElement()
, searchText); | 788 WebInspector.OpenResourceDialog.show(this, this.editorView.mainElement()
, searchText); |
| 730 }, | 789 }, |
| (...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1685 }, | 1744 }, |
| 1686 | 1745 |
| 1687 /** | 1746 /** |
| 1688 * @param {number} line | 1747 * @param {number} line |
| 1689 * @param {number=} column | 1748 * @param {number=} column |
| 1690 */ | 1749 */ |
| 1691 highlightPosition: function(line, column) | 1750 highlightPosition: function(line, column) |
| 1692 { | 1751 { |
| 1693 if (!this.canHighlightPosition()) | 1752 if (!this.canHighlightPosition()) |
| 1694 return; | 1753 return; |
| 1754 this._historyManager.updateCurrentState(); |
| 1695 this.visibleView.highlightPosition(line, column); | 1755 this.visibleView.highlightPosition(line, column); |
| 1756 this._historyManager.pushNewState(); |
| 1696 }, | 1757 }, |
| 1697 | 1758 |
| 1698 /** | 1759 /** |
| 1699 * @param {string} id | 1760 * @param {string} id |
| 1700 * @param {!WebInspector.SidebarPane} pane | 1761 * @param {!WebInspector.SidebarPane} pane |
| 1701 */ | 1762 */ |
| 1702 addExtensionSidebarPane: function(id, pane) | 1763 addExtensionSidebarPane: function(id, pane) |
| 1703 { | 1764 { |
| 1704 this._extensionSidebarPanes.push(pane); | 1765 this._extensionSidebarPanes.push(pane); |
| 1705 this._extensionSidebarPanesContainer.addPane(pane); | 1766 this._extensionSidebarPanesContainer.addPane(pane); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1807 WebInspector.SourcesPanel.ContextMenuProvider.prototype = { | 1868 WebInspector.SourcesPanel.ContextMenuProvider.prototype = { |
| 1808 /** | 1869 /** |
| 1809 * @param {!WebInspector.ContextMenu} contextMenu | 1870 * @param {!WebInspector.ContextMenu} contextMenu |
| 1810 * @param {!Object} target | 1871 * @param {!Object} target |
| 1811 */ | 1872 */ |
| 1812 appendApplicableItems: function(event, contextMenu, target) | 1873 appendApplicableItems: function(event, contextMenu, target) |
| 1813 { | 1874 { |
| 1814 WebInspector.panel("sources").appendApplicableItems(event, contextMenu,
target); | 1875 WebInspector.panel("sources").appendApplicableItems(event, contextMenu,
target); |
| 1815 } | 1876 } |
| 1816 } | 1877 } |
| OLD | NEW |