Title: [193031] branches/safari-601-branch

Diff

Modified: branches/safari-601-branch/LayoutTests/ChangeLog (193030 => 193031)


--- branches/safari-601-branch/LayoutTests/ChangeLog	2015-12-03 18:33:26 UTC (rev 193030)
+++ branches/safari-601-branch/LayoutTests/ChangeLog	2015-12-03 18:33:33 UTC (rev 193031)
@@ -1,5 +1,19 @@
 2015-12-01  Timothy Hatcher  <[email protected]>
 
+        Merge r187507. rdar://problem/23221163
+
+    2015-07-28  Joseph Pecoraro  <[email protected]>
+
+            Web Inspector: Include <template> node content in DOM Tree
+            https://bugs.webkit.org/show_bug.cgi?id=147335
+
+            Reviewed by Timothy Hatcher.
+
+            * inspector/dom/template-content-expected.txt: Added.
+            * inspector/dom/template-content.html: Added.
+
+2015-12-01  Timothy Hatcher  <[email protected]>
+
         Merge r187496. rdar://problem/23221163
 
     2015-07-28  Joseph Pecoraro  <[email protected]>

Added: branches/safari-601-branch/LayoutTests/inspector/dom/template-content-expected.txt (0 => 193031)


--- branches/safari-601-branch/LayoutTests/inspector/dom/template-content-expected.txt	                        (rev 0)
+++ branches/safari-601-branch/LayoutTests/inspector/dom/template-content-expected.txt	2015-12-03 18:33:33 UTC (rev 193031)
@@ -0,0 +1,8 @@
+Test that we include template content in DOM Nodes for <template> elements.
+
+PASS: Got DOMNode for div element
+PASS: DOMNode does not have template content
+
+PASS: Got DOMNode for template element
+PASS: DOMNode has template content
+

Added: branches/safari-601-branch/LayoutTests/inspector/dom/template-content.html (0 => 193031)


--- branches/safari-601-branch/LayoutTests/inspector/dom/template-content.html	                        (rev 0)
+++ branches/safari-601-branch/LayoutTests/inspector/dom/template-content.html	2015-12-03 18:33:33 UTC (rev 193031)
@@ -0,0 +1,33 @@
+<html>
+<head>
+<script src=""
+<script>
+function test() {
+    WebInspector.domTreeManager.requestDocument(function(documentNode) {
+        WebInspector.domTreeManager.querySelector(documentNode.id, "#div", function(nodeId) {
+            var domNode = WebInspector.domTreeManager.nodeForId(nodeId);
+            InspectorTest.expectThat(domNode, "Got DOMNode for div element");
+            InspectorTest.expectThat(!domNode.templateContent(), "DOMNode does not have template content");
+        });
+
+        WebInspector.domTreeManager.querySelector(documentNode.id, "#template", function(nodeId) {
+            var domNode = WebInspector.domTreeManager.nodeForId(nodeId);
+            InspectorTest.log("");
+            InspectorTest.expectThat(domNode, "Got DOMNode for template element");
+            InspectorTest.expectThat(domNode.templateContent(), "DOMNode has template content");
+            InspectorTest.completeTest();
+        });
+    });
+}
+</script>
+</head>
+<body _onload_="runTest()">
+    <p>Test that we include template content in DOM Nodes for &lt;template&gt; elements.</p>
+
+    <div id="div"></div>
+    <template id="template">
+        <h1>Header</h1>
+        <p>Paragraph</p>
+    </template>
+</body>
+</html>

Modified: branches/safari-601-branch/Source/WebInspectorUI/ChangeLog (193030 => 193031)


--- branches/safari-601-branch/Source/WebInspectorUI/ChangeLog	2015-12-03 18:33:26 UTC (rev 193030)
+++ branches/safari-601-branch/Source/WebInspectorUI/ChangeLog	2015-12-03 18:33:33 UTC (rev 193031)
@@ -1,5 +1,30 @@
 2015-12-01  Timothy Hatcher  <[email protected]>
 
