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

Side by Side Diff: Source/bindings/v8/CustomElementConstructorBuilder.cpp

Issue 18167006: Implement Custom Elements' entered and left document callbacks. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Feedback 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 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 are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 { 144 {
145 ASSERT(!m_prototype.IsEmpty()); 145 ASSERT(!m_prototype.IsEmpty());
146 146
147 RefPtr<Document> protect(document); 147 RefPtr<Document> protect(document);
148 148
149 v8::TryCatch exceptionCatcher; 149 v8::TryCatch exceptionCatcher;
150 exceptionCatcher.SetVerbose(true); 150 exceptionCatcher.SetVerbose(true);
151 151
152 v8::Isolate* isolate = v8::Isolate::GetCurrent(); 152 v8::Isolate* isolate = v8::Isolate::GetCurrent();
153 v8::Handle<v8::Function> created = retrieveCallback(isolate, "createdCallbac k"); 153 v8::Handle<v8::Function> created = retrieveCallback(isolate, "createdCallbac k");
154 v8::Handle<v8::Function> enteredDocument = retrieveCallback(isolate, "entere dDocumentCallback");
155 v8::Handle<v8::Function> leftDocument = retrieveCallback(isolate, "leftDocum entCallback");
154 v8::Handle<v8::Function> attributeChanged = retrieveCallback(isolate, "attri buteChangedCallback"); 156 v8::Handle<v8::Function> attributeChanged = retrieveCallback(isolate, "attri buteChangedCallback");
155 157
156 return V8CustomElementLifecycleCallbacks::create(document, m_prototype, crea ted, attributeChanged); 158 return V8CustomElementLifecycleCallbacks::create(document, m_prototype, crea ted, enteredDocument, leftDocument, attributeChanged);
157 } 159 }
158 160
159 v8::Handle<v8::Function> CustomElementConstructorBuilder::retrieveCallback(v8::I solate* isolate, const char* name) 161 v8::Handle<v8::Function> CustomElementConstructorBuilder::retrieveCallback(v8::I solate* isolate, const char* name)
160 { 162 {
161 v8::Handle<v8::Value> value = m_prototype->Get(v8String(name, isolate)); 163 v8::Handle<v8::Value> value = m_prototype->Get(v8String(name, isolate));
162 if (value.IsEmpty() || !value->IsFunction()) 164 if (value.IsEmpty() || !value->IsFunction())
163 return v8::Handle<v8::Function>(); 165 return v8::Handle<v8::Function>();
164 return v8::Handle<v8::Function>::Cast(value); 166 return v8::Handle<v8::Function>::Cast(value);
165 } 167 }
166 168
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; 292 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope;
291 RefPtr<Element> element = document->createElementNS(namespaceURI, name, mayb eType->IsNull() ? nullAtom : type, ec); 293 RefPtr<Element> element = document->createElementNS(namespaceURI, name, mayb eType->IsNull() ? nullAtom : type, ec);
292 if (ec) { 294 if (ec) {
293 setDOMException(ec, isolate); 295 setDOMException(ec, isolate);
294 return; 296 return;
295 } 297 }
296 v8SetReturnValue(args, toV8Fast(element.release(), args, document)); 298 v8SetReturnValue(args, toV8Fast(element.release(), args, document));
297 } 299 }
298 300
299 } // namespace WebCore 301 } // namespace WebCore
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698