Changeset 206534 in webkit
- Timestamp:
- Sep 28, 2016 12:37:14 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r206463 r206534 1 2016-09-28 Ryosuke Niwa <rniwa@webkit.org> 2 3 assignedNodes should include fallback contents when flattened option is set 4 https://bugs.webkit.org/show_bug.cgi?id=162656 5 6 Reviewed by Antti Koivisto. 7 8 Rebaselined the tests now that all the test cases are passing. 9 10 * web-platform-tests/shadow-dom/slots-expected.txt: 11 * web-platform-tests/shadow-dom/slots-fallback-expected.txt: 12 1 13 2016-09-27 Ryosuke Niwa <rniwa@webkit.org> 2 14 -
trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/slots-expected.txt
r206463 r206534 3 3 PASS Slots: Slots in closed. 4 4 PASS Slots: Slots not in a shadow tree. 5 FAIL Slots: Distributed nooes for Slots not in a shadow tree. assert_array_equals: lengths differ, expected 1 got 0 5 PASS Slots: Distributed nooes for Slots not in a shadow tree. 6 6 PASS Slots: Name matching 7 7 PASS Slots: No direct host child. -
trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/slots-fallback-expected.txt
r206463 r206534 1 1 2 FAIL Slots fallback: Basic. assert_array_equals: lengths differ, expected 1 got 0 3 FAIL Slots fallback: Slots in Slots. assert_array_equals: lengths differ, expected 1 got 0 4 FAIL Slots fallback: Fallback contents should not be used if a node is assigned. assert_array_equals: lengths differ, expected 1 got 0 5 FAIL Slots fallback: Slots in Slots: Assinged nodes should be used as fallback contents of another slot assert_array_equals: lengths differ, expected 1 got 0 6 FAIL Slots fallback: Complex case. assert_array_equals: lengths differ, expected 2 got 0 7 FAIL Slots fallback: Mutation. Append fallback contents. assert_array_equals: lengths differ, expected 3 got 0 8 FAIL Slots fallback: Mutation. Remove fallback contents. assert_array_equals: lengths differ, expected 1 got 0 9 FAIL Slots fallback: Mutation. Assign a node to a slot so that fallback contens are no longer used. assert_array_equals: lengths differ, expected 2 got 0 10 FAIL Slots fallback: Mutation. Remove an assigned node from a slot so that fallback contens will be used. assert_array_equals: lengths differ, expected 1 got 0 11 FAIL Slots fallback: Mutation. Remove a slot which is a fallback content of another slot. assert_array_equals: lengths differ, expected 1 got 0 2 PASS Slots fallback: Basic. 3 PASS Slots fallback: Slots in Slots. 4 PASS Slots fallback: Fallback contents should not be used if a node is assigned. 5 PASS Slots fallback: Slots in Slots: Assinged nodes should be used as fallback contents of another slot 6 PASS Slots fallback: Complex case. 7 PASS Slots fallback: Mutation. Append fallback contents. 8 PASS Slots fallback: Mutation. Remove fallback contents. 9 PASS Slots fallback: Mutation. Assign a node to a slot so that fallback contens are no longer used. 10 PASS Slots fallback: Mutation. Remove an assigned node from a slot so that fallback contens will be used. 11 PASS Slots fallback: Mutation. Remove a slot which is a fallback content of another slot. 12 12 -
trunk/Source/WebCore/ChangeLog
r206527 r206534 1 2016-09-28 Ryosuke Niwa <rniwa@webkit.org> 2 3 assignedNodes should include fallback contents when flattened option is set 4 https://bugs.webkit.org/show_bug.cgi?id=162656 5 6 Reviewed by Antti Koivisto. 7 8 Fixed the bug by traversing through fallback contents when there are no assigned nodes. 9 10 Tests: imported/w3c/web-platform-tests/shadow-dom/slots.html 11 imported/w3c/web-platform-tests/shadow-dom/slots-fallback.html 12 13 * html/HTMLSlotElement.cpp: 14 (WebCore::flattenAssignedNodes): 15 (WebCore::HTMLSlotElement::assignedNodes): 16 1 17 2016-09-27 Wenson Hsieh <wenson_hsieh@apple.com> 2 18 -
trunk/Source/WebCore/html/HTMLSlotElement.cpp
r203324 r206534 27 27 #include "HTMLSlotElement.h" 28 28 29 30 29 #include "Event.h" 31 30 #include "EventNames.h" … … 33 32 #include "MutationObserver.h" 34 33 #include "ShadowRoot.h" 34 #include "Text.h" 35 35 36 36 namespace WebCore { … … 99 99 } 100 100 101 static void flattenAssignedNodes(Vector<Node*>& nodes, const Vector<Node*>& assignedNodes)101 static void flattenAssignedNodes(Vector<Node*>& nodes, const HTMLSlotElement& slot) 102 102 { 103 for (Node* node : assignedNodes) { 104 if (is<HTMLSlotElement>(*node)) { 105 if (auto* innerAssignedNodes = downcast<HTMLSlotElement>(*node).assignedNodes()) 106 flattenAssignedNodes(nodes, *innerAssignedNodes); 107 continue; 103 auto* assignedNodes = slot.assignedNodes(); 104 if (!assignedNodes) { 105 for (Node* child = slot.firstChild(); child; child = child->nextSibling()) { 106 if (is<HTMLSlotElement>(*child)) 107 flattenAssignedNodes(nodes, downcast<HTMLSlotElement>(*child)); 108 else if (is<Text>(*child) || is<Element>(*child)) 109 nodes.append(child); 108 110 } 109 nodes.append(node); 111 return; 112 } 113 for (Node* node : *assignedNodes) { 114 if (is<HTMLSlotElement>(*node)) 115 flattenAssignedNodes(nodes, downcast<HTMLSlotElement>(*node)); 116 else 117 nodes.append(node); 110 118 } 111 119 } … … 113 121 Vector<Node*> HTMLSlotElement::assignedNodes(const AssignedNodesOptions& options) const 114 122 { 123 if (options.flatten) { 124 Vector<Node*> nodes; 125 flattenAssignedNodes(nodes, *this); 126 return nodes; 127 } 115 128 auto* assignedNodes = this->assignedNodes(); 116 129 if (!assignedNodes) 117 130 return { }; 118 119 if (!options.flatten) 120 return *assignedNodes; 121 122 Vector<Node*> nodes; 123 flattenAssignedNodes(nodes, *assignedNodes); 124 return nodes; 131 return *assignedNodes; 125 132 } 126 133
Note: See TracChangeset
for help on using the changeset viewer.