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

Side by Side Diff: Source/core/dom/custom/CustomElementCallbackScheduler.cpp

Issue 106903007: Let unresolved custom element go through CustomElementCallbackQueue. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Updated. Created 7 years 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 15 matching lines...) Expand all
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #include "config.h" 31 #include "config.h"
32 #include "core/dom/custom/CustomElementCallbackScheduler.h" 32 #include "core/dom/custom/CustomElementCallbackScheduler.h"
33 33
34 #include "core/dom/Element.h" 34 #include "core/dom/Element.h"
35 #include "core/dom/custom/CustomElementCallbackDispatcher.h" 35 #include "core/dom/custom/CustomElementCallbackDispatcher.h"
36 #include "core/dom/custom/CustomElementCallbackInvocation.h"
36 #include "core/dom/custom/CustomElementLifecycleCallbacks.h" 37 #include "core/dom/custom/CustomElementLifecycleCallbacks.h"
38 #include "core/dom/custom/CustomElementRegistrationContext.h"
39 #include "core/dom/custom/CustomElementResolutionStep.h"
37 40
38 namespace WebCore { 41 namespace WebCore {
39 42
40 void CustomElementCallbackScheduler::scheduleAttributeChangedCallback(PassRefPtr <CustomElementLifecycleCallbacks> callbacks, PassRefPtr<Element> element, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue) 43 void CustomElementCallbackScheduler::scheduleAttributeChangedCallback(PassRefPtr <CustomElementLifecycleCallbacks> callbacks, PassRefPtr<Element> element, const AtomicString& name, const AtomicString& oldValue, const AtomicString& newValue)
41 { 44 {
42 if (!callbacks->hasAttributeChangedCallback()) 45 if (!callbacks->hasAttributeChangedCallback())
43 return; 46 return;
44 47
45 CustomElementCallbackQueue* queue = instance().schedule(element); 48 CustomElementCallbackQueue* queue = instance().schedule(element);
46 queue->append(CustomElementCallbackInvocation::createAttributeChangedInvocat ion(callbacks, name, oldValue, newValue)); 49 queue->append(CustomElementCallbackInvocation::createAttributeChangedInvocat ion(callbacks, name, oldValue, newValue));
(...skipping 19 matching lines...) Expand all
66 69
67 void CustomElementCallbackScheduler::scheduleLeftViewCallback(PassRefPtr<CustomE lementLifecycleCallbacks> callbacks, PassRefPtr<Element> element) 70 void CustomElementCallbackScheduler::scheduleLeftViewCallback(PassRefPtr<CustomE lementLifecycleCallbacks> callbacks, PassRefPtr<Element> element)
68 { 71 {
69 if (!callbacks->hasLeftViewCallback()) 72 if (!callbacks->hasLeftViewCallback())
70 return; 73 return;
71 74
72 CustomElementCallbackQueue* queue = instance().schedule(element); 75 CustomElementCallbackQueue* queue = instance().schedule(element);
73 queue->append(CustomElementCallbackInvocation::createInvocation(callbacks, C ustomElementLifecycleCallbacks::LeftView)); 76 queue->append(CustomElementCallbackInvocation::createInvocation(callbacks, C ustomElementLifecycleCallbacks::LeftView));
74 } 77 }
75 78
79 void CustomElementCallbackScheduler::scheduleResolutionStep(const CustomElementD escriptor& descriptor, PassRefPtr<Element> element)
80 {
81 RefPtr<CustomElementRegistrationContext> context = element->document().regis trationContext();
82 CustomElementCallbackQueue* queue = instance().schedule(element);
83 queue->append(CustomElementResolutionStep::create(context.release(), descrip tor));
84 }
85
76 CustomElementCallbackScheduler& CustomElementCallbackScheduler::instance() 86 CustomElementCallbackScheduler& CustomElementCallbackScheduler::instance()
77 { 87 {
78 DEFINE_STATIC_LOCAL(CustomElementCallbackScheduler, instance, ()); 88 DEFINE_STATIC_LOCAL(CustomElementCallbackScheduler, instance, ());
79 return instance; 89 return instance;
80 } 90 }
81 91
82 CustomElementCallbackQueue* CustomElementCallbackScheduler::ensureCallbackQueue( PassRefPtr<Element> element) 92 CustomElementCallbackQueue* CustomElementCallbackScheduler::ensureCallbackQueue( PassRefPtr<Element> element)
83 { 93 {
84 Element* key = element.get(); 94 Element* key = element.get();
85 ElementCallbackQueueMap::iterator it = m_elementCallbackQueueMap.find(key); 95 ElementCallbackQueueMap::iterator it = m_elementCallbackQueueMap.find(key);
(...skipping 26 matching lines...) Expand all
112 // stack. Because callback queues are processed exhaustively, this 122 // stack. Because callback queues are processed exhaustively, this
113 // effectively moves the callback queue to the top of the stack. 123 // effectively moves the callback queue to the top of the stack.
114 CustomElementCallbackQueue* CustomElementCallbackScheduler::scheduleInCurrentEle mentQueue(PassRefPtr<Element> element) 124 CustomElementCallbackQueue* CustomElementCallbackScheduler::scheduleInCurrentEle mentQueue(PassRefPtr<Element> element)
115 { 125 {
116 CustomElementCallbackQueue* callbackQueue = ensureCallbackQueue(element); 126 CustomElementCallbackQueue* callbackQueue = ensureCallbackQueue(element);
117 CustomElementCallbackDispatcher::instance().enqueue(callbackQueue); 127 CustomElementCallbackDispatcher::instance().enqueue(callbackQueue);
118 return callbackQueue; 128 return callbackQueue;
119 } 129 }
120 130
121 } // namespace WebCore 131 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698