Title: [208817] trunk
Revision
208817
Author
[email protected]
Date
2016-11-16 15:06:47 -0800 (Wed, 16 Nov 2016)

Log Message

slotchange event should bubble and dispatched once
https://bugs.webkit.org/show_bug.cgi?id=164770

Reviewed by Antti Koivisto.

LayoutTests/imported/w3c:

Rebaselined the test. Some test cases fail as they do on Chrome because it's testing an outdated version of the spec.
Will fix the test upstream later.

* web-platform-tests/shadow-dom/slotchange-event-expected.txt:

Source/WebCore:

Updated our implementation of slotchange event to match the latest specification after:
https://github.com/w3c/webcomponents/issues/571
https://dom.spec.whatwg.org/#signal-a-slot-change
The new behavior matches that of Google Chrome Canary.

In the latest specification, we no longer dispatch a separate event on ancestor slots.
Instead, we fire a single slotchange event to which a new node is assigned or from which
an existing assigned node is removed. This patch mostly removes the code that existed to
locate ancestor slot elements, and makes the event bubble up by changing a single line in
HTMLSlotElement::dispatchSlotChangeEvent.

Test: fast/shadow-dom/slotchange-event-bubbling.html

* dom/ShadowRoot.h:
* dom/SlotAssignment.cpp:
(WebCore::recursivelyFireSlotChangeEvent): Deleted.
(WebCore::SlotAssignment::didChangeSlot): Removed ChangeType from the arguments since we
no longer notify the ancestor slot elements.
(WebCore::SlotAssignment::hostChildElementDidChange):
* dom/SlotAssignment.h:
(WebCore::ShadowRoot::didRemoveAllChildrenOfShadowHost):
(WebCore::ShadowRoot::didChangeDefaultSlot):
(WebCore::ShadowRoot::hostChildElementDidChangeSlotAttribute):
(WebCore::ShadowRoot::innerSlotDidChange): Deleted.
* html/HTMLDetailsElement.cpp:
(WebCore::DetailsSlotAssignment::hostChildElementDidChange):
* html/HTMLSlotElement.cpp:
(WebCore::HTMLSlotElement::dispatchSlotChangeEvent): Make slotchange event bubble.

LayoutTests:

* fast/shadow-dom/slotchange-event-bubbling-expected.txt: Added.
* fast/shadow-dom/slotchange-event-bubbling.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (208816 => 208817)


--- trunk/LayoutTests/ChangeLog	2016-11-16 23:05:00 UTC (rev 208816)
+++ trunk/LayoutTests/ChangeLog	2016-11-16 23:06:47 UTC (rev 208817)
@@ -1,3 +1,13 @@
+2016-11-16  Ryosuke Niwa  <[email protected]>
+
+        slotchange event should bubble and dispatched once
+        https://bugs.webkit.org/show_bug.cgi?id=164770
+
+        Reviewed by Antti Koivisto.
+
+        * fast/shadow-dom/slotchange-event-bubbling-expected.txt: Added.
+        * fast/shadow-dom/slotchange-event-bubbling.html: Added.
+
 2016-11-16  Simon Fraser  <[email protected]>
 
         UIScriptController: script with no async tasks fails if an earlier script registered a callback

Added: trunk/LayoutTests/fast/shadow-dom/slotchange-event-bubbling-expected.txt (0 => 208817)


