Rename LifecycleCallback to CustomElementReaction
authorrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Aug 2016 21:02:31 +0000 (21:02 +0000)
committerrniwa@webkit.org <rniwa@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Aug 2016 21:02:31 +0000 (21:02 +0000)
https://bugs.webkit.org/show_bug.cgi?id=160991

Reviewed by Chris Dumez.

Renamed LifecycleCallbackQueue and CustomElementLifecycleProcessingStack
to CustomElementReactionQueue and CustomElementReactionStack per the latest spec:
https://html.spec.whatwg.org/#custom-element-reactions

No new tests since this is just a rename of classes which are not exposed to the Web.

* CMakeLists.txt:
* WebCore.xcodeproj/project.pbxproj:

* bindings/js/JSCustomElementsRegistryCustom.cpp:
(WebCore::getCallback): Renamed from getLifecycleCallback.
(WebCore::JSCustomElementsRegistry::define):
(WebCore::getLifecycleCallback): Deleted.

* bindings/js/JSMainThreadExecState.h:
(WebCore::JSMainThreadNullState):

* bindings/scripts/CodeGeneratorJS.pm:
(GenerateImplementation):

* bindings/scripts/test/JS/JSTestObj.cpp: Rebaselined.
* bindings/scripts/test/TestObj.idl:

* dom/CustomElementReactionQueue.cpp: Moved from Source/WebCore/dom/LifecycleCallbackQueue.cpp.
(WebCore::CustomElementReactionQueueItem::CustomElementReactionQueueItem):
(WebCore::CustomElementReactionQueue::CustomElementReactionQueue):
(WebCore::CustomElementReactionQueue::~CustomElementReactionQueue):
(WebCore::CustomElementReactionQueue::enqueueElementUpgrade):
(WebCore::CustomElementReactionQueue::enqueueConnectedCallbackIfNeeded):
(WebCore::CustomElementReactionQueue::enqueueDisconnectedCallbackIfNeeded):
(WebCore::CustomElementReactionQueue::enqueueAttributeChangedCallbackIfNeeded):
(WebCore::CustomElementReactionQueue::invokeAll):
(WebCore::CustomElementReactionStack::ensureCurrentQueue):
(WebCore::CustomElementReactionStack::processQueue):

* dom/CustomElementReactionQueue.h: Moved from Source/WebCore/dom/LifecycleCallbackQueue.h.
(WebCore::CustomElementReactionStack::CustomElementReactionStack):
(WebCore::CustomElementReactionStack::~CustomElementReactionStack):
(WebCore::CustomElementReactionStack::hasCurrentProcessingStack):

* dom/Document.cpp:
(WebCore::createFallbackHTMLElement):

* dom/Element.cpp:
(WebCore::Element::attributeChanged):
(WebCore::Element::insertedInto):
(WebCore::Element::removedFrom):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@204652 268f45cc-cd09-0410-ab3c-d52691b4dbfc

12 files changed:
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/JSCustomElementsRegistryCustom.cpp
Source/WebCore/bindings/js/JSMainThreadExecState.h
Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
Source/WebCore/bindings/scripts/test/TestObj.idl
Source/WebCore/dom/CustomElementReactionQueue.cpp [moved from Source/WebCore/dom/LifecycleCallbackQueue.cpp with 68% similarity]
Source/WebCore/dom/CustomElementReactionQueue.h [moved from Source/WebCore/dom/LifecycleCallbackQueue.h with 80% similarity]
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Element.cpp

index 48566b7..40a50b9 100644 (file)
@@ -1438,6 +1438,7 @@ set(WebCore_SOURCES
     dom/ContainerNode.cpp
     dom/ContainerNodeAlgorithms.cpp
     dom/ContextDestructionObserver.cpp
+    dom/CustomElementReactionQueue.cpp
     dom/CustomElementsRegistry.cpp
     dom/CustomEvent.cpp
     dom/DOMCoreException.cpp
@@ -1484,7 +1485,6 @@ set(WebCore_SOURCES
     dom/IdTargetObserverRegistry.cpp
     dom/InlineStyleSheetOwner.cpp
     dom/KeyboardEvent.cpp
-    dom/LifecycleCallbackQueue.cpp
     dom/LiveNodeList.cpp
     dom/MessageChannel.cpp
     dom/MessageEvent.cpp
index b0c122d..201c744 100644 (file)
@@ -1,3 +1,58 @@
+2016-08-18  Ryosuke Niwa  <rniwa@webkit.org>
+
+        Rename LifecycleCallback to CustomElementReaction
+        https://bugs.webkit.org/show_bug.cgi?id=160991
+
+        Reviewed by Chris Dumez.
+
+        Renamed LifecycleCallbackQueue and CustomElementLifecycleProcessingStack
+        to CustomElementReactionQueue and CustomElementReactionStack per the latest spec:
+        https://html.spec.whatwg.org/#custom-element-reactions
+
+        No new tests since this is just a rename of classes which are not exposed to the Web.
+
+        * CMakeLists.txt:
+        * WebCore.xcodeproj/project.pbxproj:
+
+        * bindings/js/JSCustomElementsRegistryCustom.cpp:
+        (WebCore::getCallback): Renamed from getLifecycleCallback.
+        (WebCore::JSCustomElementsRegistry::define):
+        (WebCore::getLifecycleCallback): Deleted.
+
+        * bindings/js/JSMainThreadExecState.h:
+        (WebCore::JSMainThreadNullState):
+
+        * bindings/scripts/CodeGeneratorJS.pm:
+        (GenerateImplementation):
+
+        * bindings/scripts/test/JS/JSTestObj.cpp: Rebaselined.
+        * bindings/scripts/test/TestObj.idl:
+
+        * dom/CustomElementReactionQueue.cpp: Moved from Source/WebCore/dom/LifecycleCallbackQueue.cpp.
+        (WebCore::CustomElementReactionQueueItem::CustomElementReactionQueueItem):
+        (WebCore::CustomElementReactionQueue::CustomElementReactionQueue):
+        (WebCore::CustomElementReactionQueue::~CustomElementReactionQueue):
+        (WebCore::CustomElementReactionQueue::enqueueElementUpgrade):
+        (WebCore::CustomElementReactionQueue::enqueueConnectedCallbackIfNeeded):
+        (WebCore::CustomElementReactionQueue::enqueueDisconnectedCallbackIfNeeded):
+        (WebCore::CustomElementReactionQueue::enqueueAttributeChangedCallbackIfNeeded):
+        (WebCore::CustomElementReactionQueue::invokeAll):
+        (WebCore::CustomElementReactionStack::ensureCurrentQueue):
+        (WebCore::CustomElementReactionStack::processQueue):
+
+        * dom/CustomElementReactionQueue.h: Moved from Source/WebCore/dom/LifecycleCallbackQueue.h.
+        (WebCore::CustomElementReactionStack::CustomElementReactionStack):
+        (WebCore::CustomElementReactionStack::~CustomElementReactionStack):
+        (WebCore::CustomElementReactionStack::hasCurrentProcessingStack):
+
+        * dom/Document.cpp:
+        (WebCore::createFallbackHTMLElement):
+
+        * dom/Element.cpp:
+        (WebCore::Element::attributeChanged):
+        (WebCore::Element::insertedInto):
+        (WebCore::Element::removedFrom):
+
 2016-08-19  Chris Dumez  <cdumez@apple.com>
 
         Attr.prefix / Element.prefix attribute should be readonly
index 28c382e..e4f048a 100644 (file)
                9B532EA31BA928570038A827 /* SlotAssignment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B532EA11BA928570038A827 /* SlotAssignment.cpp */; };
                9B532EA41BA928570038A827 /* SlotAssignment.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B532EA21BA928570038A827 /* SlotAssignment.h */; };
                9B55EEE91B3E8898005342BC /* EditorCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9B55EEE81B3E8898005342BC /* EditorCocoa.mm */; };
