Title: [195681] trunk
Revision
195681
Author
rn...@webkit.org
Date
2016-01-27 12:08:52 -0800 (Wed, 27 Jan 2016)

Log Message

Rename HTMLSlotElement.getDistributedNodes to getAssignedNodes
https://bugs.webkit.org/show_bug.cgi?id=153534

Reviewed by Antti Koivisto.

Source/WebCore:

Did the rename.

* html/HTMLSlotElement.idl:

LayoutTests:

Updated the tests to refect the rename. Also added test cases after r192763
to assert we don't assign comment and processing instruction nodes to a slot.

* fast/shadow-dom/HTMLSlotElement-interface-expected.txt:
* fast/shadow-dom/HTMLSlotElement-interface.html:
* fast/shadow-dom/NonDocumentTypeChildNode-interface-assignedSlot.html:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (195680 => 195681)


--- trunk/LayoutTests/ChangeLog	2016-01-27 20:00:17 UTC (rev 195680)
+++ trunk/LayoutTests/ChangeLog	2016-01-27 20:08:52 UTC (rev 195681)
@@ -1,3 +1,17 @@
+2016-01-26  Ryosuke Niwa  <rn...@webkit.org>
+
+        Rename HTMLSlotElement.getDistributedNodes to getAssignedNodes
+        https://bugs.webkit.org/show_bug.cgi?id=153534
+
+        Reviewed by Antti Koivisto.
+
+        Updated the tests to refect the rename. Also added test cases after r192763
+        to assert we don't assign comment and processing instruction nodes to a slot.
+
+        * fast/shadow-dom/HTMLSlotElement-interface-expected.txt:
+        * fast/shadow-dom/HTMLSlotElement-interface.html:
+        * fast/shadow-dom/NonDocumentTypeChildNode-interface-assignedSlot.html:
+
 2016-01-27  Tim Horton  <timothy_hor...@apple.com>
 
         Need to be able to specify MIME type for <attachment> without filename or handle

Modified: trunk/LayoutTests/fast/shadow-dom/HTMLSlotElement-interface-expected.txt (195680 => 195681)


--- trunk/LayoutTests/fast/shadow-dom/HTMLSlotElement-interface-expected.txt	2016-01-27 20:00:17 UTC (rev 195680)
+++ trunk/LayoutTests/fast/shadow-dom/HTMLSlotElement-interface-expected.txt	2016-01-27 20:08:52 UTC (rev 195681)
@@ -1,8 +1,8 @@
 
 PASS HTMLSlotElement must be defined on window 
 PASS "name" attribute on HTMLSlotElement must reflect "name" attribute 
-PASS getDistributedNodes method on HTMLSlotElement must return the list of distributed nodes 
-PASS getDistributedNodes must update when slot and name attributes are modified 
-PASS getDistributedNodes must update when a default slot is introduced dynamically by a slot rename 
-PASS getDistributedNodes must update when slot elements are inserted or removed 
+PASS getAssignedNodes method on HTMLSlotElement must return the list of distributed nodes 
+PASS getAssignedNodes must update when slot and name attributes are modified 
+PASS getAssignedNodes must update when a default slot is introduced dynamically by a slot rename 
+PASS getAssignedNodes must update when slot elements are inserted or removed 
 

Modified: trunk/LayoutTests/fast/shadow-dom/HTMLSlotElement-interface.html (195680 => 195681)


--- trunk/LayoutTests/fast/shadow-dom/HTMLSlotElement-interface.html	2016-01-27 20:00:17 UTC (rev 195680)
+++ trunk/LayoutTests/fast/shadow-dom/HTMLSlotElement-interface.html	2016-01-27 20:08:52 UTC (rev 195681)
@@ -3,7 +3,7 @@
 <head>
 <title>Shadow DOM: HTMLSlotElement interface</title>
 <meta name="author" title="Ryosuke Niwa" href=""