--- trunk/LayoutTests/fast/shadow-dom/slotchange-event-bubbling-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/slotchange-event-bubbling-expected.txt	2016-11-16 23:06:47 UTC (rev 208817)
@@ -0,0 +1,18 @@
+
+PASS slotchange event must bubble in a disconnected closed-mode shadow tree 
+PASS slotchange event must bubble in a connected closed-mode shadow tree 
+PASS slotchange event must bubble in a disconnected open-mode shadow tree 
+PASS slotchange event must bubble in a connected open-mode shadow tree 
+PASS A single slotchange event must bubble from a disconnected closed-mode shadow tree toa slot in its parent closed-mode shadow tree 
+PASS A single slotchange event must bubble from a connected closed-mode shadow tree toa slot in its parent closed-mode shadow tree 
+PASS A single slotchange event must bubble from a disconnected open-mode shadow tree toa slot in its parent closed-mode shadow tree 
+PASS A single slotchange event must bubble from a connected open-mode shadow tree toa slot in its parent closed-mode shadow tree 
+PASS A single slotchange event must bubble from a disconnected closed-mode shadow tree toa slot in its parent open-mode shadow tree 
+PASS A single slotchange event must bubble from a connected closed-mode shadow tree toa slot in its parent open-mode shadow tree 
+PASS A single slotchange event must bubble from a disconnected open-mode shadow tree toa slot in its parent open-mode shadow tree 
+PASS A single slotchange event must bubble from a connected open-mode shadow tree toa slot in its parent open-mode shadow tree 
+PASS slotchange event must be fired in a disconnected closed-mode shadow tree even when the slot element itself lacks a event listener. 
+PASS slotchange event must be fired in a connected closed-mode shadow tree even when the slot element itself lacks a event listener. 
+PASS slotchange event must be fired in a disconnected open-mode shadow tree even when the slot element itself lacks a event listener. 
+PASS slotchange event must be fired in a connected open-mode shadow tree even when the slot element itself lacks a event listener. 
+

Added: trunk/LayoutTests/fast/shadow-dom/slotchange-event-bubbling.html (0 => 208817)


