Title: [154703] trunk/Source/WebInspectorUI
Revision
154703
Author
[email protected]
Date
2013-08-27 12:22:54 -0700 (Tue, 27 Aug 2013)

Log Message

Web Inspector: Debugger should have Continue to Here Context Menu
https://bugs.webkit.org/show_bug.cgi?id=120189

Patch by Joseph Pecoraro <[email protected]> on 2013-08-27
Reviewed by Timothy Hatcher.

When paused in the debugger and presenting a Context Menu in the
gutter, include a "Continue to Here" option. This requires a
script/line/column location combination.

* UserInterface/DebuggerManager.js:
(WebInspector.DebuggerManager.prototype.continueToLocation):
* UserInterface/Resource.js:
(WebInspector.Resource.prototype.scriptForLocation):
* UserInterface/SourceCodeTextEditor.js:
(WebInspector.SourceCodeTextEditor.prototype.continueToLocation):
(WebInspector.SourceCodeTextEditor.prototype.textEditorGutterContextMenu):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (154702 => 154703)


--- trunk/Source/WebInspectorUI/ChangeLog	2013-08-27 19:21:00 UTC (rev 154702)
+++ trunk/Source/WebInspectorUI/ChangeLog	2013-08-27 19:22:54 UTC (rev 154703)
@@ -1,3 +1,22 @@
+2013-08-27  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Debugger should have Continue to Here Context Menu
+        https://bugs.webkit.org/show_bug.cgi?id=120189
+
+        Reviewed by Timothy Hatcher.
+
+        When paused in the debugger and presenting a Context Menu in the
+        gutter, include a "Continue to Here" option. This requires a
+        script/line/column location combination.
+
+        * UserInterface/DebuggerManager.js:
+        (WebInspector.DebuggerManager.prototype.continueToLocation):
+        * UserInterface/Resource.js:
+        (WebInspector.Resource.prototype.scriptForLocation):
+        * UserInterface/SourceCodeTextEditor.js:
+        (WebInspector.SourceCodeTextEditor.prototype.continueToLocation):
+        (WebInspector.SourceCodeTextEditor.prototype.textEditorGutterContextMenu):
+
 2013-08-26  Joseph Pecoraro  <[email protected]>
 
         Web Inspector: We should regenerate InspectorBackendCommands.js for Legacy Inspector.json versions

Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (154702 => 154703)


--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2013-08-27 19:21:00 UTC (rev 154702)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2013-08-27 19:22:54 UTC (rev 154703)
@@ -91,6 +91,7 @@
 localizedStrings["Console warnings, click to show the Console"] = "Console warnings, click to show the Console";
 localizedStrings["Content"] = "Content";
 localizedStrings["Continue script execution (%s or %s)"] = "Continue script execution (%s or %s)";
+localizedStrings["Continue to Here"] = "Continue to Here";
 localizedStrings["Cookies"] = "Cookies";
 localizedStrings["Copy Row"] = "Copy Row";
 localizedStrings["Copy as HTML"] = "Copy as HTML";

Modified: trunk/Source/WebInspectorUI/UserInterface/DebuggerManager.js (154702 => 154703)


--- trunk/Source/WebInspectorUI/UserInterface/DebuggerManager.js	2013-08-27 19:21:00 UTC (rev 154702)
+++ trunk/Source/WebInspectorUI/UserInterface/DebuggerManager.js	2013-08-27 19:22:54 UTC (rev 154703)
@@ -210,6 +210,11 @@
         return this._scriptURLMap[url] || [];
     },
 
+    continueToLocation: function(scriptIdentifier, lineNumber, columnNumber)
+    {
+        DebuggerAgent.continueToLocation({scriptId: scriptIdentifier, lineNumber: lineNumber, columnNumber: columnNumber});
+    },
+
     addBreakpoint: function(breakpoint, skipEventDispatch)
     {
         console.assert(breakpoint);

Modified: trunk/Source/WebInspectorUI/UserInterface/Resource.js (154702 => 154703)


--- trunk/Source/WebInspectorUI/UserInterface/Resource.js	2013-08-27 19:21:00 UTC (rev 154702)
+++ trunk/Source/WebInspectorUI/UserInterface/Resource.js	2013-08-27 19:22:54 UTC (rev 154703)
@@ -417,6 +417,29 @@
         return this._scripts || [];
     },
 