-<meta name="assert" content="HTMLSlotElement must exist on window with name attribute and getDistributedNodes() method">
+<meta name="assert" content="HTMLSlotElement must exist on window with name attribute and getAssignedNode() method">
 <link rel="help" href=""
 <script src=""
 <script src=""
@@ -35,7 +35,7 @@
 }, '"name" attribute on HTMLSlotElement must reflect "name" attribute');
 
 test(function () {
-    assert_true('getDistributedNodes' in HTMLSlotElement.prototype, '"getDistributedNodes" method must be defined on HTMLSlotElement.prototype');
+    assert_true('getAssignedNodes' in HTMLSlotElement.prototype, '"getAssignedNodes" method must be defined on HTMLSlotElement.prototype');
 
     var shadowHost = document.createElement('div');
     var child = document.createElement('p');
@@ -44,24 +44,24 @@
     var slotElement = document.createElement('slot');
     shadowRoot.appendChild(slotElement);
 
-    assert_array_equals(slotElement.getDistributedNodes(), [], 'getDistributedNodes must return an empty array when there are no nodes in the shadow tree');
+    assert_array_equals(slotElement.getAssignedNodes(), [], 'getAssignedNodes must return an empty array when there are no nodes in the shadow tree');
 
     shadowHost.appendChild(child);
-    assert_array_equals(slotElement.getDistributedNodes(), [child], 'getDistributedNodes on a default slot must return an element without slot element');
+    assert_array_equals(slotElement.getAssignedNodes(), [child], 'getAssignedNodes on a default slot must return an element without slot element');
 
     child.setAttribute('slot', 'foo');
-    assert_array_equals(slotElement.getDistributedNodes(), [], 'getDistributedNodes on a default slot must not return an element with non-empty slot attribute');
+    assert_array_equals(slotElement.getAssignedNodes(), [], 'getAssignedNodes on a default slot must not return an element with non-empty slot attribute');
 
     child.setAttribute('slot', '');
-    assert_array_equals(slotElement.getDistributedNodes(), [child], 'getDistributedNodes on a default slot must return an element with empty slot attribute');
+    assert_array_equals(slotElement.getAssignedNodes(), [child], 'getAssignedNodes on a default slot must return an element with empty slot attribute');
 
     slotElement.setAttribute('name', 'bar');
-    assert_array_equals(slotElement.getDistributedNodes(), [], 'getDistributedNodes on a named slot must not return an element with empty slot attribute');
+    assert_array_equals(slotElement.getAssignedNodes(), [], 'getAssignedNodes on a named slot must not return an element with empty slot attribute');
 
     slotElement.setAttribute('name', '');
-    assert_array_equals(slotElement.getDistributedNodes(), [child], 'getDistributedNodes on an empty name slot must return an element with empty slot attribute');
+    assert_array_equals(slotElement.getAssignedNodes(), [child], 'getAssignedNodes on an empty name slot must return an element with empty slot attribute');
 
-}, 'getDistributedNodes method on HTMLSlotElement must return the list of distributed nodes');
+}, 'getAssignedNodes method on HTMLSlotElement must return the list of distributed nodes');
 
 test(function () {
     var shadowHost = document.createElement('div');
@@ -74,21 +74,21 @@
     var slotElement = document.createElement('slot');
     shadowRoot.appendChild(slotElement);
 
-    assert_array_equals(slotElement.getDistributedNodes(), [p, b], 'getDistributedNodes must return the distributed nodes');
+    assert_array_equals(slotElement.getAssignedNodes(), [p, b], 'getAssignedNodes must return the distributed nodes');
 
     slotElement.name = 'foo';
-    assert_array_equals(slotElement.getDistributedNodes(), [], 'getDistributedNodes must be empty when there are no matching elements for the slot name');
+    assert_array_equals(slotElement.getAssignedNodes(), [], 'getAssignedNodes must be empty when there are no matching elements for the slot name');
 
     b.slot = 'foo';
-    assert_array_equals(slotElement.getDistributedNodes(), [b], 'getDistributedNodes must return the nodes with the matching slot name');
+    assert_array_equals(slotElement.getAssignedNodes(), [b], 'getAssignedNodes must return the nodes with the matching slot name');
 
     p.slot = 'foo';
-    assert_array_equals(slotElement.getDistributedNodes(), [p, b], 'getDistributedNodes must return the nodes with the matching slot name in the tree order');
+    assert_array_equals(slotElement.getAssignedNodes(), [p, b], 'getAssignedNodes must return the nodes with the matching slot name in the tree order');
 
     slotElement.name = null;
-    assert_array_equals(slotElement.getDistributedNodes(), [], 'getDistributedNodes must be empty for a default slot when all elements have "slot" attributes specified');
+    assert_array_equals(slotElement.getAssignedNodes(), [], 'getAssignedNodes must be empty for a default slot when all elements have "slot" attributes specified');
 
-}, 'getDistributedNodes must update when slot and name attributes are modified');
+}, 'getAssignedNodes must update when slot and name attributes are modified');
 
 test(function () {
     var shadowHost = document.createElement('div');
@@ -100,20 +100,24 @@
     slotElement.name = 'foo';
     shadowRoot.appendChild(slotElement);
 
-    assert_array_equals(slotElement.getDistributedNodes(), [], 'getDistributedNodes must be empty when there are no matching elements for the slot name');
+    assert_array_equals(slotElement.getAssignedNodes(), [], 'getAssignedNodes must be empty when there are no matching elements for the slot name');
 
     slotElement.name = null;
-    assert_array_equals(slotElement.getDistributedNodes(), [child], 'getDistributedNodes must be empty when there are no matching elements for the slot name');
+    assert_array_equals(slotElement.getAssignedNodes(), [child], 'getAssignedNodes must be empty when there are no matching elements for the slot name');
 
-}, 'getDistributedNodes must update when a default slot is introduced dynamically by a slot rename');
+}, 'getAssignedNodes must update when a default slot is introduced dynamically by a slot rename');
 
 test(function () {
     var shadowHost = document.createElement('div');
     var p = document.createElement('p');
     var text = document.createTextNode('');
+    var comment = document.createComment('');
+    var processingInstruction = document.createProcessingInstruction('target', 'data');
     var b = document.createElement('b');
     shadowHost.appendChild(p);
     shadowHost.appendChild(text);
+    shadowHost.appendChild(comment);
+    shadowHost.appendChild(processingInstruction);
     shadowHost.appendChild(b);
 
     var shadowRoot = shadowHost.attachShadow({mode: 'open'});
@@ -124,31 +128,31 @@
     var secondSlotElement = document.createElement('slot');
     shadowRoot.appendChild(secondSlotElement);
 
-    assert_array_equals(firstSlotElement.getDistributedNodes(), [p, text, b],
-        'getDistributedNodes on a default slot must return the elements without slot attributes and text nodes');
-    assert_array_equals(secondSlotElement.getDistributedNodes(), [],
-        'getDistributedNodes on the second unnamed slot element must return an empty array');
+    assert_array_equals(firstSlotElement.getAssignedNodes(), [p, text, b],
+        'getAssignedNodes on a default slot must return the elements without slot attributes and text nodes');
+    assert_array_equals(secondSlotElement.getAssignedNodes(), [],
+        'getAssignedNodes on the second unnamed slot element must return an empty array');
 
     shadowRoot.removeChild(firstSlotElement);
-    assert_array_equals(firstSlotElement.getDistributedNodes(), [],
-        'getDistributedNodes on a detached formerly-default slot must return an empty array');
-    assert_array_equals(secondSlotElement.getDistributedNodes(), [p, text, b],
-        'getDistributedNodes on the second unnamed slot element after removing the first must return the elements without slot attributes and text nodes');
+    assert_array_equals(firstSlotElement.getAssignedNodes(), [],
+        'getAssignedNodes on a detached formerly-default slot must return an empty array');
+    assert_array_equals(secondSlotElement.getAssignedNodes(), [p, text, b],
+        'getAssignedNodes on the second unnamed slot element after removing the first must return the elements without slot attributes and text nodes');
 
     shadowRoot.removeChild(secondSlotElement);
     shadowRoot.appendChild(secondSlotElement);
-    assert_array_equals(firstSlotElement.getDistributedNodes(), [],
-        'Removing and re-inserting a default slot must not change the result of getDistributedNodes on a detached slot');
-    assert_array_equals(secondSlotElement.getDistributedNodes(), [p, text, b],
-        'Removing and re-inserting a default slot must not change the result of getDistributedNodes');
+    assert_array_equals(firstSlotElement.getAssignedNodes(), [],
+        'Removing and re-inserting a default slot must not change the result of getAssignedNodes on a detached slot');
+    assert_array_equals(secondSlotElement.getAssignedNodes(), [p, text, b],
+        'Removing and re-inserting a default slot must not change the result of getAssignedNodes');
 
     shadowRoot.insertBefore(firstSlotElement, secondSlotElement);
-    assert_array_equals(firstSlotElement.getDistributedNodes(), [p, text, b],
-        'getDistributedNodes on a newly inserted unnamed slot element must return the elements without slot attributes and text nodes');
-    assert_array_equals(secondSlotElement.getDistributedNodes(), [],
-        'getDistributedNodes on formerly-first but now second unnamed slot element must return an empty array');
+    assert_array_equals(firstSlotElement.getAssignedNodes(), [p, text, b],
+        'getAssignedNodes on a newly inserted unnamed slot element must return the elements without slot attributes and text nodes');
+    assert_array_equals(secondSlotElement.getAssignedNodes(), [],
+        'getAssignedNodes on formerly-first but now second unnamed slot element must return an empty array');
 
-}, 'getDistributedNodes must update when slot elements are inserted or removed');
+}, 'getAssignedNodes must update when slot elements are inserted or removed');
 
 </script>
 </body>

