| 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 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 { | 138 { |
| 139 ASSERT(!m_prototype.IsEmpty()); | 139 ASSERT(!m_prototype.IsEmpty()); |
| 140 | 140 |
| 141 RefPtr<ExecutionContext> executionContext(toExecutionContext(m_context)); | 141 RefPtr<ExecutionContext> executionContext(toExecutionContext(m_context)); |
| 142 | 142 |
| 143 v8::TryCatch exceptionCatcher; | 143 v8::TryCatch exceptionCatcher; |
| 144 exceptionCatcher.SetVerbose(true); | 144 exceptionCatcher.SetVerbose(true); |
| 145 | 145 |
| 146 v8::Isolate* isolate = v8::Isolate::GetCurrent(); | 146 v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
| 147 v8::Handle<v8::Function> created = retrieveCallback(isolate, "createdCallbac
k"); | 147 v8::Handle<v8::Function> created = retrieveCallback(isolate, "createdCallbac
k"); |
| 148 v8::Handle<v8::Function> enteredView = retrieveCallback(isolate, "enteredVie
wCallback"); | 148 v8::Handle<v8::Function> attached = retrieveCallback(isolate, "attachedCallb
ack"); |
| 149 v8::Handle<v8::Function> leftView = retrieveCallback(isolate, "leftViewCallb
ack"); | 149 v8::Handle<v8::Function> detached = retrieveCallback(isolate, "detachedCallb
ack"); |
| 150 v8::Handle<v8::Function> attributeChanged = retrieveCallback(isolate, "attri
buteChangedCallback"); | 150 v8::Handle<v8::Function> attributeChanged = retrieveCallback(isolate, "attri
buteChangedCallback"); |
| 151 | 151 |
| 152 m_callbacks = V8CustomElementLifecycleCallbacks::create(executionContext.get
(), m_prototype, created, enteredView, leftView, attributeChanged); | 152 m_callbacks = V8CustomElementLifecycleCallbacks::create(executionContext.get
(), m_prototype, created, attached, detached, attributeChanged); |
| 153 return m_callbacks.get(); | 153 return m_callbacks.get(); |
| 154 } | 154 } |
| 155 | 155 |
| 156 v8::Handle<v8::Function> CustomElementConstructorBuilder::retrieveCallback(v8::I
solate* isolate, const char* name) | 156 v8::Handle<v8::Function> CustomElementConstructorBuilder::retrieveCallback(v8::I
solate* isolate, const char* name) |
| 157 { | 157 { |
| 158 v8::Handle<v8::Value> value = m_prototype->Get(v8String(isolate, name)); | 158 v8::Handle<v8::Value> value = m_prototype->Get(v8String(isolate, name)); |
| 159 if (value.IsEmpty() || !value->IsFunction()) | 159 if (value.IsEmpty() || !value->IsFunction()) |
| 160 return v8::Handle<v8::Function>(); | 160 return v8::Handle<v8::Function>(); |
| 161 return value.As<v8::Function>(); | 161 return value.As<v8::Function>(); |
| 162 } | 162 } |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 278 | 278 |
| 279 ExceptionState exceptionState(ExceptionState::ConstructionContext, "CustomEl
ement", info.Holder(), info.GetIsolate()); | 279 ExceptionState exceptionState(ExceptionState::ConstructionContext, "CustomEl
ement", info.Holder(), info.GetIsolate()); |
| 280 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; | 280 CustomElementCallbackDispatcher::CallbackDeliveryScope deliveryScope; |
| 281 RefPtr<Element> element = document->createElementNS(namespaceURI, tagName, m
aybeType->IsNull() ? nullAtom : type, exceptionState); | 281 RefPtr<Element> element = document->createElementNS(namespaceURI, tagName, m
aybeType->IsNull() ? nullAtom : type, exceptionState); |
| 282 if (exceptionState.throwIfNeeded()) | 282 if (exceptionState.throwIfNeeded()) |
| 283 return; | 283 return; |
| 284 v8SetReturnValueFast(info, element.release(), document); | 284 v8SetReturnValueFast(info, element.release(), document); |
| 285 } | 285 } |
| 286 | 286 |
| 287 } // namespace WebCore | 287 } // namespace WebCore |
| OLD | NEW |