| OLD | NEW |
| 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/CEReactionsScope.h" | 5 #include "core/dom/custom/CEReactionsScope.h" |
| 6 | 6 |
| 7 #include "core/dom/Document.h" | 7 #include "core/dom/Document.h" |
| 8 #include "core/dom/Element.h" | 8 #include "core/dom/Element.h" |
| 9 #include "core/dom/custom/CustomElementReactionStack.h" | 9 #include "core/dom/custom/CustomElementReactionStack.h" |
| 10 #include "core/frame/FrameHost.h" | |
| 11 | 10 |
| 12 namespace blink { | 11 namespace blink { |
| 13 | 12 |
| 14 CEReactionsScope* CEReactionsScope::s_topOfStack = nullptr; | 13 CEReactionsScope* CEReactionsScope::s_topOfStack = nullptr; |
| 15 | 14 |
| 16 void CEReactionsScope::enqueueToCurrentQueue( | 15 void CEReactionsScope::enqueueToCurrentQueue( |
| 17 Element* element, | 16 Element* element, |
| 18 CustomElementReaction* reaction) | 17 CustomElementReaction* reaction) |
| 19 { | 18 { |
| 20 if (!m_frameHost.get()) { | 19 if (!m_workToDo) { |
| 21 m_frameHost = element->document().frameHost(); | 20 m_workToDo = true; |
| 22 m_frameHost->customElementReactionStack().push(); | 21 CustomElementReactionStack::current().push(); |
| 23 } else { | |
| 24 DCHECK_EQ(m_frameHost, element->document().frameHost()); | |
| 25 } | 22 } |
| 26 m_frameHost->customElementReactionStack().enqueueToCurrentQueue( | 23 CustomElementReactionStack::current().enqueueToCurrentQueue(element, reactio
n); |
| 27 element, reaction); | |
| 28 } | 24 } |
| 29 | 25 |
| 30 void CEReactionsScope::invokeReactions() | 26 void CEReactionsScope::invokeReactions() |
| 31 { | 27 { |
| 32 m_frameHost->customElementReactionStack().popInvokingReactions(); | 28 CustomElementReactionStack::current().popInvokingReactions(); |
| 33 } | 29 } |
| 34 | 30 |
| 35 } // namespace blink | 31 } // namespace blink |
| OLD | NEW |