Modified: trunk/LayoutTests/fast/shadow-dom/NonDocumentTypeChildNode-interface-assignedSlot.html (195680 => 195681)


--- trunk/LayoutTests/fast/shadow-dom/NonDocumentTypeChildNode-interface-assignedSlot.html	2016-01-27 20:00:17 UTC (rev 195680)
+++ trunk/LayoutTests/fast/shadow-dom/NonDocumentTypeChildNode-interface-assignedSlot.html	2016-01-27 20:08:52 UTC (rev 195681)
@@ -58,28 +58,34 @@
     var childTextNode = document.createTextNode('');
     shadowHost.appendChild(childTextNode);
 
-    var commentNode = document.createTextNode('');
+    var commentNode = document.createComment('');
     shadowHost.appendChild(commentNode);
 
+    var processingInstructionNode = document.createProcessingInstruction('target', 'data');
+    shadowHost.appendChild(processingInstructionNode);
+
     var shadowRoot = shadowHost.attachShadow({mode: 'open'});
     var slot = document.createElement('slot');
     shadowRoot.appendChild(slot);
 
     assert_equals(childElement.assignedSlot, slot, 'assignedSlot on an element must return the assigned default slot element');
     assert_equals(childTextNode.assignedSlot, slot, 'assignedSlot on a text node must return the assigned default slot element');
