| Index: Source/core/dom/Element.cpp
|
| diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
|
| index 7f7a9a06ab6a6cc3ac920dbf1a2572a23eb3d8a8..474912b54c8a4017c0b495350d3fe5681082a69e 100644
|
| --- a/Source/core/dom/Element.cpp
|
| +++ b/Source/core/dom/Element.cpp
|
| @@ -26,9 +26,12 @@
|
| #include "config.h"
|
| #include "core/dom/Element.h"
|
|
|
| +#include "bindings/core/v8/DOMDataStore.h"
|
| #include "bindings/core/v8/Dictionary.h"
|
| #include "bindings/core/v8/ExceptionMessages.h"
|
| #include "bindings/core/v8/ExceptionState.h"
|
| +#include "bindings/core/v8/V8DOMWrapper.h"
|
| +#include "bindings/core/v8/V8PerContextData.h"
|
| #include "core/CSSValueKeywords.h"
|
| #include "core/SVGNames.h"
|
| #include "core/XLinkNames.h"
|
| @@ -3268,4 +3271,38 @@ void Element::trace(Visitor* visitor)
|
| ContainerNode::trace(visitor);
|
| }
|
|
|
| +v8::Handle<v8::Object> Element::wrap(v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
|
| +{
|
| + if (isCustomElement())
|
| + return wrapCustomElement(creationContext, isolate);
|
| + return ContainerNode::wrap(creationContext, isolate);
|
| +}
|
| +
|
| +v8::Handle<v8::Object> Element::wrapCustomElement(v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
|
| +{
|
| + ASSERT(!DOMDataStore::containsWrapperNonTemplate(this, isolate));
|
| +
|
| + ASSERT(!creationContext.IsEmpty());
|
| + v8::Handle<v8::Context> context = creationContext->CreationContext();
|
| +
|
| + if (!isUpgradedCustomElement() || DOMWrapperWorld::world(context).isIsolatedWorld())
|
| + return ContainerNode::wrap(creationContext, isolate);
|
| +
|
| + V8PerContextData* perContextData = V8PerContextData::from(context);
|
| + if (!perContextData)
|
| + return v8::Handle<v8::Object>();
|
| +
|
| + CustomElementBinding* binding = perContextData->customElementBinding(customElementDefinition());
|
| + const WrapperTypeInfo* wrapperType = wrapperTypeInfo();
|
| + v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, wrapperType, toInternalPointer(), isolate);
|
| + if (wrapper.IsEmpty())
|
| + return v8::Handle<v8::Object>();
|
| +
|
| + wrapper->SetPrototype(binding->prototype());
|
| +
|
| + wrapperType->refObject(toInternalPointer());
|
| + V8DOMWrapper::associateObjectWithWrapperNonTemplate(this, wrapperType, wrapper, isolate);
|
| + return wrapper;
|
| +}
|
| +
|
| } // namespace blink
|
|
|