--- trunk/LayoutTests/fast/shadow-dom/slotchange-event-bubbling.html	                        (rev 0)
+++ trunk/LayoutTests/fast/shadow-dom/slotchange-event-bubbling.html	2016-11-16 23:06:47 UTC (rev 208817)
@@ -0,0 +1,187 @@
+<!DOCTYPE html>
+<html>
+<head>
+<title>Shadow DOM: slotchange event</title>
+<meta name="author" title="Ryosuke Niwa" href=""
+<link rel="help" href=""
+<script src=""
+<script src=""
+</head>
+<body>
+<script>
+
+function create_slotchange_observer() {
+    let log = [];
+    const listener = function (event) {
+        log.push({node: this, event: event, eventType: event.type, eventTarget: event.target});
+    }
+    return {
+        observe: (node) => node.addEventListener('slotchange', listener),
+        takeLog: () => {
+            const currentLog = log;
+            log = [];
+            return currentLog;
+        }
+    };
+}
+
+function assert_slotchange_log(logEntry, node, target, description) {
+    assert_equals(logEntry.node, node, description);
+    assert_equals(logEntry.eventType, 'slotchange', description);
+    assert_equals(logEntry.eventTarget, target, description);
+}
+
+function test_slotchange_event_bubbles(mode, connected) {
+    promise_test(() => {
+        const host = document.createElement('div');
+        if (connected)
+            document.body.appendChild(host);
+
+        const shadowRoot = host.attachShadow({'mode': mode});
+        shadowRoot.innerHTML = '<div><slot></slot></div>';
+        const container = shadowRoot.querySelector('div');
+        const slot = shadowRoot.querySelector('slot');
+
+        const observer = create_slotchange_observer();
+        observer.observe(slot);
+        observer.observe(container);
+        observer.observe(shadowRoot);
+        observer.observe(host);
+        observer.observe(document);
+        observer.observe(window);
+
+        shadowRoot.appendChild(container);
+        host.appendChild(document.createElement('span'));
+        host.appendChild(document.createElement('b'));
+
+        assert_array_equals(observer.takeLog(), [], 'slotchange event must not be fired synchronously');
+        return Promise.resolve().then(() => {
+            const log = observer.takeLog();
+
+            const events = new Set(log.map((entry) => entry.event));
+            assert_equals(events.size, 1, 'Mutating the assigned content of a slot must fire exactly one slotchange event');
+
+            assert_slotchange_log(log[0], slot, slot, 'slotchange event must be dispatched at the slot element first');
+            assert_slotchange_log(log[1], container, slot, 'slotchange event must bubble up to the parent node of the slot');
+            assert_slotchange_log(log[2], shadowRoot, slot, 'slotchange event must bubble up to the shadow root');
+            assert_equals(log.length, 3, 'slotchange must not bubble beyond the shadow root');
+        });
+    }, `slotchange event must bubble in a ${connected ? 'connected' : 'disconnected'} ${mode}-mode shadow tree`);
+}
+
+test_slotchange_event_bubbles('closed', false);
+test_slotchange_event_bubbles('closed', true);
+test_slotchange_event_bubbles('open', false);
+test_slotchange_event_bubbles('open', true);
+
+function test_single_slotchange_event_for_nested_slots(outerMode, innerMode, connected) {
+    promise_test(() => {
+        const outerHost = document.createElement('outer-host');
+        if (connected)
+            document.body.appendChild(outerHost);
+
+        const outerShadow = outerHost.attachShadow({'mode': outerMode});
+        outerShadow.innerHTML = '<div><inner-host><slot></slot></inner-host></div>';
+        const outerHostParent = outerShadow.querySelector('div');
+        const outerSlot = outerShadow.querySelector('slot');
+
+        const innerHost = outerShadow.querySelector('inner-host');
+        const innerShadow = innerHost.attachShadow({'mode': innerMode});
+        innerShadow.innerHTML = '<div><slot></slot></div>';
+        const innerSlotParent = innerShadow.querySelector('div');
+        const innerSlot = innerShadow.querySelector('slot');
+
+        const observer = create_slotchange_observer();
+        observer.observe(outerSlot);
+        observer.observe(innerHost);
+
+        observer.observe(window);
+        observer.observe(document);
+        observer.observe(outerHost);
+        observer.observe(outerShadow);
+        observer.observe(outerHostParent);
+        observer.observe(outerSlot);
+        observer.observe(innerHost);
+        observer.observe(innerShadow);
+        observer.observe(innerSlotParent);
+        observer.observe(innerSlot);
+
+        outerHost.textContent = ' ';
+
+        assert_array_equals(observer.takeLog(), [], 'slotchange event must not be fired synchronously');
+        return Promise.resolve().then(() => {
+            const log = observer.takeLog();
+
+            const events = new Set(log.map((entry) => entry.event));
+            assert_equals(events.size, 1, 'Mutating the assigned content of a slot must fire exactly one slotchange event');
+
+            assert_slotchange_log(log[0], outerSlot, outerSlot, 'slotchange event must be dispatched at the slot element first');
+            assert_slotchange_log(log[1], innerSlot, outerSlot, 'slotchange event must bubble up from a slot element to its assigned slot');
+            assert_slotchange_log(log[2], innerSlotParent, outerSlot, 'slotchange event must bubble up to the parent node of a slot');
+            assert_slotchange_log(log[3], innerShadow, outerSlot, 'slotchange event must bubble up to the shadow root');
+            assert_slotchange_log(log[4], innerHost, outerSlot,
+                'slotchange event must bubble up to the shadow host if the host is a descendent of the tree in which the event was fired');
+            assert_slotchange_log(log[5], outerHostParent, outerSlot,
+                'slotchange event must bubble up to the parent of an inner shadow host');
+            assert_slotchange_log(log[6], outerShadow, outerSlot, 'slotchange event must bubble up to the shadow root');
+            assert_equals(log.length, 7, 'slotchange must not bubble beyond the shadow root in which the event was fired');
+        });
+    }, `A single slotchange event must bubble from a ${connected ? 'connected' : 'disconnected'} ${innerMode}-mode shadow tree to`
+        + `a slot in its parent ${outerMode}-mode shadow tree`);
+}
+
+test_single_slotchange_event_for_nested_slots('closed', 'closed', false);
+test_single_slotchange_event_for_nested_slots('closed', 'closed', true);
+test_single_slotchange_event_for_nested_slots('closed', 'open', false);
+test_single_slotchange_event_for_nested_slots('closed', 'open', true);
+
+test_single_slotchange_event_for_nested_slots('open', 'closed', false);
+test_single_slotchange_event_for_nested_slots('open', 'closed', true);
+test_single_slotchange_event_for_nested_slots('open', 'open', false);
+test_single_slotchange_event_for_nested_slots('open', 'open', true);
+
+function test_slotchange_event_fired_without_listener_on_slot(mode, connected) {
+    promise_test(() => {
+        const host = document.createElement('div');
+        if (connected)
+            document.body.appendChild(host);
+
+        const shadowRoot = host.attachShadow({'mode': mode});
+        shadowRoot.innerHTML = '<div><slot></slot></div>';
+        const container = shadowRoot.querySelector('div');
+        const slot = shadowRoot.querySelector('slot');
+
+        const observer = create_slotchange_observer();
+        observer.observe(container);
+        observer.observe(shadowRoot);
+        observer.observe(host);
+        observer.observe(document);
+        observer.observe(window);
+
+        shadowRoot.appendChild(container);
+        host.appendChild(document.createElement('span'));
+        host.appendChild(document.createElement('b'));
+
+        assert_array_equals(observer.takeLog(), [], 'slotchange event must not be fired synchronously');
+        return Promise.resolve().then(() => {
+            const log = observer.takeLog();
+
+            const events = new Set(log.map((entry) => entry.event));
+            assert_equals(events.size, 1, 'Mutating the assigned content of a slot must fire exactly one slotchange event');
+
+            assert_slotchange_log(log[0], container, slot, 'slotchange event must bubble up to the parent node of the slot');
+            assert_slotchange_log(log[1], shadowRoot, slot, 'slotchange event must bubble up to the shadow root');
+            assert_equals(log.length, 2, 'slotchange must not bubble beyond the shadow root');
+        });
+    }, `slotchange event must be fired in a ${connected ? 'connected' : 'disconnected'} ${mode}-mode shadow tree`
+        + ` even when the slot element itself lacks a event listener.`);
+}
+
+test_slotchange_event_fired_without_listener_on_slot('closed', false);
+test_slotchange_event_fired_without_listener_on_slot('closed', true);
+test_slotchange_event_fired_without_listener_on_slot('open', false);
+test_slotchange_event_fired_without_listener_on_slot('open', true);
+
+</script>
+</body>
+</html>

