<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[204652] trunk/Source/WebCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/204652">204652</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2016-08-19 14:02:31 -0700 (Fri, 19 Aug 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>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):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSCustomElementsRegistryCustomcpp">trunk/Source/WebCore/bindings/js/JSCustomElementsRegistryCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSMainThreadExecStateh">trunk/Source/WebCore/bindings/js/JSMainThreadExecState.h</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm">trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp">trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsscriptstestTestObjidl">trunk/Source/WebCore/bindings/scripts/test/TestObj.idl</a></li>
<li><a href="#trunkSourceWebCoredomDocumentcpp">trunk/Source/WebCore/dom/Document.cpp</a></li>
<li><a href="#trunkSourceWebCoredomElementcpp">trunk/Source/WebCore/dom/Element.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoredomCustomElementReactionQueuecpp">trunk/Source/WebCore/dom/CustomElementReactionQueue.cpp</a></li>
<li><a href="#trunkSourceWebCoredomCustomElementReactionQueueh">trunk/Source/WebCore/dom/CustomElementReactionQueue.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoredomLifecycleCallbackQueuecpp">trunk/Source/WebCore/dom/LifecycleCallbackQueue.cpp</a></li>
<li><a href="#trunkSourceWebCoredomLifecycleCallbackQueueh">trunk/Source/WebCore/dom/LifecycleCallbackQueue.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (204651 => 204652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2016-08-19 20:40:16 UTC (rev 204651)
+++ trunk/Source/WebCore/CMakeLists.txt        2016-08-19 21:02:31 UTC (rev 204652)
</span><span class="lines">@@ -1438,6 +1438,7 @@
</span><span class="cx">     dom/ContainerNode.cpp
</span><span class="cx">     dom/ContainerNodeAlgorithms.cpp
</span><span class="cx">     dom/ContextDestructionObserver.cpp
</span><ins>+    dom/CustomElementReactionQueue.cpp
</ins><span class="cx">     dom/CustomElementsRegistry.cpp
</span><span class="cx">     dom/CustomEvent.cpp
</span><span class="cx">     dom/DOMCoreException.cpp
</span><span class="lines">@@ -1484,7 +1485,6 @@
</span><span class="cx">     dom/IdTargetObserverRegistry.cpp
</span><span class="cx">     dom/InlineStyleSheetOwner.cpp
</span><span class="cx">     dom/KeyboardEvent.cpp
</span><del>-    dom/LifecycleCallbackQueue.cpp
</del><span class="cx">     dom/LiveNodeList.cpp
</span><span class="cx">     dom/MessageChannel.cpp
</span><span class="cx">     dom/MessageEvent.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (204651 => 204652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-08-19 20:40:16 UTC (rev 204651)
+++ trunk/Source/WebCore/ChangeLog        2016-08-19 21:02:31 UTC (rev 204652)
</span><span class="lines">@@ -1,3 +1,58 @@
</span><ins>+2016-08-18  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
+
+        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):
+
</ins><span class="cx"> 2016-08-19  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Attr.prefix / Element.prefix attribute should be readonly
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (204651 => 204652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-08-19 20:40:16 UTC (rev 204651)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2016-08-19 21:02:31 UTC (rev 204652)
</span><span class="lines">@@ -3930,7 +3930,7 @@
</span><span class="cx">                 9B532EA31BA928570038A827 /* SlotAssignment.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B532EA11BA928570038A827 /* SlotAssignment.cpp */; };
</span><span class="cx">                 9B532EA41BA928570038A827 /* SlotAssignment.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B532EA21BA928570038A827 /* SlotAssignment.h */; };
</span><span class="cx">                 9B55EEE91B3E8898005342BC /* EditorCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 9B55EEE81B3E8898005342BC /* EditorCocoa.mm */; };
</span><del>-                9B56C9AA1C89329A00C456DF /* LifecycleCallbackQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B56C9A91C89329A00C456DF /* LifecycleCallbackQueue.cpp */; };
</del><ins>+                9B56C9AA1C89329A00C456DF /* CustomElementReactionQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B56C9A91C89329A00C456DF /* CustomElementReactionQueue.cpp */; };
</ins><span class="cx">                 9B69D3B41B98FFE900E3512B /* HTMLSlotElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B69D3B21B98FFE900E3512B /* HTMLSlotElement.cpp */; };
</span><span class="cx">                 9B69D3B51B98FFE900E3512B /* HTMLSlotElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B69D3B31B98FFE900E3512B /* HTMLSlotElement.h */; };
</span><span class="cx">                 9B69D3B81B99100700E3512B /* JSHTMLSlotElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9B69D3B61B99100700E3512B /* JSHTMLSlotElement.cpp */; };
</span><span class="lines">@@ -11515,8 +11515,8 @@
</span><span class="cx">                 9B532EA11BA928570038A827 /* SlotAssignment.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SlotAssignment.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 9B532EA21BA928570038A827 /* SlotAssignment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SlotAssignment.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 9B55EEE81B3E8898005342BC /* EditorCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EditorCocoa.mm; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                9B56C9A81C89312800C456DF /* LifecycleCallbackQueue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LifecycleCallbackQueue.h; sourceTree = &quot;&lt;group&gt;&quot;; };
-                9B56C9A91C89329A00C456DF /* LifecycleCallbackQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LifecycleCallbackQueue.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><ins>+                9B56C9A81C89312800C456DF /* CustomElementReactionQueue.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CustomElementReactionQueue.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                9B56C9A91C89329A00C456DF /* CustomElementReactionQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CustomElementReactionQueue.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 9B69D3B11B98FF0A00E3512B /* HTMLSlotElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLSlotElement.idl; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 9B69D3B21B98FFE900E3512B /* HTMLSlotElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLSlotElement.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 9B69D3B31B98FFE900E3512B /* HTMLSlotElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLSlotElement.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -23998,6 +23998,8 @@
</span><span class="cx">                                 9BD4E9181C462CFC005065BC /* CustomElementsRegistry.cpp */,
</span><span class="cx">                                 9BD4E9191C462CFC005065BC /* CustomElementsRegistry.h */,
</span><span class="cx">                                 9BC5F9DE1D5AAD5D002B749D /* CustomElementsRegistry.idl */,
</span><ins>+                                9B56C9A91C89329A00C456DF /* CustomElementReactionQueue.cpp */,
+                                9B56C9A81C89312800C456DF /* CustomElementReactionQueue.h */,
</ins><span class="cx">                                 62CD32561157E57C0063B0A7 /* CustomEvent.cpp */,
</span><span class="cx">                                 62CD32571157E57C0063B0A7 /* CustomEvent.h */,
</span><span class="cx">                                 62CD32581157E57C0063B0A7 /* CustomEvent.idl */,
</span><span class="lines">@@ -24137,8 +24139,6 @@
</span><span class="cx">                                 85031B2D0A44EFC700F992E0 /* KeyboardEvent.cpp */,
</span><span class="cx">                                 85031B2E0A44EFC700F992E0 /* KeyboardEvent.h */,
</span><span class="cx">                                 14CF7C2009F7110600EB3665 /* KeyboardEvent.idl */,
</span><del>-                                9B56C9A91C89329A00C456DF /* LifecycleCallbackQueue.cpp */,
-                                9B56C9A81C89312800C456DF /* LifecycleCallbackQueue.h */,
</del><span class="cx">                                 BC7FA61E0D1F0CBD00DB22A9 /* LiveNodeList.cpp */,
</span><span class="cx">                                 BC7FA61F0D1F0CBD00DB22A9 /* LiveNodeList.h */,
</span><span class="cx">                                 BC9A6144146859D9006057FD /* make_dom_exceptions.pl */,
</span><span class="lines">@@ -30576,7 +30576,7 @@
</span><span class="cx">                                 E55F497A151B888000BB67DB /* LengthFunctions.cpp in Sources */,
</span><span class="cx">                                 0F87166F1C869D83004FF0DE /* LengthPoint.cpp in Sources */,
</span><span class="cx">                                 0FEF20CE1BD4A24100128E5D /* LengthSize.cpp in Sources */,
</span><del>-                                9B56C9AA1C89329A00C456DF /* LifecycleCallbackQueue.cpp in Sources */,
</del><ins>+                                9B56C9AA1C89329A00C456DF /* CustomElementReactionQueue.cpp in Sources */,
</ins><span class="cx">                                 FFB698CC1833EE0D00158A31 /* LineBreaker.cpp in Sources */,
</span><span class="cx">                                 89B5EAA111E8003D00F2367E /* LineEnding.cpp in Sources */,
</span><span class="cx">                                 FFB698CF183402BB00158A31 /* LineInfo.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSCustomElementsRegistryCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSCustomElementsRegistryCustom.cpp (204651 => 204652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSCustomElementsRegistryCustom.cpp        2016-08-19 20:40:16 UTC (rev 204651)
+++ trunk/Source/WebCore/bindings/js/JSCustomElementsRegistryCustom.cpp        2016-08-19 21:02:31 UTC (rev 204652)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CUSTOM_ELEMENTS)
</span><span class="cx"> 
</span><del>-static JSObject* getLifecycleCallback(ExecState&amp; state, JSObject&amp; prototype, const Identifier&amp; id)
</del><ins>+static JSObject* getCustomElementCallback(ExecState&amp; state, JSObject&amp; prototype, const Identifier&amp; id)
</ins><span class="cx"> {
</span><span class="cx">     JSValue callback = prototype.get(&amp;state, id);
</span><span class="cx">     if (state.hadException())
</span><span class="lines">@@ -47,7 +47,7 @@
</span><span class="cx">     if (callback.isUndefined())
</span><span class="cx">         return nullptr;
</span><span class="cx">     if (!callback.isFunction()) {
</span><del>-        throwTypeError(&amp;state, ASCIILiteral(&quot;A lifecycle callback must be a function&quot;));
</del><ins>+        throwTypeError(&amp;state, ASCIILiteral(&quot;A custom element callback must be a function&quot;));
</ins><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><span class="cx">     return callback.getObject();
</span><span class="lines">@@ -107,13 +107,13 @@
</span><span class="cx">     QualifiedName name(nullAtom, localName, HTMLNames::xhtmlNamespaceURI);
</span><span class="cx">     auto elementInterface = JSCustomElementInterface::create(name, constructor, globalObject());
</span><span class="cx"> 
</span><del>-    auto* connectedCallback = getLifecycleCallback(state, prototypeObject, Identifier::fromString(&amp;vm, &quot;connectedCallback&quot;));
</del><ins>+    auto* connectedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&amp;vm, &quot;connectedCallback&quot;));
</ins><span class="cx">     if (state.hadException())
</span><span class="cx">         return jsUndefined();
</span><span class="cx">     if (connectedCallback)
</span><span class="cx">         elementInterface-&gt;setConnectedCallback(connectedCallback);
</span><span class="cx"> 
</span><del>-    auto* disconnectedCallback = getLifecycleCallback(state, prototypeObject, Identifier::fromString(&amp;vm, &quot;disconnectedCallback&quot;));
</del><ins>+    auto* disconnectedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&amp;vm, &quot;disconnectedCallback&quot;));
</ins><span class="cx">     if (state.hadException())
</span><span class="cx">         return jsUndefined();
</span><span class="cx">     if (disconnectedCallback)
</span><span class="lines">@@ -120,11 +120,11 @@
</span><span class="cx">         elementInterface-&gt;setDisconnectedCallback(disconnectedCallback);
</span><span class="cx"> 
</span><span class="cx">     // FIXME: Add the support for adoptedCallback.
</span><del>-    getLifecycleCallback(state, prototypeObject, Identifier::fromString(&amp;vm, &quot;adoptedCallback&quot;));
</del><ins>+    getCustomElementCallback(state, prototypeObject, Identifier::fromString(&amp;vm, &quot;adoptedCallback&quot;));
</ins><span class="cx">     if (state.hadException())
</span><span class="cx">         return jsUndefined();
</span><span class="cx"> 
</span><del>-    auto* attributeChangedCallback = getLifecycleCallback(state, prototypeObject, Identifier::fromString(&amp;vm, &quot;attributeChangedCallback&quot;));
</del><ins>+    auto* attributeChangedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&amp;vm, &quot;attributeChangedCallback&quot;));
</ins><span class="cx">     if (state.hadException())
</span><span class="cx">         return jsUndefined();
</span><span class="cx">     if (attributeChangedCallback) {
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSMainThreadExecStateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSMainThreadExecState.h (204651 => 204652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSMainThreadExecState.h        2016-08-19 20:40:16 UTC (rev 204651)
+++ trunk/Source/WebCore/bindings/js/JSMainThreadExecState.h        2016-08-19 21:02:31 UTC (rev 204652)
</span><span class="lines">@@ -26,8 +26,8 @@
</span><span class="cx"> #ifndef JSMainThreadExecState_h
</span><span class="cx"> #define JSMainThreadExecState_h
</span><span class="cx"> 
</span><ins>+#include &quot;CustomElementReactionQueue.h&quot;
</ins><span class="cx"> #include &quot;JSDOMBinding.h&quot;
</span><del>-#include &quot;LifecycleCallbackQueue.h&quot;
</del><span class="cx"> #include &lt;runtime/Completion.h&gt;
</span><span class="cx"> #include &lt;runtime/Microtask.h&gt;
</span><span class="cx"> #include &lt;wtf/MainThread.h&gt;
</span><span class="lines">@@ -148,7 +148,7 @@
</span><span class="cx"> private:
</span><span class="cx">     JSC::ExecState* m_previousState;
</span><span class="cx"> #if ENABLE(CUSTOM_ELEMENTS)
</span><del>-    CustomElementLifecycleProcessingStack m_lifecycleProcessingStack;
</del><ins>+    CustomElementReactionStack m_customElementReactionStack;
</ins><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptsCodeGeneratorJSpm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (204651 => 204652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-08-19 20:40:16 UTC (rev 204651)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm        2016-08-19 21:02:31 UTC (rev 204652)
</span><span class="lines">@@ -3342,9 +3342,9 @@
</span><span class="cx"> 
</span><span class="cx">             if ($function-&gt;signature-&gt;extendedAttributes-&gt;{&quot;CEReactions&quot;}) {
</span><span class="cx">                 push(@implContent, &quot;#if ENABLE(CUSTOM_ELEMENTS)\n&quot;);
</span><del>-                push(@implContent, &quot;    CustomElementLifecycleProcessingStack customElementLifecycleProcessingStack;\n&quot;);
</del><ins>+                push(@implContent, &quot;    CustomElementReactionStack customElementReactionStack;\n&quot;);
</ins><span class="cx">                 push(@implContent, &quot;#endif\n&quot;);
</span><del>-                $implIncludes{&quot;LifecycleCallbackQueue.h&quot;} = 1;
</del><ins>+                $implIncludes{&quot;CustomElementReactionQueue.h&quot;} = 1;
</ins><span class="cx">             }
</span><span class="cx"> 
</span><span class="cx">             if ($function-&gt;isStatic) {
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestJSJSTestObjcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (204651 => 204652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-08-19 20:40:16 UTC (rev 204651)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp        2016-08-19 21:02:31 UTC (rev 204652)
</span><span class="lines">@@ -22,6 +22,7 @@
</span><span class="cx"> #include &quot;JSTestObj.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CallbackFunction.h&quot;
</span><ins>+#include &quot;CustomElementReactionQueue.h&quot;
</ins><span class="cx"> #include &quot;DOMStringList.h&quot;
</span><span class="cx"> #include &quot;Dictionary.h&quot;
</span><span class="cx"> #include &quot;Document.h&quot;
</span><span class="lines">@@ -49,7 +50,6 @@
</span><span class="cx"> #include &quot;JSTestObj.h&quot;
</span><span class="cx"> #include &quot;JSTestSubObj.h&quot;
</span><span class="cx"> #include &quot;JSXPathNSResolver.h&quot;
</span><del>-#include &quot;LifecycleCallbackQueue.h&quot;
</del><span class="cx"> #include &quot;RuntimeEnabledFeatures.h&quot;
</span><span class="cx"> #include &quot;SVGDocument.h&quot;
</span><span class="cx"> #include &quot;SVGPoint.h&quot;
</span><span class="lines">@@ -724,7 +724,7 @@
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionTestPromiseOverloadedFunction(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionTestStaticPromiseFunction(JSC::ExecState*);
</span><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjConstructorFunctionTestStaticPromiseFunctionWithException(JSC::ExecState*);
</span><del>-JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNeedsLifecycleProcessingStack(JSC::ExecState*);
</del><ins>+JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNeedsCustomElementReactionStack(JSC::ExecState*);
</ins><span class="cx"> JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionAttachShadowRoot(JSC::ExecState*);
</span><span class="cx"> 
</span><span class="cx"> // Attributes
</span><span class="lines">@@ -1311,7 +1311,7 @@
</span><span class="cx">     { &quot;testPromiseFunctionWithException&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionTestPromiseFunctionWithException), (intptr_t) (0) } },
</span><span class="cx">     { &quot;testPromiseFunctionWithOptionalIntArgument&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgument), (intptr_t) (0) } },
</span><span class="cx">     { &quot;testPromiseOverloadedFunction&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionTestPromiseOverloadedFunction), (intptr_t) (1) } },
</span><del>-    { &quot;methodWithNeedsLifecycleProcessingStack&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionMethodWithNeedsLifecycleProcessingStack), (intptr_t) (0) } },
</del><ins>+    { &quot;methodWithNeedsCustomElementReactionStack&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionMethodWithNeedsCustomElementReactionStack), (intptr_t) (0) } },
</ins><span class="cx">     { &quot;attachShadowRoot&quot;, JSC::Function, NoIntrinsic, { (intptr_t)static_cast&lt;NativeFunction&gt;(jsTestObjPrototypeFunctionAttachShadowRoot), (intptr_t) (1) } },
</span><span class="cx"> #if ENABLE(Condition1)
</span><span class="cx">     { &quot;CONDITIONAL_CONST&quot;, DontDelete | ReadOnly | ConstantInteger, NoIntrinsic, { (long long)(0) } },
</span><span class="lines">@@ -6376,18 +6376,18 @@
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNeedsLifecycleProcessingStack(ExecState* state)
</del><ins>+EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNeedsCustomElementReactionStack(ExecState* state)
</ins><span class="cx"> {
</span><span class="cx"> #if ENABLE(CUSTOM_ELEMENTS)
</span><del>-    CustomElementLifecycleProcessingStack customElementLifecycleProcessingStack;
</del><ins>+    CustomElementReactionStack customElementReactionStack;
</ins><span class="cx"> #endif
</span><span class="cx">     JSValue thisValue = state-&gt;thisValue();
</span><span class="cx">     auto castedThis = jsDynamicCast&lt;JSTestObj*&gt;(thisValue);
</span><span class="cx">     if (UNLIKELY(!castedThis))
</span><del>-        return throwThisTypeError(*state, &quot;TestObject&quot;, &quot;methodWithNeedsLifecycleProcessingStack&quot;);
</del><ins>+        return throwThisTypeError(*state, &quot;TestObject&quot;, &quot;methodWithNeedsCustomElementReactionStack&quot;);
</ins><span class="cx">     ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
</span><span class="cx">     auto&amp; impl = castedThis-&gt;wrapped();
</span><del>-    impl.methodWithNeedsLifecycleProcessingStack();
</del><ins>+    impl.methodWithNeedsCustomElementReactionStack();
</ins><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsscriptstestTestObjidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/scripts/test/TestObj.idl (204651 => 204652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-08-19 20:40:16 UTC (rev 204651)
+++ trunk/Source/WebCore/bindings/scripts/test/TestObj.idl        2016-08-19 21:02:31 UTC (rev 204652)
</span><span class="lines">@@ -390,7 +390,7 @@
</span><span class="cx">     [PutForwards=name] readonly attribute TestNode? putForwardsNullableAttribute;
</span><span class="cx"> 
</span><span class="cx"> #if defined(TESTING_JS)
</span><del>-    [CEReactions] void methodWithNeedsLifecycleProcessingStack();
</del><ins>+    [CEReactions] void methodWithNeedsCustomElementReactionStack();
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     void attachShadowRoot(TestDictionary init);
</span></span></pre></div>
<a id="trunkSourceWebCoredomCustomElementReactionQueuecppfromrev204651trunkSourceWebCoredomLifecycleCallbackQueuecpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/dom/CustomElementReactionQueue.cpp (from rev 204651, trunk/Source/WebCore/dom/LifecycleCallbackQueue.cpp) (0 => 204652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/CustomElementReactionQueue.cpp                                (rev 0)
+++ trunk/Source/WebCore/dom/CustomElementReactionQueue.cpp        2016-08-19 21:02:31 UTC (rev 204652)
</span><span class="lines">@@ -0,0 +1,185 @@
</span><ins>+/*
+ * Copyright (C) 2015, 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;CustomElementReactionQueue.h&quot;
+
+#if ENABLE(CUSTOM_ELEMENTS)
+
+#include &quot;CustomElementsRegistry.h&quot;
+#include &quot;DOMWindow.h&quot;
+#include &quot;Document.h&quot;
+#include &quot;Element.h&quot;
+#include &quot;JSCustomElementInterface.h&quot;
+#include &quot;JSDOMBinding.h&quot;
+#include &lt;heap/Heap.h&gt;
+#include &lt;wtf/Optional.h&gt;
+#include &lt;wtf/Ref.h&gt;
+
+namespace WebCore {
+
+class CustomElementReactionQueueItem {
+public:
+    enum class Type {
+        ElementUpgrade,
+        Connected,
+        Disconnected,
+        AttributeChanged,
+    };
+
+    CustomElementReactionQueueItem(Type type, Element&amp; element, JSCustomElementInterface&amp; elementInterface)
+        : m_type(type)
+        , m_element(element)
+        , m_interface(elementInterface)
+    { }
+
+    CustomElementReactionQueueItem(Element&amp; element, JSCustomElementInterface&amp; elementInterface, const QualifiedName&amp; attributeName, const AtomicString&amp; oldValue, const AtomicString&amp; newValue)
+        : m_type(Type::AttributeChanged)
+        , m_element(element)
+        , m_interface(elementInterface)
+        , m_attributeName(attributeName)
+        , m_oldValue(oldValue)
+        , m_newValue(newValue)
+    { }
+
+    void invoke()
+    {
+        switch (m_type) {
+        case Type::ElementUpgrade:
+            m_interface-&gt;upgradeElement(m_element.get());
+            break;
+        case Type::Connected:
+            m_interface-&gt;invokeConnectedCallback(m_element.get());
+            break;
+        case Type::Disconnected:
+            m_interface-&gt;invokeDisconnectedCallback(m_element.get());
+            break;
+        case Type::AttributeChanged:
+            ASSERT(m_attributeName);
+            m_interface-&gt;invokeAttributeChangedCallback(m_element.get(), m_attributeName.value(), m_oldValue, m_newValue);
+            break;
+        }
+    }
+
+private:
+    Type m_type;
+    Ref&lt;Element&gt; m_element;
+    Ref&lt;JSCustomElementInterface&gt; m_interface;
+    Optional&lt;QualifiedName&gt; m_attributeName;
+    AtomicString m_oldValue;
+    AtomicString m_newValue;
+};
+
+CustomElementReactionQueue::CustomElementReactionQueue()
+{ }
+
+CustomElementReactionQueue::~CustomElementReactionQueue()
+{
+    ASSERT(m_items.isEmpty());
+}
+
+void CustomElementReactionQueue::enqueueElementUpgrade(Element&amp; element, JSCustomElementInterface&amp; elementInterface)
+{
+    if (auto* queue = CustomElementReactionStack::ensureCurrentQueue())
+        queue-&gt;m_items.append({CustomElementReactionQueueItem::Type::ElementUpgrade, element, elementInterface});
+}
+
+static JSCustomElementInterface* findInterfaceForCustomElement(Element&amp; element)
+{
+    ASSERT(element.isCustomElement());
+    auto* window = element.document().domWindow();
+    if (!window)
+        return nullptr;
+
+    auto* registry = window-&gt;customElementsRegistry();
+    if (!registry)
+        return nullptr;
+
+    return registry-&gt;findInterface(element.tagQName());
+}
+
+void CustomElementReactionQueue::enqueueConnectedCallbackIfNeeded(Element&amp; element)
+{
+    auto* elementInterface = findInterfaceForCustomElement(element);
+    if (!elementInterface)
+        return;
+
+    if (auto* queue = CustomElementReactionStack::ensureCurrentQueue())
+        queue-&gt;m_items.append({CustomElementReactionQueueItem::Type::Connected, element, *elementInterface});
+}
+
+void CustomElementReactionQueue::enqueueDisconnectedCallbackIfNeeded(Element&amp; element)
+{
+    auto* elementInterface = findInterfaceForCustomElement(element);
+    if (!elementInterface)
+        return;
+
+    if (auto* queue = CustomElementReactionStack::ensureCurrentQueue())
+        queue-&gt;m_items.append({CustomElementReactionQueueItem::Type::Disconnected, element, *elementInterface});
+}
+
+void CustomElementReactionQueue::enqueueAttributeChangedCallbackIfNeeded(Element&amp; element, const QualifiedName&amp; attributeName, const AtomicString&amp; oldValue, const AtomicString&amp; newValue)
+{
+    auto* elementInterface = findInterfaceForCustomElement(element);
+    if (!elementInterface || !elementInterface-&gt;observesAttribute(attributeName.localName()))
+        return;
+
+    if (auto* queue = CustomElementReactionStack::ensureCurrentQueue())
+        queue-&gt;m_items.append({element, *elementInterface, attributeName, oldValue, newValue});
+}
+
+void CustomElementReactionQueue::invokeAll()
+{
+    Vector&lt;CustomElementReactionQueueItem&gt; items;
+    items.swap(m_items);
+    for (auto&amp; item : items)
+        item.invoke();
+}
+
+CustomElementReactionQueue* CustomElementReactionStack::ensureCurrentQueue()
+{
+    // FIXME: This early exit indicates a bug that some DOM API is missing CEReactions
+    if (!s_currentProcessingStack)
+        return nullptr;
+
+    auto*&amp; queue = s_currentProcessingStack-&gt;m_queue;
+    if (!queue) // We use a raw pointer to avoid genearing code to delete it in ~CustomElementReactionStack.
+        queue = new CustomElementReactionQueue;
+    return queue;
+}
+
+CustomElementReactionStack* CustomElementReactionStack::s_currentProcessingStack = nullptr;
+
+void CustomElementReactionStack::processQueue()
+{
+    ASSERT(m_queue);
+    m_queue-&gt;invokeAll();
+    delete m_queue;
+    m_queue = nullptr;
+}
+
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCoredomCustomElementReactionQueuehfromrev204651trunkSourceWebCoredomLifecycleCallbackQueueh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/dom/CustomElementReactionQueue.h (from rev 204651, trunk/Source/WebCore/dom/LifecycleCallbackQueue.h) (0 => 204652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/CustomElementReactionQueue.h                                (rev 0)
+++ trunk/Source/WebCore/dom/CustomElementReactionQueue.h        2016-08-19 21:02:31 UTC (rev 204652)
</span><span class="lines">@@ -0,0 +1,90 @@
</span><ins>+/*
+ * Copyright (C) 2015, 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#if ENABLE(CUSTOM_ELEMENTS)
+
+#include &lt;wtf/Forward.h&gt;
+#include &lt;wtf/Noncopyable.h&gt;
+#include &lt;wtf/Vector.h&gt;
+
+namespace WebCore {
+
+class JSCustomElementInterface;
+class Document;
+class Element;
+class CustomElementReactionQueueItem;
+class QualifiedName;
+
+class CustomElementReactionQueue {
+    WTF_MAKE_NONCOPYABLE(CustomElementReactionQueue);
+public:
+    CustomElementReactionQueue();
+    ~CustomElementReactionQueue();
+
+    static void enqueueElementUpgrade(Element&amp;, JSCustomElementInterface&amp;);
+    static void enqueueConnectedCallbackIfNeeded(Element&amp;);
+    static void enqueueDisconnectedCallbackIfNeeded(Element&amp;);
+    static void enqueueAttributeChangedCallbackIfNeeded(Element&amp;, const QualifiedName&amp;, const AtomicString&amp; oldValue, const AtomicString&amp; newValue);
+
+    void invokeAll();
+
+private:
+    Vector&lt;CustomElementReactionQueueItem&gt; m_items;
+};
+
+class CustomElementReactionStack {
+public:
+    CustomElementReactionStack()
+        : m_previousProcessingStack(s_currentProcessingStack)
+    {
+        s_currentProcessingStack = this;
+    }
+
+    ~CustomElementReactionStack()
+    {
+        if (UNLIKELY(m_queue))
+            processQueue();
+        s_currentProcessingStack = m_previousProcessingStack;
+    }
+
+    // FIXME: This should be a reference once &quot;ensure&quot; starts to work.
+    static CustomElementReactionQueue* ensureCurrentQueue();
+
+    static bool hasCurrentProcessingStack() { return s_currentProcessingStack; }
+
+private:
+    void processQueue();
+
+    CustomElementReactionQueue* m_queue { nullptr };
+    CustomElementReactionStack* m_previousProcessingStack;
+
+    static CustomElementReactionStack* s_currentProcessingStack;
+};
+
+}
+
+#endif
</ins></span></pre></div>
<a id="trunkSourceWebCoredomDocumentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Document.cpp (204651 => 204652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Document.cpp        2016-08-19 20:40:16 UTC (rev 204651)
+++ trunk/Source/WebCore/dom/Document.cpp        2016-08-19 21:02:31 UTC (rev 204652)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> #include &quot;CompositionEvent.h&quot;
</span><span class="cx"> #include &quot;ContentSecurityPolicy.h&quot;
</span><span class="cx"> #include &quot;CookieJar.h&quot;
</span><ins>+#include &quot;CustomElementReactionQueue.h&quot;
</ins><span class="cx"> #include &quot;CustomElementsRegistry.h&quot;
</span><span class="cx"> #include &quot;CustomEvent.h&quot;
</span><span class="cx"> #include &quot;DOMImplementation.h&quot;
</span><span class="lines">@@ -105,7 +106,6 @@
</span><span class="cx"> #include &quot;JSModuleLoader.h&quot;
</span><span class="cx"> #include &quot;KeyboardEvent.h&quot;
</span><span class="cx"> #include &quot;Language.h&quot;
</span><del>-#include &quot;LifecycleCallbackQueue.h&quot;
</del><span class="cx"> #include &quot;LoaderStrategy.h&quot;
</span><span class="cx"> #include &quot;Logging.h&quot;
</span><span class="cx"> #include &quot;MainFrame.h&quot;
</span><span class="lines">@@ -1093,7 +1093,7 @@
</span><span class="cx">             if (auto* elementInterface = registry-&gt;findInterface(name)) {
</span><span class="cx">                 auto element = HTMLElement::create(name, document);
</span><span class="cx">                 element-&gt;setIsUnresolvedCustomElement();
</span><del>-                LifecycleCallbackQueue::enqueueElementUpgrade(element.get(), *elementInterface);
</del><ins>+                CustomElementReactionQueue::enqueueElementUpgrade(element.get(), *elementInterface);
</ins><span class="cx">                 return element;
</span><span class="cx">             }
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkSourceWebCoredomElementcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/dom/Element.cpp (204651 => 204652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/Element.cpp        2016-08-19 20:40:16 UTC (rev 204651)
+++ trunk/Source/WebCore/dom/Element.cpp        2016-08-19 21:02:31 UTC (rev 204652)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> #include &quot;ClientRectList.h&quot;
</span><span class="cx"> #include &quot;ComposedTreeAncestorIterator.h&quot;
</span><span class="cx"> #include &quot;ContainerNodeAlgorithms.h&quot;
</span><ins>+#include &quot;CustomElementReactionQueue.h&quot;
</ins><span class="cx"> #include &quot;CustomElementsRegistry.h&quot;
</span><span class="cx"> #include &quot;DOMTokenList.h&quot;
</span><span class="cx"> #include &quot;Dictionary.h&quot;
</span><span class="lines">@@ -69,7 +70,6 @@
</span><span class="cx"> #include &quot;JSLazyEventListener.h&quot;
</span><span class="cx"> #include &quot;KeyboardEvent.h&quot;
</span><span class="cx"> #include &quot;KeyframeEffect.h&quot;
</span><del>-#include &quot;LifecycleCallbackQueue.h&quot;
</del><span class="cx"> #include &quot;MainFrame.h&quot;
</span><span class="cx"> #include &quot;MutationObserverInterestGroup.h&quot;
</span><span class="cx"> #include &quot;MutationRecord.h&quot;
</span><span class="lines">@@ -1293,7 +1293,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CUSTOM_ELEMENTS)
</span><span class="cx">     if (UNLIKELY(isCustomElement()))
</span><del>-        LifecycleCallbackQueue::enqueueAttributeChangedCallbackIfNeeded(*this, name, oldValue, newValue);
</del><ins>+        CustomElementReactionQueue::enqueueAttributeChangedCallbackIfNeeded(*this, name, oldValue, newValue);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     if (valueIsSameAsBefore)
</span><span class="lines">@@ -1598,7 +1598,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CUSTOM_ELEMENTS)
</span><span class="cx">     if (newDocument &amp;&amp; UNLIKELY(isCustomElement()))
</span><del>-        LifecycleCallbackQueue::enqueueConnectedCallbackIfNeeded(*this);
</del><ins>+        CustomElementReactionQueue::enqueueConnectedCallbackIfNeeded(*this);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     return InsertionDone;
</span><span class="lines">@@ -1649,7 +1649,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(CUSTOM_ELEMENTS)
</span><span class="cx">         if (oldDocument &amp;&amp; UNLIKELY(isCustomElement()))
</span><del>-            LifecycleCallbackQueue::enqueueDisconnectedCallbackIfNeeded(*this);
</del><ins>+            CustomElementReactionQueue::enqueueDisconnectedCallbackIfNeeded(*this);
</ins><span class="cx"> #endif
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoredomLifecycleCallbackQueuecpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/dom/LifecycleCallbackQueue.cpp (204651 => 204652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/LifecycleCallbackQueue.cpp        2016-08-19 20:40:16 UTC (rev 204651)
+++ trunk/Source/WebCore/dom/LifecycleCallbackQueue.cpp        2016-08-19 21:02:31 UTC (rev 204652)
</span><span class="lines">@@ -1,185 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015, 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include &quot;config.h&quot;
-#include &quot;LifecycleCallbackQueue.h&quot;
-
-#if ENABLE(CUSTOM_ELEMENTS)
-
-#include &quot;CustomElementsRegistry.h&quot;
-#include &quot;DOMWindow.h&quot;
-#include &quot;Document.h&quot;
-#include &quot;Element.h&quot;
-#include &quot;JSCustomElementInterface.h&quot;
-#include &quot;JSDOMBinding.h&quot;
-#include &lt;heap/Heap.h&gt;
-#include &lt;wtf/Optional.h&gt;
-#include &lt;wtf/Ref.h&gt;
-
-namespace WebCore {
-
-class LifecycleQueueItem {
-public:
-    enum class Type {
-        ElementUpgrade,
-        Connected,
-        Disconnected,
-        AttributeChanged,
-    };
-
-    LifecycleQueueItem(Type type, Element&amp; element, JSCustomElementInterface&amp; elementInterface)
-        : m_type(type)
-        , m_element(element)
-        , m_interface(elementInterface)
-    { }
-
-    LifecycleQueueItem(Element&amp; element, JSCustomElementInterface&amp; elementInterface, const QualifiedName&amp; attributeName, const AtomicString&amp; oldValue, const AtomicString&amp; newValue)
-        : m_type(Type::AttributeChanged)
-        , m_element(element)
-        , m_interface(elementInterface)
-        , m_attributeName(attributeName)
-        , m_oldValue(oldValue)
-        , m_newValue(newValue)
-    { }
-
-    void invoke()
-    {
-        switch (m_type) {
-        case Type::ElementUpgrade:
-            m_interface-&gt;upgradeElement(m_element.get());
-            break;
-        case Type::Connected:
-            m_interface-&gt;invokeConnectedCallback(m_element.get());
-            break;
-        case Type::Disconnected:
-            m_interface-&gt;invokeDisconnectedCallback(m_element.get());
-            break;
-        case Type::AttributeChanged:
-            ASSERT(m_attributeName);
-            m_interface-&gt;invokeAttributeChangedCallback(m_element.get(), m_attributeName.value(), m_oldValue, m_newValue);
-            break;
-        }
-    }
-
-private:
-    Type m_type;
-    Ref&lt;Element&gt; m_element;
-    Ref&lt;JSCustomElementInterface&gt; m_interface;
-    Optional&lt;QualifiedName&gt; m_attributeName;
-    AtomicString m_oldValue;
-    AtomicString m_newValue;
-};
-
-LifecycleCallbackQueue::LifecycleCallbackQueue()
-{ }
-
-LifecycleCallbackQueue::~LifecycleCallbackQueue()
-{
-    ASSERT(m_items.isEmpty());
-}
-
-void LifecycleCallbackQueue::enqueueElementUpgrade(Element&amp; element, JSCustomElementInterface&amp; elementInterface)
-{
-    if (auto* queue = CustomElementLifecycleProcessingStack::ensureCurrentQueue())
-        queue-&gt;m_items.append(LifecycleQueueItem(LifecycleQueueItem::Type::ElementUpgrade, element, elementInterface));
-}
-
-static JSCustomElementInterface* findInterfaceForCustomElement(Element&amp; element)
-{
-    ASSERT(element.isCustomElement());
-    auto* window = element.document().domWindow();
-    if (!window)
-        return nullptr;
-
-    auto* registry = window-&gt;customElementsRegistry();
-    if (!registry)
-        return nullptr;
-
-    return registry-&gt;findInterface(element.tagQName());
-}
-
-void LifecycleCallbackQueue::enqueueConnectedCallbackIfNeeded(Element&amp; element)
-{
-    auto* elementInterface = findInterfaceForCustomElement(element);
-    if (!elementInterface)
-        return;
-
-    if (auto* queue = CustomElementLifecycleProcessingStack::ensureCurrentQueue())
-        queue-&gt;m_items.append({LifecycleQueueItem::Type::Connected, element, *elementInterface});
-}
-
-void LifecycleCallbackQueue::enqueueDisconnectedCallbackIfNeeded(Element&amp; element)
-{
-    auto* elementInterface = findInterfaceForCustomElement(element);
-    if (!elementInterface)
-        return;
-
-    if (auto* queue = CustomElementLifecycleProcessingStack::ensureCurrentQueue())
-        queue-&gt;m_items.append({LifecycleQueueItem::Type::Disconnected, element, *elementInterface});
-}
-
-void LifecycleCallbackQueue::enqueueAttributeChangedCallbackIfNeeded(Element&amp; element, const QualifiedName&amp; attributeName, const AtomicString&amp; oldValue, const AtomicString&amp; newValue)
-{
-    auto* elementInterface = findInterfaceForCustomElement(element);
-    if (!elementInterface || !elementInterface-&gt;observesAttribute(attributeName.localName()))
-        return;
-
-    if (auto* queue = CustomElementLifecycleProcessingStack::ensureCurrentQueue())
-        queue-&gt;m_items.append({element, *elementInterface, attributeName, oldValue, newValue});
-}
-
-void LifecycleCallbackQueue::invokeAll()
-{
-    Vector&lt;LifecycleQueueItem&gt; items;
-    items.swap(m_items);
-    for (auto&amp; item : items)
-        item.invoke();
-}
-
-LifecycleCallbackQueue* CustomElementLifecycleProcessingStack::ensureCurrentQueue()
-{
-    // FIXME: This early exit indicates a bug that some DOM API is missing CEReactions
-    if (!s_currentProcessingStack)
-        return nullptr;
-
-    auto*&amp; queue = s_currentProcessingStack-&gt;m_queue;
-    if (!queue) // We use a raw pointer to avoid genearing code to delete it in ~CustomElementLifecycleProcessingStack.
-        queue = new LifecycleCallbackQueue;
-    return queue;
-}
-
-CustomElementLifecycleProcessingStack* CustomElementLifecycleProcessingStack::s_currentProcessingStack = nullptr;
-
-void CustomElementLifecycleProcessingStack::processQueue()
-{
-    ASSERT(m_queue);
-    m_queue-&gt;invokeAll();
-    delete m_queue;
-    m_queue = nullptr;
-}
-
-}
-
-#endif
</del></span></pre></div>
<a id="trunkSourceWebCoredomLifecycleCallbackQueueh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/dom/LifecycleCallbackQueue.h (204651 => 204652)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/LifecycleCallbackQueue.h        2016-08-19 20:40:16 UTC (rev 204651)
+++ trunk/Source/WebCore/dom/LifecycleCallbackQueue.h        2016-08-19 21:02:31 UTC (rev 204652)
</span><span class="lines">@@ -1,90 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015, 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#pragma once
-
-#if ENABLE(CUSTOM_ELEMENTS)
-
-#include &lt;wtf/Forward.h&gt;
-#include &lt;wtf/Noncopyable.h&gt;
-#include &lt;wtf/Vector.h&gt;
-
-namespace WebCore {
-
-class JSCustomElementInterface;
-class Document;
-class Element;
-class LifecycleQueueItem;
-class QualifiedName;
-
-class LifecycleCallbackQueue {
-    WTF_MAKE_NONCOPYABLE(LifecycleCallbackQueue);
-public:
-    LifecycleCallbackQueue();
-    ~LifecycleCallbackQueue();
-
-    static void enqueueElementUpgrade(Element&amp;, JSCustomElementInterface&amp;);
-    static void enqueueConnectedCallbackIfNeeded(Element&amp;);
-    static void enqueueDisconnectedCallbackIfNeeded(Element&amp;);
-    static void enqueueAttributeChangedCallbackIfNeeded(Element&amp;, const QualifiedName&amp;, const AtomicString&amp; oldValue, const AtomicString&amp; newValue);
-
-    void invokeAll();
-
-private:
-    Vector&lt;LifecycleQueueItem&gt; m_items;
-};
-
-class CustomElementLifecycleProcessingStack {
-public:
-    CustomElementLifecycleProcessingStack()
-        : m_previousProcessingStack(s_currentProcessingStack)
-    {
-        s_currentProcessingStack = this;
-    }
-
-    ~CustomElementLifecycleProcessingStack()
-    {
-        if (UNLIKELY(m_queue))
-            processQueue();
-        s_currentProcessingStack = m_previousProcessingStack;
-    }
-
-    // FIXME: This should be a reference once &quot;ensure&quot; starts to work.
-    static LifecycleCallbackQueue* ensureCurrentQueue();
-
-    static bool hasCurrentProcessingStack() { return s_currentProcessingStack; }
-
-private:
-    void processQueue();
-
-    LifecycleCallbackQueue* m_queue { nullptr };
-    CustomElementLifecycleProcessingStack* m_previousProcessingStack;
-
-    static CustomElementLifecycleProcessingStack* s_currentProcessingStack;
-};
-
-}
-
-#endif
</del></span></pre>
</div>
</div>

</body>
</html>