mirror of
https://github.com/servo/servo.git
synced 2025-08-10 07:55:33 +01:00
Implement shadow dom slots (#35013)
* Implement slot-related algorithms Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Hook up slot elements to DOM creation logic Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Set a slot assignment mode for servo-internal shadow roots Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Assign slots when a slottable's slot attribute changes Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Properly compute slot name Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * ./mach test-tidy Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Update <slot> name when name attribute changes Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Implement fast path for Node::assign_slottables_for_a_tree assign_slottables_for_a_tree traverses all descendants of the node and is potentially very expensive. If the node is not a shadow root then assigning slottables to it won't have any effect, so we take a fast path out. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Move slottable data into ElementRareData This shrinks all element descendants back to their original size. Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Address review comments Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> * Update WPT expectations Signed-off-by: Simon Wülker <simon.wuelker@arcor.de> --------- Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>
This commit is contained in:
parent
8bb50fa3c9
commit
dabe162d44
31 changed files with 758 additions and 355 deletions
|
@ -35,5 +35,5 @@ sizeof_checker!(size_element, Element, 376);
|
|||
sizeof_checker!(size_htmlelement, HTMLElement, 392);
|
||||
sizeof_checker!(size_div, HTMLDivElement, 392);
|
||||
sizeof_checker!(size_span, HTMLSpanElement, 392);
|
||||
sizeof_checker!(size_text, Text, 232);
|
||||
sizeof_checker!(size_text, Text, 256);
|
||||
sizeof_checker!(size_characterdata, CharacterData, 232);
|
||||
|
|
|
@ -328,3 +328,6 @@
|
|||
|
||||
[dialog: Operator 'new' should instantiate a customized built-in element]
|
||||
expected: FAIL
|
||||
|
||||
[slot: Define a customized built-in element]
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,2 +1,6 @@
|
|||
[HTMLSlotElement.html]
|
||||
expected: ERROR
|
||||
[name on HTMLSlotElement must enqueue an attributeChanged reaction when adding name content attribute]
|
||||
expected: FAIL
|
||||
|
||||
[name on HTMLSlotElement must enqueue an attributeChanged reaction when replacing an existing attribute]
|
||||
expected: FAIL
|
||||
|
|
15
tests/wpt/meta/dom/idlharness.window.js.ini
vendored
15
tests/wpt/meta/dom/idlharness.window.js.ini
vendored
|
@ -8,18 +8,9 @@
|
|||
[AbortSignal must be primary interface of new AbortController().signal]
|
||||
expected: FAIL
|
||||
|
||||
[Element interface: element must inherit property "assignedSlot" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[Text interface: document.createTextNode("abc") must inherit property "assignedSlot" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[Event interface: attribute composed]
|
||||
expected: FAIL
|
||||
|
||||
[Text interface: attribute assignedSlot]
|
||||
expected: FAIL
|
||||
|
||||
[AbortSignal interface: existence and properties of interface prototype object's @@unscopables property]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -65,9 +56,6 @@
|
|||
[Element interface: operation after((Node or DOMString)...)]
|
||||
expected: FAIL
|
||||
|
||||
[Element interface: attribute assignedSlot]
|
||||
expected: FAIL
|
||||
|
||||
[CharacterData interface: existence and properties of interface prototype object's @@unscopables property]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -197,9 +185,6 @@
|
|||
[ShadowRoot interface: attribute delegatesFocus]
|
||||
expected: FAIL
|
||||
|
||||
[ShadowRoot interface: attribute slotAssignment]
|
||||
expected: FAIL
|
||||
|
||||
[XSLTProcessor interface: existence and properties of interface object]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -13,6 +13,3 @@
|
|||
|
||||
[param element's name property reflects its content attribute]
|
||||
expected: FAIL
|
||||
|
||||
[slot element's name property reflects its content attribute]
|
||||
expected: FAIL
|
||||
|
|
|
@ -7858,63 +7858,6 @@
|
|||
[HTMLTemplateElement interface: document.createElement("template") must inherit property "shadowRootSerializable" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLSlotElement interface: existence and properties of interface object]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLSlotElement interface object length]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLSlotElement interface object name]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLSlotElement interface: existence and properties of interface prototype object]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLSlotElement interface: existence and properties of interface prototype object's "constructor" property]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLSlotElement interface: existence and properties of interface prototype object's @@unscopables property]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLSlotElement interface: attribute name]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLSlotElement interface: operation assignedNodes(optional AssignedNodesOptions)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLSlotElement interface: operation assignedElements(optional AssignedNodesOptions)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLSlotElement interface: operation assign((Element or Text)...)]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLSlotElement must be primary interface of document.createElement("slot")]
|
||||
expected: FAIL
|
||||
|
||||
[Stringification of document.createElement("slot")]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLSlotElement interface: document.createElement("slot") must inherit property "name" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLSlotElement interface: document.createElement("slot") must inherit property "assignedNodes(optional AssignedNodesOptions)" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLSlotElement interface: calling assignedNodes(optional AssignedNodesOptions) on document.createElement("slot") with too few arguments must throw TypeError]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLSlotElement interface: document.createElement("slot") must inherit property "assignedElements(optional AssignedNodesOptions)" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLSlotElement interface: calling assignedElements(optional AssignedNodesOptions) on document.createElement("slot") with too few arguments must throw TypeError]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLSlotElement interface: document.createElement("slot") must inherit property "assign((Element or Text)...)" with the proper type]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLSlotElement interface: calling assign((Element or Text)...) on document.createElement("slot") with too few arguments must throw TypeError]
|
||||
expected: FAIL
|
||||
|
||||
[HTMLMarqueeElement interface: existence and properties of interface object]
|
||||
expected: FAIL
|
||||
|
||||
|
|
114
tests/wpt/meta/html/dom/reflection-misc.html.ini
vendored
114
tests/wpt/meta/html/dom/reflection-misc.html.ini
vendored
|
@ -1073,120 +1073,6 @@
|
|||
[slot.tabIndex: IDL set to -2147483648]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: typeof IDL attribute]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: IDL get with DOM attribute unset]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: setAttribute() to ""]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: setAttribute() to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo "]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: setAttribute() to undefined]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: setAttribute() to 7]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: setAttribute() to 1.5]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: setAttribute() to "5%"]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: setAttribute() to "+100"]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: setAttribute() to ".5"]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: setAttribute() to true]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: setAttribute() to false]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: setAttribute() to object "[object Object\]"]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: setAttribute() to NaN]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: setAttribute() to Infinity]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: setAttribute() to -Infinity]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: setAttribute() to "\\0"]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: setAttribute() to null]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: setAttribute() to object "test-toString"]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: setAttribute() to object "test-valueOf"]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: IDL set to ""]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: IDL set to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo "]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: IDL set to undefined]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: IDL set to 7]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: IDL set to 1.5]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: IDL set to "5%"]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: IDL set to "+100"]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: IDL set to ".5"]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: IDL set to true]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: IDL set to false]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: IDL set to object "[object Object\]"]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: IDL set to NaN]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: IDL set to Infinity]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: IDL set to -Infinity]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: IDL set to "\\0"]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: IDL set to null]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: IDL set to object "test-toString"]
|
||||
expected: FAIL
|
||||
|
||||
[slot.name: IDL set to object "test-valueOf"]
|
||||
expected: FAIL
|
||||
|
||||
[ins.accessKey: typeof IDL attribute]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -53,15 +53,6 @@
|
|||
[Interfaces for RTC: createElement]
|
||||
expected: FAIL
|
||||
|
||||
[Interfaces for slot: useNS]
|
||||
expected: FAIL
|
||||
|
||||
[Interfaces for slot: useParser]
|
||||
expected: FAIL
|
||||
|
||||
[Interfaces for SLOT: createElement]
|
||||
expected: FAIL
|
||||
|
||||
[Interfaces for permission: useNS]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,19 +1,4 @@
|
|||
[HTMLSlotElement-interface.html]
|
||||
[HTMLSlotElement must be defined on window]
|
||||
expected: FAIL
|
||||
|
||||
["name" attribute on HTMLSlotElement must reflect "name" attribute]
|
||||
expected: FAIL
|
||||
|
||||
[assignedNodes() on a HTMLSlotElement must return an empty array when the slot element is not in a tree or in a document tree]
|
||||
expected: FAIL
|
||||
|
||||
[assignedNodes({"flattened":false}) on a HTMLSlotElement must return an empty array when the slot element is not in a tree or in a document tree]
|
||||
expected: FAIL
|
||||
|
||||
[assignedNodes({"flattened":true}) on a HTMLSlotElement must return an empty array when the slot element is not in a tree or in a document tree]
|
||||
expected: FAIL
|
||||
|
||||
[assignedNodes() must return the list of assigned nodes when none of the assigned nodes themselves are slots]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -32,15 +17,6 @@
|
|||
[assignedNodes({"flattened":true}) must update when slot and name attributes are modified]
|
||||
expected: FAIL
|
||||
|
||||
[assignedNodes() must update when a default slot is introduced dynamically by a slot rename]
|
||||
expected: FAIL
|
||||
|
||||
[assignedNodes({"flattened":false}) must update when a default slot is introduced dynamically by a slot rename]
|
||||
expected: FAIL
|
||||
|
||||
[assignedNodes({"flattened":true}) must update when a default slot is introduced dynamically by a slot rename]
|
||||
expected: FAIL
|
||||
|
||||
[assignedNodes() must update when slot elements are inserted or removed]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,12 +1,3 @@
|
|||
[Slottable-mixin.html]
|
||||
[assignedSlot attribute must be defined on Element and Text interfaces]
|
||||
expected: FAIL
|
||||
|
||||
[assignedSlot must return null when the node does not have an assigned node]
|
||||
expected: FAIL
|
||||
|
||||
[assignedSlot must return the assigned slot]
|
||||
expected: FAIL
|
||||
|
||||
[assignedSlot must return null when the assigned slot element is inside a closed shadow tree]
|
||||
expected: FAIL
|
||||
|
|
|
@ -1,33 +1,31 @@
|
|||
[imperative-slot-api-slotchange.html]
|
||||
expected: TIMEOUT
|
||||
[slotchange event must not fire synchronously.]
|
||||
expected: FAIL
|
||||
|
||||
[slotchange event should not fire when assignments do not change assignedNodes.]
|
||||
expected: FAIL
|
||||
expected: TIMEOUT
|
||||
|
||||
[slotchange event should not fire when same node is assigned.]
|
||||
expected: FAIL
|
||||
expected: TIMEOUT
|
||||
|
||||
[Fire slotchange event when slot's assigned nodes changes.]
|
||||
expected: FAIL
|
||||
expected: TIMEOUT
|
||||
|
||||
[Fire slotchange event on previous slot and new slot when node is reassigned.]
|
||||
expected: FAIL
|
||||
expected: TIMEOUT
|
||||
|
||||
[Fire slotchange event on node assignment and when assigned node is removed.]
|
||||
expected: FAIL
|
||||
expected: TIMEOUT
|
||||
|
||||
[Fire slotchange event when order of assigned nodes changes.]
|
||||
expected: FAIL
|
||||
expected: TIMEOUT
|
||||
|
||||
[Fire slotchange event when assigned node is removed.]
|
||||
expected: FAIL
|
||||
expected: TIMEOUT
|
||||
|
||||
[Fire slotchange event when removing a slot from Shadows Root that changes its assigned nodes.]
|
||||
expected: FAIL
|
||||
expected: NOTRUN
|
||||
|
||||
[Fire slotchange event when assign node to nested slot, ensure event bubbles ups.]
|
||||
expected: FAIL
|
||||
expected: TIMEOUT
|
||||
|
||||
[Signal a slot change should be done in tree order.]
|
||||
expected: FAIL
|
||||
expected: NOTRUN
|
||||
|
|
|
@ -1,22 +1,4 @@
|
|||
[imperative-slot-api.html]
|
||||
[attachShadow can take slotAssignment parameter.]
|
||||
expected: FAIL
|
||||
|
||||
[slot.attach() should take variadic not sequence.]
|
||||
expected: FAIL
|
||||
|
||||
[Imperative slot API can assign nodes in manual slot assignment.]
|
||||
expected: FAIL
|
||||
|
||||
[Order of slottables is preserved in manual slot assignment.]
|
||||
expected: FAIL
|
||||
|
||||
[Previously assigned slottable is moved to new slot when it's reassigned.]
|
||||
expected: FAIL
|
||||
|
||||
[Order and assignment of nodes are preserved during multiple assignment in a row.]
|
||||
expected: FAIL
|
||||
|
||||
[Assigning invalid nodes should be allowed.]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -29,15 +11,6 @@
|
|||
[Appending slottable to different host, it loses slot assignment. It can be re-assigned within a new host.]
|
||||
expected: FAIL
|
||||
|
||||
[Previously assigned node should not be assigned if slot moved to a new shadow root. The node is re-assigned when moved back.]
|
||||
expected: FAIL
|
||||
|
||||
[Assignment with the same node in parameters should be ignored, first one wins.]
|
||||
expected: FAIL
|
||||
|
||||
[Removing a slot from DOM resets its slottable's slot assignment.]
|
||||
expected: FAIL
|
||||
|
||||
[Nodes can be assigned even if slots or nodes aren't in the same tree.]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
[imperative-slot-initial-fallback.html]
|
||||
[Unassigned imperative slot can render text node as the initial fallback]
|
||||
expected: FAIL
|
||||
|
||||
[Unassigned imperative slot can render element as the initial fallback]
|
||||
expected: FAIL
|
|
@ -1,22 +1,4 @@
|
|||
[slots-fallback.html]
|
||||
[Slots fallback: Basic.]
|
||||
expected: FAIL
|
||||
|
||||
[Slots fallback: Basic, elements only.]
|
||||
expected: FAIL
|
||||
|
||||
[Slots fallback: Slots in Slots.]
|
||||
expected: FAIL
|
||||
|
||||
[Slots fallback: Slots in Slots, elements only.]
|
||||
expected: FAIL
|
||||
|
||||
[Slots fallback: Fallback contents should not be used if a node is assigned.]
|
||||
expected: FAIL
|
||||
|
||||
[Slots fallback: Slots in Slots: Assigned nodes should be used as fallback contents of another slot]
|
||||
expected: FAIL
|
||||
|
||||
[Slots fallback: Complex case.]
|
||||
expected: FAIL
|
||||
|
||||
|
|
|
@ -1,3 +0,0 @@
|
|||
[slots-outside-shadow-dom.html]
|
||||
[Light DOM slot element should be in flattened assignedNodes]
|
||||
expected: FAIL
|
42
tests/wpt/meta/shadow-dom/slots.html.ini
vendored
42
tests/wpt/meta/shadow-dom/slots.html.ini
vendored
|
@ -1,37 +1,4 @@
|
|||
[slots.html]
|
||||
[Slots: Basic.]
|
||||
expected: FAIL
|
||||
|
||||
[Slots: Basic, elements only.]
|
||||
expected: FAIL
|
||||
|
||||
[Slots: Slots in closed.]
|
||||
expected: FAIL
|
||||
|
||||
[Slots: Slots in closed, elements only.]
|
||||
expected: FAIL
|
||||
|
||||
[Slots: Slots not in a shadow tree.]
|
||||
expected: FAIL
|
||||
|
||||
[Slots: Slots not in a shadow tree, elements only.]
|
||||
expected: FAIL
|
||||
|
||||
[Slots: Distributed nodes for Slots not in a shadow tree.]
|
||||
expected: FAIL
|
||||
|
||||
[Slots: Name matching]
|
||||
expected: FAIL
|
||||
|
||||
[Slots: No direct host child.]
|
||||
expected: FAIL
|
||||
|
||||
[Slots: Default Slot.]
|
||||
expected: FAIL
|
||||
|
||||
[Slots: Slot in Slot does not matter in assignment.]
|
||||
expected: FAIL
|
||||
|
||||
[Slots: Slot is assigned to another slot]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -50,21 +17,12 @@
|
|||
[Slots: Mutation: appendChild.]
|
||||
expected: FAIL
|
||||
|
||||
[Slots: Mutation: Change slot= attribute 1.]
|
||||
expected: FAIL
|
||||
|
||||
[Slots: Mutation: Change slot= attribute 2.]
|
||||
expected: FAIL
|
||||
|
||||
[Slots: Mutation: Change slot= attribute 3.]
|
||||
expected: FAIL
|
||||
|
||||
[Slots: Mutation: Remove a child.]
|
||||
expected: FAIL
|
||||
|
||||
[Slots: Mutation: Add a slot: after.]
|
||||
expected: FAIL
|
||||
|
||||
[Slots: Mutation: Add a slot: before.]
|
||||
expected: FAIL
|
||||
|
||||
|
|
2
tests/wpt/mozilla/meta/MANIFEST.json
vendored
2
tests/wpt/mozilla/meta/MANIFEST.json
vendored
|
@ -13499,7 +13499,7 @@
|
|||
]
|
||||
],
|
||||
"interfaces.https.html": [
|
||||
"71d2291cb162143e4abf298f0a23e6a06fe5c1bc",
|
||||
"501caf7410bba6533e11c0d83acb2729da48a289",
|
||||
[
|
||||
null,
|
||||
{}
|
||||
|
|
|
@ -160,6 +160,7 @@ test_interfaces([
|
|||
"HTMLQuoteElement",
|
||||
"HTMLScriptElement",
|
||||
"HTMLSelectElement",
|
||||
"HTMLSlotElement",
|
||||
"HTMLSourceElement",
|
||||
"HTMLSpanElement",
|
||||
"HTMLStyleElement",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue