Changeset 140303 in webkit
- Timestamp:
- Jan 20, 2013 11:27:56 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r140302 r140303 1 2013-01-20 Kentaro Hara <haraken@chromium.org> 2 3 Add a [ConstructorConditional] IDL attribute 4 https://bugs.webkit.org/show_bug.cgi?id=107407 5 6 Reviewed by Adam Barth. 7 8 Per discussion in webkit-dev, we need to implement DOM4 event constructors 9 under a enable flag. For that purpose, we implement a [ConstructorConditional] 10 IDL attribute. 11 12 Test: bindings/scripts/test/TestInterface.idl 13 14 * bindings/scripts/CodeGenerator.pm: 15 (GenerateConstructorConditionalString): 16 * bindings/scripts/CodeGeneratorJS.pm: 17 (GenerateConstructorDeclaration): 18 (GenerateConstructorHelperMethods): 19 * bindings/scripts/CodeGeneratorV8.pm: 20 (GenerateHeader): 21 (GenerateImplementation): 22 * bindings/scripts/IDLAttributes.txt: 23 * bindings/scripts/test/JS/JSTestInterface.cpp: 24 (WebCore): 25 * bindings/scripts/test/JS/JSTestInterface.h: 26 (JSTestInterfaceConstructor): 27 * bindings/scripts/test/TestInterface.idl: 28 * bindings/scripts/test/V8/V8TestInterface.cpp: 29 (WebCore::ConfigureV8TestInterfaceTemplate): 30 * bindings/scripts/test/V8/V8TestInterface.h: 31 (V8TestInterface): 32 1 33 2013-01-20 Kentaro Hara <haraken@chromium.org> 2 34 -
trunk/Source/WebCore/bindings/scripts/CodeGenerator.pm
r139641 r140303 649 649 } 650 650 651 sub GenerateConstructorConditionalString 652 { 653 my $generator = shift; 654 my $node = shift; 655 656 my $conditional = $node->extendedAttributes->{"ConstructorConditional"}; 657 if ($conditional) { 658 return $generator->GenerateConditionalStringFromAttributeValue($conditional); 659 } else { 660 return ""; 661 } 662 } 663 651 664 sub GenerateConditionalStringFromAttributeValue 652 665 { -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r140182 r140303 3683 3683 } 3684 3684 3685 my $conditionalString = $codeGenerator->GenerateConstructorConditionalString($interface); 3686 push(@$outputArray, "#if $conditionalString\n") if $conditionalString; 3685 3687 push(@$outputArray, " static JSC::ConstructType getConstructData(JSC::JSCell*, JSC::ConstructData&);\n"); 3688 push(@$outputArray, "#endif // $conditionalString\n") if $conditionalString; 3686 3689 } 3687 3690 push(@$outputArray, "};\n\n"); … … 4051 4054 if (IsConstructable($interface)) { 4052 4055 if (!$interface->extendedAttributes->{"NamedConstructor"} || $generatingNamedConstructor) { 4056 my $conditionalString = $codeGenerator->GenerateConstructorConditionalString($interface); 4057 push(@$outputArray, "#if $conditionalString\n") if $conditionalString; 4053 4058 push(@$outputArray, "ConstructType ${constructorClassName}::getConstructData(JSCell*, ConstructData& constructData)\n"); 4054 4059 push(@$outputArray, "{\n"); 4055 4060 push(@$outputArray, " constructData.native.function = construct${className};\n"); 4056 4061 push(@$outputArray, " return ConstructTypeHost;\n"); 4057 push(@$outputArray, "}\n\n"); 4062 push(@$outputArray, "}\n"); 4063 push(@$outputArray, "#endif // $conditionalString\n") if $conditionalString; 4064 push(@$outputArray, "\n"); 4058 4065 } 4059 4066 } -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorV8.pm
r139900 r140303 406 406 407 407 if (IsConstructable($interface)) { 408 push(@headerContent, <<END); 409 static v8::Handle<v8::Value> constructorCallback(const v8::Arguments&); 408 my $conditionalString = $codeGenerator->GenerateConstructorConditionalString($interface); 409 push(@headerContent, "#if $conditionalString\n") if $conditionalString; 410 push(@headerContent, " static v8::Handle<v8::Value> constructorCallback(const v8::Arguments&);\n"); 411 push(@headerContent, "#endif // $conditionalString\n") if $conditionalString; 410 412 END 411 413 } … … 2949 2951 2950 2952 if (IsConstructable($interface)) { 2951 push(@implContent, <<END); 2952 desc->SetCallHandler(${v8InterfaceName}::constructorCallback); 2953 END 2953 my $conditionalString = $codeGenerator->GenerateConstructorConditionalString($interface); 2954 push(@implContent, "#if $conditionalString\n") if $conditionalString; 2955 push(@implContent, " desc->SetCallHandler(${v8InterfaceName}::constructorCallback);\n"); 2956 push(@implContent, "#endif // $conditionalString\n") if $conditionalString; 2954 2957 } 2955 2958 -
trunk/Source/WebCore/bindings/scripts/IDLAttributes.txt
r139331 r140303 29 29 Conditional=* 30 30 Constructor 31 ConstructorConditional=* 31 32 ConstructorParameters=* 32 33 ConstructorRaisesException -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.cpp
r138008 r140303 149 149 } 150 150 151 #if ENABLE(TEST_INTERFACE) 151 152 ConstructType JSTestInterfaceConstructor::getConstructData(JSCell*, ConstructData& constructData) 152 153 { … … 154 155 return ConstructTypeHost; 155 156 } 157 #endif // ENABLE(TEST_INTERFACE) 156 158 157 159 /* Hash table for prototype */ -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestInterface.h
r135081 r140303 153 153 static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags; 154 154 static JSC::EncodedJSValue JSC_HOST_CALL constructJSTestInterface(JSC::ExecState*); 155 #if ENABLE(TEST_INTERFACE) 155 156 static JSC::ConstructType getConstructData(JSC::JSCell*, JSC::ConstructData&); 157 #endif // ENABLE(TEST_INTERFACE) 156 158 }; 157 159 -
trunk/Source/WebCore/bindings/scripts/test/TestInterface.idl
r131172 r140303 35 35 CallWith=ScriptExecutionContext, 36 36 Constructor(in DOMString str1, in [Optional=DefaultIsUndefined] DOMString str2), 37 ConstructorRaisesException 37 ConstructorRaisesException, 38 ConstructorConditional=TEST_INTERFACE 38 39 ] interface TestInterface { 39 40 }; -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.cpp
r139483 r140303 266 266 V8TestInterfaceCallbacks, WTF_ARRAY_LENGTH(V8TestInterfaceCallbacks)); 267 267 UNUSED_PARAM(defaultSignature); // In some cases, it will not be used. 268 #if ENABLE(TEST_INTERFACE) 268 269 desc->SetCallHandler(V8TestInterface::constructorCallback); 270 #endif // ENABLE(TEST_INTERFACE) 269 271 v8::Local<v8::ObjectTemplate> instance = desc->InstanceTemplate(); 270 272 v8::Local<v8::ObjectTemplate> proto = desc->PrototypeTemplate(); -
trunk/Source/WebCore/bindings/scripts/test/V8/V8TestInterface.h
r139900 r140303 47 47 static WrapperTypeInfo info; 48 48 static ActiveDOMObject* toActiveDOMObject(v8::Handle<v8::Object>); 49 #if ENABLE(TEST_INTERFACE) 49 50 static v8::Handle<v8::Value> constructorCallback(const v8::Arguments&); 51 #endif // ENABLE(TEST_INTERFACE) 50 52 static v8::Handle<v8::Value> namedPropertySetter(v8::Local<v8::String>, v8::Local<v8::Value>, const v8::AccessorInfo&); 51 53 static const int internalFieldCount = v8DefaultWrapperInternalFieldCount + 0;
Note: See TracChangeset
for help on using the changeset viewer.