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

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

Issue 220013003: Simplify CustomElementScheduler by passing the enum for callback type directly. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/core/dom/custom/CustomElementCallbackInvocation.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 RefPtr<CustomElementDefinition> definition(passDefinition); 91 RefPtr<CustomElementDefinition> definition(passDefinition);
92 92
93 switch (element->customElementState()) { 93 switch (element->customElementState()) {
94 case Element::NotCustomElement: 94 case Element::NotCustomElement:
95 case Element::Upgraded: 95 case Element::Upgraded:
96 ASSERT_NOT_REACHED(); 96 ASSERT_NOT_REACHED();
97 break; 97 break;
98 98
99 case Element::WaitingForUpgrade: 99 case Element::WaitingForUpgrade:
100 element->setCustomElementDefinition(definition); 100 element->setCustomElementDefinition(definition);
101 CustomElementScheduler::scheduleCreatedCallback(definition->callbacks(), element); 101 CustomElementScheduler::scheduleCallback(definition->callbacks(), elemen t, CustomElementLifecycleCallbacks::Created);
102 break; 102 break;
103 } 103 }
104 } 104 }
105 105
106 void CustomElement::attributeDidChange(Element* element, const AtomicString& nam e, const AtomicString& oldValue, const AtomicString& newValue) 106 void CustomElement::attributeDidChange(Element* element, const AtomicString& nam e, const AtomicString& oldValue, const AtomicString& newValue)
107 { 107 {
108 ASSERT(element->customElementState() == Element::Upgraded); 108 ASSERT(element->customElementState() == Element::Upgraded);
109 CustomElementScheduler::scheduleAttributeChangedCallback(element->customElem entDefinition()->callbacks(), element, name, oldValue, newValue); 109 CustomElementScheduler::scheduleAttributeChangedCallback(element->customElem entDefinition()->callbacks(), element, name, oldValue, newValue);
110 } 110 }
111 111
112 void CustomElement::didEnterDocument(Element* element, const Document& document) 112 void CustomElement::didEnterDocument(Element* element, const Document& document)
113 { 113 {
114 ASSERT(element->customElementState() == Element::Upgraded); 114 ASSERT(element->customElementState() == Element::Upgraded);
115 if (!document.domWindow()) 115 if (!document.domWindow())
116 return; 116 return;
117 CustomElementScheduler::scheduleAttachedCallback(element->customElementDefin ition()->callbacks(), element); 117 CustomElementScheduler::scheduleCallback(element->customElementDefinition()- >callbacks(), element, CustomElementLifecycleCallbacks::Attached);
118 } 118 }
119 119
120 void CustomElement::didLeaveDocument(Element* element, const Document& document) 120 void CustomElement::didLeaveDocument(Element* element, const Document& document)
121 { 121 {
122 ASSERT(element->customElementState() == Element::Upgraded); 122 ASSERT(element->customElementState() == Element::Upgraded);
123 if (!document.domWindow()) 123 if (!document.domWindow())
124 return; 124 return;
125 CustomElementScheduler::scheduleDetachedCallback(element->customElementDefin ition()->callbacks(), element); 125 CustomElementScheduler::scheduleCallback(element->customElementDefinition()- >callbacks(), element, CustomElementLifecycleCallbacks::Detached);
126 } 126 }
127 127
128 void CustomElement::wasDestroyed(Element* element) 128 void CustomElement::wasDestroyed(Element* element)
129 { 129 {
130 switch (element->customElementState()) { 130 switch (element->customElementState()) {
131 case Element::NotCustomElement: 131 case Element::NotCustomElement:
132 ASSERT_NOT_REACHED(); 132 ASSERT_NOT_REACHED();
133 break; 133 break;
134 134
135 case Element::WaitingForUpgrade: 135 case Element::WaitingForUpgrade:
136 case Element::Upgraded: 136 case Element::Upgraded:
137 CustomElementObserver::notifyElementWasDestroyed(element); 137 CustomElementObserver::notifyElementWasDestroyed(element);
138 break; 138 break;
139 } 139 }
140 } 140 }
141 141
142 } // namespace WebCore 142 } // namespace WebCore
OLDNEW
« no previous file with comments | « no previous file | Source/core/dom/custom/CustomElementCallbackInvocation.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698