-               9B56C9AA1C89329A00C456DF /* LifecycleCallbackQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B56C9A91C89329A00C456DF /* LifecycleCallbackQueue.cpp */; };
+               9B56C9AA1C89329A00C456DF /* CustomElementReactionQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B56C9A91C89329A00C456DF /* CustomElementReactionQueue.cpp */; };
                9B69D3B41B98FFE900E3512B /* HTMLSlotElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B69D3B21B98FFE900E3512B /* HTMLSlotElement.cpp */; };
                9B69D3B51B98FFE900E3512B /* HTMLSlotElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B69D3B31B98FFE900E3512B /* HTMLSlotElement.h */; };
                9B69D3B81B99100700E3512B /* JSHTMLSlotElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B69D3B61B99100700E3512B /* JSHTMLSlotElement.cpp */; };
                9B532EA11BA928570038A827 /* SlotAssignment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SlotAssignment.cpp; sourceTree = "<group>"; };
                9B532EA21BA928570038A827 /* SlotAssignment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SlotAssignment.h; sourceTree = "<group>"; };
                9B55EEE81B3E8898005342BC /* EditorCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EditorCocoa.mm; sourceTree = "<group>"; };
-               9B56C9A81C89312800C456DF /* LifecycleCallbackQueue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LifecycleCallbackQueue.h; sourceTree = "<group>"; };
-               9B56C9A91C89329A00C456DF /* LifecycleCallbackQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LifecycleCallbackQueue.cpp; sourceTree = "<group>"; };
+               9B56C9A81C89312800C456DF /* CustomElementReactionQueue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CustomElementReactionQueue.h; sourceTree = "<group>"; };
+               9B56C9A91C89329A00C456DF /* CustomElementReactionQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CustomElementReactionQueue.cpp; sourceTree = "<group>"; };
                9B69D3B11B98FF0A00E3512B /* HTMLSlotElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLSlotElement.idl; sourceTree = "<group>"; };
                9B69D3B21B98FFE900E3512B /* HTMLSlotElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLSlotElement.cpp; sourceTree = "<group>"; };
                9B69D3B31B98FFE900E3512B /* HTMLSlotElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLSlotElement.h; sourceTree = "<group>"; };
                                9BD4E9181C462CFC005065BC /* CustomElementsRegistry.cpp */,
                                9BD4E9191C462CFC005065BC /* CustomElementsRegistry.h */,
                                9BC5F9DE1D5AAD5D002B749D /* CustomElementsRegistry.idl */,
+                               9B56C9A91C89329A00C456DF /* CustomElementReactionQueue.cpp */,
+                               9B56C9A81C89312800C456DF /* CustomElementReactionQueue.h */,
                                62CD32561157E57C0063B0A7 /* CustomEvent.cpp */,
                                62CD32571157E57C0063B0A7 /* CustomEvent.h */,
                                62CD32581157E57C0063B0A7 /* CustomEvent.idl */,
                                85031B2D0A44EFC700F992E0 /* KeyboardEvent.cpp */,
                                85031B2E0A44EFC700F992E0 /* KeyboardEvent.h */,
                                14CF7C2009F7110600EB3665 /* KeyboardEvent.idl */,
-                               9B56C9A91C89329A00C456DF /* LifecycleCallbackQueue.cpp */,
-                               9B56C9A81C89312800C456DF /* LifecycleCallbackQueue.h */,
                                BC7FA61E0D1F0CBD00DB22A9 /* LiveNodeList.cpp */,
                                BC7FA61F0D1F0CBD00DB22A9 /* LiveNodeList.h */,
                                BC9A6144146859D9006057FD /* make_dom_exceptions.pl */,
                                E55F497A151B888000BB67DB /* LengthFunctions.cpp in Sources */,
                                0F87166F1C869D83004FF0DE /* LengthPoint.cpp in Sources */,
                                0FEF20CE1BD4A24100128E5D /* LengthSize.cpp in Sources */,
