Changeset 84484 in webkit


Ignore:
Timestamp:
Apr 21, 2011 5:05:16 AM (13 years ago)
Author:
pfeldman@chromium.org
Message:

2011-04-21 Pavel Feldman <pfeldman@chromium.org>

Reviewed by Yury Semikhatsky.

Web Inspector: add support for Go To Line in Resources panel.
https://bugs.webkit.org/show_bug.cgi?id=59077

  • inspector/front-end/CallStackSidebarPane.js: (WebInspector.CallStackSidebarPane.prototype.registerShortcuts):
  • inspector/front-end/GoToLineDialog.js: (WebInspector.GoToLineDialog.show): (WebInspector.GoToLineDialog.createShortcut): (WebInspector.GoToLineDialog.prototype._onKeyDown):
  • inspector/front-end/NetworkPanel.js: (WebInspector.NetworkPanel.prototype.handleShortcut):
  • inspector/front-end/Panel.js: (WebInspector.Panel): (WebInspector.Panel.prototype._restoreScrollPositions): (WebInspector.Panel.prototype.handleShortcut): (WebInspector.Panel.prototype.registerShortcuts): (WebInspector.Panel.prototype._showGoToLineDialog):
  • inspector/front-end/ProfilesPanel.js: (WebInspector.ProfilesPanel.prototype.handleShortcut):
  • inspector/front-end/ResourcesPanel.js: (WebInspector.ResourcesPanel):
  • inspector/front-end/ScriptsPanel.js: (WebInspector.ScriptsPanel.prototype._registerShortcuts): (WebInspector.ScriptsPanel.prototype.jumpToPreviousSearchResult):
  • inspector/front-end/inspector.js: (WebInspector._registerShortcuts): (WebInspector.documentKeyDown):