Modified: trunk/LayoutTests/imported/w3c/ChangeLog (208816 => 208817)


--- trunk/LayoutTests/imported/w3c/ChangeLog	2016-11-16 23:05:00 UTC (rev 208816)
+++ trunk/LayoutTests/imported/w3c/ChangeLog	2016-11-16 23:06:47 UTC (rev 208817)
@@ -1,3 +1,15 @@
+2016-11-16  Ryosuke Niwa  <[email protected]>
+
+        slotchange event should bubble and dispatched once
+        https://bugs.webkit.org/show_bug.cgi?id=164770
+
+        Reviewed by Antti Koivisto.
+
+        Rebaselined the test. Some test cases fail as they do on Chrome because it's testing an outdated version of the spec.
+        Will fix the test upstream later.
+
+        * web-platform-tests/shadow-dom/slotchange-event-expected.txt:
+
 2016-11-14  Jiewen Tan  <[email protected]>
 
         Update SubtleCrypto::exportKey to match the latest spec

Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/slotchange-event-expected.txt (208816 => 208817)


--- trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/slotchange-event-expected.txt	2016-11-16 23:05:00 UTC (rev 208816)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/slotchange-event-expected.txt	2016-11-16 23:06:47 UTC (rev 208817)
@@ -23,14 +23,14 @@
 PASS slotchange event must fire on a slot element inside a closed shadow root  in a document when innerHTML modifies the children of the shadow host 
 PASS slotchange event must fire on a slot element inside an open shadow root  not in a document when innerHTML modifies the children of the shadow host 
 PASS slotchange event must fire on a slot element inside a closed shadow root  not in a document when innerHTML modifies the children of the shadow host 
