Changeset 136414 in webkit


Ignore:
Timestamp:
Dec 3, 2012, 10:44:10 AM (13 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Jan Keromnes <janx@linux.com> 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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r136412 r136414  
     12012-12-03  Jan Keromnes  <janx@linux.com>
     2
     3        Web Inspector: Implement context menus in CodeMirrorTextEditor
     4        https://bugs.webkit.org/show_bug.cgi?id=94062
     5
     6        Reviewed by Pavel Feldman.
     7
     8        Listen for contextmenu events in the editor and handle them differently
     9        if triggered on gutter line number or in text body. This adds controls
     10        for breakpoints (including disabled / conditional), debugger navigation
     11        and text input methods.
     12
     13        * inspector/front-end/CodeMirrorTextEditor.js:
     14        (WebInspector.CodeMirrorTextEditor):
     15        (WebInspector.CodeMirrorTextEditor.prototype._contextMenu):
     16
    1172012-12-03  Nate Chapin  <japhet@chromium.org>
    218
  • trunk/Source/WebCore/inspector/front-end/CodeMirrorTextEditor.js

    r134561 r136414  
    5858    this._codeMirror.on("change", this._change.bind(this));
    5959    this._codeMirror.on("gutterClick", this._gutterClick.bind(this));
     60    this.element.addEventListener("contextmenu", this._contextMenu.bind(this));
    6061
    6162    this._lastRange = this.range();
     
    125126    {
    126127        this.dispatchEventToListeners(WebInspector.TextEditor.Events.GutterClick, { lineNumber: lineNumber, event: event });
     128    },
     129
     130    _contextMenu: function(event)
     131    {
     132        var contextMenu = new WebInspector.ContextMenu(event);
     133        var target = event.target.enclosingNodeOrSelfWithClass("CodeMirror-gutter-elt");
     134        if (target)
     135            this._delegate.populateLineGutterContextMenu(contextMenu, parseInt(target.textContent, 10) - 1);
     136        else
     137            this._delegate.populateTextAreaContextMenu(contextMenu, null);
     138        contextMenu.show();
    127139    },
    128140
Note: See TracChangeset for help on using the changeset viewer.