-                               9B56C9AA1C89329A00C456DF /* LifecycleCallbackQueue.cpp in Sources */,
+                               9B56C9AA1C89329A00C456DF /* CustomElementReactionQueue.cpp in Sources */,
                                FFB698CC1833EE0D00158A31 /* LineBreaker.cpp in Sources */,
                                89B5EAA111E8003D00F2367E /* LineEnding.cpp in Sources */,
                                FFB698CF183402BB00158A31 /* LineInfo.cpp in Sources */,
index 2a5689b..53fe954 100644 (file)
@@ -39,7 +39,7 @@ namespace WebCore {
 
 #if ENABLE(CUSTOM_ELEMENTS)
 
-static JSObject* getLifecycleCallback(ExecState& state, JSObject& prototype, const Identifier& id)
+static JSObject* getCustomElementCallback(ExecState& state, JSObject& prototype, const Identifier& id)
 {
     JSValue callback = prototype.get(&state, id);
     if (state.hadException())
@@ -47,7 +47,7 @@ static JSObject* getLifecycleCallback(ExecState& state, JSObject& prototype, con
     if (callback.isUndefined())
         return nullptr;
     if (!callback.isFunction()) {
-        throwTypeError(&state, ASCIILiteral("A lifecycle callback must be a function"));
+        throwTypeError(&state, ASCIILiteral("A custom element callback must be a function"));
         return nullptr;
     }
     return callback.getObject();
@@ -107,24 +107,24 @@ JSValue JSCustomElementsRegistry::define(ExecState& state)
     QualifiedName name(nullAtom, localName, HTMLNames::xhtmlNamespaceURI);
     auto elementInterface = JSCustomElementInterface::create(name, constructor, globalObject());
 
-    auto* connectedCallback = getLifecycleCallback(state, prototypeObject, Identifier::fromString(&vm, "connectedCallback"));
+    auto* connectedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "connectedCallback"));
     if (state.hadException())
         return jsUndefined();
     if (connectedCallback)
         elementInterface->setConnectedCallback(connectedCallback);
 
-    auto* disconnectedCallback = getLifecycleCallback(state, prototypeObject, Identifier::fromString(&vm, "disconnectedCallback"));
+    auto* disconnectedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "disconnectedCallback"));
     if (state.hadException())
         return jsUndefined();
     if (disconnectedCallback)
         elementInterface->setDisconnectedCallback(disconnectedCallback);
 
     // FIXME: Add the support for adoptedCallback.
-    getLifecycleCallback(state, prototypeObject, Identifier::fromString(&vm, "adoptedCallback"));
+    getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "adoptedCallback"));
     if (state.hadException())
         return jsUndefined();
 
-    auto* attributeChangedCallback = getLifecycleCallback(state, prototypeObject, Identifier::fromString(&vm, "attributeChangedCallback"));
+    auto* attributeChangedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "attributeChangedCallback"));
     if (state.hadException())
         return jsUndefined();
     if (attributeChangedCallback) {
index 92bdaa4..0ee3172 100644 (file)
@@ -26,8 +26,8 @@
 #ifndef JSMainThreadExecState_h
 #define JSMainThreadExecState_h
 
+#include "CustomElementReactionQueue.h"
 #include "JSDOMBinding.h"
-#include "LifecycleCallbackQueue.h"
 #include <runtime/Completion.h>
 #include <runtime/Microtask.h>
 #include <wtf/MainThread.h>
@@ -148,7 +148,7 @@ public:
 private:
     JSC::ExecState* m_previousState;
 #if ENABLE(CUSTOM_ELEMENTS)
-    CustomElementLifecycleProcessingStack m_lifecycleProcessingStack;
+    CustomElementReactionStack m_customElementReactionStack;
 #endif
 };
 
