Fire slot change events when the slot content changes (#35137)

* Add the onslotchange attribute to ShadowRoot

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Add spec comments to MutationObserver::queue_mutation_observer_microtask

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Add DomRefCell::take

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Add spec comments to notify_mutation_observers

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Fire slotchange events when a slot changes

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* ./mach fmt

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Fix check for when to dispatch slot events

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Potentially fire slot change events in Node::remove

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Update WPT expectations

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* ./mach fmt

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Bump stylo

Signed-off-by: Simon Wülker <simon.wuelker@arcor.de>

* Move "signal a slot change" into ScriptThread impl

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:
Simon Wülker 2025-01-27 15:13:22 +01:00 committed by GitHub
parent cd93841ba1
commit 859cc6ab9b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
17 changed files with 152 additions and 119 deletions

View file

@ -62,9 +62,6 @@
[AbortController interface: new AbortController() must inherit property "signal" with the proper type]
expected: FAIL
[ShadowRoot interface: attribute onslotchange]
expected: FAIL
[AbortController interface: new AbortController() must inherit property "abort()" with the proper type]
expected: FAIL

View file

@ -1,28 +1,7 @@
[imperative-slot-api-slotchange.html]
expected: TIMEOUT
[slotchange event must not fire synchronously.]
expected: TIMEOUT
[slotchange event should not fire when same node is assigned.]
expected: TIMEOUT
[Fire slotchange event when slot's assigned nodes changes.]
expected: TIMEOUT
[Fire slotchange event on previous slot and new slot when node is reassigned.]
expected: TIMEOUT
[Fire slotchange event on node assignment and when assigned node is removed.]
expected: TIMEOUT
[Fire slotchange event when order of assigned nodes changes.]
expected: TIMEOUT
[Fire slotchange event when assigned node is removed.]
expected: TIMEOUT
[Fire slotchange event when removing a slot from Shadows Root that changes its assigned nodes.]
expected: NOTRUN
expected: TIMEOUT
[Fire slotchange event when assign node to nested slot, ensure event bubbles ups.]
expected: TIMEOUT

View file

@ -8,9 +8,6 @@
[Moving a slot's tree order position within a shadow host has no impact on its assigned slottables.]
expected: FAIL
[Appending slottable to different host, it loses slot assignment. It can be re-assigned within a new host.]
expected: FAIL
[Nodes can be assigned even if slots or nodes aren't in the same tree.]
expected: FAIL

View file

@ -35,18 +35,6 @@
[slotchange event must not fire on a slot element inside a closed shadow root not in a document when another slot's assigned nodes change]
expected: FAIL
[slotchange event must fire on a slot element when a shadow host has a slottable and the slot was inserted and must not fire when the shadow host was mutated after the slot was removed inside an open shadow root in a document]
expected: FAIL
[slotchange event must fire on a slot element when a shadow host has a slottable and the slot was inserted and must not fire when the shadow host was mutated after the slot was removed inside a closed shadow root in a document]
expected: FAIL
[slotchange event must fire on a slot element when a shadow host has a slottable and the slot was inserted and must not fire when the shadow host was mutated after the slot was removed inside an open shadow root not in a document]
expected: FAIL
[slotchange event must fire on a slot element when a shadow host has a slottable and the slot was inserted and must not fire when the shadow host was mutated after the slot was removed inside a closed shadow root not in a document]
expected: FAIL
[slotchange event must fire on a slot element inside an open shadow root in a document even if the slot was removed immediately after the assigned nodes were mutated]
expected: FAIL

View file

@ -3,47 +3,8 @@
[slotchange event: Append a child to a host.]
expected: TIMEOUT
[slotchange event: Remove a child from a host.]
expected: TIMEOUT
[slotchange event: Remove a child before adding an event listener.]
expected: TIMEOUT
[slotchange event: Change slot= attribute to make it un-assigned.]
expected: TIMEOUT
[slotchange event: Change slot's name= attribute so that none is assigned.]
expected: TIMEOUT
[slotchange event: Change slot= attribute to make it assigned.]
expected: TIMEOUT
[slotchange event: Change slot's name= attribute so that a node is assigned to the slot.]
expected: TIMEOUT
[slotchange event: Change fallback content - assignedNodes still empty.]
expected: TIMEOUT
[slotchange event: Remove a fallback content - assignedNodes still empty.]
expected: TIMEOUT
[slotchange event: Add a fallback content to nested slots - assignedNodes still empty.]
expected: TIMEOUT
[slotchange event: Remove a fallback content from nested slots - assignedNodes still empty.]
expected: TIMEOUT
[slotchange event: Insert a slot before an existing slot.]
expected: TIMEOUT
[slotchange event: Remove a preceding slot.]
expected: TIMEOUT
[slotchange event: A slot is assigned to another slot.]
expected: TIMEOUT
[slotchange event: Slotchange should be fired if assigned nodes are changed.]
expected: TIMEOUT
[slotchange event: Child content is added to nested slots.]
expected: TIMEOUT

View file

@ -1,6 +0,0 @@
[slots-fallback-in-document.html]
[Children of a slot in a document tree should not be counted in flattened assigned nodes.]
expected: FAIL
[Slot fallback content in shadow tree should be counted in flattened assigned nodes.]
expected: FAIL

View file

@ -14,8 +14,5 @@
[Slots fallback: Mutation. Assign a node to a slot so that fallback contens are no longer used.]
expected: FAIL
[Slots fallback: Mutation. Remove an assigned node from a slot so that fallback contens will be used.]
expected: FAIL
[Slots fallback: Mutation. Remove a slot which is a fallback content of another slot.]
expected: FAIL

View file

@ -26,9 +26,6 @@
[Slots: Mutation: Add a slot: before.]
expected: FAIL
[Slots: Mutation: Remove a slot.]
expected: FAIL
[Slots: Mutation: Change slot name= attribute.]
expected: FAIL