-PASS slotchange event must fire on a slot element inside an open shadow root  in a document when nested slots's contents change 
-PASS slotchange event must fire on a slot element inside a closed shadow root  in a document when nested slots's contents change 
-PASS slotchange event must fire on a slot element inside an open shadow root  not in a document when nested slots's contents change 
-PASS slotchange event must fire on a slot element inside a closed shadow root  not in a document when nested slots's contents change 
-PASS slotchange event must fire at the end of current microtask after mutation observers are invoked inside an open shadow root  in a document when slots's contents change 
-PASS slotchange event must fire at the end of current microtask after mutation observers are invoked inside a closed shadow root  in a document when slots's contents change 
-PASS slotchange event must fire at the end of current microtask after mutation observers are invoked inside an open shadow root  not in a document when slots's contents change 
-PASS slotchange event must fire at the end of current microtask after mutation observers are invoked inside a closed shadow root  not in a document when slots's contents change 
+FAIL slotchange event must fire on a slot element inside an open shadow root  in a document when nested slots's contents change assert_equals: slotchange must be fired on a slot element if the assigned nodes changed expected 1 but got 0
+FAIL slotchange event must fire on a slot element inside a closed shadow root  in a document when nested slots's contents change assert_equals: slotchange must be fired on a slot element if the assigned nodes changed expected 1 but got 0
+FAIL slotchange event must fire on a slot element inside an open shadow root  not in a document when nested slots's contents change assert_equals: slotchange must be fired on a slot element if the assigned nodes changed expected 1 but got 0
+FAIL slotchange event must fire on a slot element inside a closed shadow root  not in a document when nested slots's contents change assert_equals: slotchange must be fired on a slot element if the assigned nodes changed expected 1 but got 0
+FAIL slotchange event must fire at the end of current microtask after mutation observers are invoked inside an open shadow root  in a document when slots's contents change assert_array_equals: slotchange event must be fired during a single compound microtask lengths differ, expected 2 got 1
+FAIL slotchange event must fire at the end of current microtask after mutation observers are invoked inside a closed shadow root  in a document when slots's contents change assert_array_equals: slotchange event must be fired during a single compound microtask lengths differ, expected 2 got 1
+FAIL slotchange event must fire at the end of current microtask after mutation observers are invoked inside an open shadow root  not in a document when slots's contents change assert_array_equals: slotchange event must be fired during a single compound microtask lengths differ, expected 2 got 1
+FAIL slotchange event must fire at the end of current microtask after mutation observers are invoked inside a closed shadow root  not in a document when slots's contents change assert_array_equals: slotchange event must be fired during a single compound microtask lengths differ, expected 2 got 1
 hello
 hello
 

Modified: trunk/Source/WebCore/ChangeLog (208816 => 208817)


--- trunk/Source/WebCore/ChangeLog	2016-11-16 23:05:00 UTC (rev 208816)
+++ trunk/Source/WebCore/ChangeLog	2016-11-16 23:06:47 UTC (rev 208817)
@@ -1,3 +1,39 @@
+2016-11-16  Ryosuke Niwa  <[email protected]>
+
+        slotchange event should bubble and dispatched once
+        https://bugs.webkit.org/show_bug.cgi?id=164770
+
+        Reviewed by Antti Koivisto.
+
+        Updated our implementation of slotchange event to match the latest specification after:
+        https://github.com/w3c/webcomponents/issues/571
+        https://dom.spec.whatwg.org/#signal-a-slot-change
+        The new behavior matches that of Google Chrome Canary.
+
+        In the latest specification, we no longer dispatch a separate event on ancestor slots.
+        Instead, we fire a single slotchange event to which a new node is assigned or from which
+        an existing assigned node is removed. This patch mostly removes the code that existed to
+        locate ancestor slot elements, and makes the event bubble up by changing a single line in
+        HTMLSlotElement::dispatchSlotChangeEvent.
+
+        Test: fast/shadow-dom/slotchange-event-bubbling.html
+
+        * dom/ShadowRoot.h:
+        * dom/SlotAssignment.cpp:
+        (WebCore::recursivelyFireSlotChangeEvent): Deleted.
+        (WebCore::SlotAssignment::didChangeSlot): Removed ChangeType from the arguments since we
+        no longer notify the ancestor slot elements.
+        (WebCore::SlotAssignment::hostChildElementDidChange):
+        * dom/SlotAssignment.h:
+        (WebCore::ShadowRoot::didRemoveAllChildrenOfShadowHost):
+        (WebCore::ShadowRoot::didChangeDefaultSlot):
+        (WebCore::ShadowRoot::hostChildElementDidChangeSlotAttribute):
+        (WebCore::ShadowRoot::innerSlotDidChange): Deleted.
+        * html/HTMLDetailsElement.cpp:
+        (WebCore::DetailsSlotAssignment::hostChildElementDidChange):
+        * html/HTMLSlotElement.cpp:
+        (WebCore::HTMLSlotElement::dispatchSlotChangeEvent): Make slotchange event bubble.
+
 2016-11-16  Alex Christensen  <[email protected]>
 
         REGRESSION (r207162): [debug] loader/stateobjects LayoutTests timing out

