| OLD | NEW |
| 1 #!/usr/bin/perl -w | 1 #!/usr/bin/perl -w |
| 2 | 2 |
| 3 # Copyright (C) 2005, 2006, 2007, 2009 Apple Inc. All rights reserved. | 3 # Copyright (C) 2005, 2006, 2007, 2009 Apple Inc. All rights reserved. |
| 4 # Copyright (C) 2009, Julien Chaffraix <jchaffraix@webkit.org> | 4 # Copyright (C) 2009, Julien Chaffraix <jchaffraix@webkit.org> |
| 5 # Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmob
ile.com/) | 5 # Copyright (C) 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmob
ile.com/) |
| 6 # Copyright (C) 2011 Ericsson AB. All rights reserved. | 6 # Copyright (C) 2011 Ericsson AB. All rights reserved. |
| 7 # | 7 # |
| 8 # Redistribution and use in source and binary forms, with or without | 8 # Redistribution and use in source and binary forms, with or without |
| 9 # modification, are permitted provided that the following conditions | 9 # modification, are permitted provided that the following conditions |
| 10 # are met: | 10 # are met: |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 use strict; | 32 use strict; |
| 33 | 33 |
| 34 use StaticString; | 34 use StaticString; |
| 35 use Config; | 35 use Config; |
| 36 use Getopt::Long; | 36 use Getopt::Long; |
| 37 use File::Path; | 37 use File::Path; |
| 38 use File::Spec; | 38 use File::Spec; |
| 39 use IO::File; | 39 use IO::File; |
| 40 use InFilesParser; | 40 use InFilesParser; |
| 41 | 41 |
| 42 use FindBin; # locate this script |
| 43 use lib "$FindBin::Bin/../../../../../third_party/WebKit/Source/bindings/scripts
"; # use the binding generator directory. |
| 44 #use lib "$FindBin::Bin/../bindings/scripts"; # use the binding generator direc
tory. |
| 45 use idltopath; |
| 46 |
| 42 sub readTags($$); | 47 sub readTags($$); |
| 43 sub readAttrs($$); | 48 sub readAttrs($$); |
| 44 | 49 |
| 45 my $printFactory = 0; | 50 my $printFactory = 0; |
| 46 my $fontNamesIn = ""; | 51 my $fontNamesIn = ""; |
| 47 my $tagsFile = ""; | 52 my $tagsFile = ""; |
| 48 my $attrsFile = ""; | 53 my $attrsFile = ""; |
| 49 my $outputDir = "."; | 54 my $outputDir = "."; |
| 50 my %parsedTags = (); | 55 my %parsedTags = (); |
| 51 my %parsedAttrs = (); | 56 my %parsedAttrs = (); |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 "; | 610 "; |
| 606 } | 611 } |
| 607 | 612 |
| 608 sub printNamesHeaderFile | 613 sub printNamesHeaderFile |
| 609 { | 614 { |
| 610 my ($headerPath) = shift; | 615 my ($headerPath) = shift; |
| 611 my $F; | 616 my $F; |
| 612 open F, ">$headerPath"; | 617 open F, ">$headerPath"; |
| 613 | 618 |
| 614 printLicenseHeader($F); | 619 printLicenseHeader($F); |
| 615 printHeaderHead($F, "DOM", $parameters{namespace}, "#include \"QualifiedName
.h\""); | 620 printHeaderHead($F, "DOM", $parameters{namespace}, "#include \"core/dom/Qual
ifiedName.h\""); |
| 616 | 621 |
| 617 my $lowerNamespace = lc($parameters{namespacePrefix}); | 622 my $lowerNamespace = lc($parameters{namespacePrefix}); |
| 618 print F "// Namespace\n"; | 623 print F "// Namespace\n"; |
| 619 print F "extern const WTF::AtomicString ${lowerNamespace}NamespaceURI;\n\n"; | 624 print F "extern const WTF::AtomicString ${lowerNamespace}NamespaceURI;\n\n"; |
| 620 | 625 |
| 621 if (keys %allTags) { | 626 if (keys %allTags) { |
| 622 print F "// Tags\n"; | 627 print F "// Tags\n"; |
| 623 printMacros($F, "extern const WebCore::QualifiedName", "Tag", \%allTags)
; | 628 printMacros($F, "extern const WebCore::QualifiedName", "Tag", \%allTags)
; |
| 624 } | 629 } |
| 625 | 630 |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 my %tagsSeen; | 723 my %tagsSeen; |
| 719 for my $tagName (sort keys %enabledTags) { | 724 for my $tagName (sort keys %enabledTags) { |
| 720 my $JSInterfaceName = $enabledTags{$tagName}{JSInterfaceName}; | 725 my $JSInterfaceName = $enabledTags{$tagName}{JSInterfaceName}; |
| 721 next if defined($tagsSeen{$JSInterfaceName}) || usesDefaultJSWrapper($ta
gName); | 726 next if defined($tagsSeen{$JSInterfaceName}) || usesDefaultJSWrapper($ta
gName); |
| 722 if ($enabledTags{$tagName}{conditional}) { | 727 if ($enabledTags{$tagName}{conditional}) { |
| 723 # We skip feature-define-specific #includes here since we handle the
m separately. | 728 # We skip feature-define-specific #includes here since we handle the
m separately. |
| 724 next; | 729 next; |
| 725 } | 730 } |
| 726 $tagsSeen{$JSInterfaceName} = 1; | 731 $tagsSeen{$JSInterfaceName} = 1; |
| 727 | 732 |
| 728 print F "#include \"V8${JSInterfaceName}.h\"\n"; | 733 # V8HTMLElementWrapperFactory.cpp that uses this code is generated into
"webkit" and for instance V8HTMLAnchorElement.h is in "webkit/bindings" |
| 734 print F "#include \"bindings/V8${JSInterfaceName}.h\"\n"; |
| 729 } | 735 } |
| 730 print F "#include \"V8$parameters{fallbackInterfaceName}.h\"\n"; | 736 print F "#include \"bindings/V8$parameters{fallbackInterfaceName}.h\"\n"; |
| 731 } | 737 } |
| 732 | 738 |
| 733 sub printElementIncludes | 739 sub printElementIncludes |
| 734 { | 740 { |
| 735 my $F = shift; | 741 my $F = shift; |
| 736 | 742 |
| 737 my %tagsSeen; | 743 my %tagsSeen; |
| 738 for my $tagName (sort keys %enabledTags) { | 744 for my $tagName (sort keys %enabledTags) { |
| 739 my $interfaceName = $enabledTags{$tagName}{interfaceName}; | 745 my $interfaceName = $enabledTags{$tagName}{interfaceName}; |
| 740 next if defined($tagsSeen{$interfaceName}); | 746 next if defined($tagsSeen{$interfaceName}); |
| 741 if ($enabledTags{$tagName}{conditional}) { | 747 if ($enabledTags{$tagName}{conditional}) { |
| 742 # We skip feature-define-specific #includes here since we handle the
m separately. | 748 # We skip feature-define-specific #includes here since we handle the
m separately. |
| 743 next; | 749 next; |
| 744 } | 750 } |
| 745 $tagsSeen{$interfaceName} = 1; | 751 $tagsSeen{$interfaceName} = 1; |
| 746 | 752 |
| 747 print F "#include \"${interfaceName}.h\"\n"; | 753 my $includepath = idl_to_path($interfaceName); |
| 754 print F "#include \"$includepath${interfaceName}.h\"\n"; |
| 748 } | 755 } |
| 749 print F "#include \"$parameters{fallbackInterfaceName}.h\"\n"; | 756 print F "#include \"$parameters{fallbackInterfaceName}.h\"\n"; |
| 750 } | 757 } |
| 751 | 758 |
| 752 sub printConditionalElementIncludes | 759 sub printConditionalElementIncludes |
| 753 { | 760 { |
| 754 my ($F, $shouldIncludeV8Headers) = @_; | 761 my ($F, $shouldIncludeV8Headers) = @_; |
| 755 | 762 |
| 756 my %conditionals; | 763 my %conditionals; |
| 757 my %unconditionalElementIncludes; | 764 my %unconditionalElementIncludes; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 ; | 838 ; |
| 832 | 839 |
| 833 printElementIncludes($F); | 840 printElementIncludes($F); |
| 834 | 841 |
| 835 print F "\n#include <wtf/HashMap.h>\n"; | 842 print F "\n#include <wtf/HashMap.h>\n"; |
| 836 | 843 |
| 837 printConditionalElementIncludes($F); | 844 printConditionalElementIncludes($F); |
| 838 | 845 |
| 839 print F <<END | 846 print F <<END |
| 840 | 847 |
| 841 #include "ContextFeatures.h" | 848 #include "core/dom/ContextFeatures.h" |
| 842 #include "Document.h" | 849 #include "core/dom/Document.h" |
| 843 #include "RuntimeEnabledFeatures.h" | 850 #include "core/page/RuntimeEnabledFeatures.h" |
| 844 #include "Settings.h" | 851 #include "core/page/Settings.h" |
| 845 | 852 |
| 846 #if ENABLE(CUSTOM_ELEMENTS) | 853 #if ENABLE(CUSTOM_ELEMENTS) |
| 847 #include "CustomElementConstructor.h" | 854 #include "CustomElementConstructor.h" |
| 848 #include "CustomElementRegistry.h" | 855 #include "CustomElementRegistry.h" |
| 849 #endif | 856 #endif |
| 850 | 857 |
| 851 namespace WebCore { | 858 namespace WebCore { |
| 852 | 859 |
| 853 using namespace $parameters{namespace}Names; | 860 using namespace $parameters{namespace}Names; |
| 854 | 861 |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1100 print F "\n#include \"$parameters{namespace}Names.h\"\n\n"; | 1107 print F "\n#include \"$parameters{namespace}Names.h\"\n\n"; |
| 1101 | 1108 |
| 1102 printElementIncludes($F); | 1109 printElementIncludes($F); |
| 1103 | 1110 |
| 1104 print F "\n#include <wtf/StdLibExtras.h>\n"; | 1111 print F "\n#include <wtf/StdLibExtras.h>\n"; |
| 1105 | 1112 |
| 1106 printConditionalElementIncludes($F, 1); | 1113 printConditionalElementIncludes($F, 1); |
| 1107 | 1114 |
| 1108 print F <<END | 1115 print F <<END |
| 1109 | 1116 |
| 1110 #include "ContextFeatures.h" | 1117 #include "core/dom/ContextFeatures.h" |
| 1111 #include "Document.h" | 1118 #include "core/dom/Document.h" |
| 1112 #include "RuntimeEnabledFeatures.h" | 1119 #include "core/page/RuntimeEnabledFeatures.h" |
| 1113 #include "Settings.h" | 1120 #include "core/page/Settings.h" |
| 1114 | 1121 |
| 1115 #include "V8$parameters{namespace}Element.h" | 1122 #include "V8$parameters{namespace}Element.h" |
| 1116 | 1123 |
| 1117 #if ENABLE(CUSTOM_ELEMENTS) | 1124 #if ENABLE(CUSTOM_ELEMENTS) |
| 1118 #include "CustomElementHelpers.h" | 1125 #include "bindings/v8/CustomElementHelpers.h" |
| 1119 #endif | 1126 #endif |
| 1120 | 1127 |
| 1121 #include <v8.h> | 1128 #include <v8.h> |
| 1122 | 1129 |
| 1123 namespace WebCore { | 1130 namespace WebCore { |
| 1124 | 1131 |
| 1125 using namespace $parameters{namespace}Names; | 1132 using namespace $parameters{namespace}Names; |
| 1126 | 1133 |
| 1127 typedef v8::Handle<v8::Object> (*Create$parameters{namespace}ElementWrapperFunct
ion)($parameters{namespace}Element*, v8::Handle<v8::Object> creationContext, v8:
:Isolate*); | 1134 typedef v8::Handle<v8::Object> (*Create$parameters{namespace}ElementWrapperFunct
ion)($parameters{namespace}Element*, v8::Handle<v8::Object> creationContext, v8:
:Isolate*); |
| 1128 | 1135 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1242 open F, ">" . $outputDir . "/V8" . $wrapperFactoryFileName . ".h"; | 1249 open F, ">" . $outputDir . "/V8" . $wrapperFactoryFileName . ".h"; |
| 1243 | 1250 |
| 1244 printLicenseHeader($F); | 1251 printLicenseHeader($F); |
| 1245 | 1252 |
| 1246 print F "#ifndef V8$parameters{namespace}ElementWrapperFactory_h\n"; | 1253 print F "#ifndef V8$parameters{namespace}ElementWrapperFactory_h\n"; |
| 1247 print F "#define V8$parameters{namespace}ElementWrapperFactory_h\n\n"; | 1254 print F "#define V8$parameters{namespace}ElementWrapperFactory_h\n\n"; |
| 1248 | 1255 |
| 1249 print F "#if $parameters{guardFactoryWith}\n" if $parameters{guardFactoryWit
h}; | 1256 print F "#if $parameters{guardFactoryWith}\n" if $parameters{guardFactoryWit
h}; |
| 1250 | 1257 |
| 1251 print F <<END | 1258 print F <<END |
| 1252 #include <V8$parameters{namespace}Element.h> | 1259 #include "bindings/V8$parameters{namespace}Element.h" |
| 1253 #include <V8$parameters{fallbackInterfaceName}.h> | 1260 #include "bindings/V8$parameters{fallbackInterfaceName}.h" |
| 1254 #include <v8.h> | 1261 #include <v8.h> |
| 1255 | 1262 |
| 1256 namespace WebCore { | 1263 namespace WebCore { |
| 1257 | 1264 |
| 1258 class $parameters{namespace}Element; | 1265 class $parameters{namespace}Element; |
| 1259 | 1266 |
| 1260 const QualifiedName* find$parameters{namespace}TagNameOfV8Type(const Wrapper
TypeInfo*); | 1267 const QualifiedName* find$parameters{namespace}TagNameOfV8Type(const Wrapper
TypeInfo*); |
| 1261 v8::Handle<v8::Object> createV8$parameters{namespace}Wrapper($parameters{nam
espace}Element*, v8::Handle<v8::Object> creationContext, v8::Isolate*); | 1268 v8::Handle<v8::Object> createV8$parameters{namespace}Wrapper($parameters{nam
espace}Element*, v8::Handle<v8::Object> creationContext, v8::Isolate*); |
| 1262 inline v8::Handle<v8::Object> createV8$parameters{namespace}DirectWrapper($p
arameters{namespace}Element* element, v8::Handle<v8::Object> creationContext, v8
::Isolate* isolate) | 1269 inline v8::Handle<v8::Object> createV8$parameters{namespace}DirectWrapper($p
arameters{namespace}Element* element, v8::Handle<v8::Object> creationContext, v8
::Isolate* isolate) |
| 1263 { | 1270 { |
| 1264 return V8$parameters{namespace}Element::createWrapper(element, creationC
ontext, isolate); | 1271 return V8$parameters{namespace}Element::createWrapper(element, creationC
ontext, isolate); |
| 1265 } | 1272 } |
| 1266 inline v8::Handle<v8::Object> createV8$parameters{namespace}FallbackWrapper(
$parameters{fallbackInterfaceName}* element, v8::Handle<v8::Object> creationCont
ext, v8::Isolate* isolate) | 1273 inline v8::Handle<v8::Object> createV8$parameters{namespace}FallbackWrapper(
$parameters{fallbackInterfaceName}* element, v8::Handle<v8::Object> creationCont
ext, v8::Isolate* isolate) |
| 1267 { | 1274 { |
| 1268 return V8$parameters{fallbackInterfaceName}::createWrapper(element, crea
tionContext, isolate); | 1275 return V8$parameters{fallbackInterfaceName}::createWrapper(element, crea
tionContext, isolate); |
| 1269 } | 1276 } |
| 1270 } | 1277 } |
| 1271 END | 1278 END |
| 1272 ; | 1279 ; |
| 1273 print F "#endif // $parameters{guardFactoryWith}\n\n" if $parameters{guardFa
ctoryWith}; | 1280 print F "#endif // $parameters{guardFactoryWith}\n\n" if $parameters{guardFa
ctoryWith}; |
| 1274 | 1281 |
| 1275 print F "#endif // V8$parameters{namespace}ElementWrapperFactory_h\n"; | 1282 print F "#endif // V8$parameters{namespace}ElementWrapperFactory_h\n"; |
| 1276 | 1283 |
| 1277 close F; | 1284 close F; |
| 1278 } | 1285 } |
| OLD | NEW |