Title: [131701] trunk
Revision
131701
Author
[email protected]
Date
2012-10-17 20:59:51 -0700 (Wed, 17 Oct 2012)

Log Message

Content element does not expose distributedNodes property.
https://bugs.webkit.org/show_bug.cgi?id=99232

Reviewed by Dimitri Glazkov.

Add getDistributedNodes() to HTMLContentElement's IDL, which returns a
static NodeList whose node are distributed to the content element.

Source/WebCore:

Test: fast/dom/shadow/content-element-distributed-nodes.html

* html/shadow/HTMLContentElement.idl:
* html/shadow/InsertionPoint.cpp:
(WebCore::InsertionPoint::getDistributedNodes):
* html/shadow/InsertionPoint.h:
(InsertionPoint):
* testing/Internals.cpp:
* testing/Internals.h:
(Internals):
* testing/Internals.idl:

LayoutTests:

* fast/dom/shadow/content-element-distributed-nodes-expected.txt: Added.
* fast/dom/shadow/content-element-distributed-nodes.html: Added.
* fast/dom/shadow/distributed-nodes-expected.txt: Removed.
* fast/dom/shadow/distributed-nodes.html: Removed.
* platform/qt/TestExpectations:

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (131700 => 131701)


--- trunk/LayoutTests/ChangeLog	2012-10-18 02:56:08 UTC (rev 131700)
+++ trunk/LayoutTests/ChangeLog	2012-10-18 03:59:51 UTC (rev 131701)
@@ -1,3 +1,19 @@
+2012-10-17  Hayato Ito  <[email protected]>
+
+        Content element does not expose distributedNodes property.
+        https://bugs.webkit.org/show_bug.cgi?id=99232
+
+        Reviewed by Dimitri Glazkov.
+
+        Add getDistributedNodes() to HTMLContentElement's IDL, which returns a
+        static NodeList whose node are distributed to the content element.
+
+        * fast/dom/shadow/content-element-distributed-nodes-expected.txt: Added.
+        * fast/dom/shadow/content-element-distributed-nodes.html: Added.
+        * fast/dom/shadow/distributed-nodes-expected.txt: Removed.
+        * fast/dom/shadow/distributed-nodes.html: Removed.
+        * platform/qt/TestExpectations:
+
 2012-10-17  Dirk Pranke  <[email protected]>
 
         Clone baselines from platform/mac to platform/chromium [7 of 7]

Added: trunk/LayoutTests/fast/dom/shadow/content-element-distributed-nodes-expected.txt (0 => 131701)


--- trunk/LayoutTests/fast/dom/shadow/content-element-distributed-nodes-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/content-element-distributed-nodes-expected.txt	2012-10-18 03:59:51 UTC (rev 131701)
@@ -0,0 +1,19 @@
+Tests for content element's getDistributedNodes().
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS nodeList.length is expectedNodes.length
+PASS nodeList.item(0) is expectedNodes[0]
+PASS nodeList.length is expectedNodes.length
+PASS nodeList.item(0) is expectedNodes[0]
+PASS nodeList.length is expectedNodes.length
+PASS nodeList.item(0) is expectedNodes[0]
+Verify that getDistributedNodes() returns a static NodeList.
+PASS nodeList.length is expectedNodes.length
+PASS nodeList.item(0) is expectedNodes[0]
+PASS nodeList.length is expectedNodes.length
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/dom/shadow/content-element-distributed-nodes.html (0 => 131701)