Modified: trunk/Source/WebCore/dom/ShadowRoot.h (208816 => 208817)


--- trunk/Source/WebCore/dom/ShadowRoot.h	2016-11-16 23:05:00 UTC (rev 208816)
+++ trunk/Source/WebCore/dom/ShadowRoot.h	2016-11-16 23:06:47 UTC (rev 208817)
@@ -78,7 +78,6 @@
     void didChangeDefaultSlot();
     void hostChildElementDidChange(const Element&);
     void hostChildElementDidChangeSlotAttribute(const AtomicString& oldValue, const AtomicString& newValue);
-    void innerSlotDidChange(const AtomicString&);
 
     const Vector<Node*>* assignedNodesForSlot(const HTMLSlotElement&);
 

Modified: trunk/Source/WebCore/dom/SlotAssignment.cpp (208816 => 208817)


--- trunk/Source/WebCore/dom/SlotAssignment.cpp	2016-11-16 23:05:00 UTC (rev 208816)
+++ trunk/Source/WebCore/dom/SlotAssignment.cpp	2016-11-16 23:06:47 UTC (rev 208817)
@@ -127,23 +127,8 @@
     ASSERT(slotInfo.element || m_needsToResolveSlotElements);
 }
 
-static void recursivelyFireSlotChangeEvent(HTMLSlotElement& slotElement)
+void SlotAssignment::didChangeSlot(const AtomicString& slotAttrValue, ShadowRoot& shadowRoot)
 {
-    slotElement.enqueueSlotChangeEvent();
-
-    auto* slotParent = slotElement.parentElement();
-    if (!slotParent)
-        return;
-
-    auto* shadowRootOfSlotParent = slotParent->shadowRoot();
-    if (!shadowRootOfSlotParent)
-        return;
-
-    shadowRootOfSlotParent->innerSlotDidChange(slotElement.attributeWithoutSynchronization(slotAttr));
-}
-
-void SlotAssignment::didChangeSlot(const AtomicString& slotAttrValue, ChangeType changeType, ShadowRoot& shadowRoot)
-{
     auto& slotName = slotNameFromAttributeValue(slotAttrValue);
     auto it = m_slots.find(slotName);
     if (it == m_slots.end())
@@ -153,20 +138,18 @@
     if (!slotElement)
         return;
 
-    if (changeType == ChangeType::DirectChild) {
-        shadowRoot.host()->invalidateStyleAndRenderersForSubtree();
-        m_slotAssignmentsIsValid = false;
-    }
+    shadowRoot.host()->invalidateStyleAndRenderersForSubtree();
+    m_slotAssignmentsIsValid = false;
 
     if (shadowRoot.mode() == ShadowRootMode::UserAgent)
         return;
 
-    recursivelyFireSlotChangeEvent(*slotElement);
+    slotElement->enqueueSlotChangeEvent();
 }
 
 void SlotAssignment::hostChildElementDidChange(const Element& childElement, ShadowRoot& shadowRoot)
 {
-    didChangeSlot(childElement.attributeWithoutSynchronization(slotAttr), ChangeType::DirectChild, shadowRoot);
+    didChangeSlot(childElement.attributeWithoutSynchronization(slotAttr), shadowRoot);
 }
 
 const Vector<Node*>* SlotAssignment::assignedNodesForSlot(const HTMLSlotElement& slotElement, ShadowRoot& shadowRoot)

Modified: trunk/Source/WebCore/dom/SlotAssignment.h (208816 => 208817)


--- trunk/Source/WebCore/dom/SlotAssignment.h	2016-11-16 23:05:00 UTC (rev 208816)
+++ trunk/Source/WebCore/dom/SlotAssignment.h	2016-11-16 23:06:47 UTC (rev 208817)
@@ -51,8 +51,7 @@
     void addSlotElementByName(const AtomicString&, HTMLSlotElement&, ShadowRoot&);
     void removeSlotElementByName(const AtomicString&, HTMLSlotElement&, ShadowRoot&);
 