-    assert_equals(commentNode.assignedSlot, slot, 'assignedSlot on a comment node must return the assigned default slot element');
+    assert_equals(commentNode.assignedSlot, null, 'assignedSlot on a comment node must always return null');
+    assert_equals(processingInstructionNode.assignedSlot, null, 'assignedSlot on a comment node must always return null');
 
     slot.name = 'foo';
     assert_equals(childElement.assignedSlot, null, 'assignedSlot on an element must null when the element is unassigned from a slot element');
     assert_equals(childTextNode.assignedSlot, null, 'assignedSlot on a text node must null when the node is unassigned from a slot element');
     assert_equals(commentNode.assignedSlot, null, 'assignedSlot on a text node must null when the node is unassigned from a slot element');
+    assert_equals(processingInstructionNode.assignedSlot, null, 'assignedSlot on a text node must null when the node is unassigned from a slot element');
 
     childElement.slot = 'foo';
     assert_equals(childElement.assignedSlot, slot, 'assignedSlot on an element must return the re-assigned slot element');
 
     slot.name = null;
     assert_equals(childTextNode.assignedSlot, slot, 'assignedSlot on a text node must return the re-assigned slot element');
-    assert_equals(commentNode.assignedSlot, slot, 'assignedSlot on a comment node must return the re-assigned slot element');
+    assert_equals(commentNode.assignedSlot, null, 'assignedSlot on a comment node must always return null');
+    assert_equals(processingInstructionNode.assignedSlot, null, 'assignedSlot on a comment node must always return null');
 
 }, 'assignedSlot must return the assigned slot');
 
