OLD | NEW |
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 RefPtr<CustomElementDefinition> definition(passDefinition); | 97 RefPtr<CustomElementDefinition> definition(passDefinition); |
98 | 98 |
99 switch (element->customElementState()) { | 99 switch (element->customElementState()) { |
100 case Element::NotCustomElement: | 100 case Element::NotCustomElement: |
101 case Element::Upgraded: | 101 case Element::Upgraded: |
102 ASSERT_NOT_REACHED(); | 102 ASSERT_NOT_REACHED(); |
103 break; | 103 break; |
104 | 104 |
105 case Element::WaitingForUpgrade: | 105 case Element::WaitingForUpgrade: |
106 element->setCustomElementDefinition(definition); | 106 element->setCustomElementDefinition(definition); |
107 CustomElementScheduler::scheduleCallback(definition->callbacks(), elemen
t, CustomElementLifecycleCallbacks::Created); | 107 CustomElementScheduler::scheduleCallback(definition->callbacks(), elemen
t, CustomElementLifecycleCallbacks::CreatedCallback); |
108 break; | 108 break; |
109 } | 109 } |
110 } | 110 } |
111 | 111 |
112 void CustomElement::attributeDidChange(Element* element, const AtomicString& nam
e, const AtomicString& oldValue, const AtomicString& newValue) | 112 void CustomElement::attributeDidChange(Element* element, const AtomicString& nam
e, const AtomicString& oldValue, const AtomicString& newValue) |
113 { | 113 { |
114 ASSERT(element->customElementState() == Element::Upgraded); | 114 ASSERT(element->customElementState() == Element::Upgraded); |
115 CustomElementScheduler::scheduleAttributeChangedCallback(element->customElem
entDefinition()->callbacks(), element, name, oldValue, newValue); | 115 CustomElementScheduler::scheduleAttributeChangedCallback(element->customElem
entDefinition()->callbacks(), element, name, oldValue, newValue); |
116 } | 116 } |
117 | 117 |
118 void CustomElement::didEnterDocument(Element* element, const Document& document) | 118 void CustomElement::didEnterDocument(Element* element, const Document& document) |
119 { | 119 { |
120 ASSERT(element->customElementState() == Element::Upgraded); | 120 ASSERT(element->customElementState() == Element::Upgraded); |
121 if (!document.domWindow()) | 121 if (!document.domWindow()) |
122 return; | 122 return; |
123 CustomElementScheduler::scheduleCallback(element->customElementDefinition()-
>callbacks(), element, CustomElementLifecycleCallbacks::Attached); | 123 CustomElementScheduler::scheduleCallback(element->customElementDefinition()-
>callbacks(), element, CustomElementLifecycleCallbacks::AttachedCallback); |
124 } | 124 } |
125 | 125 |
126 void CustomElement::didLeaveDocument(Element* element, const Document& document) | 126 void CustomElement::didLeaveDocument(Element* element, const Document& document) |
127 { | 127 { |
128 ASSERT(element->customElementState() == Element::Upgraded); | 128 ASSERT(element->customElementState() == Element::Upgraded); |
129 if (!document.domWindow()) | 129 if (!document.domWindow()) |
130 return; | 130 return; |
131 CustomElementScheduler::scheduleCallback(element->customElementDefinition()-
>callbacks(), element, CustomElementLifecycleCallbacks::Detached); | 131 CustomElementScheduler::scheduleCallback(element->customElementDefinition()-
>callbacks(), element, CustomElementLifecycleCallbacks::DetachedCallback); |
132 } | 132 } |
133 | 133 |
134 void CustomElement::wasDestroyed(Element* element) | 134 void CustomElement::wasDestroyed(Element* element) |
135 { | 135 { |
136 switch (element->customElementState()) { | 136 switch (element->customElementState()) { |
137 case Element::NotCustomElement: | 137 case Element::NotCustomElement: |
138 ASSERT_NOT_REACHED(); | 138 ASSERT_NOT_REACHED(); |
139 break; | 139 break; |
140 | 140 |
141 case Element::WaitingForUpgrade: | 141 case Element::WaitingForUpgrade: |
142 case Element::Upgraded: | 142 case Element::Upgraded: |
143 CustomElementObserver::notifyElementWasDestroyed(element); | 143 CustomElementObserver::notifyElementWasDestroyed(element); |
144 break; | 144 break; |
145 } | 145 } |
146 } | 146 } |
147 | 147 |
148 } // namespace blink | 148 } // namespace blink |
OLD | NEW |