Changeset 96577 in webkit


Ignore:
Timestamp:
Oct 4, 2011 2:17:08 AM (12 years ago)
Author:
pfeldman@chromium.org
Message:

Web Inspector: remove dependency from GoToLine dialog from Panel.
https://bugs.webkit.org/show_bug.cgi?id=69327

Reviewed by Yury Semikhatsky.

  • inspector/front-end/GoToLineDialog.js:

(WebInspector.GoToLineDialog.install):
(WebInspector.GoToLineDialog._show):

  • inspector/front-end/NetworkItemView.js:

(WebInspector.NetworkItemView.prototype._tabSelected):
(WebInspector.ResourceContentView.prototype.contentLoaded):
(WebInspector.ResourceContentView.prototype.canHighlightLine):
(WebInspector.ResourceContentView.prototype.highlightLine):
(set WebInspector):

  • inspector/front-end/NetworkPanel.js:

(WebInspector.NetworkPanel.viewGetter):
(WebInspector.NetworkPanel):

  • inspector/front-end/Panel.js:

(WebInspector.Panel.prototype.registerShortcut):

  • inspector/front-end/ResourcesPanel.js:

(WebInspector.ResourcesPanel.viewGetter):
(WebInspector.ResourcesPanel):
(WebInspector.ResourcesPanel.prototype.showResource):

  • inspector/front-end/ScriptsPanel.js:

(WebInspector.ScriptsPanel.viewGetter):

  • inspector/front-end/SourceFrame.js:

(WebInspector.SourceFrame.prototype.canHighlightLine):

  • inspector/front-end/TabbedPane.js:

(WebInspector.TabbedPane.prototype._hideTab):
(WebInspector.TabbedPane.prototype.canHighlightLine):
(WebInspector.TabbedPane.prototype.highlightLine):

  • inspector/front-end/View.js:

(WebInspector.View.prototype.canHighlightLine):
(WebInspector.View.prototype.highlightLine):

