<!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 <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):
+
</ins><span class="cx"> 2016-08-19 Chris Dumez <cdumez@apple.com>
</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 = "<group>"; };
</span><span class="cx">                 9B532EA21BA928570038A827 /* SlotAssignment.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SlotAssignment.h; sourceTree = "<group>"; };
</span><span class="cx">                 9B55EEE81B3E8898005342BC /* EditorCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EditorCocoa.mm; sourceTree = "<group>"; };
</span><del>-                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>"; };
</del><ins>+                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>"; };
</ins><span class="cx">                 9B69D3B11B98FF0A00E3512B /* HTMLSlotElement.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = HTMLSlotElement.idl; sourceTree = "<group>"; };
</span><span class="cx">                 9B69D3B21B98FFE900E3512B /* HTMLSlotElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLSlotElement.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 9B69D3B31B98FFE900E3512B /* HTMLSlotElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLSlotElement.h; sourceTree = "<group>"; };
</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& state, JSObject& prototype, const Identifier& id)
</del><ins>+static JSObject* getCustomElementCallback(ExecState& state, JSObject& prototype, const Identifier& id)
</ins><span class="cx"> {
</span><span class="cx"> JSValue callback = prototype.get(&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(&state, ASCIILiteral("A lifecycle callback must be a function"));
</del><ins>+ throwTypeError(&state, ASCIILiteral("A custom element callback must be a function"));
</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(&vm, "connectedCallback"));
</del><ins>+ auto* connectedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "connectedCallback"));
</ins><span class="cx"> if (state.hadException())
</span><span class="cx"> return jsUndefined();
</span><span class="cx"> if (connectedCallback)
</span><span class="cx"> elementInterface->setConnectedCallback(connectedCallback);
</span><span class="cx">
</span><del>- auto* disconnectedCallback = getLifecycleCallback(state, prototypeObject, Identifier::fromString(&vm, "disconnectedCallback"));
</del><ins>+ auto* disconnectedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "disconnectedCallback"));
</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->setDisconnectedCallback(disconnectedCallback);
</span><span class="cx">
</span><span class="cx"> // FIXME: Add the support for adoptedCallback.
</span><del>- getLifecycleCallback(state, prototypeObject, Identifier::fromString(&vm, "adoptedCallback"));
</del><ins>+ getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "adoptedCallback"));
</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(&vm, "attributeChangedCallback"));
</del><ins>+ auto* attributeChangedCallback = getCustomElementCallback(state, prototypeObject, Identifier::fromString(&vm, "attributeChangedCallback"));
</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 "CustomElementReactionQueue.h"
</ins><span class="cx"> #include "JSDOMBinding.h"
</span><del>-#include "LifecycleCallbackQueue.h"
</del><span class="cx"> #include <runtime/Completion.h>
</span><span class="cx"> #include <runtime/Microtask.h>
</span><span class="cx"> #include <wtf/MainThread.h>
</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->signature->extendedAttributes->{"CEReactions"}) {
</span><span class="cx"> push(@implContent, "#if ENABLE(CUSTOM_ELEMENTS)\n");
</span><del>- push(@implContent, " CustomElementLifecycleProcessingStack customElementLifecycleProcessingStack;\n");
</del><ins>+ push(@implContent, " CustomElementReactionStack customElementReactionStack;\n");
</ins><span class="cx"> push(@implContent, "#endif\n");
</span><del>- $implIncludes{"LifecycleCallbackQueue.h"} = 1;
</del><ins>+ $implIncludes{"CustomElementReactionQueue.h"} = 1;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if ($function->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 "JSTestObj.h"
</span><span class="cx">
</span><span class="cx"> #include "CallbackFunction.h"
</span><ins>+#include "CustomElementReactionQueue.h"
</ins><span class="cx"> #include "DOMStringList.h"
</span><span class="cx"> #include "Dictionary.h"
</span><span class="cx"> #include "Document.h"
</span><span class="lines">@@ -49,7 +50,6 @@
</span><span class="cx"> #include "JSTestObj.h"
</span><span class="cx"> #include "JSTestSubObj.h"
</span><span class="cx"> #include "JSXPathNSResolver.h"
</span><del>-#include "LifecycleCallbackQueue.h"
</del><span class="cx"> #include "RuntimeEnabledFeatures.h"
</span><span class="cx"> #include "SVGDocument.h"
</span><span class="cx"> #include "SVGPoint.h"
</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"> { "testPromiseFunctionWithException", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionTestPromiseFunctionWithException), (intptr_t) (0) } },
</span><span class="cx"> { "testPromiseFunctionWithOptionalIntArgument", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionTestPromiseFunctionWithOptionalIntArgument), (intptr_t) (0) } },
</span><span class="cx"> { "testPromiseOverloadedFunction", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionTestPromiseOverloadedFunction), (intptr_t) (1) } },
</span><del>- { "methodWithNeedsLifecycleProcessingStack", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNeedsLifecycleProcessingStack), (intptr_t) (0) } },
</del><ins>+ { "methodWithNeedsCustomElementReactionStack", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNeedsCustomElementReactionStack), (intptr_t) (0) } },
</ins><span class="cx"> { "attachShadowRoot", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionAttachShadowRoot), (intptr_t) (1) } },
</span><span class="cx"> #if ENABLE(Condition1)
</span><span class="cx"> { "CONDITIONAL_CONST", 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->thisValue();
</span><span class="cx"> auto castedThis = jsDynamicCast<JSTestObj*>(thisValue);
</span><span class="cx"> if (UNLIKELY(!castedThis))
</span><del>- return throwThisTypeError(*state, "TestObject", "methodWithNeedsLifecycleProcessingStack");
</del><ins>+ return throwThisTypeError(*state, "TestObject", "methodWithNeedsCustomElementReactionStack");
</ins><span class="cx"> ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info());
</span><span class="cx"> auto& impl = castedThis->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 "config.h"
+#include "CustomElementReactionQueue.h"
+
+#if ENABLE(CUSTOM_ELEMENTS)
+
+#include "CustomElementsRegistry.h"
+#include "DOMWindow.h"
+#include "Document.h"
+#include "Element.h"
+#include "JSCustomElementInterface.h"
+#include "JSDOMBinding.h"
+#include <heap/Heap.h>
+#include <wtf/Optional.h>
+#include <wtf/Ref.h>
+
+namespace WebCore {
+
+class CustomElementReactionQueueItem {
+public:
+ enum class Type {
+ ElementUpgrade,
+ Connected,
+ Disconnected,
+ AttributeChanged,
+ };
+
+ CustomElementReactionQueueItem(Type type, Element& element, JSCustomElementInterface& elementInterface)
+ : m_type(type)
+ , m_element(element)
+ , m_interface(elementInterface)
+ { }
+
+ CustomElementReactionQueueItem(Element& element, JSCustomElementInterface& elementInterface, const QualifiedName& attributeName, const AtomicString& oldValue, const AtomicString& 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->upgradeElement(m_element.get());
+ break;
+ case Type::Connected:
+ m_interface->invokeConnectedCallback(m_element.get());
+ break;
+ case Type::Disconnected:
+ m_interface->invokeDisconnectedCallback(m_element.get());
+ break;
+ case Type::AttributeChanged:
+ ASSERT(m_attributeName);
+ m_interface->invokeAttributeChangedCallback(m_element.get(), m_attributeName.value(), m_oldValue, m_newValue);
+ break;
+ }
+ }
+
+private:
+ Type m_type;
+ Ref<Element> m_element;
+ Ref<JSCustomElementInterface> m_interface;
+ Optional<QualifiedName> m_attributeName;
+ AtomicString m_oldValue;
+ AtomicString m_newValue;
+};
+
+CustomElementReactionQueue::CustomElementReactionQueue()
+{ }
+
+CustomElementReactionQueue::~CustomElementReactionQueue()
+{
+ ASSERT(m_items.isEmpty());
+}
+
+void CustomElementReactionQueue::enqueueElementUpgrade(Element& element, JSCustomElementInterface& elementInterface)
+{
+ if (auto* queue = CustomElementReactionStack::ensureCurrentQueue())
+ queue->m_items.append({CustomElementReactionQueueItem::Type::ElementUpgrade, element, elementInterface});
+}
+
+static JSCustomElementInterface* findInterfaceForCustomElement(Element& element)
+{
+ ASSERT(element.isCustomElement());
+ auto* window = element.document().domWindow();
+ if (!window)
+ return nullptr;
+
+ auto* registry = window->customElementsRegistry();
+ if (!registry)
+ return nullptr;
+
+ return registry->findInterface(element.tagQName());
+}
+
+void CustomElementReactionQueue::enqueueConnectedCallbackIfNeeded(Element& element)
+{
+ auto* elementInterface = findInterfaceForCustomElement(element);
+ if (!elementInterface)
+ return;
+
+ if (auto* queue = CustomElementReactionStack::ensureCurrentQueue())
+ queue->m_items.append({CustomElementReactionQueueItem::Type::Connected, element, *elementInterface});
+}
+
+void CustomElementReactionQueue::enqueueDisconnectedCallbackIfNeeded(Element& element)
+{
+ auto* elementInterface = findInterfaceForCustomElement(element);
+ if (!elementInterface)
+ return;
+
+ if (auto* queue = CustomElementReactionStack::ensureCurrentQueue())
+ queue->m_items.append({CustomElementReactionQueueItem::Type::Disconnected, element, *elementInterface});
+}
+
+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 = CustomElementReactionStack::ensureCurrentQueue())
+ queue->m_items.append({element, *elementInterface, attributeName, oldValue, newValue});
+}
+
+void CustomElementReactionQueue::invokeAll()
+{
+ Vector<CustomElementReactionQueueItem> items;
+ items.swap(m_items);
+ for (auto& 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*& queue = s_currentProcessingStack->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->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 <wtf/Forward.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/Vector.h>
+
+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&, JSCustomElementInterface&);
+ static void enqueueConnectedCallbackIfNeeded(Element&);
+ static void enqueueDisconnectedCallbackIfNeeded(Element&);
+ static void enqueueAttributeChangedCallbackIfNeeded(Element&, const QualifiedName&, const AtomicString& oldValue, const AtomicString& newValue);
+
+ void invokeAll();
+
+private:
+ Vector<CustomElementReactionQueueItem> 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 "ensure" 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 "CompositionEvent.h"
</span><span class="cx"> #include "ContentSecurityPolicy.h"
</span><span class="cx"> #include "CookieJar.h"
</span><ins>+#include "CustomElementReactionQueue.h"
</ins><span class="cx"> #include "CustomElementsRegistry.h"
</span><span class="cx"> #include "CustomEvent.h"
</span><span class="cx"> #include "DOMImplementation.h"
</span><span class="lines">@@ -105,7 +106,6 @@
</span><span class="cx"> #include "JSModuleLoader.h"
</span><span class="cx"> #include "KeyboardEvent.h"
</span><span class="cx"> #include "Language.h"
</span><del>-#include "LifecycleCallbackQueue.h"
</del><span class="cx"> #include "LoaderStrategy.h"
</span><span class="cx"> #include "Logging.h"
</span><span class="cx"> #include "MainFrame.h"
</span><span class="lines">@@ -1093,7 +1093,7 @@
</span><span class="cx"> if (auto* elementInterface = registry->findInterface(name)) {
</span><span class="cx"> auto element = HTMLElement::create(name, document);
</span><span class="cx"> element->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 "ClientRectList.h"
</span><span class="cx"> #include "ComposedTreeAncestorIterator.h"
</span><span class="cx"> #include "ContainerNodeAlgorithms.h"
</span><ins>+#include "CustomElementReactionQueue.h"
</ins><span class="cx"> #include "CustomElementsRegistry.h"
</span><span class="cx"> #include "DOMTokenList.h"
</span><span class="cx"> #include "Dictionary.h"
</span><span class="lines">@@ -69,7 +70,6 @@
</span><span class="cx"> #include "JSLazyEventListener.h"
</span><span class="cx"> #include "KeyboardEvent.h"
</span><span class="cx"> #include "KeyframeEffect.h"
</span><del>-#include "LifecycleCallbackQueue.h"
</del><span class="cx"> #include "MainFrame.h"
</span><span class="cx"> #include "MutationObserverInterestGroup.h"
</span><span class="cx"> #include "MutationRecord.h"
</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 && 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 && 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 "config.h"
-#include "LifecycleCallbackQueue.h"
-
-#if ENABLE(CUSTOM_ELEMENTS)
-
-#include "CustomElementsRegistry.h"
-#include "DOMWindow.h"
-#include "Document.h"
-#include "Element.h"
-#include "JSCustomElementInterface.h"
-#include "JSDOMBinding.h"
-#include <heap/Heap.h>
-#include <wtf/Optional.h>
-#include <wtf/Ref.h>
-
-namespace WebCore {
-
-class LifecycleQueueItem {
-public:
- enum class Type {
- ElementUpgrade,
- Connected,
- Disconnected,
- AttributeChanged,
- };
-
- LifecycleQueueItem(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)
- : 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->upgradeElement(m_element.get());
- break;
- case Type::Connected:
- m_interface->invokeConnectedCallback(m_element.get());
- break;
- case Type::Disconnected:
- m_interface->invokeDisconnectedCallback(m_element.get());
- break;
- case Type::AttributeChanged:
- ASSERT(m_attributeName);
- m_interface->invokeAttributeChangedCallback(m_element.get(), m_attributeName.value(), m_oldValue, m_newValue);
- break;
- }
- }
-
-private:
- Type m_type;
- Ref<Element> m_element;
- Ref<JSCustomElementInterface> m_interface;
- Optional<QualifiedName> m_attributeName;
- AtomicString m_oldValue;
- AtomicString m_newValue;
-};
-
-LifecycleCallbackQueue::LifecycleCallbackQueue()
-{ }
-
-LifecycleCallbackQueue::~LifecycleCallbackQueue()
-{
- ASSERT(m_items.isEmpty());
-}
-
-void LifecycleCallbackQueue::enqueueElementUpgrade(Element& element, JSCustomElementInterface& elementInterface)
-{
- if (auto* queue = CustomElementLifecycleProcessingStack::ensureCurrentQueue())
- queue->m_items.append(LifecycleQueueItem(LifecycleQueueItem::Type::ElementUpgrade, element, elementInterface));
-}
-
-static JSCustomElementInterface* findInterfaceForCustomElement(Element& element)
-{
- ASSERT(element.isCustomElement());
- auto* window = element.document().domWindow();
- if (!window)
- return nullptr;
-
- auto* registry = window->customElementsRegistry();
- if (!registry)
- return nullptr;
-
- return registry->findInterface(element.tagQName());
-}
-
-void LifecycleCallbackQueue::enqueueConnectedCallbackIfNeeded(Element& element)
-{
- auto* elementInterface = findInterfaceForCustomElement(element);
- if (!elementInterface)
- return;
-
- if (auto* queue = CustomElementLifecycleProcessingStack::ensureCurrentQueue())
- queue->m_items.append({LifecycleQueueItem::Type::Connected, element, *elementInterface});
-}
-
-void LifecycleCallbackQueue::enqueueDisconnectedCallbackIfNeeded(Element& element)
-{
- auto* elementInterface = findInterfaceForCustomElement(element);
- if (!elementInterface)
- return;
-
- if (auto* queue = CustomElementLifecycleProcessingStack::ensureCurrentQueue())
- queue->m_items.append({LifecycleQueueItem::Type::Disconnected, element, *elementInterface});
-}
-
-void LifecycleCallbackQueue::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())
- queue->m_items.append({element, *elementInterface, attributeName, oldValue, newValue});
-}
-
-void LifecycleCallbackQueue::invokeAll()
-{
- Vector<LifecycleQueueItem> items;
- items.swap(m_items);
- for (auto& 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*& queue = s_currentProcessingStack->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->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 <wtf/Forward.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/Vector.h>
-
-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&, JSCustomElementInterface&);
- static void enqueueConnectedCallbackIfNeeded(Element&);
- static void enqueueDisconnectedCallbackIfNeeded(Element&);
- static void enqueueAttributeChangedCallbackIfNeeded(Element&, const QualifiedName&, const AtomicString& oldValue, const AtomicString& newValue);
-
- void invokeAll();
-
-private:
- Vector<LifecycleQueueItem> 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 "ensure" 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>