Location:
trunk/Source/WebCore
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r84483 r84484  
     12011-04-21  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Reviewed by Yury Semikhatsky.
     4
     5        Web Inspector: add support for Go To Line in Resources panel.
     6        https://bugs.webkit.org/show_bug.cgi?id=59077
     7
     8        * inspector/front-end/CallStackSidebarPane.js:
     9        (WebInspector.CallStackSidebarPane.prototype.registerShortcuts):
     10        * inspector/front-end/GoToLineDialog.js:
     11        (WebInspector.GoToLineDialog.show):
     12        (WebInspector.GoToLineDialog.createShortcut):
     13        (WebInspector.GoToLineDialog.prototype._onKeyDown):
     14        * inspector/front-end/NetworkPanel.js:
     15        (WebInspector.NetworkPanel.prototype.handleShortcut):
     16        * inspector/front-end/Panel.js:
     17        (WebInspector.Panel):
     18        (WebInspector.Panel.prototype._restoreScrollPositions):
     19        (WebInspector.Panel.prototype.handleShortcut):
     20        (WebInspector.Panel.prototype.registerShortcuts):
     21        (WebInspector.Panel.prototype._showGoToLineDialog):
     22        * inspector/front-end/ProfilesPanel.js:
     23        (WebInspector.ProfilesPanel.prototype.handleShortcut):
     24        * inspector/front-end/ResourcesPanel.js:
     25        (WebInspector.ResourcesPanel):
     26        * inspector/front-end/ScriptsPanel.js:
     27        (WebInspector.ScriptsPanel.prototype._registerShortcuts):
     28        (WebInspector.ScriptsPanel.prototype.jumpToPreviousSearchResult):
     29        * inspector/front-end/inspector.js:
     30        (WebInspector._registerShortcuts):
     31        (WebInspector.documentKeyDown):
     32
    1332011-04-21  Pavel Feldman  <pfeldman@google.com>
    234
  • trunk/Source/WebCore/inspector/front-end/CallStackSidebarPane.js

    r83864 r84484  
    8484    },
    8585
    86     handleShortcut: function(event)
    87     {
    88         var shortcut = WebInspector.KeyboardShortcut.makeKeyFromEvent(event);
    89         var handler = this._shortcuts[shortcut];
    90         if (handler) {
    91             handler(event);
    92             event.handled = true;
    93         }
    94     },
    95 
    9686    _selectNextCallFrameOnStack: function()
    9787    {
     
    153143    },
    154144
    155     registerShortcuts: function(section)
     145    registerShortcuts: function(section, shortcuts)
    156146    {
    157         this._shortcuts = {};
    158 
    159147        var nextCallFrame = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Period,
    160148            WebInspector.KeyboardShortcut.Modifiers.Ctrl);
    161         this._shortcuts[nextCallFrame.key] = this._selectNextCallFrameOnStack.bind(this);
     149        shortcuts[nextCallFrame.key] = this._selectNextCallFrameOnStack.bind(this);
    162150
    163151        var prevCallFrame = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Comma,
    164152            WebInspector.KeyboardShortcut.Modifiers.Ctrl);
    165         this._shortcuts[prevCallFrame.key] = this._selectPreviousCallFrameOnStack.bind(this);
     153        shortcuts[prevCallFrame.key] = this._selectPreviousCallFrameOnStack.bind(this);
    166154
    167155        section.addRelatedKeys([ nextCallFrame.name, prevCallFrame.name ], WebInspector.UIString("Next/previous call frame"));
  • trunk/Source/WebCore/inspector/front-end/GoToLineDialog.js

    r82943 r84484  
    7272WebInspector.GoToLineDialog.show = function(sourceView)
    7373{
     74    if (!sourceView || typeof sourceView.highlightLine !== "function")
     75        return;
    7476    if (this._instance)
    7577        return;
    7678    this._instance = new WebInspector.GoToLineDialog(sourceView);
     79}
     80
     81WebInspector.GoToLineDialog.createShortcut = function()
     82{
     83    var isMac = WebInspector.isMac();
     84    var shortcut;
     85    if (isMac)
     86        return WebInspector.KeyboardShortcut.makeDescriptor("l", WebInspector.KeyboardShortcut.Modifiers.Meta);
     87    return WebInspector.KeyboardShortcut.makeDescriptor("g", WebInspector.KeyboardShortcut.Modifiers.Ctrl);
    7788}
    7889
     
    106117        if (this._closeKeys.indexOf(event.keyCode) >= 0) {
    107118            this._hide();
     119            event.preventDefault();
    108120            event.stopPropagation();
    109121        }
  • trunk/Source/WebCore/inspector/front-end/NetworkPanel.js

    r84358 r84484  
    132132            this._toggleGridMode();
    133133            event.handled = true;
    134         }
     134            return;
     135        }
     136
     137        WebInspector.Panel.prototype.handleShortcut.call(this, event);
    135138    },
    136139
  • trunk/Source/WebCore/inspector/front-end/Panel.js

    r82832 r84484  
    3535    this._panelName = name;
    3636
     37    this._shortcuts = {};
     38
    3739    WebInspector.settings.installApplicationSetting(this._sidebarWidthSettingName(), undefined);
    3840}
     
    419421                container.scrollTop = container._scrollTop;
    420422        }
     423    },
     424
     425    handleShortcut: function(event)
     426    {
     427        var shortcutKey = WebInspector.KeyboardShortcut.makeKeyFromEvent(event);
     428        var handler = this._shortcuts[shortcutKey];
     429        if (handler) {
     430            handler(event);
     431            event.handled = true;
     432        }
     433    },
     434
     435    registerShortcuts: function(shortcuts)
     436    {
     437        this._shortcuts = shortcuts || {};
     438        var goToLineShortcut = WebInspector.GoToLineDialog.createShortcut();
     439        this._shortcuts[goToLineShortcut.key] = this._showGoToLineDialog.bind(this);
     440    },
     441
     442    _showGoToLineDialog: function(e)
     443    {
     444         var view = this.visibleView;
     445         WebInspector.GoToLineDialog.show(view);
     446         if (view)
     447             WebInspector.GoToLineDialog.show(view);
    421448    }
    422449}
  • trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js

    r83718 r84484  
    737737    handleShortcut: function(event)
    738738    {
    739         if (!Preferences.heapProfilerPresent || Preferences.detailedHeapProfiles)
    740             return;
    741         var combo = ["U+004C", "U+0045", "U+0041", "U+004B", "U+005A"];  // "LEAKZ"
    742         if (this._recognizeKeyboardCombo(combo, event)) {
    743             this._displayDetailedHeapProfilesEnabledHint();         
    744             this._enableDetailedHeapProfiles(true);
    745         }
     739        if (Preferences.heapProfilerPresent && Preferences.detailedHeapProfiles) {
     740            var combo = ["U+004C", "U+0045", "U+0041", "U+004B", "U+005A"];  // "LEAKZ"
     741            if (this._recognizeKeyboardCombo(combo, event)) {
     742                this._displayDetailedHeapProfilesEnabledHint();         
     743                this._enableDetailedHeapProfiles(true);
     744            }
     745        }
     746        WebInspector.Panel.prototype.handleShortcut.call(this, event);
    746747    },
    747748
  • trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js

    r84365 r84484  
    7676    this.sidebarElement.addEventListener("mouseout", this._onmouseout.bind(this), false);
    7777
     78    this.registerShortcuts();
     79
    7880    WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceUpdated, this._refreshResource, this);
    7981}
  • trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js

    r83864 r84484  
    504504    },
    505505
    506     handleShortcut: function(event)
    507     {
    508         var shortcut = WebInspector.KeyboardShortcut.makeKeyFromEvent(event);
    509         var handler = this._shortcuts[shortcut];
    510         if (handler) {
    511             handler(event);
    512             event.handled = true;
    513         } else
    514             this.sidebarPanes.callstack.handleShortcut(event);
    515     },
    516 
    517506    _showSourceFrameAndAddToHistory: function(sourceFileId)
    518507    {
     
    888877        var platformSpecificModifier = WebInspector.KeyboardShortcut.Modifiers.CtrlOrMeta;
    889878
    890         this._shortcuts = {};
     879        var shortcuts = {};
    891880
    892881        // Continue.
    893882        handler = this.pauseButton.click.bind(this.pauseButton);
    894883        shortcut1 = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F8);
    895         this._shortcuts[shortcut1.key] = handler;
     884        shortcuts[shortcut1.key] = handler;
    896885        shortcut2 = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Slash, platformSpecificModifier);
    897         this._shortcuts[shortcut2.key] = handler;
     886        shortcuts[shortcut2.key] = handler;
    898887        section.addAlternateKeys([ shortcut1.name, shortcut2.name ], WebInspector.UIString("Continue"));
    899888
     
    901890        handler = this.stepOverButton.click.bind(this.stepOverButton);
    902891        shortcut1 = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F10);
    903         this._shortcuts[shortcut1.key] = handler;
     892        shortcuts[shortcut1.key] = handler;
    904893        shortcut2 = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.SingleQuote, platformSpecificModifier);
    905         this._shortcuts[shortcut2.key] = handler;
     894        shortcuts[shortcut2.key] = handler;
    906895        section.addAlternateKeys([ shortcut1.name, shortcut2.name ], WebInspector.UIString("Step over"));
    907896
     
    909898        handler = this.stepIntoButton.click.bind(this.stepIntoButton);
    910899        shortcut1 = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F11);
    911         this._shortcuts[shortcut1.key] = handler;
     900        shortcuts[shortcut1.key] = handler;
    912901        shortcut2 = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Semicolon, platformSpecificModifier);
    913         this._shortcuts[shortcut2.key] = handler;
     902        shortcuts[shortcut2.key] = handler;
    914903        section.addAlternateKeys([ shortcut1.name, shortcut2.name ], WebInspector.UIString("Step into"));
    915904
     
    917906        handler = this.stepOutButton.click.bind(this.stepOutButton);
    918907        shortcut1 = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.F11, WebInspector.KeyboardShortcut.Modifiers.Shift);
    919         this._shortcuts[shortcut1.key] = handler;
     908        shortcuts[shortcut1.key] = handler;
    920909        shortcut2 = WebInspector.KeyboardShortcut.makeDescriptor(WebInspector.KeyboardShortcut.Keys.Semicolon, WebInspector.KeyboardShortcut.Modifiers.Shift, platformSpecificModifier);
    921         this._shortcuts[shortcut2.key] = handler;
     910        shortcuts[shortcut2.key] = handler;
    922911        section.addAlternateKeys([ shortcut1.name, shortcut2.name ], WebInspector.UIString("Step out"));
    923912
    924         var isMac = WebInspector.isMac();
    925         if (isMac)
    926             shortcut1 = WebInspector.KeyboardShortcut.makeDescriptor("l", WebInspector.KeyboardShortcut.Modifiers.Meta);
    927         else
    928             shortcut1 = WebInspector.KeyboardShortcut.makeDescriptor("g", WebInspector.KeyboardShortcut.Modifiers.Ctrl);
    929         this._shortcuts[shortcut1.key] = this.showGoToLineDialog.bind(this);
    930         section.addAlternateKeys([ shortcut1.name ], WebInspector.UIString("Go to Line"));
    931         this.sidebarPanes.callstack.registerShortcuts(section);
     913        this.sidebarPanes.callstack.registerShortcuts(section, shortcuts);
     914        this.registerShortcuts(shortcuts);
    932915    },
    933916
     
    999982            this._searchView.jumpToPreviousSearchResult();
    1000983    },
    1001 
    1002     showGoToLineDialog: function(e)
    1003     {
    1004          var view = this.visibleView;
    1005          if (view)
    1006              WebInspector.GoToLineDialog.show(view);
    1007     }
    1008984}
    1009985
  • trunk/Source/WebCore/inspector/front-end/inspector.js

    r84481 r84484  
    682682        section.addRelatedKeys(keys, WebInspector.UIString("Find next/previous"));
    683683    }
     684
     685    var goToShortcut = WebInspector.GoToLineDialog.createShortcut();
     686    section.addKey(goToShortcut.name, WebInspector.UIString("Go to Line"));
    684687}
    685688
     
    709712    }
    710713
    711     if (this.currentPanel && this.currentPanel.handleShortcut) {
     714    if (this.currentPanel) {
    712715        this.currentPanel.handleShortcut(event);
    713716        if (event.handled) {
Note: See TracChangeset for help on using the changeset viewer.