WebKit Bugzilla
Attachment 348485 Details for
Bug 189146
: Add assignedElements to HTMLSlotElement
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Adds the method
bug-189146-20180829224333.patch (text/plain), 7.44 KB, created by
Ryosuke Niwa
on 2018-08-29 22:43:33 PDT
(
hide
)
Description:
Adds the method
Filename:
MIME Type:
Creator:
Ryosuke Niwa
Created:
2018-08-29 22:43:33 PDT
Size:
7.44 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 235483) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,27 @@ >+2018-08-29 Ryosuke Niwa <rniwa@webkit.org> >+ >+ Add assignedElements to HTMLSlotElement >+ https://bugs.webkit.org/show_bug.cgi?id=189146 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Added assignedElements to HTMLSlotElement. For now, we simply filter the results returned by assignedNodes. >+ >+ Also fixed a bug that assignedNodes was returning the fallback content when the slot is not in a shadow tree, >+ which is specified in step 2 of the concept to find flattened slotables for a slot. >+ >+ Spec: https://html.spec.whatwg.org/multipage/scripting.html#dom-slot-assignedelements >+ https://dom.spec.whatwg.org/#find-flattened-slotables >+ >+ Tests: imported/w3c/web-platform-tests/shadow-dom/slots.html >+ imported/w3c/web-platform-tests/shadow-dom/slots-fallback.html >+ >+ * html/HTMLSlotElement.cpp: >+ (WebCore::HTMLSlotElement::assignedNodes const): >+ (WebCore::HTMLSlotElement::assignedElements const): >+ * html/HTMLSlotElement.h: >+ * html/HTMLSlotElement.idl: >+ > 2018-08-29 Ryosuke Niwa <rniwa@webkit.org> > > Modernize SlotAssignment >Index: Source/WebCore/html/HTMLSlotElement.cpp >=================================================================== >--- Source/WebCore/html/HTMLSlotElement.cpp (revision 235481) >+++ Source/WebCore/html/HTMLSlotElement.cpp (working copy) >@@ -129,6 +129,8 @@ static void flattenAssignedNodes(Vector< > Vector<Node*> HTMLSlotElement::assignedNodes(const AssignedNodesOptions& options) const > { > if (options.flatten) { >+ if (!isInShadowTree()) >+ return { }; > Vector<Node*> nodes; > flattenAssignedNodes(nodes, *this); > return nodes; >@@ -139,6 +141,20 @@ Vector<Node*> HTMLSlotElement::assignedN > return *assignedNodes; > } > >+Vector<Ref<Element>> HTMLSlotElement::assignedElements(const AssignedNodesOptions& options) const >+{ >+ auto nodes = assignedNodes(options); >+ >+ Vector<Ref<Element>> elements; >+ elements.reserveCapacity(nodes.size()); >+ for (auto* node : nodes) { >+ if (is<Element>(*node)) >+ elements.uncheckedAppend(downcast<Element>(*node)); >+ } >+ >+ return elements; >+} >+ > void HTMLSlotElement::enqueueSlotChangeEvent() > { > // https://dom.spec.whatwg.org/#signal-a-slot-change >Index: Source/WebCore/html/HTMLSlotElement.h >=================================================================== >--- Source/WebCore/html/HTMLSlotElement.h (revision 235483) >+++ Source/WebCore/html/HTMLSlotElement.h (working copy) >@@ -40,6 +40,7 @@ public: > bool flatten; > }; > Vector<Node*> assignedNodes(const AssignedNodesOptions&) const; >+ Vector<Ref<Element>> assignedElements(const AssignedNodesOptions&) const; > > void enqueueSlotChangeEvent(); > void didRemoveFromSignalSlotList() { m_inSignalSlotList = false; } >Index: Source/WebCore/html/HTMLSlotElement.idl >=================================================================== >--- Source/WebCore/html/HTMLSlotElement.idl (revision 235481) >+++ Source/WebCore/html/HTMLSlotElement.idl (working copy) >@@ -29,6 +29,7 @@ > ] interface HTMLSlotElement : HTMLElement { > [Reflect] attribute DOMString name; > sequence<Node> assignedNodes(optional AssignedNodesOptions options); >+ sequence<Element> assignedElements(optional AssignedNodesOptions options); > }; > > dictionary AssignedNodesOptions { >Index: LayoutTests/imported/w3c/ChangeLog >=================================================================== >--- LayoutTests/imported/w3c/ChangeLog (revision 235496) >+++ LayoutTests/imported/w3c/ChangeLog (working copy) >@@ -1,3 +1,15 @@ >+2018-08-29 Ryosuke Niwa <rniwa@webkit.org> >+ >+ Add assignedElements to HTMLSlotElement >+ https://bugs.webkit.org/show_bug.cgi?id=189146 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Rebaselined the tests now that we're passing all test cases. >+ >+ * web-platform-tests/shadow-dom/slots-expected.txt: >+ * web-platform-tests/shadow-dom/slots-fallback-expected.txt: >+ > 2018-08-29 Olivia Barnett <obarnett@apple.com> > > Implement the Web Share API >Index: LayoutTests/imported/w3c/web-platform-tests/shadow-dom/slots-expected.txt >=================================================================== >--- LayoutTests/imported/w3c/web-platform-tests/shadow-dom/slots-expected.txt (revision 235481) >+++ LayoutTests/imported/w3c/web-platform-tests/shadow-dom/slots-expected.txt (working copy) >@@ -1,11 +1,11 @@ > > PASS Slots: Basic. >-FAIL Slots: Basic, elements only. n.s1.assignedElements is not a function. (In 'n.s1.assignedElements()', 'n.s1.assignedElements' is undefined) >+PASS Slots: Basic, elements only. > PASS Slots: Slots in closed. >-FAIL Slots: Slots in closed, elements only. n.s1.assignedElements is not a function. (In 'n.s1.assignedElements()', 'n.s1.assignedElements' is undefined) >+PASS Slots: Slots in closed, elements only. > PASS Slots: Slots not in a shadow tree. >-FAIL Slots: Slots not in a shadow tree, elements only. n.s1.assignedElements is not a function. (In 'n.s1.assignedElements()', 'n.s1.assignedElements' is undefined) >-FAIL Slots: Distributed nodes for Slots not in a shadow tree. assert_array_equals: lengths differ, expected 0 got 1 >+PASS Slots: Slots not in a shadow tree, elements only. >+PASS Slots: Distributed nodes for Slots not in a shadow tree. > PASS Slots: Name matching > PASS Slots: No direct host child. > PASS Slots: Default Slot. >Index: LayoutTests/imported/w3c/web-platform-tests/shadow-dom/slots-fallback-expected.txt >=================================================================== >--- LayoutTests/imported/w3c/web-platform-tests/shadow-dom/slots-fallback-expected.txt (revision 235481) >+++ LayoutTests/imported/w3c/web-platform-tests/shadow-dom/slots-fallback-expected.txt (working copy) >@@ -1,15 +1,15 @@ > > PASS Slots fallback: Basic. >-FAIL Slots fallback: Basic, elements only. n.s1.assignedElements is not a function. (In 'n.s1.assignedElements()', 'n.s1.assignedElements' is undefined) >+PASS Slots fallback: Basic, elements only. > PASS Slots fallback: Slots in Slots. >-FAIL Slots fallback: Slots in Slots, elements only. n.s1.assignedElements is not a function. (In 'n.s1.assignedElements()', 'n.s1.assignedElements' is undefined) >+PASS Slots fallback: Slots in Slots, elements only. > PASS Slots fallback: Fallback contents should not be used if a node is assigned. > PASS Slots fallback: Slots in Slots: Assigned nodes should be used as fallback contents of another slot > PASS Slots fallback: Complex case. >-FAIL Slots fallback: Complex case, elements only. n.s1.assignedElements is not a function. (In 'n.s1.assignedElements()', 'n.s1.assignedElements' is undefined) >+PASS Slots fallback: Complex case, elements only. > PASS Slots fallback: Mutation. Append fallback contents. > PASS Slots fallback: Mutation. Remove fallback contents. > PASS Slots fallback: Mutation. Assign a node to a slot so that fallback contens are no longer used. > PASS Slots fallback: Mutation. Remove an assigned node from a slot so that fallback contens will be used. >-FAIL Slots fallback: Mutation. Remove a slot which is a fallback content of another slot. assert_array_equals: fall back contents should be empty because s1 is not in a shadow tree. lengths differ, expected 0 got 1 >+PASS Slots fallback: Mutation. Remove a slot which is a fallback content of another slot. >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
darin
:
review+
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 189146
: 348485