Commit e135cd32 authored by pfeldman@chromium.org's avatar pfeldman@chromium.org

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):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96577 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 8f17fcc2
2011-10-04 Pavel Feldman <pfeldman@google.com>
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):
2011-10-04 Sheriff Bot <webkit.review.bot@gmail.com>
Unreviewed, rolling out r96491.
......@@ -66,9 +66,22 @@ WebInspector.GoToLineDialog = function(view)
this._input.select();
}
WebInspector.GoToLineDialog.show = function(sourceView)
WebInspector.GoToLineDialog.install = function(panel, viewGetter)
{
if (!sourceView || typeof sourceView.highlightLine !== "function")
function showGoToLineDialog()
{
var view = viewGetter();
if (view)
WebInspector.GoToLineDialog._show(view);
}
var goToLineShortcut = WebInspector.GoToLineDialog.createShortcut();
panel.registerShortcut(goToLineShortcut.key, showGoToLineDialog);
}
WebInspector.GoToLineDialog._show = function(sourceView)
{
if (!sourceView || !sourceView.canHighlightLine())
return;
if (this._instance)
return;
......
......@@ -79,15 +79,6 @@ WebInspector.NetworkItemView.prototype = {
{
if (event.data.isUserGesture)
WebInspector.settings.resourceViewTab.set(event.data.tabId);
this._installHighlightSupport(event.data.view);
},
_installHighlightSupport: function(view)
{
if (typeof view.highlightLine === "function")
this.highlightLine = view.highlightLine.bind(view);
else
delete this.highlightLine;
}
}
......@@ -145,6 +136,17 @@ WebInspector.ResourceContentView.prototype = {
contentLoaded: function()
{
// Should be implemented by subclasses.
},
canHighlightLine: function()
{
return this._innerView && this._innerView.canHighlightLine();
},
highlightLine: function(line)
{
if (this.canHighlightLine())
this._innerView.highlightLine(line);
}
}
......
......@@ -1300,7 +1300,11 @@ WebInspector.NetworkPanel = function()
this._closeButtonElement.addEventListener("click", this._toggleGridMode.bind(this), false);
this._viewsContainerElement.appendChild(this._closeButtonElement);
this.registerShortcuts();
function viewGetter()
{
return this.visibleView;
}
WebInspector.GoToLineDialog.install(this, viewGetter.bind(this));
}
WebInspector.NetworkPanel.prototype = {
......
......@@ -407,24 +407,9 @@ WebInspector.Panel.prototype = {
}
},
registerShortcuts: function(shortcuts)
{
this._shortcuts = shortcuts || {};
var goToLineShortcut = WebInspector.GoToLineDialog.createShortcut();
this._shortcuts[goToLineShortcut.key] = this._showGoToLineDialog.bind(this);
},
registerShortcut: function(key, handler)
{
this._shortcuts[key] = handler;
},
_showGoToLineDialog: function(e)
{
var view = this.visibleView;
WebInspector.GoToLineDialog.show(view);
if (view)
WebInspector.GoToLineDialog.show(view);
}
}
......
......@@ -75,7 +75,11 @@ WebInspector.ResourcesPanel = function(database)
this.sidebarElement.addEventListener("mousemove", this._onmousemove.bind(this), false);
this.sidebarElement.addEventListener("mouseout", this._onmouseout.bind(this), false);
this.registerShortcuts();
function viewGetter()
{
return this.visibleView;
}
WebInspector.GoToLineDialog.install(this, viewGetter.bind(this));
WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.OnLoad, this._onLoadEventFired, this);
}
......@@ -339,7 +343,7 @@ WebInspector.ResourcesPanel.prototype = {
if (line !== undefined) {
var view = this._resourceViewForResource(resource);
if (view.highlightLine)
if (view.canHighlightLine())
view.highlightLine(line);
}
return true;
......
......@@ -32,7 +32,11 @@ WebInspector.ScriptsPanel = function(presentationModel)
this._presentationModel = presentationModel;
this.registerShortcuts();
function viewGetter()
{
return this.visibleView;
}
WebInspector.GoToLineDialog.install(this, viewGetter.bind(this));
this.topStatusBar = document.createElement("div");
this.topStatusBar.className = "status-bar";
......
......@@ -163,6 +163,11 @@ WebInspector.SourceFrame.prototype = {
return this._textModel;
},
canHighlightLine: function(line)
{
return true;
},
highlightLine: function(line)
{
if (this.loaded)
......
......@@ -83,6 +83,17 @@ WebInspector.TabbedPane.prototype = {
{
tab.tabElement.removeStyleClass("selected");
tab.view.visible = false;
},
canHighlightLine: function()
{
return this._currentTab && this._currentTab.view && this._currentTab.view.canHighlightLine();
},
highlightLine: function(line)
{
if (this.canHighlightLine())
this._currentTab.view.highlightLine(line);
}
}
......
......@@ -159,6 +159,15 @@ WebInspector.View.prototype = {
{
},
canHighlightLine: function()
{
return false;
},
highlightLine: function(line)
{
},
doResize: function()
{
this.dispatchToSelfAndVisibleChildren("onResize");
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment