| 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 |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 | 200 |
| 201 WebInspector.startBatchUpdate(); | 201 WebInspector.startBatchUpdate(); |
| 202 this._workspace.uiSourceCodes().forEach(this._addUISourceCode.bind(this)); | 202 this._workspace.uiSourceCodes().forEach(this._addUISourceCode.bind(this)); |
| 203 WebInspector.endBatchUpdate(); | 203 WebInspector.endBatchUpdate(); |
| 204 | 204 |
| 205 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeA
dded, this._uiSourceCodeAdded, this); | 205 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeA
dded, this._uiSourceCodeAdded, this); |
| 206 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeR
emoved, this._uiSourceCodeRemoved, this); | 206 this._workspace.addEventListener(WebInspector.Workspace.Events.UISourceCodeR
emoved, this._uiSourceCodeRemoved, this); |
| 207 this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillRe
set, this._projectWillReset.bind(this), this); | 207 this._workspace.addEventListener(WebInspector.Workspace.Events.ProjectWillRe
set, this._projectWillReset.bind(this), this); |
| 208 WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Event
s.GlobalObjectCleared, this._debuggerReset, this); | 208 WebInspector.debuggerModel.addEventListener(WebInspector.DebuggerModel.Event
s.GlobalObjectCleared, this._debuggerReset, this); |
| 209 | 209 |
| 210 this._boundOnKeyUp = this._onKeyUp.bind(this); | |
| 211 this._boundOnKeyDown = this._onKeyDown.bind(this); | |
| 212 | |
| 213 function handleBeforeUnload(event) | 210 function handleBeforeUnload(event) |
| 214 { | 211 { |
| 215 if (event.returnValue) | 212 if (event.returnValue) |
| 216 return; | 213 return; |
| 217 var unsavedSourceCodes = WebInspector.workspace.unsavedSourceCodes(); | 214 var unsavedSourceCodes = WebInspector.workspace.unsavedSourceCodes(); |
| 218 if (!unsavedSourceCodes.length) | 215 if (!unsavedSourceCodes.length) |
| 219 return; | 216 return; |
| 220 | 217 |
| 221 event.returnValue = WebInspector.UIString("DevTools have unsaved changes
that will be permanently lost."); | 218 event.returnValue = WebInspector.UIString("DevTools have unsaved changes
that will be permanently lost."); |
| 222 WebInspector.inspectorView.showPanel("sources"); | 219 WebInspector.inspectorView.showPanel("sources"); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 var drawerEditorInstance = WebInspector.moduleManager.instance(WebInspec
tor.DrawerEditor); | 282 var drawerEditorInstance = WebInspector.moduleManager.instance(WebInspec
tor.DrawerEditor); |
| 286 console.assert(drawerEditorInstance instanceof WebInspector.SourcesPanel
.DrawerEditor, "WebInspector.DrawerEditor module instance does not use WebInspec
tor.SourcesPanel.DrawerEditor as an implementation. "); | 283 console.assert(drawerEditorInstance instanceof WebInspector.SourcesPanel
.DrawerEditor, "WebInspector.DrawerEditor module instance does not use WebInspec
tor.SourcesPanel.DrawerEditor as an implementation. "); |
| 287 return /** @type {!WebInspector.SourcesPanel.DrawerEditor} */ (drawerEdi
torInstance); | 284 return /** @type {!WebInspector.SourcesPanel.DrawerEditor} */ (drawerEdi
torInstance); |
| 288 }, | 285 }, |
| 289 | 286 |
| 290 wasShown: function() | 287 wasShown: function() |
| 291 { | 288 { |
| 292 this._drawerEditor()._panelWasShown(); | 289 this._drawerEditor()._panelWasShown(); |
| 293 this.sourcesView.show(this.editorView.mainElement()); | 290 this.sourcesView.show(this.editorView.mainElement()); |
| 294 WebInspector.Panel.prototype.wasShown.call(this); | 291 WebInspector.Panel.prototype.wasShown.call(this); |
| 295 | |
| 296 this.element.addEventListener("keydown", this._boundOnKeyDown, false); | |
| 297 this.element.addEventListener("keyup", this._boundOnKeyUp, false); | |
| 298 }, | 292 }, |
| 299 | 293 |
| 300 willHide: function() | 294 willHide: function() |
| 301 { | 295 { |
| 302 this.element.removeEventListener("keydown", this._boundOnKeyDown, false)
; | |
| 303 this.element.removeEventListener("keyup", this._boundOnKeyUp, false); | |
| 304 | |
| 305 WebInspector.Panel.prototype.willHide.call(this); | 296 WebInspector.Panel.prototype.willHide.call(this); |
| 306 this._drawerEditor()._panelWillHide(); | 297 this._drawerEditor()._panelWillHide(); |
| 307 this.sourcesView.show(this._drawerEditorView.element); | 298 this.sourcesView.show(this._drawerEditorView.element); |
| 308 }, | 299 }, |
| 309 | 300 |
| 310 /** | 301 /** |
| 311 * @return {!WebInspector.SearchableView} | 302 * @return {!WebInspector.SearchableView} |
| 312 */ | 303 */ |
| 313 searchableView: function() | 304 searchableView: function() |
| 314 { | 305 { |
| (...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 | 700 |
| 710 _clearCurrentExecutionLine: function() | 701 _clearCurrentExecutionLine: function() |
| 711 { | 702 { |
| 712 if (this._executionSourceFrame) | 703 if (this._executionSourceFrame) |
| 713 this._executionSourceFrame.clearExecutionLine(); | 704 this._executionSourceFrame.clearExecutionLine(); |
| 714 delete this._executionSourceFrame; | 705 delete this._executionSourceFrame; |
| 715 }, | 706 }, |
| 716 | 707 |
| 717 _setExecutionLine: function(uiLocation) | 708 _setExecutionLine: function(uiLocation) |
| 718 { | 709 { |
| 719 var callFrame = WebInspector.debuggerModel.selectedCallFrame() | |
| 720 var sourceFrame = this._getOrCreateSourceFrame(uiLocation.uiSourceCode); | 710 var sourceFrame = this._getOrCreateSourceFrame(uiLocation.uiSourceCode); |
| 721 sourceFrame.setExecutionLine(uiLocation.lineNumber, callFrame); | 711 sourceFrame.setExecutionLine(uiLocation.lineNumber); |
| 722 this._executionSourceFrame = sourceFrame; | 712 this._executionSourceFrame = sourceFrame; |
| 723 }, | 713 }, |
| 724 | 714 |
| 725 _executionLineChanged: function(uiLocation) | 715 _executionLineChanged: function(uiLocation) |
| 726 { | 716 { |
| 727 this._historyManager.updateCurrentState(); | 717 this._historyManager.updateCurrentState(); |
| 728 this._clearCurrentExecutionLine(); | 718 this._clearCurrentExecutionLine(); |
| 729 this._setExecutionLine(uiLocation); | 719 this._setExecutionLine(uiLocation); |
| 730 | 720 |
| 731 var uiSourceCode = uiLocation.uiSourceCode; | 721 var uiSourceCode = uiLocation.uiSourceCode; |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 delete this._skipExecutionLineRevealing; | 927 delete this._skipExecutionLineRevealing; |
| 938 this._paused = false; | 928 this._paused = false; |
| 939 | 929 |
| 940 this._clearInterface(); | 930 this._clearInterface(); |
| 941 | 931 |
| 942 WebInspector.debuggerModel.stepInto(); | 932 WebInspector.debuggerModel.stepInto(); |
| 943 return true; | 933 return true; |
| 944 }, | 934 }, |
| 945 | 935 |
| 946 /** | 936 /** |
| 947 * @param {?Event=} event | |
| 948 * @return {boolean} | |
| 949 */ | |
| 950 _stepIntoSelectionClicked: function(event) | |
| 951 { | |
| 952 if (!this._paused) | |
| 953 return true; | |
| 954 | |
| 955 if (this._executionSourceFrame) { | |
| 956 var stepIntoMarkup = this._executionSourceFrame.stepIntoMarkup(); | |
| 957 if (stepIntoMarkup) | |
| 958 stepIntoMarkup.iterateSelection(event.shiftKey); | |
| 959 } | |
| 960 return true; | |
| 961 }, | |
| 962 | |
| 963 doStepIntoSelection: function(rawLocation) | |
| 964 { | |
| 965 if (!this._paused) | |
| 966 return; | |
| 967 | |
| 968 delete this._skipExecutionLineRevealing; | |
| 969 this._paused = false; | |
| 970 this._clearInterface(); | |
| 971 WebInspector.debuggerModel.stepIntoSelection(rawLocation); | |
| 972 }, | |
| 973 | |
| 974 /** | |
| 975 * @return {boolean} | 937 * @return {boolean} |
| 976 */ | 938 */ |
| 977 _stepOutClicked: function() | 939 _stepOutClicked: function() |
| 978 { | 940 { |
| 979 if (!this._paused) | 941 if (!this._paused) |
| 980 return true; | 942 return true; |
| 981 | 943 |
| 982 delete this._skipExecutionLineRevealing; | 944 delete this._skipExecutionLineRevealing; |
| 983 this._paused = false; | 945 this._paused = false; |
| 984 | 946 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1064 handler = this._stepOverClicked.bind(this); | 1026 handler = this._stepOverClicked.bind(this); |
| 1065 this._stepOverButton = this._createButtonAndRegisterShortcuts("scripts-s
tep-over", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.St
epOver); | 1027 this._stepOverButton = this._createButtonAndRegisterShortcuts("scripts-s
tep-over", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.St
epOver); |
| 1066 debugToolbar.appendChild(this._stepOverButton.element); | 1028 debugToolbar.appendChild(this._stepOverButton.element); |
| 1067 | 1029 |
| 1068 // Step into. | 1030 // Step into. |
| 1069 title = WebInspector.UIString("Step into next function call (%s)."); | 1031 title = WebInspector.UIString("Step into next function call (%s)."); |
| 1070 handler = this._stepIntoClicked.bind(this); | 1032 handler = this._stepIntoClicked.bind(this); |
| 1071 this._stepIntoButton = this._createButtonAndRegisterShortcuts("scripts-s
tep-into", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.St
epInto); | 1033 this._stepIntoButton = this._createButtonAndRegisterShortcuts("scripts-s
tep-into", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.St
epInto); |
| 1072 debugToolbar.appendChild(this._stepIntoButton.element); | 1034 debugToolbar.appendChild(this._stepIntoButton.element); |
| 1073 | 1035 |
| 1074 // Step into selection (keyboard shortcut only). | |
| 1075 this.registerShortcuts(WebInspector.ShortcutsScreen.SourcesPanelShortcut
s.StepIntoSelection, this._stepIntoSelectionClicked.bind(this)) | |
| 1076 | |
| 1077 // Step out. | 1036 // Step out. |
| 1078 title = WebInspector.UIString("Step out of current function (%s)."); | 1037 title = WebInspector.UIString("Step out of current function (%s)."); |
| 1079 handler = this._stepOutClicked.bind(this); | 1038 handler = this._stepOutClicked.bind(this); |
| 1080 this._stepOutButton = this._createButtonAndRegisterShortcuts("scripts-st
ep-out", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.Step
Out); | 1039 this._stepOutButton = this._createButtonAndRegisterShortcuts("scripts-st
ep-out", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.Step
Out); |
| 1081 debugToolbar.appendChild(this._stepOutButton.element); | 1040 debugToolbar.appendChild(this._stepOutButton.element); |
| 1082 | 1041 |
| 1083 // Toggle Breakpoints | 1042 // Toggle Breakpoints |
| 1084 this._toggleBreakpointsButton = new WebInspector.StatusBarButton(WebInsp
ector.UIString("Deactivate breakpoints."), "scripts-toggle-breakpoints"); | 1043 this._toggleBreakpointsButton = new WebInspector.StatusBarButton(WebInsp
ector.UIString("Deactivate breakpoints."), "scripts-toggle-breakpoints"); |
| 1085 this._toggleBreakpointsButton.toggled = false; | 1044 this._toggleBreakpointsButton.toggled = false; |
| 1086 this._toggleBreakpointsButton.addEventListener("click", this._toggleBrea
kpointsClicked, this); | 1045 this._toggleBreakpointsButton.addEventListener("click", this._toggleBrea
kpointsClicked, this); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1241 replaceAllWith: function(query, text) | 1200 replaceAllWith: function(query, text) |
| 1242 { | 1201 { |
| 1243 var sourceFrame = this.currentSourceFrame(); | 1202 var sourceFrame = this.currentSourceFrame(); |
| 1244 if (!sourceFrame) { | 1203 if (!sourceFrame) { |
| 1245 console.assert(sourceFrame); | 1204 console.assert(sourceFrame); |
| 1246 return; | 1205 return; |
| 1247 } | 1206 } |
| 1248 sourceFrame.replaceAllWith(query, text); | 1207 sourceFrame.replaceAllWith(query, text); |
| 1249 }, | 1208 }, |
| 1250 | 1209 |
| 1251 _onKeyDown: function(event) | |
| 1252 { | |
| 1253 if (event.keyCode !== WebInspector.KeyboardShortcut.Keys.CtrlOrMeta.code
) | |
| 1254 return; | |
| 1255 if (!this._paused || !this._executionSourceFrame) | |
| 1256 return; | |
| 1257 var stepIntoMarkup = this._executionSourceFrame.stepIntoMarkup(); | |
| 1258 if (stepIntoMarkup) | |
| 1259 stepIntoMarkup.startIteratingSelection(); | |
| 1260 }, | |
| 1261 | |
| 1262 _onKeyUp: function(event) | |
| 1263 { | |
| 1264 if (event.keyCode !== WebInspector.KeyboardShortcut.Keys.CtrlOrMeta.code
) | |
| 1265 return; | |
| 1266 if (!this._paused || !this._executionSourceFrame) | |
| 1267 return; | |
| 1268 var stepIntoMarkup = this._executionSourceFrame.stepIntoMarkup(); | |
| 1269 if (!stepIntoMarkup) | |
| 1270 return; | |
| 1271 var currentPosition = stepIntoMarkup.getSelectedItemIndex(); | |
| 1272 if (typeof currentPosition === "undefined") { | |
| 1273 stepIntoMarkup.stopIteratingSelection(); | |
| 1274 } else { | |
| 1275 var rawLocation = stepIntoMarkup.getRawPosition(currentPosition); | |
| 1276 this.doStepIntoSelection(rawLocation); | |
| 1277 } | |
| 1278 }, | |
| 1279 | |
| 1280 addToWatch: function(expression) | 1210 addToWatch: function(expression) |
| 1281 { | 1211 { |
| 1282 this.sidebarPanes.watchExpressions.addExpression(expression); | 1212 this.sidebarPanes.watchExpressions.addExpression(expression); |
| 1283 }, | 1213 }, |
| 1284 | 1214 |
| 1285 /** | 1215 /** |
| 1286 * @return {boolean} | 1216 * @return {boolean} |
| 1287 */ | 1217 */ |
| 1288 _toggleBreakpoint: function() | 1218 _toggleBreakpoint: function() |
| 1289 { | 1219 { |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1805 { | 1735 { |
| 1806 } | 1736 } |
| 1807 | 1737 |
| 1808 WebInspector.SourcesPanel.EditorAction.prototype = { | 1738 WebInspector.SourcesPanel.EditorAction.prototype = { |
| 1809 /** | 1739 /** |
| 1810 * @param {!WebInspector.SourcesPanel} panel | 1740 * @param {!WebInspector.SourcesPanel} panel |
| 1811 * @return {!Element} | 1741 * @return {!Element} |
| 1812 */ | 1742 */ |
| 1813 button: function(panel) { } | 1743 button: function(panel) { } |
| 1814 } | 1744 } |
| OLD | NEW |