--- trunk/LayoutTests/fast/dom/shadow/content-element-distributed-nodes.html	                        (rev 0)
+++ trunk/LayoutTests/fast/dom/shadow/content-element-distributed-nodes.html	2012-10-18 03:59:51 UTC (rev 131701)
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<html>
+<head>
+<script src=""
+<script src=""
+</head>
+<body>
+<script>
+description("Tests for content element's getDistributedNodes().");
+
+document.body.appendChild(
+    createDOM('div', {},
+              createDOM('div', {'id': 'host-1'},
+                        createShadowRoot(
+                            createDOM('content', {'id': 'content-1'})),
+                        createDOM('div', {'id': 'child-1'})),
+              createDOM('div', {'id': 'host-2'},
+                        createShadowRoot(
+                            createDOM('content', {'id': 'content-2'}),
+                            createDOM('div', {'id': 'host-3'},
+                                      createShadowRoot(
+                                          createDOM('content', {'id': 'content-3'})),
+                                      createDOM('div', {'id': 'child-3'}))),
+                        createDOM('div', {'id': 'child-2'}))));
+
+
+var content1 = getNodeInShadowTreeStack('host-1/content-1');
+var content2 = getNodeInShadowTreeStack('host-2/content-2');
+var content3 = getNodeInShadowTreeStack('host-2/host-3/content-3');
+
+var child1 = getNodeInShadowTreeStack('child-1');
+var child2 = getNodeInShadowTreeStack('child-2');
+var child3 = getNodeInShadowTreeStack('host-2/child-3');
+
+var distributedNodes1 = content1.getDistributedNodes();
+var distributedNodes2 = content2.getDistributedNodes();
+var distributedNodes3 = content3.getDistributedNodes();
+
+function assertNodeList(nodeList, expectedNodes)
+{
+    window.nodeList = nodeList;
+    window.expectedNodes = expectedNodes;
+    shouldBe("nodeList.length", "expectedNodes.length");
+    for (var i = 0; i < nodeList.length; ++i) {
+      shouldBe("nodeList.item(" + i + ")", "expectedNodes[" + i + "]");
+    }
+}
+
+assertNodeList(distributedNodes1, [child1]);
+assertNodeList(distributedNodes2, [child2]);
+assertNodeList(distributedNodes3, [child3]);
+
+debug('Verify that getDistributedNodes() returns a static NodeList.');
+document.getElementById('host-1').innerHTML = '';
+assertNodeList(distributedNodes1, [child1]);
+assertNodeList(content1.getDistributedNodes(), []);
+
+</script>
+<script src=""
+</body>
+</html>

Deleted: trunk/LayoutTests/fast/dom/shadow/distributed-nodes-expected.txt (131700 => 131701)


--- trunk/LayoutTests/fast/dom/shadow/distributed-nodes-expected.txt	2012-10-18 02:56:08 UTC (rev 131700)
+++ trunk/LayoutTests/fast/dom/shadow/distributed-nodes-expected.txt	2012-10-18 03:59:51 UTC (rev 131701)
@@ -1,12 +0,0 @@
-PASS nodeList.length is 3
-PASS nodeList.item(0) is a
-PASS nodeList.item(1) is b
-PASS nodeList.item(2) is c
-PASS successfullyParsed is true
-
-TEST COMPLETE
-This test checks internals.distributedNodes(insertionPoint) returns the node distributed to the insertion point.
-
-A
-B
-C

Deleted: trunk/LayoutTests/fast/dom/shadow/distributed-nodes.html (131700 => 131701)


--- trunk/LayoutTests/fast/dom/shadow/distributed-nodes.html	2012-10-18 02:56:08 UTC (rev 131700)
+++ trunk/LayoutTests/fast/dom/shadow/distributed-nodes.html	2012-10-18 03:59:51 UTC (rev 131701)
@@ -1,40 +0,0 @@
-<!DOCTYPE html>
-<html>
-<body>
-<script src=""
-<script src=""
-
-<p>This test checks internals.distributedNodes(insertionPoint) returns the node distributed to the insertion point.</p>
-
-<div id="host">
-    <div id="a">A</div>
-    <div id="b">B</div>
-    <div id="c">C</div>
-</div>
-
-<script>
-jsTestIsAsync = true;
-
-var shadowRoot = new WebKitShadowRoot(host);
-var shadow = document.createElement('content');
-shadow.setAttribute('select', 'div');
-shadowRoot.appendChild(shadow);
-
-var nodeList;
-setTimeout(function() {
-    nodeList = internals.distributedNodes(shadow);
-
-    shouldBe('nodeList.length', "3");
-    shouldBe('nodeList.item(0)', 'a');
-    shouldBe('nodeList.item(1)', 'b');
-    shouldBe('nodeList.item(2)', 'c');
-
-    finishJSTest();
-}, 0);
-
-</script>
-
-<script src=""
-
-</body>
-</html>

