summaryrefslogtreecommitdiff
path: root/chromium/third_party/blink/renderer/core/html/custom/custom_element_reaction_stack.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2018-05-15 10:20:33 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2018-05-15 10:28:57 +0000
commitd17ea114e5ef69ad5d5d7413280a13e6428098aa (patch)
tree2c01a75df69f30d27b1432467cfe7c1467a498da /chromium/third_party/blink/renderer/core/html/custom/custom_element_reaction_stack.h
parent8c5c43c7b138c9b4b0bf56d946e61d3bbc111bec (diff)
downloadqtwebengine-chromium-d17ea114e5ef69ad5d5d7413280a13e6428098aa.tar.gz
BASELINE: Update Chromium to 67.0.3396.47
Change-Id: Idcb1341782e417561a2473eeecc82642dafda5b7 Reviewed-by: Michal Klocek <michal.klocek@qt.io>
Diffstat (limited to 'chromium/third_party/blink/renderer/core/html/custom/custom_element_reaction_stack.h')
-rw-r--r--chromium/third_party/blink/renderer/core/html/custom/custom_element_reaction_stack.h70
1 files changed, 70 insertions, 0 deletions
diff --git a/chromium/third_party/blink/renderer/core/html/custom/custom_element_reaction_stack.h b/chromium/third_party/blink/renderer/core/html/custom/custom_element_reaction_stack.h
new file mode 100644
index 00000000000..119114068d9
--- /dev/null
+++ b/chromium/third_party/blink/renderer/core/html/custom/custom_element_reaction_stack.h
@@ -0,0 +1,70 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef THIRD_PARTY_BLINK_RENDERER_CORE_HTML_CUSTOM_CUSTOM_ELEMENT_REACTION_STACK_H_
+#define THIRD_PARTY_BLINK_RENDERER_CORE_HTML_CUSTOM_CUSTOM_ELEMENT_REACTION_STACK_H_
+
+#include "base/macros.h"
+#include "third_party/blink/renderer/core/core_export.h"
+#include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
+#include "third_party/blink/renderer/platform/heap/handle.h"
+
+namespace blink {
+
+class CustomElementReaction;
+class CustomElementReactionQueue;
+class Element;
+
+// https://html.spec.whatwg.org/multipage/scripting.html#custom-element-reactions
+class CORE_EXPORT CustomElementReactionStack final
+ : public GarbageCollected<CustomElementReactionStack>,
+ public TraceWrapperBase {
+ public:
+ CustomElementReactionStack();
+
+ void Trace(blink::Visitor*);
+ void TraceWrappers(const ScriptWrappableVisitor*) const override;
+ const char* NameInHeapSnapshot() const override {
+ return "CustomElementReactionStack";
+ }
+
+ void Push();
+ void PopInvokingReactions();
+ void EnqueueToCurrentQueue(Element*, CustomElementReaction*);
+ void EnqueueToBackupQueue(Element*, CustomElementReaction*);
+ void ClearQueue(Element*);
+
+ static CustomElementReactionStack& Current();
+
+ private:
+ friend class CustomElementReactionStackTestSupport;
+
+ using ElementReactionQueueMap =
+ HeapHashMap<TraceWrapperMember<Element>,
+ Member<CustomElementReactionQueue>>;
+ ElementReactionQueueMap map_;
+
+ using ElementQueue = HeapVector<Member<Element>, 1>;
+ HeapVector<Member<ElementQueue>> stack_;
+ Member<ElementQueue> backup_queue_;
+
+ void InvokeBackupQueue();
+ void InvokeReactions(ElementQueue&);
+ void Enqueue(Member<ElementQueue>&, Element*, CustomElementReaction*);
+
+ DISALLOW_COPY_AND_ASSIGN(CustomElementReactionStack);
+};
+
+class CORE_EXPORT CustomElementReactionStackTestSupport final {
+ private:
+ friend class ResetCustomElementReactionStackForTest;
+
+ CustomElementReactionStackTestSupport() = delete;
+ static CustomElementReactionStack* SetCurrentForTest(
+ CustomElementReactionStack*);
+};
+
+} // namespace blink
+
+#endif // THIRD_PARTY_BLINK_RENDERER_CORE_HTML_CUSTOM_CUSTOM_ELEMENT_REACTION_STACK_H_