Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Unified Diff: third_party/WebKit/Source/core/dom/custom/CustomElement.cpp

Issue 2097463002: Add backup element queue to CustomElementReactionStack (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dominicc nits Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/dom/custom/CustomElement.cpp
diff --git a/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp b/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp
index 9a25fae89425cffb20de18482d8f72cd61635d28..bab2bec31f979861f122309a32330b8eedf6d6be 100644
--- a/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp
+++ b/third_party/WebKit/Source/core/dom/custom/CustomElement.cpp
@@ -6,10 +6,13 @@
#include "core/dom/Document.h"
#include "core/dom/QualifiedName.h"
+#include "core/dom/custom/CEReactionsScope.h"
#include "core/dom/custom/CustomElementDefinition.h"
+#include "core/dom/custom/CustomElementReactionStack.h"
#include "core/dom/custom/CustomElementsRegistry.h"
#include "core/dom/custom/V0CustomElement.h"
#include "core/dom/custom/V0CustomElementRegistrationContext.h"
+#include "core/frame/FrameHost.h"
#include "core/frame/LocalDOMWindow.h"
#include "core/html/HTMLElement.h"
#include "platform/text/Character.h"
@@ -159,6 +162,24 @@ HTMLElement* CustomElement::createUndefinedElement(Document& document, const Qua
return element;
}
+void CustomElement::enqueue(Element* element, CustomElementReaction* reaction)
+{
+ // To enqueue an element on the appropriate element queue
+ // https://html.spec.whatwg.org/multipage/scripting.html#enqueue-an-element-on-the-appropriate-element-queue
+
+ // If the custom element reactions stack is not empty, then
+ // Add element to the current element queue.
+ if (CEReactionsScope* current = CEReactionsScope::current()) {
+ current->enqueueToCurrentQueue(element, reaction);
+ return;
+ }
+
+ // If the custom element reactions stack is empty, then
+ // Add element to the backup element queue.
+ element->document().frameHost()->customElementReactionStack()
+ .enqueueToBackupQueue(element, reaction);
+}
+
void CustomElement::enqueueConnectedCallback(Element* element)
{
DCHECK_EQ(element->getCustomElementState(), CustomElementState::Custom);

Powered by Google App Engine
This is Rietveld 408576698