Changeset 207710 in webkit
- Timestamp:
- Oct 22, 2016 1:15:52 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r207703 r207710 1 2016-10-22 Ryosuke Niwa <rniwa@webkit.org> 2 3 Upgrading custom element should enqueue attributeChanged and connected callbacks 4 https://bugs.webkit.org/show_bug.cgi?id=163840 5 6 Reviewed by Darin Adler. 7 8 Added a W3C style testharness.js test for making sure upgrading custom custom elements 9 would enqueue attributedChanged and connected reactions. 10 11 * fast/custom-elements/upgrading-enqueue-reactions-expected.txt: Added. 12 * fast/custom-elements/upgrading-enqueue-reactions.html: Added. 13 1 14 2016-10-21 Ryosuke Niwa <rniwa@webkit.org> 2 15 -
trunk/LayoutTests/imported/w3c/ChangeLog
r207703 r207710 1 2016-10-22 Ryosuke Niwa <rniwa@webkit.org> 2 3 Upgrading custom element should enqueue attributeChanged and connected callbacks 4 https://bugs.webkit.org/show_bug.cgi?id=163840 5 6 Reviewed by Darin Adler. 7 8 Rebaselined the tests as more test cases are passing now. 9 10 * web-platform-tests/custom-elements/reactions/Node-expected.txt: 11 * web-platform-tests/custom-elements/reactions/Range-expected.txt: 12 1 13 2016-10-21 Ryosuke Niwa <rniwa@webkit.org> 2 14 -
trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Node-expected.txt
r207170 r207710 4 4 FAIL textContent on Node must enqueue an attributeChanged reaction when replacing an existing attribute assert_array_equals: lengths differ, expected 1 got 2 5 5 PASS textContent on Node must not enqueue an attributeChanged reaction when replacing an existing unobserved attribute 6 FAIL cloneNode on Node must enqueue an attributeChanged reaction when cloning an element with an observed attribute assert_array_equals: lengths differ, expected 2 got 1 6 PASS cloneNode on Node must enqueue an attributeChanged reaction when cloning an element with an observed attribute 7 7 PASS cloneNode on Node must not enqueue an attributeChanged reaction when cloning an element with an unobserved attribute 8 FAIL cloneNode on Node must enqueue an attributeChanged reaction when cloning an element only for observed attributes assert_array_equals: lengths differ, expected 3 got 1 8 PASS cloneNode on Node must enqueue an attributeChanged reaction when cloning an element only for observed attributes 9 9 PASS insertBefore on ChildNode must enqueue a connected reaction 10 10 PASS insertBefore on ChildNode must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document -
trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/reactions/Range-expected.txt
r207703 r207710 2 2 PASS deleteContents on Range must enqueue a disconnected reaction 3 3 PASS extractContents on Range must enqueue a disconnected reaction 4 FAIL cloneContents on Range must enqueue an attributeChanged reaction when cloning an element with an observed attribute assert_array_equals: lengths differ, expected 2 got 1 4 PASS cloneContents on Range must enqueue an attributeChanged reaction when cloning an element with an observed attribute 5 5 PASS cloneContents on Range must not enqueue an attributeChanged reaction when cloning an element with an unobserved attribute 6 FAIL cloneContents on Range must enqueue an attributeChanged reaction when cloning an element only for observed attributes assert_array_equals: lengths differ, expected 3 got 1 6 PASS cloneContents on Range must enqueue an attributeChanged reaction when cloning an element only for observed attributes 7 7 PASS insertNode on Range must enqueue a connected reaction 8 8 PASS insertNode on Range must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document 9 9 PASS surroundContents on Range must enqueue a connected reaction 10 10 PASS surroundContents on Range must enqueue a disconnected reaction, an adopted reaction, and a connected reaction when the custom element was in another document 11 FAIL createContextualFragment on Range must construct a custom element assert_array_equals: lengths differ, expected 2 got 1 11 PASS createContextualFragment on Range must construct a custom element 12 12 -
trunk/Source/WebCore/ChangeLog
r207708 r207710 1 2016-10-22 Ryosuke Niwa <rniwa@webkit.org> 2 3 Upgrading custom element should enqueue attributeChanged and connected callbacks 4 https://bugs.webkit.org/show_bug.cgi?id=163840 5 6 Reviewed by Darin Adler. 7 8 When upgrading a custom element, enqueue attributeChanged and connectedCallbacks as needed as specified 9 in step 3 and 4 of: https://html.spec.whatwg.org/multipage/scripting.html#concept-upgrade-an-element 10 11 Test: fast/custom-elements/upgrading-enqueue-reactions.html 12 13 * bindings/js/JSCustomElementInterface.cpp: 14 (WebCore::JSCustomElementInterface::upgradeElement): Enqueue 15 * dom/CustomElementReactionQueue.cpp: 16 (WebCore::CustomElementReactionQueueItem::invoke): Don't invoke callbacks when the custom element had 17 failed to upgrade. 18 (WebCore::CustomElementReactionQueue::enqueuePostUpgradeReactions): Added. 19 (WebCore::CustomElementReactionQueue::invokeAll): Upgrading a custom element may enqueue more reactions. 20 Keep invoking reactions until the queue becomes empty. 21 * dom/CustomElementReactionQueue.h: 22 * dom/Range.idl: Added a forgotten CEReactions here. 23 1 24 2016-10-21 David Kilzer <ddkilzer@apple.com> 2 25 -
trunk/Source/WebCore/bindings/js/JSCustomElementInterface.cpp
r206960 r207710 183 183 } 184 184 185 CustomElementReactionQueue::enqueuePostUpgradeReactions(element, *this); 186 185 187 m_constructionStack.append(&element); 186 188 -
trunk/Source/WebCore/dom/CustomElementReactionQueue.cpp
r205416 r207710 76 76 void invoke() 77 77 { 78 if (m_element->isFailedCustomElement()) 79 return; 78 80 switch (m_type) { 79 81 case Type::ElementUpgrade: … … 189 191 } 190 192 193 void CustomElementReactionQueue::enqueuePostUpgradeReactions(Element& element, JSCustomElementInterface& elementInterface) 194 { 195 if (!element.hasAttributes() && !element.inDocument()) 196 return; 197 198 auto* queue = CustomElementReactionStack::ensureCurrentQueue(); 199 if (!queue) 200 return; 201 202 if (element.hasAttributes()) { 203 for (auto& attribute : element.attributesIterator()) { 204 if (elementInterface.observesAttribute(attribute.localName())) 205 queue->m_items.append({element, elementInterface, attribute.name(), nullAtom, attribute.value()}); 206 } 207 } 208 209 if (element.inDocument() && elementInterface.hasConnectedCallback()) 210 queue->m_items.append({CustomElementReactionQueueItem::Type::Connected, element, elementInterface}); 211 } 212 191 213 void CustomElementReactionQueue::invokeAll() 192 214 { 193 Vector<CustomElementReactionQueueItem> items; 194 items.swap(m_items); 195 for (auto& item : items) 196 item.invoke(); 215 // FIXME: This queue needs to be per element. 216 while (!m_items.isEmpty()) { 217 Vector<CustomElementReactionQueueItem> items = WTFMove(m_items); 218 for (auto& item : items) 219 item.invoke(); 220 } 197 221 } 198 222 -
trunk/Source/WebCore/dom/CustomElementReactionQueue.h
r205340 r207710 52 52 static void enqueueAdoptedCallbackIfNeeded(Element&, Document& oldDocument, Document& newDocument); 53 53 static void enqueueAttributeChangedCallbackIfNeeded(Element&, const QualifiedName&, const AtomicString& oldValue, const AtomicString& newValue); 54 static void enqueuePostUpgradeReactions(Element&, JSCustomElementInterface&); 54 55 55 56 void invokeAll(); -
trunk/Source/WebCore/dom/Range.idl
r207170 r207710 68 68 ClientRect getBoundingClientRect(); 69 69 70 [ MayThrowLegacyException, NewObject] DocumentFragment createContextualFragment(DOMString html);70 [CEReactions, MayThrowLegacyException, NewObject] DocumentFragment createContextualFragment(DOMString html); 71 71 72 72 [MayThrowLegacyException] short compareNode(Node refNode);
Note: See TracChangeset
for help on using the changeset viewer.