Modified: trunk/LayoutTests/platform/qt/TestExpectations (131700 => 131701)


--- trunk/LayoutTests/platform/qt/TestExpectations	2012-10-18 02:56:08 UTC (rev 131700)
+++ trunk/LayoutTests/platform/qt/TestExpectations	2012-10-18 03:59:51 UTC (rev 131701)
@@ -193,12 +193,12 @@
 fast/dom/shadow/composed-shadow-tree-walker.html
 fast/dom/shadow/content-after-style.html
 fast/dom/shadow/content-element-api.html
+fast/dom/shadow/content-element-distributed-nodes.html
 fast/dom/shadow/content-element-move.html
 fast/dom/shadow/content-element-outside-shadow.html
 fast/dom/shadow/content-element-outside-shadow-style.html
 fast/dom/shadow/content-element-in-media-element.html
 fast/dom/shadow/content-element-in-meter-element.html
-fast/dom/shadow/distributed-nodes.html
 fast/dom/shadow/drop-event-for-input-in-shadow.html
 fast/dom/shadow/drop-event-in-shadow.html
 fast/dom/shadow/elements-in-frameless-document.html

Modified: trunk/Source/WebCore/ChangeLog (131700 => 131701)


--- trunk/Source/WebCore/ChangeLog	2012-10-18 02:56:08 UTC (rev 131700)
+++ trunk/Source/WebCore/ChangeLog	2012-10-18 03:59:51 UTC (rev 131701)
@@ -1,3 +1,25 @@
+2012-10-17  Hayato Ito  <[email protected]>
+
+        Content element does not expose distributedNodes property.
+        https://bugs.webkit.org/show_bug.cgi?id=99232
+
+        Reviewed by Dimitri Glazkov.
+
+        Add getDistributedNodes() to HTMLContentElement's IDL, which returns a
+        static NodeList whose node are distributed to the content element.
+
+        Test: fast/dom/shadow/content-element-distributed-nodes.html
+
+        * html/shadow/HTMLContentElement.idl:
+        * html/shadow/InsertionPoint.cpp:
+        (WebCore::InsertionPoint::getDistributedNodes):
+        * html/shadow/InsertionPoint.h:
+        (InsertionPoint):
+        * testing/Internals.cpp:
+        * testing/Internals.h:
+        (Internals):
+        * testing/Internals.idl:
+
 2012-10-17  Pan Deng  <[email protected]>
 
         [User Timing] implement main interface in of User Timing, according to http://www.w3.org/TR/2012/CR-user-timing-20120726/

Modified: trunk/Source/WebCore/html/shadow/HTMLContentElement.idl (131700 => 131701)


--- trunk/Source/WebCore/html/shadow/HTMLContentElement.idl	2012-10-18 02:56:08 UTC (rev 131700)
+++ trunk/Source/WebCore/html/shadow/HTMLContentElement.idl	2012-10-18 03:59:51 UTC (rev 131701)
@@ -30,4 +30,5 @@
 ] interface HTMLContentElement : HTMLElement {
     [Reflect] attribute DOMString select;
     attribute boolean resetStyleInheritance;
+    NodeList getDistributedNodes();
 };

Modified: trunk/Source/WebCore/html/shadow/InsertionPoint.cpp (131700 => 131701)