@@ -94,13 +100,17 @@
     var commentNode = document.createTextNode('');
     shadowHost.appendChild(commentNode);
 
+    var processingInstructionNode = document.createProcessingInstruction('target', 'data');
+    shadowHost.appendChild(processingInstructionNode);
+
     var shadowRoot = shadowHost.attachShadow({mode: 'closed'});
     var slot = document.createElement('slot');
     shadowRoot.appendChild(slot);
 
-    assert_equals(childElement.assignedSlot, null, 'assignedSlot on an element must return the assigned slot element.');
-    assert_equals(childTextNode.assignedSlot, null, 'assignedSlot on a text node must return the assigned slot element.');
-    assert_equals(commentNode.assignedSlot, null, 'assignedSlot on a comment node must return the assigned slot element.');
+    assert_equals(childElement.assignedSlot, null, 'assignedSlot on an element must return null if the slot is inside a closed shadow tree.');
+    assert_equals(childTextNode.assignedSlot, null, 'assignedSlot on a text node must return null if the slot is inside a closed shadow tree.');
+    assert_equals(commentNode.assignedSlot, null, 'assignedSlot on a comment node must always return null.');
+    assert_equals(processingInstructionNode.assignedSlot, null, 'assignedSlot on a processing instruction must always return null.');
 
 }, 'assignedSlot must return null when the assigned slot element is inside a closed shadow tree');
 

Modified: trunk/Source/WebCore/ChangeLog (195680 => 195681)


--- trunk/Source/WebCore/ChangeLog	2016-01-27 20:00:17 UTC (rev 195680)
+++ trunk/Source/WebCore/ChangeLog	2016-01-27 20:08:52 UTC (rev 195681)
@@ -1,3 +1,14 @@
+2016-01-26  Ryosuke Niwa  <rn...@webkit.org>
+
+        Rename HTMLSlotElement.getDistributedNodes to getAssignedNodes
+        https://bugs.webkit.org/show_bug.cgi?id=153534
+
+        Reviewed by Antti Koivisto.
+
+        Did the rename.
+
+        * html/HTMLSlotElement.idl:
+
 2016-01-27  Tim Horton  <timothy_hor...@apple.com>
 
         Need to be able to specify MIME type for <attachment> without filename or handle

Modified: trunk/Source/WebCore/html/HTMLSlotElement.idl (195680 => 195681)


--- trunk/Source/WebCore/html/HTMLSlotElement.idl	2016-01-27 20:00:17 UTC (rev 195680)
+++ trunk/Source/WebCore/html/HTMLSlotElement.idl	2016-01-27 20:08:52 UTC (rev 195681)
@@ -30,6 +30,6 @@
 ] interface HTMLSlotElement : HTMLElement {
 
     [Reflect] attribute DOMString name;
-    [ImplementedAs=assignedNodes] sequence<Node> getDistributedNodes();
+    [ImplementedAs=assignedNodes] sequence<Node> getAssignedNodes();
 
 };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to