Changeset 146851 in webkit
- Timestamp:
- Mar 25, 2013 11:35:06 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r146849 r146851 1 2013-03-25 Hajime Morrita <morrita@google.com> 2 3 Custom Elements Refactoring: The name V8CustomElement is confusing. 4 https://bugs.webkit.org/show_bug.cgi?id=113165 5 6 Reviewed by Kent Tamura. 7 8 This change moves functions from V8CustomElement to CustomElementHelpers and 9 removes V8CustomElement. V8CustomElement is just a heritage of old design 10 and no longer makes sense. 11 12 No new tests. No behavior change. 13 14 * WebCore.gypi: 15 * bindings/v8/CustomElementHelpers.cpp: 16 (WebCore::CustomElementHelpers::createWrapper): 17 (WebCore): 18 * bindings/v8/CustomElementHelpers.h: 19 (CustomElementHelpers): 20 (WebCore::CustomElementHelpers::wrap): 21 (WebCore): 22 (WebCore::CustomElementHelpers::constructorOf): 23 * bindings/v8/V8CustomElement.cpp: Removed. 24 * bindings/v8/V8CustomElement.h: Removed. 25 * bindings/v8/custom/V8CustomElementConstructorCustom.cpp: 26 (WebCore::V8CustomElementConstructor::callAsFunctionCallback): 27 * dom/make_names.pl: 28 (printWrapperFactoryCppFile): 29 1 30 2013-03-25 Eugene Klyuchnikov <eustas@chromium.org> 2 31 -
trunk/Source/WebCore/WebCore.gypi
r146833 r146851 1373 1373 'bindings/v8/V8Collection.cpp', 1374 1374 'bindings/v8/V8Collection.h', 1375 'bindings/v8/V8CustomElement.cpp',1376 'bindings/v8/V8CustomElement.h',1377 1375 'bindings/v8/V8DOMConfiguration.cpp', 1378 1376 'bindings/v8/V8DOMConfiguration.h', -
trunk/Source/WebCore/bindings/v8/CustomElementHelpers.cpp
r146592 r146851 44 44 #if ENABLE(CUSTOM_ELEMENTS) 45 45 46 v8::Handle<v8::Object> CustomElementHelpers::createWrapper(PassRefPtr<Element> impl, v8::Handle<v8::Object> creationContext, PassRefPtr<CustomElementConstructor> constructor, v8::Isolate* isolate) 47 { 48 ASSERT(impl); 49 50 // The constructor and registered lifecycle callbacks should be visible only from main world. 51 // FIXME: This shouldn't be needed once each custom element has its own FunctionTemplate 52 // https://bugs.webkit.org/show_bug.cgi?id=108138 53 if (!CustomElementHelpers::isFeatureAllowed(creationContext->CreationContext())) { 54 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, &V8HTMLElement::info, impl.get(), isolate); 55 if (!wrapper.IsEmpty()) 56 V8DOMWrapper::associateObjectWithWrapper(impl, &V8HTMLElement::info, wrapper, isolate, WrapperConfiguration::Dependent); 57 return wrapper; 58 } 59 60 v8::Handle<v8::Value> constructorValue = WebCore::toV8(constructor.get(), creationContext, isolate); 61 if (constructorValue.IsEmpty() || !constructorValue->IsObject()) 62 return v8::Handle<v8::Object>(); 63 v8::Handle<v8::Object> constructorWapper = v8::Handle<v8::Object>::Cast(constructorValue); 64 v8::Handle<v8::Object> prototype = v8::Handle<v8::Object>::Cast(constructorWapper->Get(v8::String::NewSymbol("prototype"))); 65 WrapperTypeInfo* typeInfo = CustomElementHelpers::findWrapperType(prototype); 66 if (!typeInfo) 67 return v8::Handle<v8::Object>(); 68 69 v8::Handle<v8::Object> wrapper = V8DOMWrapper::createWrapper(creationContext, typeInfo, impl.get(), isolate); 70 if (wrapper.IsEmpty()) 71 return v8::Handle<v8::Object>(); 72 73 wrapper->SetPrototype(prototype); 74 V8DOMWrapper::associateObjectWithWrapper(impl, typeInfo, wrapper, isolate, WrapperConfiguration::Dependent); 75 return wrapper; 76 } 77 46 78 bool CustomElementHelpers::initializeConstructorWrapper(CustomElementConstructor* constructor, const ScriptValue& prototype, ScriptState* state) 47 79 { -
trunk/Source/WebCore/bindings/v8/CustomElementHelpers.h
r146583 r146851 32 32 #define CustomElementHelpers_h 33 33 34 #include "CustomElementConstructor.h" 35 #include "CustomElementRegistry.h" 36 #include "Document.h" 34 37 #include "ExceptionCode.h" 35 38 #include "ScriptValue.h" 39 #include "V8Binding.h" 40 #include "V8DOMWrapper.h" 41 #include "V8HTMLElement.h" 42 #include "V8HTMLUnknownElement.h" 36 43 #include <wtf/Forward.h> 44 #include <wtf/PassRefPtr.h> 37 45 38 46 namespace WebCore { … … 59 67 static void invokeReadyCallbacksIfNeeded(ScriptExecutionContext*, const Vector<CustomElementInvocation>&); 60 68 69 // 70 // You can just use toV8(Node*) to get correct wrapper objects, even for custom elements. 71 // Then generated ElementWrapperFactories call V8CustomElement::wrap() with proper CustomElementConstructor instances 72 // accordingly. 73 // 74 static v8::Handle<v8::Object> wrap(Element*, v8::Handle<v8::Object> creationContext, PassRefPtr<CustomElementConstructor>, v8::Isolate*); 75 static PassRefPtr<CustomElementConstructor> constructorOf(Element*); 76 61 77 private: 62 78 static void invokeReadyCallbackIfNeeded(Element*, v8::Handle<v8::Context>); 79 static v8::Handle<v8::Object> createWrapper(PassRefPtr<Element>, v8::Handle<v8::Object>, PassRefPtr<CustomElementConstructor>, v8::Isolate*); 63 80 }; 81 82 inline v8::Handle<v8::Object> CustomElementHelpers::wrap(Element* impl, v8::Handle<v8::Object> creationContext, PassRefPtr<CustomElementConstructor> constructor, v8::Isolate* isolate) 83 { 84 ASSERT(impl); 85 ASSERT(DOMDataStore::getWrapper(impl, isolate).IsEmpty()); 86 return CustomElementHelpers::createWrapper(impl, creationContext, constructor, isolate); 87 } 88 89 inline PassRefPtr<CustomElementConstructor> CustomElementHelpers::constructorOf(Element* element) 90 { 91 if (CustomElementRegistry* registry = element->document()->registry()) 92 return registry->findFor(element); 93 return 0; 94 } 64 95 65 96 #endif // ENABLE(CUSTOM_ELEMENTS) -
trunk/Source/WebCore/bindings/v8/custom/V8CustomElementConstructorCustom.cpp
r145932 r146851 33 33 34 34 #include "CustomElementConstructor.h" 35 #include "CustomElementHelpers.h" 35 36 #include "V8Binding.h" 36 #include "V8CustomElement.h"37 37 38 38 namespace WebCore { … … 49 49 if (!element) 50 50 return v8Undefined(); 51 return V8CustomElement::wrap(element.get(), args.Holder(), impl, args.GetIsolate());51 return CustomElementHelpers::wrap(element.get(), args.Holder(), impl, args.GetIsolate()); 52 52 } 53 53 -
trunk/Source/WebCore/dom/make_names.pl
r146464 r146851 1220 1220 1221 1221 #if ENABLE(CUSTOM_ELEMENTS) 1222 #include " V8CustomElement.h"1222 #include "CustomElementHelpers.h" 1223 1223 #endif 1224 1224 … … 1297 1297 print F <<END 1298 1298 #if ENABLE(CUSTOM_ELEMENTS) 1299 if (PassRefPtr<CustomElementConstructor> constructor = V8CustomElement::constructorOf(element))1300 return V8CustomElement::wrap(element, creationContext, constructor, isolate);1299 if (PassRefPtr<CustomElementConstructor> constructor = CustomElementHelpers::constructorOf(element)) 1300 return CustomElementHelpers::wrap(element, creationContext, constructor, isolate); 1301 1301 #endif 1302 1302 END
Note: See TracChangeset
for help on using the changeset viewer.