https://bugs.webkit.org/show_bug.cgi?id=90188
Reviewed by Yury Semikhatsky.
* inspector/front-end/JavaScriptSourceFrame.js:
(WebInspector.JavaScriptSourceFrame.prototype._onMouseDown):
(WebInspector.JavaScriptSourceFrame.prototype._toggleBreakpoint):
(WebInspector.JavaScriptSourceFrame.prototype.toggleBreakpointOnCurrentLine):
* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype._toggleBreakpoint):
(WebInspector.ScriptsPanel.prototype._showOutlineDialog):
* inspector/front-end/TextViewer.js:
(WebInspector.TextViewer.prototype.selection):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121535
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
2012-06-28 Vsevolod Vlasov <vsevik@chromium.org>
+ Web Inspector: Add toggle breakpoint shortcut.
+ https://bugs.webkit.org/show_bug.cgi?id=90188
+
+ Reviewed by Yury Semikhatsky.
+
+ * inspector/front-end/JavaScriptSourceFrame.js:
+ (WebInspector.JavaScriptSourceFrame.prototype._onMouseDown):
+ (WebInspector.JavaScriptSourceFrame.prototype._toggleBreakpoint):
+ (WebInspector.JavaScriptSourceFrame.prototype.toggleBreakpointOnCurrentLine):
+ * inspector/front-end/ScriptsPanel.js:
+ (WebInspector.ScriptsPanel.prototype._toggleBreakpoint):
+ (WebInspector.ScriptsPanel.prototype._showOutlineDialog):
+ * inspector/front-end/TextViewer.js:
+ (WebInspector.TextViewer.prototype.selection):
+
+2012-06-28 Vsevolod Vlasov <vsevik@chromium.org>
+
Web Inspector: Cursor should follow execution line when debugging.
https://bugs.webkit.org/show_bug.cgi?id=90184
return;
var lineNumber = target.lineNumber;
- var breakpoint = this._breakpointManager.findBreakpoint(this._javaScriptSource, lineNumber);
- if (breakpoint) {
- if (event.shiftKey)
- breakpoint.setEnabled(!breakpoint.enabled());
- else
- breakpoint.remove();
- } else
- this._setBreakpoint(lineNumber, "", true);
+ this._toggleBreakpoint(lineNumber, event.shiftKey);
event.preventDefault();
},
/**
* @param {number} lineNumber
+ * @param {boolean} onlyDisable
+ */
+ _toggleBreakpoint: function(lineNumber, onlyDisable)
+ {
+ var breakpoint = this._breakpointManager.findBreakpoint(this._javaScriptSource, lineNumber);
+ if (breakpoint) {
+ if (onlyDisable)
+ breakpoint.setEnabled(!breakpoint.enabled());
+ else
+ breakpoint.remove();
+ } else
+ this._setBreakpoint(lineNumber, "", true);
+ },
+
+ toggleBreakpointOnCurrentLine: function()
+ {
+ var selection = this.textViewer.selection();
+ if (!selection)
+ return;
+ this._toggleBreakpoint(selection.startLine, false);
+ },
+
+ /**
+ * @param {number} lineNumber
* @param {string} condition
* @param {boolean} enabled
*/
helpSection.addKey(outlineShortcut.name, WebInspector.UIString("Go to member"));
this.registerShortcut(outlineShortcut.key, this._showOutlineDialog.bind(this));
+ var createBreakpointShortcut = WebInspector.KeyboardShortcut.makeDescriptor("b", WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta);
+ helpSection.addKey(createBreakpointShortcut.name, WebInspector.UIString("Toggle breakpoint"));
+ this.registerShortcut(createBreakpointShortcut.key, this._toggleBreakpoint.bind(this));
+
var panelEnablerHeading = WebInspector.UIString("You need to enable debugging before you can use the Scripts panel.");
var panelEnablerDisclaimer = WebInspector.UIString("Enabling debugging will make scripts run slower.");
var panelEnablerButton = WebInspector.UIString("Enable Debugging");
this.sidebarPanes.watchExpressions.addExpression(expression);
},
+ _toggleBreakpoint: function()
+ {
+ var sourceFrame = this.visibleView;
+ if (!sourceFrame)
+ return;
+
+ if (sourceFrame instanceof WebInspector.JavaScriptSourceFrame) {
+ var javaScriptSourceFrame = /** @type {WebInspector.JavaScriptSourceFrame} */ sourceFrame;
+ javaScriptSourceFrame.toggleBreakpointOnCurrentLine();
+ }
+ },
+
_showOutlineDialog: function()
{
- var uiSourceCode = this._editorContainer.currentFile();
- if (!uiSourceCode)
- return;
+ var uiSourceCode = this._editorContainer.currentFile();
+ if (!uiSourceCode)
+ return;
- if (uiSourceCode instanceof WebInspector.JavaScriptSource)
- WebInspector.JavaScriptOutlineDialog.show(this.visibleView, uiSourceCode);
- else if (uiSourceCode instanceof WebInspector.StyleSource)
- WebInspector.StyleSheetOutlineDialog.show(this.visibleView, /** @type {WebInspector.StyleSource} */ uiSourceCode);
+ if (uiSourceCode instanceof WebInspector.JavaScriptSource)
+ WebInspector.JavaScriptOutlineDialog.show(this.visibleView, uiSourceCode);
+ else if (uiSourceCode instanceof WebInspector.StyleSource)
+ WebInspector.StyleSheetOutlineDialog.show(this.visibleView, /** @type {WebInspector.StyleSource} */ uiSourceCode);
},
_installDebuggerSidebarController: function()
},
/**
+ * @return {WebInspector.TextRange}
+ */
+ selection: function(textRange)
+ {
+ return this._mainPanel._getSelection();
+ },
+
+ /**
* @param {WebInspector.TextRange} textRange
*/
setSelection: function(textRange)