Title: [96577] trunk/Source/WebCore
Revision
96577
Author
pfeld...@chromium.org
Date
2011-10-04 02:17:08 -0700 (Tue, 04 Oct 2011)

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

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (96576 => 96577)


--- trunk/Source/WebCore/ChangeLog	2011-10-04 09:03:51 UTC (rev 96576)
+++ trunk/Source/WebCore/ChangeLog	2011-10-04 09:17:08 UTC (rev 96577)
@@ -1,3 +1,40 @@
+2011-10-04  Pavel Feldman  <pfeld...@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....@gmail.com>
 
         Unreviewed, rolling out r96491.

Modified: trunk/Source/WebCore/inspector/front-end/GoToLineDialog.js (96576 => 96577)


--- trunk/Source/WebCore/inspector/front-end/GoToLineDialog.js	2011-10-04 09:03:51 UTC (rev 96576)
+++ trunk/Source/WebCore/inspector/front-end/GoToLineDialog.js	2011-10-04 09:17:08 UTC (rev 96577)
@@ -66,9 +66,22 @@
     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;

Modified: trunk/Source/WebCore/inspector/front-end/NetworkItemView.js (96576 => 96577)


--- trunk/Source/WebCore/inspector/front-end/NetworkItemView.js	2011-10-04 09:03:51 UTC (rev 96576)
+++ trunk/Source/WebCore/inspector/front-end/NetworkItemView.js	2011-10-04 09:17:08 UTC (rev 96577)
@@ -79,15 +79,6 @@
     {
         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 @@
     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);
     }
 }
 

Modified: trunk/Source/WebCore/inspector/front-end/NetworkPanel.js (96576 => 96577)


--- trunk/Source/WebCore/inspector/front-end/NetworkPanel.js	2011-10-04 09:03:51 UTC (rev 96576)
+++ trunk/Source/WebCore/inspector/front-end/NetworkPanel.js	2011-10-04 09:17:08 UTC (rev 96577)
@@ -1300,7 +1300,11 @@
     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 = {

Modified: trunk/Source/WebCore/inspector/front-end/Panel.js (96576 => 96577)


--- trunk/Source/WebCore/inspector/front-end/Panel.js	2011-10-04 09:03:51 UTC (rev 96576)
+++ trunk/Source/WebCore/inspector/front-end/Panel.js	2011-10-04 09:17:08 UTC (rev 96577)
@@ -407,24 +407,9 @@
         }
     },
 
-    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);
     }
 }
 

Modified: trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js (96576 => 96577)


--- trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js	2011-10-04 09:03:51 UTC (rev 96576)
+++ trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js	2011-10-04 09:17:08 UTC (rev 96577)
@@ -75,7 +75,11 @@
     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 @@
 
         if (line !== undefined) {
             var view = this._resourceViewForResource(resource);
-            if (view.highlightLine)
+            if (view.canHighlightLine())
                 view.highlightLine(line);
         }
         return true;

Modified: trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js (96576 => 96577)


--- trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2011-10-04 09:03:51 UTC (rev 96576)
+++ trunk/Source/WebCore/inspector/front-end/ScriptsPanel.js	2011-10-04 09:17:08 UTC (rev 96577)
@@ -32,7 +32,11 @@
 
     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";

Modified: trunk/Source/WebCore/inspector/front-end/SourceFrame.js (96576 => 96577)


--- trunk/Source/WebCore/inspector/front-end/SourceFrame.js	2011-10-04 09:03:51 UTC (rev 96576)
+++ trunk/Source/WebCore/inspector/front-end/SourceFrame.js	2011-10-04 09:17:08 UTC (rev 96577)
@@ -163,6 +163,11 @@
         return this._textModel;
     },
 
+    canHighlightLine: function(line)
+    {
+        return true;
+    },
+
     highlightLine: function(line)
     {
         if (this.loaded)

Modified: trunk/Source/WebCore/inspector/front-end/TabbedPane.js (96576 => 96577)


--- trunk/Source/WebCore/inspector/front-end/TabbedPane.js	2011-10-04 09:03:51 UTC (rev 96576)
+++ trunk/Source/WebCore/inspector/front-end/TabbedPane.js	2011-10-04 09:17:08 UTC (rev 96577)
@@ -83,6 +83,17 @@
     {
         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);
     }
 }
 

Modified: trunk/Source/WebCore/inspector/front-end/View.js (96576 => 96577)


--- trunk/Source/WebCore/inspector/front-end/View.js	2011-10-04 09:03:51 UTC (rev 96576)
+++ trunk/Source/WebCore/inspector/front-end/View.js	2011-10-04 09:17:08 UTC (rev 96577)
@@ -159,6 +159,15 @@
     {
     },
 
+    canHighlightLine: function()
+    {
+        return false;
+    },
+
+    highlightLine: function(line)
+    {
+    },
+
     doResize: function()
     {
         this.dispatchToSelfAndVisibleChildren("onResize");
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to