[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.21-584-g1e41756

eric at webkit.org eric at webkit.org
Fri Feb 26 22:25:42 UTC 2010


The following commit has been merged in the webkit-1.1 branch:
commit dca99dfc2c183a99d17a5187608c5c11e99fb672
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Feb 19 15:16:10 2010 +0000

    2010-02-19  Alexander Pavlov  <apavlov at chromium.org>
    
            Reviewed by Pavel Feldman.
    
            WebInspector: Elements panel: Correctly show empty elements' ending tags
            for XML and HTML documents.
            https://bugs.webkit.org/show_bug.cgi?id=26315
    
            * inspector/console-dirxml-expected.txt:
            * inspector/console-format-collections-expected.txt:
            * inspector/console-format-expected.txt:
            * inspector/elements-panel-limited-children-expected.txt:
            * inspector/elements-panel-structure-expected.txt:
            Re-baselined due to closing tags and ellipses between opening and closing tags
    
            * inspector/elements-panel-xhtml-structure-expected.txt: Added.
            * inspector/elements-panel-xhtml-structure.xhtml: Added.
    2010-02-19  Alexander Pavlov  <apavlov at chromium.org>
    
            Reviewed by Pavel Feldman.
    
            WebInspector: Elements panel: Correctly show empty elements' ending tags
            for XML and HTML documents.
            https://bugs.webkit.org/show_bug.cgi?id=26315
    
            Test: inspector/elements-panel-xhtml-structure.xhtml
    
            * inspector/InspectorController.cpp:
            (WebCore::InspectorController::populateScriptObjects):
            * inspector/front-end/ElementsTreeOutline.js:
            (WebInspector.ElementsTreeOutline.prototype.set rootDOMNode):
            (WebInspector.ElementsTreeOutline.prototype.get isXMLMimeType):
            (WebInspector.ElementsTreeOutline.prototype._contextMenuEventFired):
            (WebInspector.ElementsTreeElement.prototype.onexpand):
            (WebInspector.ElementsTreeElement.prototype.oncollapse):
            (WebInspector.ElementsTreeElement.prototype.updateTitle.callback):
            (WebInspector.ElementsTreeElement.prototype.updateTitle):
            (WebInspector.ElementsTreeElement.prototype._nodeTitleInfo):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55016 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 2f6d389..fdb4b99 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,21 @@
+2010-02-19  Alexander Pavlov  <apavlov at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        WebInspector: Elements panel: Correctly show empty elements' ending tags
+        for XML and HTML documents.
+        https://bugs.webkit.org/show_bug.cgi?id=26315
+
+        * inspector/console-dirxml-expected.txt:
+        * inspector/console-format-collections-expected.txt:
+        * inspector/console-format-expected.txt:
+        * inspector/elements-panel-limited-children-expected.txt:
+        * inspector/elements-panel-structure-expected.txt:
+        Re-baselined due to closing tags and ellipses between opening and closing tags
+
+        * inspector/elements-panel-xhtml-structure-expected.txt: Added.
+        * inspector/elements-panel-xhtml-structure.xhtml: Added.
+
 2010-02-19  Andras Becsi  <abecsi at webkit.org>
         Unreviewed Changelog typo fix.
 
diff --git a/LayoutTests/inspector/console-dirxml-expected.txt b/LayoutTests/inspector/console-dirxml-expected.txt
index 08b450e..1673cb4 100644
--- a/LayoutTests/inspector/console-dirxml-expected.txt
+++ b/LayoutTests/inspector/console-dirxml-expected.txt
@@ -6,6 +6,6 @@ Tests that console logging dumps proper messages.
 
 console-dirxml.html:12Document
 console-dirxml.html:13Document Fragment
-console-dirxml.html:14<p>
-console-dirxml.html:15[<p>]
+console-dirxml.html:14<p></p>
+console-dirxml.html:15[<p></p>]
 
diff --git a/LayoutTests/inspector/console-format-collections-expected.txt b/LayoutTests/inspector/console-format-collections-expected.txt
index c7217bc..16bf94f 100644
--- a/LayoutTests/inspector/console-format-collections-expected.txt
+++ b/LayoutTests/inspector/console-format-collections-expected.txt
@@ -6,10 +6,10 @@ CONSOLE MESSAGE: line 31: [object HTMLCollection]
 CONSOLE MESSAGE: line 35: [object NodeList]
 Tests that console nicely formats HTML Collections and NodeLists.
 
-console-format-collections.html:15[<select id="sel" name="sel">]
-console-format-collections.html:19[<script src="../http/tests/inspector/inspector-test.js">, <script src="console-tests.js">, <script>]
+console-format-collections.html:15[<select id="sel" name="sel">…</select>]
+console-format-collections.html:19[<script src="../http/tests/inspector/inspector-test.js"></script>, <script src="console-tests.js"></script>, <script>…</script>]
 console-format-collections.html:23[<option value="1">one</option>, <option value="2">two</option>]
-console-format-collections.html:27[<html>, <head>, <script src="../http/tests/inspector/inspector-test.js">, <script src="console-tests.js">, <script>, <body onload="onload()">, <p> Tests that console nicely formats HTML Collections and NodeLists. </p>, <div style="display:none">, <form id="f">, <select id="sel" name="sel">, <option value="1">one</option>, <option value="2">two</option>, <input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">, <div id="output">]
-console-format-collections.html:31[<select id="sel" name="sel">, <input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">]
+console-format-collections.html:27[<html>…</html>, <head>…</head>, <script src="../http/tests/inspector/inspector-test.js"></script>, <script src="console-tests.js"></script>, <script>…</script>, <body onload="onload()">…</body>, <p> Tests that console nicely formats HTML Collections and NodeLists. </p>, <div style="display:none">…</div>, <form id="f">…</form>, <select id="sel" name="sel">…</select>, <option value="1">one</option>, <option value="2">two</option>, <input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">, <div id="output"></div>]
+console-format-collections.html:31[<select id="sel" name="sel">…</select>, <input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">]
 console-format-collections.html:35[<input type="radio" name="x" value="x1">, <input type="radio" name="x" value="x2">]
 
diff --git a/LayoutTests/inspector/console-format-expected.txt b/LayoutTests/inspector/console-format-expected.txt
index 6333b3d..54141bd 100644
--- a/LayoutTests/inspector/console-format-expected.txt
+++ b/LayoutTests/inspector/console-format-expected.txt
@@ -55,8 +55,8 @@ console-format.html:53["test named "test""]
 console-format.html:52Error: Unknown error
 console-format.html:53[Error: Unknown error]
 Error: Unknown error
-console-format.html:52<body onload="onload()">
-console-format.html:53[<body onload="onload()">]
+console-format.html:52<body onload="onload()">…</body>
+console-format.html:53[<body onload="onload()">…</body>]
 "HTMLBodyElement"
 console-format.html:52function () { return 1; }
 console-format.html:53[function () { return 1; }]
diff --git a/LayoutTests/inspector/elements-panel-limited-children-expected.txt b/LayoutTests/inspector/elements-panel-limited-children-expected.txt
index 52c4a39..8bf2179 100644
--- a/LayoutTests/inspector/elements-panel-limited-children-expected.txt
+++ b/LayoutTests/inspector/elements-panel-limited-children-expected.txt
@@ -12,6 +12,7 @@ Tests that src and href element targets are rewritten properly.
 
 <div id="data">/
 <a>
+</a>
 <div id="id1">1
 </div>
 <div id="id3">3
@@ -23,6 +24,7 @@ Tests that src and href element targets are rewritten properly.
 </div>
 <div id="data">/
 <a>
+</a>
 <div id="id1">1
 </div>
 <div id="id3">3
@@ -42,5 +44,6 @@ Tests that src and href element targets are rewritten properly.
 <div id="id10">10
 </div>
 <a>
+</a>
 </div>
 
diff --git a/LayoutTests/inspector/elements-panel-structure-expected.txt b/LayoutTests/inspector/elements-panel-structure-expected.txt
index 76efb25..c566acf 100644
--- a/LayoutTests/inspector/elements-panel-structure-expected.txt
+++ b/LayoutTests/inspector/elements-panel-structure-expected.txt
@@ -3,12 +3,15 @@ Tests that elements panel shows dom tree structure.
 
 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
 <html>
-<head>
+<head>…
+</head>
 <body onload="onload()">
 <p>Tests that elements panel shows dom tree structure.
 </p>
 <pre id="outputPre">
+</pre>
 <div id="output">
+</div>
 </body>
 </html>
 
diff --git a/LayoutTests/inspector/elements-panel-xhtml-structure-expected.txt b/LayoutTests/inspector/elements-panel-xhtml-structure-expected.txt
new file mode 100644
index 0000000..f05cd40
--- /dev/null
+++ b/LayoutTests/inspector/elements-panel-xhtml-structure-expected.txt
@@ -0,0 +1,28 @@
+Tests that elements panel shows XML dom tree structure with closing tags for all elements.
+
+Paragraph BR test
+Next line
+
+
+application/xhtml+xml 
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>…
+</head>
+<body onload="onload()">
+<p>"Tests that elements panel shows XML dom tree structure with closing tags for all elements."
+</p>
+<hr>
+</hr>
+<p>"Paragraph BR test"
+<br>
+</br>"Next line"
+</p>
+<img alt="Random Image">
+</img>
+<pre id="outputPre">
+</pre>
+<div id="output">
+</div>
+</body>
+</html>
+
diff --git a/LayoutTests/inspector/elements-panel-xhtml-structure.xhtml b/LayoutTests/inspector/elements-panel-xhtml-structure.xhtml
new file mode 100644
index 0000000..88bfe25
--- /dev/null
+++ b/LayoutTests/inspector/elements-panel-xhtml-structure.xhtml
@@ -0,0 +1,122 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+<script src="../http/tests/inspector/inspector-test.js"></script>
+<script src="elements-tests.js"></script>
+<script>
+<![CDATA[
+function doit()
+{
+    function preOutput(result)
+    {
+        var output = document.getElementById("outputPre");
+        output.textContent = result.replace(/\u200b/g, "").replace(/\n/g, "").replace(/</g, "\n<");
+    }
+
+    function nodeDumpCallback(dump)
+    {
+        preOutput(dump);
+        notifyDone();
+    }
+
+    function nodeExpandedCallback(result)
+    {
+        if (result) {
+            preOutput(result);
+            notifyDone();
+        }
+        evaluateInWebInspector("frontend_dumpAllElements", nodeDumpCallback);
+    }
+
+    function domLoadedCallback(result)
+    {
+        if (result) {
+            preOutput(result);
+            notifyDone();
+        }
+        evaluateInWebInspector("frontend_expandNodes", nodeExpandedCallback);
+    }
+
+    evaluateInWebInspector("frontend_loadDOM", domLoadedCallback);
+}
+
+
+// Frontend functions.
+
+function frontend_dumpAllElements(testController)
+{
+    testController.waitUntilDone();
+    // Need test to be async to expand whole the tree first.
+    frontend_expandDOMSubtree(WebInspector.domAgent.document);
+    testController.runAfterPendingDispatches(function() {
+        testController.notifyDone(WebInspector.mainResource.mimeType + " " + WebInspector.panels.elements.treeOutline.element.textContent);
+    });
+}
+
+function frontend_expandNodes(testController)
+{
+    try {
+        var innerMapping = WebInspector.domAgent._idToDOMNode;
+        var treeElement = false;
+        var result = "";
+
+        for (var nodeId in innerMapping) {
+            var node = innerMapping[nodeId];
+            result += node.nodeName + " ";
+            if (node.nodeName === "p") {
+                treeElement = WebInspector.panels.elements.treeOutline.createTreeElementFor(node);
+                if (treeElement) {
+                    treeElement.reveal();
+                    treeElement.expand();
+                }
+            }
+        }
+
+        if (!treeElement) {
+            if (treeElement === false)
+                testController.notifyDone("No 'p' DOM element found");
+            else
+                testController.notifyDone("'p' tree element could not be created");
+
+            return;
+        }
+
+        testController.notifyDone("");
+    } catch(e) {
+        testController.notifyDone("expandNode: " + e);
+    }
+}
+
+function frontend_loadDOM(testController)
+{
+    testController.waitUntilDone();
+    // Need test to be async to expand whole the tree first.
+    try {
+        frontend_expandDOMSubtree(WebInspector.domAgent.document);
+        testController.runAfterPendingDispatches(function() {
+            testController.notifyDone("");
+        });
+    } catch(e) {
+        testController.notifyDone("loadDOM: " + e);
+    }
+}
+
+]]>
+</script>
+</head>
+
+<body onload="onload()">
+<p>
+Tests that elements panel shows XML dom tree structure with closing tags for all elements.
+</p>
+
+<hr></hr>
+<p>Paragraph BR test<br/>Next line
+</p>
+
+<img alt="Random Image"></img>
+
+<pre id="outputPre">
+</pre>
+
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 872f8b4..0e990ca 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,25 @@
+2010-02-19  Alexander Pavlov  <apavlov at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        WebInspector: Elements panel: Correctly show empty elements' ending tags
+        for XML and HTML documents.
+        https://bugs.webkit.org/show_bug.cgi?id=26315
+
+        Test: inspector/elements-panel-xhtml-structure.xhtml
+
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::populateScriptObjects):
+        * inspector/front-end/ElementsTreeOutline.js:
+        (WebInspector.ElementsTreeOutline.prototype.set rootDOMNode):
+        (WebInspector.ElementsTreeOutline.prototype.get isXMLMimeType):
+        (WebInspector.ElementsTreeOutline.prototype._contextMenuEventFired):
+        (WebInspector.ElementsTreeElement.prototype.onexpand):
+        (WebInspector.ElementsTreeElement.prototype.oncollapse):
+        (WebInspector.ElementsTreeElement.prototype.updateTitle.callback):
+        (WebInspector.ElementsTreeElement.prototype.updateTitle):
+        (WebInspector.ElementsTreeElement.prototype._nodeTitleInfo):
+
 2010-02-19  Pavel Feldman  <pfeldman at chromium.org>
 
         Not reviewed. Chromium build fix: reverting r54997 and r54998.
diff --git a/WebCore/inspector/InspectorController.cpp b/WebCore/inspector/InspectorController.cpp
index 73433bc..b487ad8 100644
--- a/WebCore/inspector/InspectorController.cpp
+++ b/WebCore/inspector/InspectorController.cpp
@@ -654,12 +654,13 @@ void InspectorController::populateScriptObjects()
         return;
 
     m_frontend->populateFrontendSettings(setting(FrontendSettingsSettingName));
-    m_domAgent->setDocument(m_inspectedPage->mainFrame()->document());
 
     ResourcesMap::iterator resourcesEnd = m_resources.end();
     for (ResourcesMap::iterator it = m_resources.begin(); it != resourcesEnd; ++it)
         it->second->updateScriptObject(m_frontend.get());
 
+    m_domAgent->setDocument(m_inspectedPage->mainFrame()->document());
+
     if (m_expiredConsoleMessageCount)
         m_frontend->updateConsoleMessageExpiredCount(m_expiredConsoleMessageCount);
     unsigned messageCount = m_consoleMessages.size();
diff --git a/WebCore/inspector/front-end/ElementsTreeOutline.js b/WebCore/inspector/front-end/ElementsTreeOutline.js
index fbce9c1..fe7ae53 100644
--- a/WebCore/inspector/front-end/ElementsTreeOutline.js
+++ b/WebCore/inspector/front-end/ElementsTreeOutline.js
@@ -59,9 +59,16 @@ WebInspector.ElementsTreeOutline.prototype = {
 
         this._rootDOMNode = x;
 
+        this._isXMLMimeType = !!(WebInspector.mainResource && WebInspector.mainResource.mimeType && WebInspector.mainResource.mimeType.match(/x(?:ht)?ml/i));
+
         this.update();
     },
 
+    get isXMLMimeType()
+    {
+        return this._isXMLMimeType;
+    },
+
     get focusedDOMNode()
     {
         return this._focusedDOMNode;
@@ -292,9 +299,9 @@ WebInspector.ElementsTreeOutline.prototype = {
 
         var tag = event.target.enclosingNodeOrSelfWithClass("webkit-html-tag");
         var textNode = event.target.enclosingNodeOrSelfWithClass("webkit-html-text-node");
-        if (tag)
+        if (tag && listItem.treeElement._populateTagContextMenu)
             listItem.treeElement._populateTagContextMenu(contextMenu, event);
-        else if (textNode)
+        else if (textNode && listItem.treeElement._populateTextContextMenu)
             listItem.treeElement._populateTextContextMenu(contextMenu, textNode);
         contextMenu.show(event);
     }
@@ -317,6 +324,14 @@ WebInspector.ElementsTreeElement = function(node)
 
 WebInspector.ElementsTreeElement.InitialChildrenLimit = 500;
 
+// A union of HTML4 and HTML5-Draft elements that explicitly
+// or implicitly (for HTML5) forbid the closing tag.
+// FIXME: Revise once HTML5 Final is published.
+WebInspector.ElementsTreeElement.ForbiddenClosingTagElements = [
+    "area", "base", "basefont", "br", "canvas", "col", "command", "embed", "frame",
+    "hr", "img", "input", "isindex", "keygen", "link", "meta", "param", "source"
+].keySet();
+
 WebInspector.ElementsTreeElement.prototype = {
     highlightSearchResults: function(searchQuery)
     {
@@ -620,11 +635,13 @@ WebInspector.ElementsTreeElement.prototype = {
 
     onexpand: function()
     {
+        this.updateTitle();
         this.treeOutline.updateSelection();
     },
 
     oncollapse: function()
     {
+        this.updateTitle();
         this.treeOutline.updateSelection();
     },
 
@@ -996,7 +1013,7 @@ WebInspector.ElementsTreeElement.prototype = {
         var self = this;
         function callback(tooltipText)
         {
-            var title = self._nodeTitleInfo(self.representedObject, self.hasChildren, WebInspector.linkifyURL, tooltipText).title;
+            var title = self._nodeTitleInfo(WebInspector.linkifyURL, tooltipText).title;
             self.title = "<span class=\"highlight\">" + title + "</span>";
             delete self.selectionElement;
             self.updateSelection();
@@ -1034,9 +1051,10 @@ WebInspector.ElementsTreeElement.prototype = {
         return hrefValue;
     },
 
-    _nodeTitleInfo: function(node, hasChildren, linkify, tooltipText)
+    _nodeTitleInfo: function(linkify, tooltipText)
     {
-        var info = {title: "", hasChildren: hasChildren};
+        var node = this.representedObject;
+        var info = {title: "", hasChildren: this.hasChildren};
         
         switch (node.nodeType) {
             case Node.DOCUMENT_NODE:
@@ -1048,7 +1066,8 @@ WebInspector.ElementsTreeElement.prototype = {
                 break;
 
             case Node.ELEMENT_NODE:
-                info.title = "<span class=\"webkit-html-tag\">&lt;" + node.nodeName.toLowerCase().escapeHTML();
+                var tagName = node.nodeName.toLowerCase().escapeHTML();
+                info.title = "<span class=\"webkit-html-tag\">&lt;" + tagName;
                 
                 if (node.hasAttributes()) {
                     for (var i = 0; i < node.attributes.length; ++i) {
@@ -1069,15 +1088,21 @@ WebInspector.ElementsTreeElement.prototype = {
                 }
                 info.title += "&gt;</span>&#8203;";
                 
+                const closingTagHTML = "<span class=\"webkit-html-tag\">&lt;/" + tagName + "&gt;</span>&#8203;";
+                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 += closingTagHTML;
+                }
+
                 // 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
-                
-                var textChild = onlyTextChild.call(node);
-                var showInlineText = textChild && textChild.textContent.length < Preferences.maxInlineTextChildLength;
-                
                 if (showInlineText) {
-                    info.title += "<span class=\"webkit-html-text-node\">" + textChild.nodeValue.escapeHTML() + "</span>&#8203;<span class=\"webkit-html-tag\">&lt;/" + node.nodeName.toLowerCase().escapeHTML() + "&gt;</span>";
+                    info.title += "<span class=\"webkit-html-text-node\">" + textChild.nodeValue.escapeHTML() + "</span>&#8203;" + closingTagHTML;
                     info.hasChildren = false;
                 }
                 break;

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list