+        Merge r187507. rdar://problem/23221163
+
+    2015-07-28  Joseph Pecoraro  <[email protected]>
+
+            Web Inspector: Include <template> node content in DOM Tree
+            https://bugs.webkit.org/show_bug.cgi?id=147335
+
+            Reviewed by Timothy Hatcher.
+
+            * UserInterface/Controllers/DOMTreeManager.js:
+            (WebInspector.DOMTreeManager.prototype._unbind):
+            Cleanup templateContent when DOMNodes get removed.
+
+            * UserInterface/Models/DOMNode.js:
+            (WebInspector.DOMNode.prototype.templateContent):
+            Create a DOMNode from the payload's templateContent.
+
+            * UserInterface/Views/DOMTreeElement.js:
+            (WebInspector.DOMTreeElement.prototype._singleTextChild):
+            (WebInspector.DOMTreeElement.prototype._hasVisibleChildren):
+            (WebInspector.DOMTreeElement.prototype._visibleChildren):
+            A DOMTreeElement has children if the DOMNode has template content.
+
+2015-12-01  Timothy Hatcher  <[email protected]>
+
         Merge r187500. rdar://problem/23221163
 
     2015-07-28  Devin Rousso  <[email protected]>

Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Controllers/DOMTreeManager.js (193030 => 193031)


--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Controllers/DOMTreeManager.js	2015-12-03 18:33:26 UTC (rev 193030)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Controllers/DOMTreeManager.js	2015-12-03 18:33:33 UTC (rev 193031)
@@ -289,12 +289,14 @@
         for (var i = 0; node.children && i < node.children.length; ++i)
             this._unbind(node.children[i]);
 
+        if (node.templateContent())
+            this._unbind(node.templateContent());
+
         var pseudoElements = node.pseudoElements();
         for (var pseudoElement of pseudoElements)
             this._unbind(pseudoElement);
 
         // FIXME: Handle shadow roots.
-        // FIXME: Handle template content.
     }
 
     get restoreSelectedNodeIsAllowed()

Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Models/DOMNode.js (193030 => 193031)


--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Models/DOMNode.js	2015-12-03 18:33:26 UTC (rev 193030)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Models/DOMNode.js	2015-12-03 18:33:33 UTC (rev 193031)
@@ -79,7 +79,10 @@
             }
         }
 
-        // FIXME: Handle templateContent.
+        if (payload.templateContent) {
+            this._templateContent = new WebInspector.DOMNode(this._domAgent, this.ownerDocument, true, payload.templateContent);
+            this._templateContent.parentNode = this;
+        }
 
         if (payload.children)
             this._setChildrenPayload(payload.children);
@@ -263,6 +266,11 @@
         return this._localName;
     }
 
+    templateContent()
+    {
+        return this._templateContent || null;
+    }
+
     pseudoType()
     {
         return this._pseudoType;

Modified: branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js (193030 => 193031)


--- branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js	2015-12-03 18:33:26 UTC (rev 193030)
+++ branches/safari-601-branch/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js	2015-12-03 18:33:33 UTC (rev 193031)
@@ -1262,6 +1262,8 @@
 
         if (node.hasShadowRoots())
             return null;
+        if (node.templateContent())
+            return null;
         if (node.hasPseudoElements())
             return null;
 
@@ -1288,6 +1290,8 @@
 
         if (node.hasChildNodes())
             return true;
+        if (node.templateContent())
+            return true;
         if (node.hasPseudoElements())
             return true;
 
@@ -1300,6 +1304,10 @@
 
         var visibleChildren = [];
 
+        var templateContent = node.templateContent();
+        if (templateContent)
+            visibleChildren.push(templateContent);
+
         var beforePseudoElement = node.beforePseudoElement();
         if (beforePseudoElement)
             visibleChildren.push(beforePseudoElement);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to