Changeset 208176 in webkit
- Timestamp:
- Oct 31, 2016, 2:47:30 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r208170 r208176 1 2016-10-31 Ryosuke Niwa <rniwa@webkit.org> 2 3 CSSStyleDeclaration should be annotated with CEReactions 4 https://bugs.webkit.org/show_bug.cgi?id=163968 5 6 Reviewed by Antti Koivisto. 7 8 Added a W3C style testharness.js test. 9 10 * fast/custom-elements/reactions/CSSStyleDeclaration-expected.txt: Added. 11 * fast/custom-elements/reactions/CSSStyleDeclaration.html: Added. 12 1 13 2016-10-31 Zalan Bujtas <zalan@apple.com> 2 14 -
trunk/LayoutTests/imported/w3c/ChangeLog
r208096 r208176 1 2016-10-31 Ryosuke Niwa <rniwa@webkit.org> 2 3 CSSStyleDeclaration should be annotated with CEReactions 4 https://bugs.webkit.org/show_bug.cgi?id=163968 5 6 Reviewed by Antti Koivisto. 7 8 Rebaselined the test now that all test cases pass. 9 10 * web-platform-tests/custom-elements/attribute-changed-callback-expected.txt: 11 1 12 2016-10-28 Darin Adler <darin@apple.com> 2 13 -
trunk/LayoutTests/imported/w3c/web-platform-tests/custom-elements/attribute-changed-callback-expected.txt
r207571 r208176 8 8 PASS Mutating observedAttributes after calling customElements.define must not affect the set of attributes for which attributedChangedCallback is invoked 9 9 PASS attributedChangedCallback must be enqueued for attributes specified in a non-Array iterable observedAttributes 10 FAIL attributedChangedCallback must be enqueued for style attribute change by mutating inline style declaration assert_equals: expected 1 but got 0 10 PASS attributedChangedCallback must be enqueued for style attribute change by mutating inline style declaration 11 11 PASS attributedChangedCallback must not be enqueued when mutating inline style declaration if the style attribute is not observed 12 12 -
trunk/Source/WebCore/ChangeLog
r208175 r208176 1 2016-10-31 Ryosuke Niwa <rniwa@webkit.org> 2 3 CSSStyleDeclaration should be annotated with CEReactions 4 https://bugs.webkit.org/show_bug.cgi?id=163968 5 6 Reviewed by Antti Koivisto. 7 8 Added CEReactions to CSSStyleDeclaration.idl. 9 10 Test: fast/custom-elements/reactions/CSSStyleDeclaration.html 11 12 * bindings/js/JSCSSStyleDeclarationCustom.cpp: 13 (WebCore::JSCSSStyleDeclaration::putDelegate): 14 * css/CSSStyleDeclaration.idl: 15 * css/PropertySetCSSStyleDeclaration.cpp: 16 (WebCore::StyleAttributeMutationScope::StyleAttributeMutationScope): Remember the old value when this is 17 an inline style declaration for a custom element. Also store m_oldValue and m_customElement instead of 18 a mutation record so that we don't create a superfluous mutation record for custom elements. 19 (WebCore::StyleAttributeMutationScope::~StyleAttributeMutationScope): Enqueue attributeChangedCallback 20 when m_customElement is not null. 21 * dom/CustomElementReactionQueue.cpp: 22 (WebCore::CustomElementReactionQueue::observesStyleAttribute): 23 * dom/CustomElementReactionQueue.h: 24 1 25 2016-10-31 Jer Noble <jer.noble@apple.com> 2 26 -
trunk/Source/WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp
r208135 r208176 34 34 #include "CSSStyleSheet.h" 35 35 #include "CSSValue.h" 36 #include "CustomElementReactionQueue.h" 36 37 #include "HashTools.h" 37 38 #include "JSCSSStyleDeclaration.h" … … 323 324 bool JSCSSStyleDeclaration::putDelegate(ExecState* state, PropertyName propertyName, JSValue value, PutPropertySlot&, bool& putResult) 324 325 { 326 #if ENABLE(CUSTOM_ELEMENTS) 327 CustomElementReactionStack customElementReactionStack; 328 #endif 325 329 auto propertyInfo = parseJavaScriptCSSPropertyName(propertyName); 326 330 if (!propertyInfo.propertyID) -
trunk/Source/WebCore/css/CSSStyleDeclaration.idl
r207396 r208176 29 29 SkipVTableValidation, 30 30 ] interface CSSStyleDeclaration { 31 [ SetterMayThrowException] attribute DOMString cssText;31 [CEReactions, SetterMayThrowException] attribute DOMString cssText; 32 32 33 33 DOMString getPropertyValue(DOMString propertyName); 34 34 [Custom] CSSValue? getPropertyCSSValue(DOMString propertyName); 35 35 36 [ MayThrowException] DOMString removeProperty(DOMString propertyName);36 [CEReactions, MayThrowException] DOMString removeProperty(DOMString propertyName); 37 37 DOMString? getPropertyPriority(DOMString propertyName); 38 38 39 [ MayThrowException] void setProperty(DOMString propertyName, [TreatNullAs=EmptyString] DOMString value, [TreatNullAs=EmptyString] optional DOMString priority = "");39 [CEReactions, MayThrowException] void setProperty(DOMString propertyName, [TreatNullAs=EmptyString] DOMString value, [TreatNullAs=EmptyString] optional DOMString priority = ""); 40 40 41 41 readonly attribute unsigned long length; -
trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp
r207396 r208176 27 27 #include "CSSRule.h" 28 28 #include "CSSStyleSheet.h" 29 #include "CustomElementReactionQueue.h" 29 30 #include "HTMLNames.h" 30 31 #include "InspectorInstrumentation.h" … … 54 55 s_currentDecl = decl; 55 56 56 if (!s_currentDecl->parentElement()) 57 auto* element = s_currentDecl->parentElement(); 58 if (!element) 57 59 return; 58 60 … … 63 65 shouldReadOldValue = true; 64 66 65 AtomicString oldValue; 67 #if ENABLE(CUSTOM_ELEMENTS) 68 if (UNLIKELY(element->isDefinedCustomElement())) { 69 auto* reactionQueue = element->reactionQueue(); 70 if (reactionQueue && reactionQueue->observesStyleAttribute()) { 71 m_customElement = element; 72 shouldReadOldValue = true; 73 } 74 } 75 #endif 76 66 77 if (shouldReadOldValue) 67 oldValue = s_currentDecl->parentElement()->getAttribute(HTMLNames::styleAttr); 68 69 if (m_mutationRecipients) { 70 AtomicString requestedOldValue = m_mutationRecipients->isOldValueRequested() ? oldValue : nullAtom; 71 m_mutation = MutationRecord::createAttributes(*s_currentDecl->parentElement(), HTMLNames::styleAttr, requestedOldValue); 72 } 78 m_oldValue = s_currentDecl->parentElement()->getAttribute(HTMLNames::styleAttr); 73 79 } 74 80 … … 79 85 return; 80 86 81 if (m_mutation && s_shouldDeliver) 82 m_mutationRecipients->enqueueMutationRecord(m_mutation.releaseNonNull()); 87 if (s_shouldDeliver) { 88 if (m_mutationRecipients) { 89 auto mutation = MutationRecord::createAttributes(*s_currentDecl->parentElement(), HTMLNames::styleAttr, m_oldValue); 90 m_mutationRecipients->enqueueMutationRecord(WTFMove(mutation)); 91 } 92 if (m_customElement) { 93 AtomicString newValue = m_customElement->getAttribute(HTMLNames::styleAttr); 94 CustomElementReactionQueue::enqueueAttributeChangedCallbackIfNeeded(*m_customElement, HTMLNames::styleAttr, m_oldValue, newValue); 95 } 96 } 83 97 84 98 s_shouldDeliver = false; … … 112 126 113 127 std::unique_ptr<MutationObserverInterestGroup> m_mutationRecipients; 114 RefPtr<MutationRecord> m_mutation; 128 AtomicString m_oldValue; 129 RefPtr<Element> m_customElement; 115 130 }; 116 131 -
trunk/Source/WebCore/dom/CustomElementReactionQueue.cpp
r207810 r208176 33 33 #include "Document.h" 34 34 #include "Element.h" 35 #include "HTMLNames.h" 35 36 #include "JSCustomElementInterface.h" 36 37 #include "JSDOMBinding.h" … … 191 192 } 192 193 194 bool CustomElementReactionQueue::observesStyleAttribute() const 195 { 196 return m_interface->observesAttribute(HTMLNames::styleAttr.localName()); 197 } 198 193 199 void CustomElementReactionQueue::invokeAll(Element& element) 194 200 { -
trunk/Source/WebCore/dom/CustomElementReactionQueue.h
r207810 r208176 54 54 static void enqueuePostUpgradeReactions(Element&); 55 55 56 bool observesStyleAttribute() const; 56 57 void invokeAll(Element&); 57 58 void clear();
Note:
See TracChangeset
for help on using the changeset viewer.