| 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 "bindings/core/v8/ScriptCustomElementDefinitionBuilder.h" | 5 #include "bindings/core/v8/ScriptCustomElementDefinitionBuilder.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/DOMWrapperWorld.h" | 7 #include "bindings/core/v8/DOMWrapperWorld.h" |
| 8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "bindings/core/v8/ScriptCustomElementDefinition.h" | 9 #include "bindings/core/v8/ScriptCustomElementDefinition.h" |
| 10 #include "bindings/core/v8/ScriptState.h" | 10 #include "bindings/core/v8/ScriptState.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 m_observedAttributes.add(attribute); | 149 m_observedAttributes.add(attribute); |
| 150 return true; | 150 return true; |
| 151 } | 151 } |
| 152 | 152 |
| 153 bool ScriptCustomElementDefinitionBuilder::rememberOriginalProperties() | 153 bool ScriptCustomElementDefinitionBuilder::rememberOriginalProperties() |
| 154 { | 154 { |
| 155 // Spec requires to use values of these properties at the point | 155 // Spec requires to use values of these properties at the point |
| 156 // CustomElementDefinition is built, even if JS changes them afterwards. | 156 // CustomElementDefinition is built, even if JS changes them afterwards. |
| 157 const String kConnectedCallback = "connectedCallback"; | 157 const String kConnectedCallback = "connectedCallback"; |
| 158 const String kDisconnectedCallback = "disconnectedCallback"; | 158 const String kDisconnectedCallback = "disconnectedCallback"; |
| 159 const String kAdoptedCallback = "adoptedCallback"; |
| 159 const String kAttributeChangedCallback = "attributeChangedCallback"; | 160 const String kAttributeChangedCallback = "attributeChangedCallback"; |
| 160 return callableForName(kConnectedCallback, m_connectedCallback) | 161 return callableForName(kConnectedCallback, m_connectedCallback) |
| 161 && callableForName(kDisconnectedCallback, m_disconnectedCallback) | 162 && callableForName(kDisconnectedCallback, m_disconnectedCallback) |
| 163 && callableForName(kAdoptedCallback, m_adoptedCallback) |
| 162 && callableForName(kAttributeChangedCallback, m_attributeChangedCallback
) | 164 && callableForName(kAttributeChangedCallback, m_attributeChangedCallback
) |
| 163 && (m_attributeChangedCallback.IsEmpty() || retrieveObservedAttributes()
); | 165 && (m_attributeChangedCallback.IsEmpty() || retrieveObservedAttributes()
); |
| 164 } | 166 } |
| 165 | 167 |
| 166 CustomElementDefinition* ScriptCustomElementDefinitionBuilder::build( | 168 CustomElementDefinition* ScriptCustomElementDefinitionBuilder::build( |
| 167 const CustomElementDescriptor& descriptor) | 169 const CustomElementDescriptor& descriptor) |
| 168 { | 170 { |
| 169 return ScriptCustomElementDefinition::create( | 171 return ScriptCustomElementDefinition::create( |
| 170 m_scriptState.get(), | 172 m_scriptState.get(), |
| 171 m_registry, | 173 m_registry, |
| 172 descriptor, | 174 descriptor, |
| 173 m_constructor, | 175 m_constructor, |
| 174 m_prototype, | 176 m_prototype, |
| 175 m_connectedCallback, | 177 m_connectedCallback, |
| 176 m_disconnectedCallback, | 178 m_disconnectedCallback, |
| 179 m_adoptedCallback, |
| 177 m_attributeChangedCallback, | 180 m_attributeChangedCallback, |
| 178 m_observedAttributes); | 181 m_observedAttributes); |
| 179 } | 182 } |
| 180 | 183 |
| 181 } // namespace blink | 184 } // namespace blink |
| OLD | NEW |