Title: [136414] trunk/Source/WebCore
Revision
136414
Author
[email protected]
Date
2012-12-03 10:44:10 -0800 (Mon, 03 Dec 2012)

Log Message

Web Inspector: Implement context menus in CodeMirrorTextEditor
https://bugs.webkit.org/show_bug.cgi?id=94062

Patch by Jan Keromnes <[email protected]> on 2012-12-03
Reviewed by Pavel Feldman.

Listen for contextmenu events in the editor and handle them differently
if triggered on gutter line number or in text body. This adds controls
for breakpoints (including disabled / conditional), debugger navigation
and text input methods.

* inspector/front-end/CodeMirrorTextEditor.js:
(WebInspector.CodeMirrorTextEditor):
(WebInspector.CodeMirrorTextEditor.prototype._contextMenu):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (136413 => 136414)


--- trunk/Source/WebCore/ChangeLog	2012-12-03 18:42:51 UTC (rev 136413)
+++ trunk/Source/WebCore/ChangeLog	2012-12-03 18:44:10 UTC (rev 136414)
@@ -1,3 +1,19 @@
+2012-12-03  Jan Keromnes  <[email protected]>
+
+        Web Inspector: Implement context menus in CodeMirrorTextEditor
+        https://bugs.webkit.org/show_bug.cgi?id=94062
+
+        Reviewed by Pavel Feldman.
+
+        Listen for contextmenu events in the editor and handle them differently
+        if triggered on gutter line number or in text body. This adds controls
+        for breakpoints (including disabled / conditional), debugger navigation
+        and text input methods.
+
+        * inspector/front-end/CodeMirrorTextEditor.js:
+        (WebInspector.CodeMirrorTextEditor):
+        (WebInspector.CodeMirrorTextEditor.prototype._contextMenu):
+
 2012-12-03  Nate Chapin  <[email protected]>
 
         Make MainResourceLoader not use m_frame directly.

Modified: trunk/Source/WebCore/inspector/front-end/CodeMirrorTextEditor.js (136413 => 136414)


--- trunk/Source/WebCore/inspector/front-end/CodeMirrorTextEditor.js	2012-12-03 18:42:51 UTC (rev 136413)
+++ trunk/Source/WebCore/inspector/front-end/CodeMirrorTextEditor.js	2012-12-03 18:44:10 UTC (rev 136414)
@@ -57,6 +57,7 @@
 
     this._codeMirror.on("change", this._change.bind(this));
     this._codeMirror.on("gutterClick", this._gutterClick.bind(this));
+    this.element.addEventListener("contextmenu", this._contextMenu.bind(this));
 
     this._lastRange = this.range();
 
@@ -126,6 +127,17 @@
         this.dispatchEventToListeners(WebInspector.TextEditor.Events.GutterClick, { lineNumber: lineNumber, event: event });
     },
 
+    _contextMenu: function(event)
+    {
+        var contextMenu = new WebInspector.ContextMenu(event);
+        var target = event.target.enclosingNodeOrSelfWithClass("CodeMirror-gutter-elt");
+        if (target)
+            this._delegate.populateLineGutterContextMenu(contextMenu, parseInt(target.textContent, 10) - 1);
+        else
+            this._delegate.populateTextAreaContextMenu(contextMenu, null);
+        contextMenu.show();
+    },
+
     /**
      * @param {number} lineNumber
      * @param {boolean} disabled
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to