Title: [99686] trunk/Source/WebCore
Revision
99686
Author
[email protected]
Date
2011-11-09 03:58:02 -0800 (Wed, 09 Nov 2011)

Log Message

Web Inspector: ResourcesPanel should support adding subtitle to any BaseStorageTreeElement.
https://bugs.webkit.org/show_bug.cgi?id=71848

Reviewed by Pavel Feldman.

* inspector/front-end/ResourcesPanel.js:
(WebInspector.BaseStorageTreeElement.prototype.onattach):
(WebInspector.BaseStorageTreeElement.prototype.get displayName):
(WebInspector.BaseStorageTreeElement.prototype._updateDisplayName):
(WebInspector.BaseStorageTreeElement.prototype._updateTitle):
(WebInspector.BaseStorageTreeElement.prototype._updateSubtitle):
(WebInspector.BaseStorageTreeElement.prototype.set titleText):
(WebInspector.BaseStorageTreeElement.prototype.get subtitleText):
(WebInspector.BaseStorageTreeElement.prototype.set subtitleText):
(WebInspector.FrameTreeElement.prototype.frameNavigated):
(WebInspector.FrameTreeElement.prototype.get itemURL):
(WebInspector.FrameTreeElement.prototype.onselect):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (99685 => 99686)


--- trunk/Source/WebCore/ChangeLog	2011-11-09 11:56:05 UTC (rev 99685)
+++ trunk/Source/WebCore/ChangeLog	2011-11-09 11:58:02 UTC (rev 99686)
@@ -1,3 +1,23 @@
+2011-11-09  Vsevolod Vlasov  <[email protected]>
+
+        Web Inspector: ResourcesPanel should support adding subtitle to any BaseStorageTreeElement.
+        https://bugs.webkit.org/show_bug.cgi?id=71848
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/front-end/ResourcesPanel.js:
+        (WebInspector.BaseStorageTreeElement.prototype.onattach):
+        (WebInspector.BaseStorageTreeElement.prototype.get displayName):
+        (WebInspector.BaseStorageTreeElement.prototype._updateDisplayName):
+        (WebInspector.BaseStorageTreeElement.prototype._updateTitle):
+        (WebInspector.BaseStorageTreeElement.prototype._updateSubtitle):
+        (WebInspector.BaseStorageTreeElement.prototype.set titleText):
+        (WebInspector.BaseStorageTreeElement.prototype.get subtitleText):
+        (WebInspector.BaseStorageTreeElement.prototype.set subtitleText):
+        (WebInspector.FrameTreeElement.prototype.frameNavigated):
+        (WebInspector.FrameTreeElement.prototype.get itemURL):
+        (WebInspector.FrameTreeElement.prototype.onselect):
+
 2011-11-08  Pavel Feldman  <[email protected]>
 
         Web Inspector: crash upon InspectorValue serialization that has 0 value / array entry.

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


--- trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js	2011-11-09 11:56:05 UTC (rev 99685)
+++ trunk/Source/WebCore/inspector/front-end/ResourcesPanel.js	2011-11-09 11:58:02 UTC (rev 99686)
@@ -866,10 +866,55 @@
 
         this.titleElement = document.createElement("div");
         this.titleElement.className = "base-storage-tree-element-title";
-        this.titleElement.textContent = this._titleText;
+        this._titleTextNode = document.createTextNode("");
+        this.titleElement.appendChild(this._titleTextNode);
+        this._updateTitle();
+        this._updateSubtitle();
         this.listItemElement.appendChild(this.titleElement);
     },
 
+    get displayName()
+    {
+        return this._displayName;
+    },
+
+    _updateDisplayName: function()
+    {
+        this._displayName = this._titleText || "";
+        if (this._subtitleText)
+            this._displayName += " (" + this._subtitleText + ")";
+    },
+
+    _updateTitle: function()
+    {
+        this._updateDisplayName();
+        
+        if (!this.titleElement)
+            return;
+
+        this._titleTextNode.textContent = this._titleText || "";
+    },
+
+    _updateSubtitle: function()
+    {
+        this._updateDisplayName();
+        
+        if (!this.titleElement)
+            return;
+
+        if (this._subtitleText) {
+            if (!this._subtitleElement) {
+                this._subtitleElement = document.createElement("span");
+                this._subtitleElement.className = "base-storage-tree-element-subtitle";
+                this.titleElement.appendChild(this._subtitleElement);
+            }
+            this._subtitleElement.textContent = "(" + this._subtitleText + ")";
+        } else if (this._subtitleElement) {
+            this.titleElement.removeChild(this._subtitleElement);
+            delete this._subtitleElement;
+        }
+    },
+
     onselect: function()
     {
         var itemURL = this.itemURL;
@@ -891,10 +936,20 @@
     set titleText(titleText)
     {
         this._titleText = titleText;
-        if (this.titleElement)
-            this.titleElement.textContent = this._titleText;
+        this._updateTitle();
     },
 
+    get subtitleText()
+    {
+        return this._subtitleText;
+    },
+
+    set subtitleText(subtitleText)
+    {
+        this._subtitleText = subtitleText;
+        this._updateSubtitle();
+    },
+
     get searchMatchesCount()
     {
         return 0;
@@ -975,9 +1030,8 @@
         this.removeChildren();
         this._frameId = frame.id;
 
-        var title = frame.name;
-        var subtitle = WebInspector.Resource.displayName(frame.url);
-        this.setTitles(title, subtitle);
+        this.titleText = frame.name;
+        this.subtitleText = WebInspector.Resource.displayName(frame.url);
 
         this._categoryElements = {};
         this._treeElementForResource = {};
@@ -987,53 +1041,18 @@
 
     get itemURL()
     {
-        return "frame://" + encodeURI(this._displayName);
+        return "frame://" + encodeURI(this.displayName);
     },
 
-    onattach: function()
-    {
-        WebInspector.BaseStorageTreeElement.prototype.onattach.call(this);
-        if (this._titleToSetOnAttach || this._subtitleToSetOnAttach) {
-            this.setTitles(this._titleToSetOnAttach, this._subtitleToSetOnAttach);
-            delete this._titleToSetOnAttach;
-            delete this._subtitleToSetOnAttach;
-        }
-    },
-
     onselect: function()
     {
         WebInspector.BaseStorageTreeElement.prototype.onselect.call(this);
-        this._storagePanel.showCategoryView(this._displayName);
+        this._storagePanel.showCategoryView(this.displayName);
 
         this.listItemElement.removeStyleClass("hovered");
         DOMAgent.hideHighlight();
     },
 
-    get displayName()
-    {
-        return this._displayName;
-    },
-
-    setTitles: function(title, subtitle)
-    {
-        this._displayName = title || "";
-        if (subtitle)
-            this._displayName += " (" + subtitle + ")";
-
-        if (this.parent) {
-            this.titleElement.textContent = title || "";
-            if (subtitle) {
-                var subtitleElement = document.createElement("span");
-                subtitleElement.className = "base-storage-tree-element-subtitle";
-                subtitleElement.textContent = "(" + subtitle + ")";
-                this.titleElement.appendChild(subtitleElement);
-            }
-        } else {
-            this._titleToSetOnAttach = title;
-            this._subtitleToSetOnAttach = subtitle;
-        }
-    },
-
     set hovered(hovered)
     {
         if (hovered) {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to