+    scriptForLocation: function(sourceCodeLocation)
+    {
+        console.assert(!(this instanceof WebInspector.SourceMapResource));
+        console.assert(sourceCodeLocation.sourceCode === this, "SourceCodeLocation must be in this Resource");
+        if (sourceCodeLocation.sourceCode !== this)
+            return null;
+
+        var lineNumber = sourceCodeLocation.lineNumber;
+        var columnNumber = sourceCodeLocation.columnNumber;
+        for (var i = 0; i < this._scripts.length; ++i) {
+            var script = this._scripts[i];
+            if (script.range.startLine <= lineNumber && script.range.endLine >= lineNumber) {
+                if (script.range.startLine === lineNumber && columnNumber < script.range.startColumn)
+                    continue;
+                if (script.range.endLine === lineNumber && columnNumber > script.range.endColumn)
+                    continue;
+                return script;
+            }
+        }
+
+        return null;
+    },
+
     updateForRedirectResponse: function(url, requestHeaders, timestamp)
     {
         console.assert(!this._finished);

Modified: trunk/Source/WebInspectorUI/UserInterface/SourceCodeTextEditor.js (154702 => 154703)


--- trunk/Source/WebInspectorUI/UserInterface/SourceCodeTextEditor.js	2013-08-27 19:21:00 UTC (rev 154702)
+++ trunk/Source/WebInspectorUI/UserInterface/SourceCodeTextEditor.js	2013-08-27 19:22:54 UTC (rev 154703)
@@ -683,6 +683,30 @@
 
         event.preventDefault();
 
+        var contextMenu = new WebInspector.ContextMenu(event);
+
+        // Paused. Add Continue to Here option only if we have a script identifier for the location.
+        if (WebInspector.debuggerManager.paused) {
+            var editorLineInfo = {lineNumber:lineNumber, columnNumber:columnNumber};
+            var unformattedLineInfo = this._unformattedLineInfoForEditorLineInfo(editorLineInfo);
+            var sourceCodeLocation = this._sourceCode.createSourceCodeLocation(unformattedLineInfo.lineNumber, unformattedLineInfo.columnNumber);
+
+            if (sourceCodeLocation.sourceCode instanceof WebInspector.Script)
+                var script = sourceCodeLocation.sourceCode;
+            else if (sourceCodeLocation.sourceCode instanceof WebInspector.Resource)
+                var script = sourceCodeLocation.sourceCode.scriptForLocation(sourceCodeLocation);
+
+            if (script) {
+                function continueToLocation()
+                {
+                    WebInspector.debuggerManager.continueToLocation(script.id, sourceCodeLocation.lineNumber, sourceCodeLocation.columnNumber);
+                }
+
+                contextMenu.appendItem(WebInspector.UIString("Continue to Here"), continueToLocation);
+                contextMenu.appendSeparator();
+            }
+        }
+
         var breakpoints = [];
         for (var i = 0; i < editorBreakpoints.length; ++i) {
             var lineInfo = editorBreakpoints[i];
@@ -700,7 +724,6 @@
                 this.setBreakpointInfoForLineAndColumn(data.lineNumber, data.columnNumber, data.breakpointInfo);
             }
 
-            var contextMenu = new WebInspector.ContextMenu(event);
             contextMenu.appendItem(WebInspector.UIString("Add Breakpoint"), addBreakpoint.bind(this));
             contextMenu.show();
             return;
@@ -717,7 +740,6 @@
                     treeElement.revealAndSelect();
             }
 
-            var contextMenu = new WebInspector.ContextMenu(event);
             breakpoint.appendContextMenuItems(contextMenu, event.target);
             contextMenu.appendSeparator();
             contextMenu.appendItem(WebInspector.UIString("Reveal in Debugger Navigation Sidebar"), revealInSidebar);
@@ -749,7 +771,6 @@
                 breakpoints[i].disabled = shouldDisable;
         }
 
-        var contextMenu = new WebInspector.ContextMenu(event);
         if (shouldDisable)
             contextMenu.appendItem(WebInspector.UIString("Disable Breakpoints"), toggleBreakpoints.bind(this));
         else
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to