Title: [121535] trunk/Source/WebCore
- Revision
- 121535
- Author
- [email protected]
- Date
- 2012-06-29 02:12:12 -0700 (Fri, 29 Jun 2012)
Log Message
Web Inspector: Add toggle breakpoint shortcut.
https://bugs.webkit.org/show_bug.cgi?id=90188
Reviewed by Yury Semikhatsky.
* inspector/front-end/_javascript_SourceFrame.js:
(WebInspector._javascript_SourceFrame.prototype._onMouseDown):
(WebInspector._javascript_SourceFrame.prototype._toggleBreakpoint):
(WebInspector._javascript_SourceFrame.prototype.toggleBreakpointOnCurrentLine):
* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype._toggleBreakpoint):
(WebInspector.ScriptsPanel.prototype._showOutlineDialog):
* inspector/front-end/TextViewer.js:
(WebInspector.TextViewer.prototype.selection):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (121534 => 121535)
--- trunk/Source/WebCore/ChangeLog 2012-06-29 09:09:02 UTC (rev 121534)
+++ trunk/Source/WebCore/ChangeLog 2012-06-29 09:12:12 UTC (rev 121535)
@@ -1,5 +1,22 @@
2012-06-28 Vsevolod Vlasov <[email protected]>
+ Web Inspector: Add toggle breakpoint shortcut.
+ https://bugs.webkit.org/show_bug.cgi?id=90188
+
+ Reviewed by Yury Semikhatsky.
+
+ * inspector/front-end/_javascript_SourceFrame.js:
+ (WebInspector._javascript_SourceFrame.prototype._onMouseDown):
+ (WebInspector._javascript_SourceFrame.prototype._toggleBreakpoint):
+ (WebInspector._javascript_SourceFrame.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 <[email protected]>
+
Web Inspector: Cursor should follow execution line when debugging.
https://bugs.webkit.org/show_bug.cgi?id=90184
Modified: trunk/Source/WebCore/inspector/front-end/_javascript_SourceFrame.js (121534 => 121535)
--- trunk/Source/WebCore/inspector/front-end/_javascript_SourceFrame.js 2012-06-29 09:09:02 UTC (rev 121534)
+++ trunk/Source/WebCore/inspector/front-end/_javascript_SourceFrame.js 2012-06-29 09:12:12 UTC (rev 121535)
@@ -359,14 +359,7 @@
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();
},
@@ -532,6 +525,30 @@
/**
* @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
*/
Modified: trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js (121534 => 121535)
--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js 2012-06-29 09:09:02 UTC (rev 121534)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js 2012-06-29 09:12:12 UTC (rev 121535)
@@ -133,6 +133,10 @@
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");
@@ -952,16 +956,28 @@
this.sidebarPanes.watchExpressions.addExpression(_expression_);
},
+ _toggleBreakpoint: function()
+ {
+ var sourceFrame = this.visibleView;
+ if (!sourceFrame)
+ return;
+
+ if (sourceFrame instanceof WebInspector._javascript_SourceFrame) {
+ var _javascript_SourceFrame = /** @type {WebInspector._javascript_SourceFrame} */ sourceFrame;
+ _javascript_SourceFrame.toggleBreakpointOnCurrentLine();
+ }
+ },
+
_showOutlineDialog: function()
{
- var uiSourceCode = this._editorContainer.currentFile();
- if (!uiSourceCode)
- return;
+ var uiSourceCode = this._editorContainer.currentFile();
+ if (!uiSourceCode)
+ return;
- if (uiSourceCode instanceof WebInspector._javascript_Source)
- WebInspector._javascript_OutlineDialog.show(this.visibleView, uiSourceCode);
- else if (uiSourceCode instanceof WebInspector.StyleSource)
- WebInspector.StyleSheetOutlineDialog.show(this.visibleView, /** @type {WebInspector.StyleSource} */ uiSourceCode);
+ if (uiSourceCode instanceof WebInspector._javascript_Source)
+ WebInspector._javascript_OutlineDialog.show(this.visibleView, uiSourceCode);
+ else if (uiSourceCode instanceof WebInspector.StyleSource)
+ WebInspector.StyleSheetOutlineDialog.show(this.visibleView, /** @type {WebInspector.StyleSource} */ uiSourceCode);
},
_installDebuggerSidebarController: function()
Modified: trunk/Source/WebCore/inspector/front-end/TextViewer.js (121534 => 121535)
--- trunk/Source/WebCore/inspector/front-end/TextViewer.js 2012-06-29 09:09:02 UTC (rev 121534)
+++ trunk/Source/WebCore/inspector/front-end/TextViewer.js 2012-06-29 09:12:12 UTC (rev 121535)
@@ -308,6 +308,14 @@
},
/**
+ * @return {WebInspector.TextRange}
+ */
+ selection: function(textRange)
+ {
+ return this._mainPanel._getSelection();
+ },
+
+ /**
* @param {WebInspector.TextRange} textRange
*/
setSelection: function(textRange)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes