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

pfeldman at chromium.org pfeldman at chromium.org
Wed Dec 22 15:53:51 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit a04c7b470320db99b584329799ec45307ce54f03
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 16 10:59:50 2010 +0000

    2010-11-15  Pavel Feldman  <pfeldman at chromium.org>
    
            Reviewed by Yury Semikhatsky.
    
            Web Inspector: extract HTML title setter in treeoutline.js.
            https://bugs.webkit.org/show_bug.cgi?id=49540
    
            * inspector/front-end/ElementsTreeOutline.js:
            (WebInspector.ElementsTreeElement.prototype.adjustCollapsedRange):
            (WebInspector.ElementsTreeElement.prototype.updateTitle):
            * inspector/front-end/treeoutline.js:
            (TreeElement.prototype.get titleHTML):
            (TreeElement.prototype.set titleHTML):
            (TreeElement.prototype._setListItemNodeContent):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@72072 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 6e57bcb..e6412e9 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-11-15  Pavel Feldman  <pfeldman at chromium.org>
+
+        Reviewed by Yury Semikhatsky.
+
+        Web Inspector: extract HTML title setter in treeoutline.js.
+        https://bugs.webkit.org/show_bug.cgi?id=49540
+
+        * inspector/front-end/ElementsTreeOutline.js:
+        (WebInspector.ElementsTreeElement.prototype.adjustCollapsedRange):
+        (WebInspector.ElementsTreeElement.prototype.updateTitle):
+        * inspector/front-end/treeoutline.js:
+        (TreeElement.prototype.get titleHTML):
+        (TreeElement.prototype.set titleHTML):
+        (TreeElement.prototype._setListItemNodeContent):
+
 2010-11-16  John Knottenbelt  <jknotten at chromium.org>
 
         Reviewed by Jeremy Orlow.
diff --git a/WebCore/inspector/front-end/AuditResultView.js b/WebCore/inspector/front-end/AuditResultView.js
index 2636463..5771684 100644
--- a/WebCore/inspector/front-end/AuditResultView.js
+++ b/WebCore/inspector/front-end/AuditResultView.js
@@ -89,7 +89,8 @@ WebInspector.AuditCategoryResultPane.prototype = {
                 title = String.sprintf("%s (%d)", title, result.violationCount);
         }
 
-        var treeElement = new TreeElement(title, null, !!result.children);
+        var treeElement = new TreeElement(null, null, !!result.children);
+        treeElement.titleHTML = title;
         parentTreeElement.appendChild(treeElement);
 
         if (result.className)
diff --git a/WebCore/inspector/front-end/ElementsTreeOutline.js b/WebCore/inspector/front-end/ElementsTreeOutline.js
index a9d86e6..f893ca0 100644
--- a/WebCore/inspector/front-end/ElementsTreeOutline.js
+++ b/WebCore/inspector/front-end/ElementsTreeOutline.js
@@ -600,8 +600,8 @@ WebInspector.ElementsTreeElement.prototype = {
         if (childNodeCount > this.expandedChildCount) {
             var targetButtonIndex = expandedChildCount;
             if (!this.expandAllButtonElement) {
-                var title = "<button class=\"show-all-nodes\" value=\"\" />";
-                var item = new TreeElement(title, null, false);
+                var item = new TreeElement(null, null, false);
+                item.titleHTML = "<button class=\"show-all-nodes\" value=\"\" />";
                 item.selectable = false;
                 item.expandAllButton = true;
                 this.insertChild(item, targetButtonIndex);
@@ -1182,8 +1182,7 @@ WebInspector.ElementsTreeElement.prototype = {
         if (this._editing)
             return;
 
-        var title = this._nodeTitleInfo(WebInspector.linkifyURL).title;
-        this.title = "<span class=\"highlight\">" + title + "</span>";
+        this.titleHTML = "<span class=\"highlight\">" + this._nodeTitleInfo(WebInspector.linkifyURL).titleHTML + "</span>";
         delete this.selectionElement;
         this.updateSelection();
         this._preventFollowingLinksOnDoubleClick();
@@ -1233,53 +1232,54 @@ WebInspector.ElementsTreeElement.prototype = {
     _nodeTitleInfo: function(linkify)
     {
         var node = this.representedObject;
-        var info = {title: "", hasChildren: this.hasChildren};
+        var info = {titleHTML: "", hasChildren: this.hasChildren};
 
         switch (node.nodeType) {
             case Node.DOCUMENT_NODE:
-                info.title = "Document";
+                info.titleHTML = "Document";
                 break;
 
             case Node.DOCUMENT_FRAGMENT_NODE:
-                info.title = "Document Fragment";
+                info.titleHTML = "Document Fragment";
                 break;
 
             case Node.ATTRIBUTE_NODE:
                 var value = node.value || "\u200B"; // Zero width space to force showing an empty value.
-                info.title = this._attributeHTML(node.name, value);
+                info.titleHTML = this._attributeHTML(node.name, value);
                 break;
 
             case Node.ELEMENT_NODE:
                 var tagName = this.treeOutline.nodeNameToCorrectCase(node.nodeName).escapeHTML();
                 if (this._elementCloseTag) {
-                    info.title = this._tagHTML(tagName, true, true);
+                    info.titleHTML = this._tagHTML(tagName, true, true);
                     info.hasChildren = false;
                     break;
                 }
 
-                info.title = this._tagHTML(tagName, false, false, linkify);
+                var titleHTML = this._tagHTML(tagName, false, false, linkify);
 
                 var textChild = onlyTextChild.call(node);
                 var showInlineText = textChild && textChild.textContent.length < Preferences.maxInlineTextChildLength;
 
                 if (!this.expanded && (!showInlineText && (this.treeOutline.isXMLMimeType || !WebInspector.ElementsTreeElement.ForbiddenClosingTagElements[tagName]))) {
                     if (this.hasChildren)
-                        info.title += "<span class=\"webkit-html-text-node\">&#8230;</span>&#8203;";
-                    info.title += this._tagHTML(tagName, true, false);
+                        titleHTML += "<span class=\"webkit-html-text-node\">&#8230;</span>&#8203;";
+                    titleHTML += this._tagHTML(tagName, true, false);
                 }
 
                 // If this element only has a single child that is a text node,
                 // just show that text and the closing tag inline rather than
                 // create a subtree for them
                 if (showInlineText) {
-                    info.title += "<span class=\"webkit-html-text-node\">" + textChild.nodeValue.escapeHTML() + "</span>&#8203;" + this._tagHTML(tagName, true, false);
+                    titleHTML += "<span class=\"webkit-html-text-node\">" + textChild.nodeValue.escapeHTML() + "</span>&#8203;" + this._tagHTML(tagName, true, false);
                     info.hasChildren = false;
                 }
+                info.titleHTML = titleHTML;
                 break;
 
             case Node.TEXT_NODE:
                 if (isNodeWhitespace.call(node))
-                    info.title = "(whitespace)";
+                    info.titleHTML = "(whitespace)";
                 else {
                     if (node.parentNode && node.parentNode.nodeName.toLowerCase() === "script") {
                         var newNode = document.createElement("span");
@@ -1288,7 +1288,7 @@ WebInspector.ElementsTreeElement.prototype = {
                         var javascriptSyntaxHighlighter = new WebInspector.DOMSyntaxHighlighter("text/javascript");
                         javascriptSyntaxHighlighter.syntaxHighlightNode(newNode);
 
-                        info.title = "<span class=\"webkit-html-text-node webkit-html-js-node\">" + newNode.innerHTML.replace(/^[\n\r]*/, "").replace(/\s*$/, "") + "</span>";
+                        info.titleHTML = "<span class=\"webkit-html-text-node webkit-html-js-node\">" + newNode.innerHTML.replace(/^[\n\r]*/, "").replace(/\s*$/, "") + "</span>";
                     } else if (node.parentNode && node.parentNode.nodeName.toLowerCase() === "style") {
                         var newNode = document.createElement("span");
                         newNode.textContent = node.textContent;
@@ -1296,35 +1296,35 @@ WebInspector.ElementsTreeElement.prototype = {
                         var cssSyntaxHighlighter = new WebInspector.DOMSyntaxHighlighter("text/css");
                         cssSyntaxHighlighter.syntaxHighlightNode(newNode);
 
-                        info.title = "<span class=\"webkit-html-text-node webkit-html-css-node\">" + newNode.innerHTML.replace(/^[\n\r]*/, "").replace(/\s*$/, "") + "</span>";
-                    } else {
-                        info.title = "\"<span class=\"webkit-html-text-node\">" + node.nodeValue.escapeHTML() + "</span>\"";
-                    }
+                        info.titleHTML = "<span class=\"webkit-html-text-node webkit-html-css-node\">" + newNode.innerHTML.replace(/^[\n\r]*/, "").replace(/\s*$/, "") + "</span>";
+                    } else
+                        info.titleHTML = "\"<span class=\"webkit-html-text-node\">" + node.nodeValue.escapeHTML() + "</span>\"";
                 }
                 break;
 
             case Node.COMMENT_NODE:
-                info.title = "<span class=\"webkit-html-comment\">&lt;!--" + node.nodeValue.escapeHTML() + "--&gt;</span>";
+                info.titleHTML = "<span class=\"webkit-html-comment\">&lt;!--" + node.nodeValue.escapeHTML() + "--&gt;</span>";
                 break;
 
             case Node.DOCUMENT_TYPE_NODE:
-                info.title = "<span class=\"webkit-html-doctype\">&lt;!DOCTYPE " + node.nodeName;
+                var titleHTML = "<span class=\"webkit-html-doctype\">&lt;!DOCTYPE " + node.nodeName;
                 if (node.publicId) {
-                    info.title += " PUBLIC \"" + node.publicId + "\"";
+                    titleHTML += " PUBLIC \"" + node.publicId + "\"";
                     if (node.systemId)
-                        info.title += " \"" + node.systemId + "\"";
+                        titleHTML += " \"" + node.systemId + "\"";
                 } else if (node.systemId)
-                    info.title += " SYSTEM \"" + node.systemId + "\"";
+                    titleHTML += " SYSTEM \"" + node.systemId + "\"";
                 if (node.internalSubset)
-                    info.title += " [" + node.internalSubset + "]";
-                info.title += "&gt;</span>";
+                    titleHTML += " [" + node.internalSubset + "]";
+                titleHTML += "&gt;</span>";
+                info.titleHTML = titleHTML;
                 break;
 
             case Node.CDATA_SECTION_NODE:
-                info.title = "<span class=\"webkit-html-text-node\">&lt;![CDATA[" + node.nodeValue.escapeHTML() + "]]&gt;</span>";
+                info.titleHTML = "<span class=\"webkit-html-text-node\">&lt;![CDATA[" + node.nodeValue.escapeHTML() + "]]&gt;</span>";
                 break;
             default:
-                info.title = this.treeOutline.nodeNameToCorrectCase(node.nodeName).collapseWhitespace().escapeHTML();
+                info.titleHTML = this.treeOutline.nodeNameToCorrectCase(node.nodeName).collapseWhitespace().escapeHTML();
         }
 
         return info;
diff --git a/WebCore/inspector/front-end/ObjectPropertiesSection.js b/WebCore/inspector/front-end/ObjectPropertiesSection.js
index 610dc41..e13e5eb 100644
--- a/WebCore/inspector/front-end/ObjectPropertiesSection.js
+++ b/WebCore/inspector/front-end/ObjectPropertiesSection.js
@@ -76,7 +76,8 @@ WebInspector.ObjectPropertiesSection.prototype = {
 
         if (!this.propertiesTreeOutline.children.length) {
             var title = "<div class=\"info\">" + this.emptyPlaceholder + "</div>";
-            var infoElement = new TreeElement(title, null, false);
+            var infoElement = new TreeElement(null, null, false);
+            infoElement.titleHTML = title;
             this.propertiesTreeOutline.appendChild(infoElement);
         }
         this.propertiesForTest = properties;
diff --git a/WebCore/inspector/front-end/ResourceView.js b/WebCore/inspector/front-end/ResourceView.js
index 3949901..19e3052 100644
--- a/WebCore/inspector/front-end/ResourceView.js
+++ b/WebCore/inspector/front-end/ResourceView.js
@@ -175,7 +175,7 @@ WebInspector.ResourceView.prototype = {
 
     _refreshURL: function()
     {
-        this.urlTreeElement.title = "<div class=\"header-name\">" + WebInspector.UIString("Request URL") + ":</div>" +
+        this.urlTreeElement.titleHTML = "<div class=\"header-name\">" + WebInspector.UIString("Request URL") + ":</div>" +
             "<div class=\"header-value source-code\">" + this.resource.url.escapeHTML() + "</div>";
     },
 
@@ -211,7 +211,8 @@ WebInspector.ResourceView.prototype = {
         this.requestPayloadTreeElement.removeChildren();
 
         var title = "<div class=\"raw-form-data header-value source-code\">" + formData.escapeHTML() + "</div>";
-        var parmTreeElement = new TreeElement(title, null, false);
+        var parmTreeElement = new TreeElement(null, null, false);
+        parmTreeElement.titleHTML = title;
         parmTreeElement.selectable = false;
         this.requestPayloadTreeElement.appendChild(parmTreeElement);
     },
@@ -220,7 +221,7 @@ WebInspector.ResourceView.prototype = {
     {
         parmsTreeElement.removeChildren();
 
-        parmsTreeElement.title = title + "<span class=\"header-count\">" + WebInspector.UIString(" (%d)", parms.length) + "</span>";
+        parmsTreeElement.titleHTML = title + "<span class=\"header-count\">" + WebInspector.UIString(" (%d)", parms.length) + "</span>";
 
         for (var i = 0; i < parms.length; ++i) {
             var name = parms[i].name;
@@ -246,7 +247,8 @@ WebInspector.ResourceView.prototype = {
             var title = "<div class=\"header-name\">" + name.escapeHTML() + ":</div>";
             title += "<div class=\"header-value source-code\">" + valueEscaped + "</div>";
 
-            var parmTreeElement = new TreeElement(title, null, false);
+            var parmTreeElement = new TreeElement(null, null, false);
+            parmTreeElement.titleHTML = title;
             parmTreeElement.selectable = false;
             parmTreeElement.tooltip = this._decodeHover;
             parmTreeElement.ondblclick = this._toggleURLdecoding.bind(this);
@@ -309,10 +311,10 @@ WebInspector.ResourceView.prototype = {
             var statusTextEscaped = this.resource.statusCode + " " + this.resource.statusText.escapeHTML();
             statusCodeImage = "<img class=\"resource-status-image\" src=\"" + statusImageSource + "\" title=\"" + statusTextEscaped + "\">";
     
-            requestMethodElement.title = "<div class=\"header-name\">" + WebInspector.UIString("Request Method") + ":</div>" +
+            requestMethodElement.titleHTML = "<div class=\"header-name\">" + WebInspector.UIString("Request Method") + ":</div>" +
                 "<div class=\"header-value source-code\">" + this.resource.requestMethod + "</div>";
 
-            statusCodeElement.title = "<div class=\"header-name\">" + WebInspector.UIString("Status Code") + ":</div>" +
+            statusCodeElement.titleHTML = "<div class=\"header-name\">" + WebInspector.UIString("Status Code") + ":</div>" +
                 statusCodeImage + "<div class=\"header-value source-code\">" + statusTextEscaped + "</div>";
         }
     },
@@ -322,7 +324,7 @@ WebInspector.ResourceView.prototype = {
         headersTreeElement.removeChildren();
 
         var length = headers.length;
-        headersTreeElement.title = title.escapeHTML() + "<span class=\"header-count\">" + WebInspector.UIString(" (%d)", length) + "</span>";
+        headersTreeElement.titleHTML = title.escapeHTML() + "<span class=\"header-count\">" + WebInspector.UIString(" (%d)", length) + "</span>";
         headersTreeElement.hidden = !length;
 
         var length = headers.length;
@@ -330,7 +332,8 @@ WebInspector.ResourceView.prototype = {
             var title = "<div class=\"header-name\">" + headers[i].header.escapeHTML() + ":</div>";
             title += "<div class=\"header-value source-code\">" + headers[i].value.escapeHTML() + "</div>"
 
-            var headerTreeElement = new TreeElement(title, null, false);
+            var headerTreeElement = new TreeElement(null, null, false);
+            headerTreeElement.titleHTML = title;
             headerTreeElement.selectable = false;
             headersTreeElement.appendChild(headerTreeElement);
         }
@@ -339,7 +342,8 @@ WebInspector.ResourceView.prototype = {
             var title = "<div class=\"header-name\">" + additionalRow.header.escapeHTML() + ":</div>";
             title += "<div class=\"header-value source-code\">" + additionalRow.value.escapeHTML() + "</div>"
 
-            var headerTreeElement = new TreeElement(title, null, false);
+            var headerTreeElement = new TreeElement(null, null, false);
+            headerTreeElement.titleHTML = title;
             headerTreeElement.selectable = false;
             headersTreeElement.appendChild(headerTreeElement);
         }
diff --git a/WebCore/inspector/front-end/StylesSidebarPane.js b/WebCore/inspector/front-end/StylesSidebarPane.js
index 6d1b541..d239391 100644
--- a/WebCore/inspector/front-end/StylesSidebarPane.js
+++ b/WebCore/inspector/front-end/StylesSidebarPane.js
@@ -977,7 +977,8 @@ WebInspector.ComputedStylePropertiesSection.prototype = {
                     var value = property.value;
                     var title = "<span style='color: gray'>" + selectorText + "</span> - " + value;
                     var subtitle = " <span style='float:right'>" + section.subtitleElement.innerHTML + "</span>";
-                    var childElement = new TreeElement(title + subtitle, null, false);
+                    var childElement = new TreeElement(null, null, false);
+                    childElement.titleHTML = title + subtitle;
                     treeElement.appendChild(childElement);
                     if (section.isPropertyOverloaded(property.name))
                         childElement.listItemElement.addStyleClass("overloaded");
diff --git a/WebCore/inspector/front-end/WorkersSidebarPane.js b/WebCore/inspector/front-end/WorkersSidebarPane.js
index 7d6a00f..177cd15 100644
--- a/WebCore/inspector/front-end/WorkersSidebarPane.js
+++ b/WebCore/inspector/front-end/WorkersSidebarPane.js
@@ -59,7 +59,8 @@ WebInspector.WorkersSidebarPane.prototype = {
         this._workers[id] = worker;
 
         var title = WebInspector.linkifyURL(url, WebInspector.displayNameForURL(url), "worker-item", true, url);
-        var treeElement = new TreeElement(title, worker, false);
+        var treeElement = new TreeElement(null, worker, false);
+        treeElement.titleHTML = title;
         this._treeOutline.appendChild(treeElement);
     },
 
diff --git a/WebCore/inspector/front-end/treeoutline.js b/WebCore/inspector/front-end/treeoutline.js
index e2f879c..a1e052f 100644
--- a/WebCore/inspector/front-end/treeoutline.js
+++ b/WebCore/inspector/front-end/treeoutline.js
@@ -485,6 +485,15 @@ TreeElement.prototype = {
         this._setListItemNodeContent();
     },
 
+    get titleHTML() {
+        return this._titleHTML;
+    },
+
+    set titleHTML(x) {
+        this._titleHTML = x;
+        this._setListItemNodeContent();
+    },
+
     get tooltip() {
         return this._tooltip;
     },
@@ -553,8 +562,13 @@ TreeElement.prototype = {
     {
         if (!this._listItemNode)
             return;
-        if (!this._title || typeof this._title === "string")
-            this._listItemNode.innerHTML = this._title;
+
+        if (!this._titleHTML && !this._title)
+            this._listItemNode.removeChildren();
+        else if (typeof this._titleHTML === "string")
+            this._listItemNode.innerHTML = this._titleHTML;
+        else if (typeof this._title === "string")
+            this._listItemNode.textContent = this._title;
         else {
             this._listItemNode.removeChildren();
             if (this._title.parentNode)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list