| 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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 937 delete this._skipExecutionLineRevealing; | 928 delete this._skipExecutionLineRevealing; |
| 938 this._paused = false; | 929 this._paused = false; |
| 939 | 930 |
| 940 this._clearInterface(); | 931 this._clearInterface(); |
| 941 | 932 |
| 942 WebInspector.debuggerModel.stepInto(); | 933 WebInspector.debuggerModel.stepInto(); |
| 943 return true; | 934 return true; |
| 944 }, | 935 }, |
| 945 | 936 |
| 946 /** | 937 /** |
| 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} | 938 * @return {boolean} |
| 976 */ | 939 */ |
| 977 _stepOutClicked: function() | 940 _stepOutClicked: function() |
| 978 { | 941 { |
| 979 if (!this._paused) | 942 if (!this._paused) |
| 980 return true; | 943 return true; |
| 981 | 944 |
| 982 delete this._skipExecutionLineRevealing; | 945 delete this._skipExecutionLineRevealing; |
| 983 this._paused = false; | 946 this._paused = false; |
| 984 | 947 |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1064 handler = this._stepOverClicked.bind(this); | 1027 handler = this._stepOverClicked.bind(this); |
| 1065 this._stepOverButton = this._createButtonAndRegisterShortcuts("scripts-s
tep-over", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.St
epOver); | 1028 this._stepOverButton = this._createButtonAndRegisterShortcuts("scripts-s
tep-over", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.St
epOver); |
| 1066 debugToolbar.appendChild(this._stepOverButton.element); | 1029 debugToolbar.appendChild(this._stepOverButton.element); |
| 1067 | 1030 |
| 1068 // Step into. | 1031 // Step into. |
| 1069 title = WebInspector.UIString("Step into next function call (%s)."); | 1032 title = WebInspector.UIString("Step into next function call (%s)."); |
| 1070 handler = this._stepIntoClicked.bind(this); | 1033 handler = this._stepIntoClicked.bind(this); |
| 1071 this._stepIntoButton = this._createButtonAndRegisterShortcuts("scripts-s
tep-into", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.St
epInto); | 1034 this._stepIntoButton = this._createButtonAndRegisterShortcuts("scripts-s
tep-into", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.St
epInto); |
| 1072 debugToolbar.appendChild(this._stepIntoButton.element); | 1035 debugToolbar.appendChild(this._stepIntoButton.element); |
| 1073 | 1036 |
| 1074 // Step into selection (keyboard shortcut only). | |
| 1075 this.registerShortcuts(WebInspector.ShortcutsScreen.SourcesPanelShortcut
s.StepIntoSelection, this._stepIntoSelectionClicked.bind(this)) | |
| 1076 | |
| 1077 // Step out. | 1037 // Step out. |
| 1078 title = WebInspector.UIString("Step out of current function (%s)."); | 1038 title = WebInspector.UIString("Step out of current function (%s)."); |
| 1079 handler = this._stepOutClicked.bind(this); | 1039 handler = this._stepOutClicked.bind(this); |
| 1080 this._stepOutButton = this._createButtonAndRegisterShortcuts("scripts-st
ep-out", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.Step
Out); | 1040 this._stepOutButton = this._createButtonAndRegisterShortcuts("scripts-st
ep-out", title, handler, WebInspector.ShortcutsScreen.SourcesPanelShortcuts.Step
Out); |
| 1081 debugToolbar.appendChild(this._stepOutButton.element); | 1041 debugToolbar.appendChild(this._stepOutButton.element); |
| 1082 | 1042 |
| 1083 // Toggle Breakpoints | 1043 // Toggle Breakpoints |
| 1084 this._toggleBreakpointsButton = new WebInspector.StatusBarButton(WebInsp
ector.UIString("Deactivate breakpoints."), "scripts-toggle-breakpoints"); | 1044 this._toggleBreakpointsButton = new WebInspector.StatusBarButton(WebInsp
ector.UIString("Deactivate breakpoints."), "scripts-toggle-breakpoints"); |
| 1085 this._toggleBreakpointsButton.toggled = false; | 1045 this._toggleBreakpointsButton.toggled = false; |
| 1086 this._toggleBreakpointsButton.addEventListener("click", this._toggleBrea
kpointsClicked, this); | 1046 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) | 1201 replaceAllWith: function(query, text) |
| 1242 { | 1202 { |
| 1243 var sourceFrame = this.currentSourceFrame(); | 1203 var sourceFrame = this.currentSourceFrame(); |
| 1244 if (!sourceFrame) { | 1204 if (!sourceFrame) { |
| 1245 console.assert(sourceFrame); | 1205 console.assert(sourceFrame); |
| 1246 return; | 1206 return; |
| 1247 } | 1207 } |
| 1248 sourceFrame.replaceAllWith(query, text); | 1208 sourceFrame.replaceAllWith(query, text); |
| 1249 }, | 1209 }, |
| 1250 | 1210 |
| 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) | 1211 addToWatch: function(expression) |
| 1281 { | 1212 { |
| 1282 this.sidebarPanes.watchExpressions.addExpression(expression); | 1213 this.sidebarPanes.watchExpressions.addExpression(expression); |
| 1283 }, | 1214 }, |
| 1284 | 1215 |
| 1285 /** | 1216 /** |
| 1286 * @return {boolean} | 1217 * @return {boolean} |
| 1287 */ | 1218 */ |
| 1288 _toggleBreakpoint: function() | 1219 _toggleBreakpoint: function() |
| 1289 { | 1220 { |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1805 { | 1736 { |
| 1806 } | 1737 } |
| 1807 | 1738 |
| 1808 WebInspector.SourcesPanel.EditorAction.prototype = { | 1739 WebInspector.SourcesPanel.EditorAction.prototype = { |
| 1809 /** | 1740 /** |
| 1810 * @param {!WebInspector.SourcesPanel} panel | 1741 * @param {!WebInspector.SourcesPanel} panel |
| 1811 * @return {!Element} | 1742 * @return {!Element} |
| 1812 */ | 1743 */ |
| 1813 button: function(panel) { } | 1744 button: function(panel) { } |
| 1814 } | 1745 } |
| OLD | NEW |