--- trunk/Source/WebCore/html/shadow/InsertionPoint.cpp	2012-10-18 02:56:08 UTC (rev 131700)
+++ trunk/Source/WebCore/html/shadow/InsertionPoint.cpp	2012-10-18 03:59:51 UTC (rev 131701)
@@ -88,11 +88,9 @@
     return true;
 }
 
-PassRefPtr<NodeList> InsertionPoint::distributedNodes() const
+PassRefPtr<NodeList> InsertionPoint::getDistributedNodes() const
 {
-    if (!attached())
-        return 0;
-
+    document()->updateLayout();
     Vector<RefPtr<Node> > nodes;
 
     for (size_t i = 0; i < m_distribution.size(); ++i)

Modified: trunk/Source/WebCore/html/shadow/InsertionPoint.h (131700 => 131701)


--- trunk/Source/WebCore/html/shadow/InsertionPoint.h	2012-10-18 02:56:08 UTC (rev 131700)
+++ trunk/Source/WebCore/html/shadow/InsertionPoint.h	2012-10-18 03:59:51 UTC (rev 131701)
@@ -49,7 +49,7 @@
     bool isShadowBoundary() const;
     bool isActive() const;
 
-    PassRefPtr<NodeList> distributedNodes() const;
+    PassRefPtr<NodeList> getDistributedNodes() const;
 
     virtual const AtomicString& select() const = 0;
     virtual bool isSelectValid() const = 0;

Modified: trunk/Source/WebCore/testing/Internals.cpp (131700 => 131701)


--- trunk/Source/WebCore/testing/Internals.cpp	2012-10-18 02:56:08 UTC (rev 131700)
+++ trunk/Source/WebCore/testing/Internals.cpp	2012-10-18 03:59:51 UTC (rev 131701)
@@ -297,16 +297,6 @@
     return parentTreeScope ? parentTreeScope->rootNode() : 0;
 }
 
-PassRefPtr<NodeList> Internals::distributedNodes(Element* insertionPoint, ExceptionCode& ec)
-{
-    if (!insertionPoint || !isInsertionPoint(insertionPoint)) {
-        ec = INVALID_ACCESS_ERR;
-        return 0;
-    }
-
-    return toInsertionPoint(insertionPoint)->distributedNodes();
-}
-
 bool Internals::hasShadowInsertionPoint(const Node* root, ExceptionCode& ec) const
 {
     if (root && root->isShadowRoot())

Modified: trunk/Source/WebCore/testing/Internals.h (131700 => 131701)


--- trunk/Source/WebCore/testing/Internals.h	2012-10-18 02:56:08 UTC (rev 131700)
+++ trunk/Source/WebCore/testing/Internals.h	2012-10-18 03:59:51 UTC (rev 131701)
@@ -90,7 +90,6 @@
     bool isValidContentSelect(Element* insertionPoint, ExceptionCode&);
     Node* treeScopeRootNode(Node*, ExceptionCode&);
     Node* parentTreeScope(Node*, ExceptionCode&);
-    PassRefPtr<NodeList> distributedNodes(Element* insertionPoint, ExceptionCode&);
 
     bool attached(Node*, ExceptionCode&);
 

Modified: trunk/Source/WebCore/testing/Internals.idl (131700 => 131701)


--- trunk/Source/WebCore/testing/Internals.idl	2012-10-18 02:56:08 UTC (rev 131700)
+++ trunk/Source/WebCore/testing/Internals.idl	2012-10-18 03:59:51 UTC (rev 131701)
@@ -56,7 +56,6 @@
     boolean isValidContentSelect(in Element contentElement) raises(DOMException);
     Node treeScopeRootNode(in Node node) raises (DOMException);
     Node parentTreeScope(in Node node) raises (DOMException);
-    NodeList distributedNodes(in Element insertionPoint) raises(DOMException);
 
     Node nextSiblingByWalker(in Node node) raises(DOMException);
     Node firstChildByWalker(in Node node) raises(DOMException);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to