index a314d45..1f999cb 100644 (file)
@@ -3342,9 +3342,9 @@ END
 
             if ($function->signature->extendedAttributes->{"CEReactions"}) {
                 push(@implContent, "#if ENABLE(CUSTOM_ELEMENTS)\n");
-                push(@implContent, "    CustomElementLifecycleProcessingStack customElementLifecycleProcessingStack;\n");
+                push(@implContent, "    CustomElementReactionStack customElementReactionStack;\n");
                 push(@implContent, "#endif\n");
-                $implIncludes{"LifecycleCallbackQueue.h"} = 1;
+                $implIncludes{"CustomElementReactionQueue.h"} = 1;
             }
 
             if ($function->isStatic) {
index 29ee017..2cbf558 100644 (file)
@@ -22,6 +22,7 @@
 #include "JSTestObj.h"
 
 #include "CallbackFunction.h"
+#include "CustomElementReactionQueue.h"
 #include "DOMStringList.h"
 #include "Dictionary.h"
 #include "Document.h"
@@ -49,7 +50,6 @@
 #include "JSTestObj.h"
 #include "JSTestSubObj.h"
 #include "JSXPathNSResolver.h"
-#include "LifecycleCallbackQueue.h"
 #include "RuntimeEnabledFeatures.h"
 #include "SVGDocument.h"
 #include "SVGPoint.h"
@@ -724,7 +724,7 @@ JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestPromiseFunctionW
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestPromiseOverloadedFunction(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionTestStaticPromiseFunction(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionTestStaticPromiseFunctionWithException(JSC::ExecState*);
-JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNeedsLifecycleProcessingStack(JSC::ExecState*);
+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNeedsCustomElementReactionStack(JSC::ExecState*);
 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAttachShadowRoot(JSC::ExecState*);
 
 // Attributes
@@ -1311,7 +1311,7 @@ static const HashTableValue JSTestObjPrototypeTableValues[] =
     { "testPromiseFunctionWithException", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionTestPromiseFunctionWithException), (intptr_t) (0) } },
     { "testPromiseFunctionWithOptionalIntArgument", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgument), (intptr_t) (0) } },
     { "testPromiseOverloadedFunction", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionTestPromiseOverloadedFunction), (intptr_t) (1) } },
-    { "methodWithNeedsLifecycleProcessingStack", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNeedsLifecycleProcessingStack), (intptr_t) (0) } },
+    { "methodWithNeedsCustomElementReactionStack", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNeedsCustomElementReactionStack), (intptr_t) (0) } },
     { "attachShadowRoot", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionAttachShadowRoot), (intptr_t) (1) } },
 #if ENABLE(Condition1)
     { "CONDITIONAL_CONST", DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(0) } },
@@ -6376,18 +6376,18 @@ static inline EncodedJSValue jsTestObjConstructorFunctionTestStaticPromiseFuncti
     return JSValue::encode(jsUndefined());
 }
 
-EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNeedsLifecycleProcessingStack(ExecState* state)
+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNeedsCustomElementReactionStack(ExecState* state)
 {
 #if ENABLE(CUSTOM_ELEMENTS)
-    CustomElementLifecycleProcessingStack customElementLifecycleProcessingStack;
+    CustomElementReactionStack customElementReactionStack;
 #endif
     JSValue thisValue = state->thisValue();
     auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
     if (UNLIKELY(!castedThis))
-        return throwThisTypeError(*state, "TestObject", "methodWithNeedsLifecycleProcessingStack");
+        return throwThisTypeError(*state, "TestObject", "methodWithNeedsCustomElementReactionStack");
     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
     auto& impl = castedThis->wrapped();
-    impl.methodWithNeedsLifecycleProcessingStack();
+    impl.methodWithNeedsCustomElementReactionStack();
     return JSValue::encode(jsUndefined());
 }
 
index 2ecbff8..caf5c2e 100644 (file)
@@ -390,7 +390,7 @@ enum TestConfidence { "high", "kinda-low" };
     [PutForwards=name] readonly attribute TestNode? putForwardsNullableAttribute;
 
 #if defined(TESTING_JS)
-    [CEReactions] void methodWithNeedsLifecycleProcessingStack();
+    [CEReactions] void methodWithNeedsCustomElementReactionStack();
 #endif
 
     void attachShadowRoot(TestDictionary init);
@@ -24,7 +24,7 @@
  */
 
 #include "config.h"