Location:
trunk/Source/WebCore
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r96576 r96577  
     12011-10-04  Pavel Feldman  <pfeldman@google.com>
     2
     3        Web Inspector: remove dependency from GoToLine dialog from Panel.
     4        https://bugs.webkit.org/show_bug.cgi?id=69327
     5
     6        Reviewed by Yury Semikhatsky.
     7
     8        * inspector/front-end/GoToLineDialog.js:
     9        (WebInspector.GoToLineDialog.install):
     10        (WebInspector.GoToLineDialog._show):
     11        * inspector/front-end/NetworkItemView.js:
     12        (WebInspector.NetworkItemView.prototype._tabSelected):
     13        (WebInspector.ResourceContentView.prototype.contentLoaded):
     14        (WebInspector.ResourceContentView.prototype.canHighlightLine):
     15        (WebInspector.ResourceContentView.prototype.highlightLine):
     16        (set WebInspector):
     17        * inspector/front-end/NetworkPanel.js:
     18        (WebInspector.NetworkPanel.viewGetter):
     19        (WebInspector.NetworkPanel):
     20        * inspector/front-end/Panel.js:
     21        (WebInspector.Panel.prototype.registerShortcut):
     22        * inspector/front-end/ResourcesPanel.js:
     23        (WebInspector.ResourcesPanel.viewGetter):
     24        (WebInspector.ResourcesPanel):
     25        (WebInspector.ResourcesPanel.prototype.showResource):
     26        * inspector/front-end/ScriptsPanel.js:
     27        (WebInspector.ScriptsPanel.viewGetter):
     28        * inspector/front-end/SourceFrame.js:
     29        (WebInspector.SourceFrame.prototype.canHighlightLine):
     30        * inspector/front-end/TabbedPane.js:
     31        (WebInspector.TabbedPane.prototype._hideTab):
     32        (WebInspector.TabbedPane.prototype.canHighlightLine):
     33        (WebInspector.TabbedPane.prototype.highlightLine):
     34        * inspector/front-end/View.js:
     35        (WebInspector.View.prototype.canHighlightLine):
     36        (WebInspector.View.prototype.highlightLine):
     37
    1382011-10-04  Sheriff Bot  <webkit.review.bot@gmail.com>
    239
  • trunk/Source/WebCore/inspector/front-end/GoToLineDialog.js

    r94754 r96577  
    6767}
    6868
    69 WebInspector.GoToLineDialog.show = function(sourceView)
     69WebInspector.GoToLineDialog.install = function(panel, viewGetter)
    7070{
    71     if (!sourceView || typeof sourceView.highlightLine !== "function")
     71    function showGoToLineDialog()
     72    {
     73         var view = viewGetter();
     74         if (view)
     75             WebInspector.GoToLineDialog._show(view);
     76    }
     77
     78    var goToLineShortcut = WebInspector.GoToLineDialog.createShortcut();
     79    panel.registerShortcut(goToLineShortcut.key, showGoToLineDialog);
     80}
     81
     82WebInspector.GoToLineDialog._show = function(sourceView)
     83{
     84    if (!sourceView || !sourceView.canHighlightLine())
    7285        return;
    7386    if (this._instance)
  • trunk/Source/WebCore/inspector/front-end/NetworkItemView.js

    r93196 r96577  
    8080        if (event.data.isUserGesture)
    8181            WebInspector.settings.resourceViewTab.set(event.data.tabId);
    82         this._installHighlightSupport(event.data.view);
    83     },
    84 
    85     _installHighlightSupport: function(view)
    86     {
    87         if (typeof view.highlightLine === "function")
    88             this.highlightLine = view.highlightLine.bind(view);
    89         else
    90             delete this.highlightLine;
    9182    }
    9283}
     
    146137    {
    147138        // Should be implemented by subclasses.
     139    },
     140
     141    canHighlightLine: function()
     142    {
     143        return this._innerView && this._innerView.canHighlightLine();
     144    },
     145
     146    highlightLine: function(line)
     147    {
     148        if (this.canHighlightLine())
     149            this._innerView.highlightLine(line);
    148150    }
    149151}
  • trunk/Source/WebCore/inspector/front-end/NetworkPanel.js

    r96519 r96577  
    13011301    this._viewsContainerElement.appendChild(this._closeButtonElement);
    13021302
    1303     this.registerShortcuts();
     1303    function viewGetter()
     1304    {
     1305        return this.visibleView;
     1306    }
     1307    WebInspector.GoToLineDialog.install(this, viewGetter.bind(this));
    13041308}
    13051309
  • trunk/Source/WebCore/inspector/front-end/Panel.js

    r93701 r96577  
    408408    },
    409409
    410     registerShortcuts: function(shortcuts)
    411     {
    412         this._shortcuts = shortcuts || {};
    413         var goToLineShortcut = WebInspector.GoToLineDialog.createShortcut();
    414         this._shortcuts[goToLineShortcut.key] = this._showGoToLineDialog.bind(this);
    415     },
    416 
    417410    registerShortcut: function(key, handler)
    418411    {
    419412        this._shortcuts[key] = handler;
    420     },
    421 
    422     _showGoToLineDialog: function(e)
    423     {
    424          var view = this.visibleView;
    425          WebInspector.GoToLineDialog.show(view);
    426          if (view)
    427              WebInspector.GoToLineDialog.show(view);
    428413    }
    429414}
  • trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js

    r95984 r96577  
    7676    this.sidebarElement.addEventListener("mouseout", this._onmouseout.bind(this), false);
    7777
    78     this.registerShortcuts();
     78    function viewGetter()
     79    {
     80        return this.visibleView;
     81    }
     82    WebInspector.GoToLineDialog.install(this, viewGetter.bind(this));
    7983
    8084    WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.OnLoad, this._onLoadEventFired, this);
     
    340344        if (line !== undefined) {
    341345            var view = this._resourceViewForResource(resource);
    342             if (view.highlightLine)
     346            if (view.canHighlightLine())
    343347                view.highlightLine(line);
    344348        }
  • trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js

    r96319 r96577  
    3333    this._presentationModel = presentationModel;
    3434
    35     this.registerShortcuts();
     35    function viewGetter()
     36    {
     37        return this.visibleView;
     38    }
     39    WebInspector.GoToLineDialog.install(this, viewGetter.bind(this));
    3640
    3741    this.topStatusBar = document.createElement("div");
  • trunk/Source/WebCore/inspector/front-end/SourceFrame.js

    r94842 r96577  
    162162    {
    163163        return this._textModel;
     164    },
     165
     166    canHighlightLine: function(line)
     167    {
     168        return true;
    164169    },
    165170
  • trunk/Source/WebCore/inspector/front-end/TabbedPane.js

    r93701 r96577  
    8484        tab.tabElement.removeStyleClass("selected");
    8585        tab.view.visible = false;
     86    },
     87
     88    canHighlightLine: function()
     89    {
     90        return this._currentTab && this._currentTab.view && this._currentTab.view.canHighlightLine();
     91    },
     92
     93    highlightLine: function(line)
     94    {
     95        if (this.canHighlightLine())
     96            this._currentTab.view.highlightLine(line);
    8697    }
    8798}
  • trunk/Source/WebCore/inspector/front-end/View.js

    r96485 r96577  
    160160    },
    161161
     162    canHighlightLine: function()
     163    {
     164        return false;
     165    },
     166
     167    highlightLine: function(line)
     168    {
     169    },
     170
    162171    doResize: function()
    163172    {
Note: See TracChangeset for help on using the changeset viewer.