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

Unified Diff: Source/bindings/v8/CustomElementConstructorBuilder.cpp

Issue 18789002: Implement Custom Elements' attributeChangedCallback. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Sync to tip. Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: Source/bindings/v8/CustomElementConstructorBuilder.cpp
diff --git a/Source/bindings/v8/CustomElementConstructorBuilder.cpp b/Source/bindings/v8/CustomElementConstructorBuilder.cpp
index 9bbc116dce34fe27e36f7c6b9b393cdeee518f9a..337d10a1ffb647c8b423c5cd8750b47ed5a82518 100644
--- a/Source/bindings/v8/CustomElementConstructorBuilder.cpp
+++ b/Source/bindings/v8/CustomElementConstructorBuilder.cpp
@@ -150,13 +150,18 @@ PassRefPtr<CustomElementLifecycleCallbacks> CustomElementConstructorBuilder::cre
exceptionCatcher.SetVerbose(true);
v8::Isolate* isolate = v8::Isolate::GetCurrent();
- v8::Handle<v8::Value> createdValue = m_prototype->Get(v8String("createdCallback", isolate));
+ v8::Handle<v8::Function> created = retrieveCallback(isolate, "createdCallback");
+ v8::Handle<v8::Function> attributeChanged = retrieveCallback(isolate, "attributeChangedCallback");
- v8::Handle<v8::Function> createdFunction;
- if (!createdValue.IsEmpty() && createdValue->IsFunction())
- createdFunction = v8::Handle<v8::Function>::Cast(createdValue);
+ return V8CustomElementLifecycleCallbacks::create(document, m_prototype, created, attributeChanged);
+}
- return V8CustomElementLifecycleCallbacks::create(document, m_prototype, createdFunction);
+v8::Handle<v8::Function> CustomElementConstructorBuilder::retrieveCallback(v8::Isolate* isolate, const char* name)
+{
+ v8::Handle<v8::Value> value = m_prototype->Get(v8String(name, isolate));
+ if (value.IsEmpty() || !value->IsFunction())
+ return v8::Handle<v8::Function>();
+ return v8::Handle<v8::Function>::Cast(value);
}
bool CustomElementConstructorBuilder::createConstructor(Document* document, CustomElementDefinition* definition)
« no previous file with comments | « Source/bindings/v8/CustomElementConstructorBuilder.h ('k') | Source/bindings/v8/V8CustomElementLifecycleCallbacks.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698