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

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

Issue 2058823002: Implement callback reactions for Custom Elements V1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@stack-ce
Patch Set: dominicc review 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
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/dom/custom/CustomElementReaction.h" 5 #include "core/dom/custom/CustomElementReaction.h"
6 6
7 #include "core/dom/custom/CustomElementReactionQueue.h" 7 #include "core/dom/custom/CustomElementReactionQueue.h"
8 #include "platform/heap/Handle.h" 8 #include "platform/heap/Handle.h"
9 #include "wtf/Noncopyable.h" 9 #include "wtf/Noncopyable.h"
10 #include <initializer_list> 10 #include <initializer_list>
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 } 70 }
71 private: 71 private:
72 Member<CustomElementReactionQueue> m_queue; 72 Member<CustomElementReactionQueue> m_queue;
73 Member<CustomElementReaction> m_reaction; 73 Member<CustomElementReaction> m_reaction;
74 }; 74 };
75 75
76 class TestReaction : public CustomElementReaction { 76 class TestReaction : public CustomElementReaction {
77 WTF_MAKE_NONCOPYABLE(TestReaction); 77 WTF_MAKE_NONCOPYABLE(TestReaction);
78 public: 78 public:
79 TestReaction(std::initializer_list<Command*> commands) 79 TestReaction(std::initializer_list<Command*> commands)
80 : CustomElementReaction(nullptr)
80 { 81 {
81 // TODO(dominicc): Simply pass the initializer list when 82 // TODO(dominicc): Simply pass the initializer list when
82 // HeapVector supports initializer lists like Vector. 83 // HeapVector supports initializer lists like Vector.
83 for (auto& command : commands) 84 for (auto& command : commands)
84 m_commands.append(command); 85 m_commands.append(command);
85 } 86 }
86 ~TestReaction() override = default; 87 ~TestReaction() override = default;
87 DEFINE_INLINE_VIRTUAL_TRACE() 88 DEFINE_INLINE_VIRTUAL_TRACE()
88 { 89 {
89 CustomElementReaction::trace(visitor); 90 CustomElementReaction::trace(visitor);
90 visitor->trace(m_commands); 91 visitor->trace(m_commands);
91 } 92 }
92 void invoke(Element* element) override 93 void invoke(Element* element) override
93 { 94 {
94 for (auto& command : m_commands) 95 for (auto& command : m_commands)
95 command->run(element); 96 command->run(element);
96 } 97 }
97 98
98 private: 99 private:
99 HeapVector<Member<Command>> m_commands; 100 HeapVector<Member<Command>> m_commands;
100 }; 101 };
101 102
102 } // namespace blink 103 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698