[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

caseq at chromium.org caseq at chromium.org
Wed Dec 22 15:49:45 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 171b0165e269a1bd5f6d36cdbac7277e7cab8e9f
Author: caseq at chromium.org <caseq at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Nov 13 16:32:54 2010 +0000

    2010-11-13  Andrey Kosyakov  <caseq at chromium.org>
    
            Reviewed by Pavel Feldman.
    
            Web Inspector: [refactoring] support Views in TabbedPane and streamline tab selection in resource view
            https://bugs.webkit.org/show_bug.cgi?id=49493
    
            * inspector/front-end/NetworkPanel.js:
            (WebInspector.NetworkPanel.prototype._showResource):
            * inspector/front-end/ResourceView.js:
            (WebInspector.ResourceView):
            (WebInspector.ResourceView.prototype.selectContentTab):
            (WebInspector.ResourceView.prototype._selectTab):
            (WebInspector.ResourceView.prototype._refreshCookies):
            (WebInspector.ResourceCookiesTab.prototype.show):
            * inspector/front-end/StoragePanel.js:
            (WebInspector.StoragePanel.prototype.showResource):
            * inspector/front-end/TabbedPane.js:
            (WebInspector.TabbedPane.prototype.appendTab):
            (WebInspector.TabbedPane.prototype.hasTab):
            (WebInspector.TabbedPane.prototype.selectTabById):
            (WebInspector.TabbedPane.prototype._hideTab):
            (WebInspector.TabbedPane.prototype._showTab):
            * inspector/front-end/inspector.css:
            (.resource-view-cookies):
            (.resource-view-cookies.visible):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71967 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index ed2ad71..087ecbe 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,30 @@
+2010-11-13  Andrey Kosyakov  <caseq at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Web Inspector: [refactoring] support Views in TabbedPane and streamline tab selection in resource view
+        https://bugs.webkit.org/show_bug.cgi?id=49493
+
+        * inspector/front-end/NetworkPanel.js:
+        (WebInspector.NetworkPanel.prototype._showResource):
+        * inspector/front-end/ResourceView.js:
+        (WebInspector.ResourceView):
+        (WebInspector.ResourceView.prototype.selectContentTab):
+        (WebInspector.ResourceView.prototype._selectTab):
+        (WebInspector.ResourceView.prototype._refreshCookies):
+        (WebInspector.ResourceCookiesTab.prototype.show):
+        * inspector/front-end/StoragePanel.js:
+        (WebInspector.StoragePanel.prototype.showResource):
+        * inspector/front-end/TabbedPane.js:
+        (WebInspector.TabbedPane.prototype.appendTab):
+        (WebInspector.TabbedPane.prototype.hasTab):
+        (WebInspector.TabbedPane.prototype.selectTabById):
+        (WebInspector.TabbedPane.prototype._hideTab):
+        (WebInspector.TabbedPane.prototype._showTab):
+        * inspector/front-end/inspector.css:
+        (.resource-view-cookies):
+        (.resource-view-cookies.visible):
+
 2010-11-13  Yury Semikhatsky  <yurys at chromium.org>
 
         Reviewed by Pavel Feldman.
diff --git a/WebCore/inspector/front-end/NetworkPanel.js b/WebCore/inspector/front-end/NetworkPanel.js
index 4e0a64a..a695167 100644
--- a/WebCore/inspector/front-end/NetworkPanel.js
+++ b/WebCore/inspector/front-end/NetworkPanel.js
@@ -864,7 +864,7 @@ WebInspector.NetworkPanel.prototype = {
         view.show(this._viewsContainerElement);
 
         if (line) {
-            view.selectContentTab(true);
+            view.selectContentTab();
             if (view.revealLine)
                 view.revealLine(line);
             if (view.highlightLine)
diff --git a/WebCore/inspector/front-end/ResourceView.js b/WebCore/inspector/front-end/ResourceView.js
index 3ca7fcc..3949901 100644
--- a/WebCore/inspector/front-end/ResourceView.js
+++ b/WebCore/inspector/front-end/ResourceView.js
@@ -39,12 +39,12 @@ WebInspector.ResourceView = function(resource)
 
     this.headersElement = document.createElement("div");
     this.headersElement.className = "resource-view-headers";
-    this.tabbedPane.appendTab("headers", WebInspector.UIString("Headers"), this.headersElement, this._selectHeadersTab.bind(this, true));
+    this.tabbedPane.appendTab("headers", WebInspector.UIString("Headers"), this.headersElement, this._selectTab.bind(this, "headers"));
 
     if (this.hasContentTab()) {
         this.contentElement = document.createElement("div");
         this.contentElement.className = "resource-view-content";
-        this.tabbedPane.appendTab("content", WebInspector.UIString("Content"), this.contentElement, this.selectContentTab.bind(this, true));
+        this.tabbedPane.appendTab("content", WebInspector.UIString("Content"), this.contentElement, this._selectTab.bind(this, "content"));
     }
 
     this.headersListElement = document.createElement("ol");
@@ -145,29 +145,26 @@ WebInspector.ResourceView.prototype = {
             this._cookiesView.resize();
     },
 
-    _selectTab: function()
+    selectContentTab: function()
     {
-        var preferredTab = WebInspector.settings.resourceViewTab;
-        if (this._headersVisible && this._cookiesView && preferredTab === "cookies")
-            this._selectCookiesTab();
-        else if (this._headersVisible && (!this.hasContentTab() || preferredTab === "headers"))
-            this._selectHeadersTab();
-        else
-            this._innerSelectContentTab();
+        this._selectTab("content");
     },
 
-    _selectHeadersTab: function(updatePrefs)
+    _selectTab: function(tab)
     {
-        if (updatePrefs)
-            WebInspector.settings.resourceViewTab = "headers";
-        this.tabbedPane.selectTabById("headers");
-    },
-
-    selectContentTab: function(updatePrefs)
-    {
-        if (updatePrefs)
-            WebInspector.settings.resourceViewTab = "content";
-        this._innerSelectContentTab();
+        if (tab)
+            WebInspector.settings.resourceViewTab = tab;
+        else {
+            var preferredTab = WebInspector.settings.resourceViewTab;
+            tab = "content";
+
+            // Honor user tab preference (if we can). Fallback to content if headers not visible, headers otherwise.
+            if (this._headersVisible)
+                tab = this.tabbedPane.hasTab(preferredTab) ? preferredTab : "headers";
+        }
+        this.tabbedPane.selectTabById(tab);
+        if (tab === "content" && this.hasContentTab())
+            this.contentTabSelected();
     },
 
     hasContentTab: function()
@@ -176,22 +173,6 @@ WebInspector.ResourceView.prototype = {
         return false;
     },
 
-    _selectCookiesTab: function(updatePrefs)
-    {
-        if (updatePrefs)
-            WebInspector.settings.resourceViewTab = "cookies";
-        this.tabbedPane.selectTabById("cookies");
-        this._cookiesView.resize();
-    },
-
-    _innerSelectContentTab: function()
-    {
-        this.tabbedPane.selectTabById("content");
-        this.resize();
-        if (this.hasContentTab())
-            this.contentTabSelected();
-    },
-
     _refreshURL: function()
     {
         this.urlTreeElement.title = "<div class=\"header-name\">" + WebInspector.UIString("Request URL") + ":</div>" +
@@ -370,7 +351,7 @@ WebInspector.ResourceView.prototype = {
             if (!this.resource.requestCookies && !this.resource.responseCookies)
                 return;
             this._cookiesView = new WebInspector.ResourceCookiesTab();
-            this.tabbedPane.appendTab("cookies", WebInspector.UIString("Cookies"), this._cookiesView.element, this._selectCookiesTab.bind(this, true));
+            this.tabbedPane.appendTab("cookies", WebInspector.UIString("Cookies"), this._cookiesView, this._selectTab.bind(this, "cookies"));
         }
         this._cookiesView.requestCookies = this.resource.requestCookies;
         this._cookiesView.responseCookies = this.resource.responseCookies;
@@ -391,6 +372,12 @@ WebInspector.ResourceCookiesTab = function()
 }
 
 WebInspector.ResourceCookiesTab.prototype = {
+    show: function(parentElement)
+    {
+        WebInspector.CookiesTable.prototype.show.call(this, parentElement);
+        this.resize();
+    },
+
     set requestCookies(cookies)
     {
         if (this._requestCookies === cookies)
diff --git a/WebCore/inspector/front-end/StoragePanel.js b/WebCore/inspector/front-end/StoragePanel.js
index eb4eabb..95eb1ce 100644
--- a/WebCore/inspector/front-end/StoragePanel.js
+++ b/WebCore/inspector/front-end/StoragePanel.js
@@ -359,7 +359,7 @@ WebInspector.StoragePanel.prototype = {
 
         if (line) {
             var view = WebInspector.ResourceManager.resourceViewForResource(resource);
-            view.selectContentTab(true);
+            view.selectContentTab();
             if (view.revealLine)
                 view.revealLine(line);
             if (view.highlightLine)
diff --git a/WebCore/inspector/front-end/TabbedPane.js b/WebCore/inspector/front-end/TabbedPane.js
index 1c7b9b0..1ed9725 100644
--- a/WebCore/inspector/front-end/TabbedPane.js
+++ b/WebCore/inspector/front-end/TabbedPane.js
@@ -39,42 +39,55 @@ WebInspector.TabbedPane = function(element)
 }
 
 WebInspector.TabbedPane.prototype = {
-    appendTab: function(id, tabTitle, contentElement, tabClickListener)
+    appendTab: function(id, tabTitle, content, tabClickListener)
     {
         var tabElement = document.createElement("li");
         tabElement.textContent = tabTitle;
         tabElement.addEventListener("click", tabClickListener, false);
         this.tabsElement.appendChild(tabElement);
-        this.contentElement.appendChild(contentElement);
-        this._tabObjects[id] = {tab: tabElement, content: contentElement};
+        var tabObject = { tab: tabElement };
+        if (content instanceof HTMLElement) {
+            tabObject.element = content;
+            this.contentElement.appendChild(content);
+        }
+        else {
+            this.contentElement.appendChild(content.element);
+            tabObject.view = content;
+        }
+        this._tabObjects[id] = tabObject;
     },
-    
-    tabObjectForId: function(id)
+
+    hasTab: function(tabId)
     {
-        return this._tabObjects[id];
+        return tabId in this._tabObjects;
+    },
+     
+    selectTabById: function(tabId)
+    {
+        for (var id in this._tabObjects) {
+            if (id === tabId)
+                this._showTab(this._tabObjects[id]);
+            else
+                this._hideTab(this._tabObjects[id]);
+        }
+        return this.hasTab(tabId);
     },
 
-    hideTab: function(id)
+    _showTab: function(tabObject)
     {
-        var tabObject = this._tabObjects[id];
-        if (tabObject)
-            tabObject.tab.addStyleClass("hidden");
+        tabObject.tab.addStyleClass("selected");
+        if (tabObject.element)
+            tabObject.element.removeStyleClass("hidden");
+        else
+            tabObject.view.visible = true;
     },
 
-    selectTabById: function(selectId)
+    _hideTab: function(tabObject)
     {
-        var selected = false;
-        for (var id in this._tabObjects) {
-            var tabObject = this._tabObjects[id];
-            if (id === selectId) {
-                selected = true;
-                tabObject.tab.addStyleClass("selected");
-                tabObject.content.removeStyleClass("hidden");
-            } else {
-                tabObject.tab.removeStyleClass("selected");
-                tabObject.content.addStyleClass("hidden");
-            }
-        }
-        return selected;
+        tabObject.tab.removeStyleClass("selected");
+        if (tabObject.element)
+            tabObject.element.addStyleClass("hidden");
+        else
+            tabObject.view.visible = false;
     }
 }
diff --git a/WebCore/inspector/front-end/inspector.css b/WebCore/inspector/front-end/inspector.css
index 35fe120..ad80cfb 100644
--- a/WebCore/inspector/front-end/inspector.css
+++ b/WebCore/inspector/front-end/inspector.css
@@ -887,6 +887,7 @@ body.platform-linux .monospace, body.platform-linux .source-code {
 }
 
 .resource-view-cookies {
+    display: none;
     position: absolute;
     top: 0;
     right: 0;
@@ -897,6 +898,10 @@ body.platform-linux .monospace, body.platform-linux .source-code {
     height: 100%;
 }
 
+.resource-view-cookies.visible {
+    display: block;
+}
+
 .resource-view-cookies.table .data-grid {
     height: 100%;
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list