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

Side by Side Diff: third_party/WebKit/Source/core/dom/custom/CEReactionsScope.h

Issue 2023093003: Upgrade in-document custom elements when an element is defined. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CEReactionsScope_h
6 #define CEReactionsScope_h
7
8 #include "core/CoreExport.h"
9 #include "platform/heap/Handle.h"
10 #include "wtf/Allocator.h"
11 #include "wtf/Noncopyable.h"
12 #include "wtf/StdLibExtras.h"
13
14 namespace blink {
15
16 class CustomElementReaction;
17 class Element;
18 class FrameHost;
19
20 // https://html.spec.whatwg.org/multipage/scripting.html#cereactions
21 class CORE_EXPORT CEReactionsScope final {
22 STACK_ALLOCATED();
23 WTF_MAKE_NONCOPYABLE(CEReactionsScope);
yosin_UTC9 2016/06/01 06:15:44 nit: Better to use DISALLOW_COPY_AND_ASSIGN(CEReac
24 public:
25 static CEReactionsScope* current()
26 {
27 return topOfStack();
28 }
29
30 CEReactionsScope()
yosin_UTC9 2016/06/01 06:15:44 Do we really need to them inline? To reduce compil
dominicc (has gone to gerrit) 2016/06/01 23:30:56 Probably yes; these will get added to every CEReac
31 : m_prev(topOfStack())
32 {
33 topOfStack() = this;
34 }
35
36 ~CEReactionsScope()
37 {
38 CEReactionsScope** top = &topOfStack();
39 *top = (*top)->m_prev;
40 if (m_frameHost.get())
41 invokeReactions();
42 }
43
44 void enqueue(Element*, CustomElementReaction*);
45
46 private:
47 static CEReactionsScope*& topOfStack()
48 {
49 static CEReactionsScope* top = nullptr;
50 return top;
51 }
52
53 void invokeReactions();
54
55 CEReactionsScope* m_prev;
56 Member<FrameHost> m_frameHost;
57 };
58
59 } // namespace blink
60
61 #endif // CEReactionsScope_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698