-#include "LifecycleCallbackQueue.h"
+#include "CustomElementReactionQueue.h"
 
 #if ENABLE(CUSTOM_ELEMENTS)
 
@@ -40,7 +40,7 @@
 
 namespace WebCore {
 
-class LifecycleQueueItem {
+class CustomElementReactionQueueItem {
 public:
     enum class Type {
         ElementUpgrade,
@@ -49,13 +49,13 @@ public:
         AttributeChanged,
     };
 
-    LifecycleQueueItem(Type type, Element& element, JSCustomElementInterface& elementInterface)
+    CustomElementReactionQueueItem(Type type, Element& element, JSCustomElementInterface& elementInterface)
         : m_type(type)
         , m_element(element)
         , m_interface(elementInterface)
     { }
 
-    LifecycleQueueItem(Element& element, JSCustomElementInterface& elementInterface, const QualifiedName& attributeName, const AtomicString& oldValue, const AtomicString& newValue)
+    CustomElementReactionQueueItem(Element& element, JSCustomElementInterface& elementInterface, const QualifiedName& attributeName, const AtomicString& oldValue, const AtomicString& newValue)
         : m_type(Type::AttributeChanged)
         , m_element(element)
         , m_interface(elementInterface)
@@ -92,18 +92,18 @@ private:
     AtomicString m_newValue;
 };
 
-LifecycleCallbackQueue::LifecycleCallbackQueue()
+CustomElementReactionQueue::CustomElementReactionQueue()
 { }
 
-LifecycleCallbackQueue::~LifecycleCallbackQueue()
+CustomElementReactionQueue::~CustomElementReactionQueue()
 {
     ASSERT(m_items.isEmpty());
 }
 
-void LifecycleCallbackQueue::enqueueElementUpgrade(Element& element, JSCustomElementInterface& elementInterface)
+void CustomElementReactionQueue::enqueueElementUpgrade(Element& element, JSCustomElementInterface& elementInterface)
 {
-    if (auto* queue = CustomElementLifecycleProcessingStack::ensureCurrentQueue())
-        queue->m_items.append(LifecycleQueueItem(LifecycleQueueItem::Type::ElementUpgrade, element, elementInterface));
+    if (auto* queue = CustomElementReactionStack::ensureCurrentQueue())
+        queue->m_items.append({CustomElementReactionQueueItem::Type::ElementUpgrade, element, elementInterface});
 }
 
 static JSCustomElementInterface* findInterfaceForCustomElement(Element& element)
@@ -120,59 +120,59 @@ static JSCustomElementInterface* findInterfaceForCustomElement(Element& element)
     return registry->findInterface(element.tagQName());
 }
 
-void LifecycleCallbackQueue::enqueueConnectedCallbackIfNeeded(Element& element)
+void CustomElementReactionQueue::enqueueConnectedCallbackIfNeeded(Element& element)
 {
     auto* elementInterface = findInterfaceForCustomElement(element);
     if (!elementInterface)
         return;
 
-    if (auto* queue = CustomElementLifecycleProcessingStack::ensureCurrentQueue())
-        queue->m_items.append({LifecycleQueueItem::Type::Connected, element, *elementInterface});
+    if (auto* queue = CustomElementReactionStack::ensureCurrentQueue())
+        queue->m_items.append({CustomElementReactionQueueItem::Type::Connected, element, *elementInterface});
 }
 
-void LifecycleCallbackQueue::enqueueDisconnectedCallbackIfNeeded(Element& element)
+void CustomElementReactionQueue::enqueueDisconnectedCallbackIfNeeded(Element& element)
 {
     auto* elementInterface = findInterfaceForCustomElement(element);
     if (!elementInterface)
         return;
 
-    if (auto* queue = CustomElementLifecycleProcessingStack::ensureCurrentQueue())
-        queue->m_items.append({LifecycleQueueItem::Type::Disconnected, element, *elementInterface});
+    if (auto* queue = CustomElementReactionStack::ensureCurrentQueue())
+        queue->m_items.append({CustomElementReactionQueueItem::Type::Disconnected, element, *elementInterface});
 }
 
-void LifecycleCallbackQueue::enqueueAttributeChangedCallbackIfNeeded(Element& element, const QualifiedName& attributeName, const AtomicString& oldValue, const AtomicString& newValue)
+void CustomElementReactionQueue::enqueueAttributeChangedCallbackIfNeeded(Element& element, const QualifiedName& attributeName, const AtomicString& oldValue, const AtomicString& newValue)
 {
     auto* elementInterface = findInterfaceForCustomElement(element);
     if (!elementInterface || !elementInterface->observesAttribute(attributeName.localName()))
         return;
 
-    if (auto* queue = CustomElementLifecycleProcessingStack::ensureCurrentQueue())
+    if (auto* queue = CustomElementReactionStack::ensureCurrentQueue())
         queue->m_items.append({element, *elementInterface, attributeName, oldValue, newValue});
 }
 
-void LifecycleCallbackQueue::invokeAll()
+void CustomElementReactionQueue::invokeAll()
 {
-    Vector<LifecycleQueueItem> items;
+    Vector<CustomElementReactionQueueItem> items;
     items.swap(m_items);
     for (auto& item : items)
         item.invoke();
 }
 
-LifecycleCallbackQueue* CustomElementLifecycleProcessingStack::ensureCurrentQueue()
+CustomElementReactionQueue* CustomElementReactionStack::ensureCurrentQueue()
 {
     // FIXME: This early exit indicates a bug that some DOM API is missing CEReactions
     if (!s_currentProcessingStack)
         return nullptr;
 
     auto*& queue = s_currentProcessingStack->m_queue;
-    if (!queue) // We use a raw pointer to avoid genearing code to delete it in ~CustomElementLifecycleProcessingStack.
-        queue = new LifecycleCallbackQueue;
+    if (!queue) // We use a raw pointer to avoid genearing code to delete it in ~CustomElementReactionStack.
+        queue = new CustomElementReactionQueue;
     return queue;
 }
 
-CustomElementLifecycleProcessingStack* CustomElementLifecycleProcessingStack::s_currentProcessingStack = nullptr;
+CustomElementReactionStack* CustomElementReactionStack::s_currentProcessingStack = nullptr;
 
-void CustomElementLifecycleProcessingStack::processQueue()
+void CustomElementReactionStack::processQueue()
 {
     ASSERT(m_queue);
     m_queue->invokeAll();
@@ -36,14 +36,14 @@ namespace WebCore {
 class JSCustomElementInterface;
 class Document;
 class Element;
-class LifecycleQueueItem;
+class CustomElementReactionQueueItem;
 class QualifiedName;
 
-class LifecycleCallbackQueue {
-    WTF_MAKE_NONCOPYABLE(LifecycleCallbackQueue);
+class CustomElementReactionQueue {
+    WTF_MAKE_NONCOPYABLE(CustomElementReactionQueue);
 public:
-    LifecycleCallbackQueue();
-    ~LifecycleCallbackQueue();
+    CustomElementReactionQueue();
+    ~CustomElementReactionQueue();
 
     static void enqueueElementUpgrade(Element&, JSCustomElementInterface&);
     static void enqueueConnectedCallbackIfNeeded(Element&);
@@ -53,18 +53,18 @@ public:
     void invokeAll();
 
 private:
-    Vector<LifecycleQueueItem> m_items;
+    Vector<CustomElementReactionQueueItem> m_items;
 };
 
-class CustomElementLifecycleProcessingStack {
+class CustomElementReactionStack {
 public:
-    CustomElementLifecycleProcessingStack()
+    CustomElementReactionStack()
         : m_previousProcessingStack(s_currentProcessingStack)
     {
         s_currentProcessingStack = this;
     }
 
-    ~CustomElementLifecycleProcessingStack()
+    ~CustomElementReactionStack()
     {
         if (UNLIKELY(m_queue))
             processQueue();
@@ -72,17 +72,17 @@ public:
     }
 
     // FIXME: This should be a reference once "ensure" starts to work.
-    static LifecycleCallbackQueue* ensureCurrentQueue();
+    static CustomElementReactionQueue* ensureCurrentQueue();
 
     static bool hasCurrentProcessingStack() { return s_currentProcessingStack; }
 
 private:
     void processQueue();
 
-    LifecycleCallbackQueue* m_queue { nullptr };
-    CustomElementLifecycleProcessingStack* m_previousProcessingStack;
+    CustomElementReactionQueue* m_queue { nullptr };
+    CustomElementReactionStack* m_previousProcessingStack;
 
-    static CustomElementLifecycleProcessingStack* s_currentProcessingStack;
+    static CustomElementReactionStack* s_currentProcessingStack;
 };
 
 }
index 07a11b2..29d3fd7 100644 (file)
@@ -44,6 +44,7 @@
 #include "CompositionEvent.h"
 #include "ContentSecurityPolicy.h"
 #include "CookieJar.h"
+#include "CustomElementReactionQueue.h"
 #include "CustomElementsRegistry.h"
 #include "CustomEvent.h"
 #include "DOMImplementation.h"
 #include "JSModuleLoader.h"
 #include "KeyboardEvent.h"
 #include "Language.h"
-#include "LifecycleCallbackQueue.h"
 #include "LoaderStrategy.h"
 #include "Logging.h"
 #include "MainFrame.h"
@@ -1093,7 +1093,7 @@ static Ref<HTMLElement> createFallbackHTMLElement(Document& document, const Qual
             if (auto* elementInterface = registry->findInterface(name)) {
                 auto element = HTMLElement::create(name, document);
                 element->setIsUnresolvedCustomElement();
-                LifecycleCallbackQueue::enqueueElementUpgrade(element.get(), *elementInterface);
+                CustomElementReactionQueue::enqueueElementUpgrade(element.get(), *elementInterface);
                 return element;
             }
         }
index 9d9de2d..33e9bde 100644 (file)
@@ -37,6 +37,7 @@
 #include "ClientRectList.h"
 #include "ComposedTreeAncestorIterator.h"
 #include "ContainerNodeAlgorithms.h"
+#include "CustomElementReactionQueue.h"
 #include "CustomElementsRegistry.h"
 #include "DOMTokenList.h"
 #include "Dictionary.h"
@@ -69,7 +70,6 @@
 #include "JSLazyEventListener.h"
 #include "KeyboardEvent.h"
 #include "KeyframeEffect.h"
-#include "LifecycleCallbackQueue.h"
 #include "MainFrame.h"
 #include "MutationObserverInterestGroup.h"
 #include "MutationRecord.h"
@@ -1293,7 +1293,7 @@ void Element::attributeChanged(const QualifiedName& name, const AtomicString& ol
 
 #if ENABLE(CUSTOM_ELEMENTS)
     if (UNLIKELY(isCustomElement()))
-        LifecycleCallbackQueue::enqueueAttributeChangedCallbackIfNeeded(*this, name, oldValue, newValue);
+        CustomElementReactionQueue::enqueueAttributeChangedCallbackIfNeeded(*this, name, oldValue, newValue);
 #endif
 
     if (valueIsSameAsBefore)
@@ -1598,7 +1598,7 @@ Node::InsertionNotificationRequest Element::insertedInto(ContainerNode& insertio
 
 #if ENABLE(CUSTOM_ELEMENTS)
     if (newDocument && UNLIKELY(isCustomElement()))
-        LifecycleCallbackQueue::enqueueConnectedCallbackIfNeeded(*this);
+        CustomElementReactionQueue::enqueueConnectedCallbackIfNeeded(*this);
 #endif
 
     return InsertionDone;
@@ -1649,7 +1649,7 @@ void Element::removedFrom(ContainerNode& insertionPoint)
 
 #if ENABLE(CUSTOM_ELEMENTS)
         if (oldDocument && UNLIKELY(isCustomElement()))
-            LifecycleCallbackQueue::enqueueDisconnectedCallbackIfNeeded(*this);
+            CustomElementReactionQueue::enqueueDisconnectedCallbackIfNeeded(*this);
 #endif
     }