-    enum class ChangeType { DirectChild, InnerSlot };
-    void didChangeSlot(const AtomicString&, ChangeType, ShadowRoot&);
+    void didChangeSlot(const AtomicString&, ShadowRoot&);
     void enqueueSlotChangeEvent(const AtomicString&, ShadowRoot&);
 
     const Vector<Node*>* assignedNodesForSlot(const HTMLSlotElement&, ShadowRoot&);
@@ -99,13 +98,13 @@
 inline void ShadowRoot::didRemoveAllChildrenOfShadowHost()
 {
     if (m_slotAssignment) // FIXME: This is incorrect when there were no elements or text nodes removed.
-        m_slotAssignment->didChangeSlot(nullAtom, SlotAssignment::ChangeType::DirectChild, *this);
+        m_slotAssignment->didChangeSlot(nullAtom, *this);
 }
 
 inline void ShadowRoot::didChangeDefaultSlot()
 {
     if (m_slotAssignment)
-        m_slotAssignment->didChangeSlot(nullAtom, SlotAssignment::ChangeType::DirectChild, *this);
+        m_slotAssignment->didChangeSlot(nullAtom, *this);
 }
 
 inline void ShadowRoot::hostChildElementDidChange(const Element& childElement)
@@ -117,15 +116,9 @@
 inline void ShadowRoot::hostChildElementDidChangeSlotAttribute(const AtomicString& oldValue, const AtomicString& newValue)
 {
     if (m_slotAssignment) {
-        m_slotAssignment->didChangeSlot(oldValue, SlotAssignment::ChangeType::DirectChild, *this);
-        m_slotAssignment->didChangeSlot(newValue, SlotAssignment::ChangeType::DirectChild, *this);
+        m_slotAssignment->didChangeSlot(oldValue, *this);
+        m_slotAssignment->didChangeSlot(newValue, *this);
     }
 }
 
-inline void ShadowRoot::innerSlotDidChange(const AtomicString& name)
-{
-    if (m_slotAssignment)
-        m_slotAssignment->didChangeSlot(name, SlotAssignment::ChangeType::InnerSlot, *this);
-}
-
 } // namespace WebCore

Modified: trunk/Source/WebCore/html/HTMLDetailsElement.cpp (208816 => 208817)


--- trunk/Source/WebCore/html/HTMLDetailsElement.cpp	2016-11-16 23:05:00 UTC (rev 208816)
+++ trunk/Source/WebCore/html/HTMLDetailsElement.cpp	2016-11-16 23:06:47 UTC (rev 208817)
@@ -64,9 +64,9 @@
     if (is<HTMLSummaryElement>(childElement)) {
         // Don't check whether this is the first summary element
         // since we don't know the answer when this function is called inside Element::removedFrom.
-        didChangeSlot(summarySlotName(), ChangeType::DirectChild, shadowRoot);
+        didChangeSlot(summarySlotName(), shadowRoot);
     } else
-        didChangeSlot(SlotAssignment::defaultSlotName(), ChangeType::DirectChild, shadowRoot);
+        didChangeSlot(SlotAssignment::defaultSlotName(), shadowRoot);
 }
 
 const AtomicString& DetailsSlotAssignment::slotNameForHostChild(const Node& child) const

Modified: trunk/Source/WebCore/html/HTMLSlotElement.cpp (208816 => 208817)


--- trunk/Source/WebCore/html/HTMLSlotElement.cpp	2016-11-16 23:05:00 UTC (rev 208816)
+++ trunk/Source/WebCore/html/HTMLSlotElement.cpp	2016-11-16 23:06:47 UTC (rev 208817)
@@ -144,7 +144,7 @@
 {
     m_inSignalSlotList = false;
 
-    bool bubbles = false;
+    bool bubbles = true;
     bool cancelable = false;
     Ref<Event> event = Event::create(eventNames().slotchangeEvent, bubbles, cancelable);
     event->setTarget(this);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to