| 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 # | 6 # |
| 7 # Redistribution and use in source and binary forms, with or without | 7 # Redistribution and use in source and binary forms, with or without |
| 8 # modification, are permitted provided that the following conditions | 8 # modification, are permitted provided that the following conditions |
| 9 # are met: | 9 # are met: |
| 10 # | 10 # |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 # Helper method to dump the constructor interior and call the | 280 # Helper method to dump the constructor interior and call the |
| 281 # Element constructor with the right arguments. | 281 # Element constructor with the right arguments. |
| 282 # The variable names should be kept in sync with the previous method. | 282 # The variable names should be kept in sync with the previous method. |
| 283 sub printConstructorInterior | 283 sub printConstructorInterior |
| 284 { | 284 { |
| 285 my ($F, $tagName, $interfaceName, $constructorTagName) = @_; | 285 my ($F, $tagName, $interfaceName, $constructorTagName) = @_; |
| 286 | 286 |
| 287 # Handle media elements. | 287 # Handle media elements. |
| 288 if ($tags{$tagName}{wrapperOnlyIfMediaIsAvailable}) { | 288 if ($tags{$tagName}{wrapperOnlyIfMediaIsAvailable}) { |
| 289 print F <<END | 289 print F <<END |
| 290 if (!MediaPlayer::isAvailable()) | 290 Settings* settings = document->settings(); |
| 291 if (!MediaPlayer::isAvailable() || (settings && !settings->isMediaEnabled())
) |
| 291 return HTMLElement::create($constructorTagName, document); | 292 return HTMLElement::create($constructorTagName, document); |
| 293 |
| 292 END | 294 END |
| 293 ; | 295 ; |
| 294 } | 296 } |
| 295 | 297 |
| 296 my $newPrefix = ""; | 298 my $newPrefix = ""; |
| 297 my $createSuffix = "::create"; | 299 my $createSuffix = "::create"; |
| 298 | 300 |
| 299 if ($tags{$tagName}{createWithNew}) { | 301 if ($tags{$tagName}{createWithNew}) { |
| 300 $newPrefix = "new "; | 302 $newPrefix = "new "; |
| 301 $createSuffix = ""; | 303 $createSuffix = ""; |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 | 633 |
| 632 #include "$parameters{namespace}Names.h" | 634 #include "$parameters{namespace}Names.h" |
| 633 END | 635 END |
| 634 ; | 636 ; |
| 635 | 637 |
| 636 printElementIncludes($F); | 638 printElementIncludes($F); |
| 637 | 639 |
| 638 print F <<END | 640 print F <<END |
| 639 #include <wtf/HashMap.h> | 641 #include <wtf/HashMap.h> |
| 640 | 642 |
| 641 #if ENABLE(DASHBOARD_SUPPORT) | 643 #if ENABLE(DASHBOARD_SUPPORT) || ENABLE(VIDEO) |
| 642 #include "Document.h" | 644 #include "Document.h" |
| 643 #include "Settings.h" | 645 #include "Settings.h" |
| 644 #endif | 646 #endif |
| 645 | 647 |
| 646 namespace WebCore { | 648 namespace WebCore { |
| 647 | 649 |
| 648 using namespace $parameters{namespace}Names; | 650 using namespace $parameters{namespace}Names; |
| 649 | 651 |
| 650 END | 652 END |
| 651 ; | 653 ; |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 832 print F "#if ${conditionalString}\n\n"; | 834 print F "#if ${conditionalString}\n\n"; |
| 833 } | 835 } |
| 834 | 836 |
| 835 if ($wrapperFactoryType eq "JS") { | 837 if ($wrapperFactoryType eq "JS") { |
| 836 # Hack for the media tags | 838 # Hack for the media tags |
| 837 # FIXME: This should have been done via a CustomWrapper attribute an
d a separate *Custom file. | 839 # FIXME: This should have been done via a CustomWrapper attribute an
d a separate *Custom file. |
| 838 if ($tags{$tagName}{wrapperOnlyIfMediaIsAvailable}) { | 840 if ($tags{$tagName}{wrapperOnlyIfMediaIsAvailable}) { |
| 839 print F <<END | 841 print F <<END |
| 840 static JSNode* create${JSInterfaceName}Wrapper(ExecState* exec, JSDOMGlobalObjec
t* globalObject, PassRefPtr<$parameters{namespace}Element> element) | 842 static JSNode* create${JSInterfaceName}Wrapper(ExecState* exec, JSDOMGlobalObjec
t* globalObject, PassRefPtr<$parameters{namespace}Element> element) |
| 841 { | 843 { |
| 842 if (!MediaPlayer::isAvailable()) | 844 Settings* settings = element->document()->settings(); |
| 845 if (!MediaPlayer::isAvailable() || (settings && !settings->isMediaEnabled())
) |
| 843 return CREATE_DOM_NODE_WRAPPER(exec, globalObject, $parameters{namespace
}Element, element.get()); | 846 return CREATE_DOM_NODE_WRAPPER(exec, globalObject, $parameters{namespace
}Element, element.get()); |
| 844 return CREATE_DOM_NODE_WRAPPER(exec, globalObject, ${JSInterfaceName}, eleme
nt.get()); | 847 return CREATE_DOM_NODE_WRAPPER(exec, globalObject, ${JSInterfaceName}, eleme
nt.get()); |
| 845 } | 848 } |
| 846 | 849 |
| 847 END | 850 END |
| 848 ; | 851 ; |
| 849 } else { | 852 } else { |
| 850 print F <<END | 853 print F <<END |
| 851 static JSNode* create${JSInterfaceName}Wrapper(ExecState* exec, JSDOMGlobalObjec
t* globalObject, PassRefPtr<$parameters{namespace}Element> element) | 854 static JSNode* create${JSInterfaceName}Wrapper(ExecState* exec, JSDOMGlobalObjec
t* globalObject, PassRefPtr<$parameters{namespace}Element> element) |
| 852 { | 855 { |
| 853 return CREATE_DOM_NODE_WRAPPER(exec, globalObject, ${JSInterfaceName}, eleme
nt.get()); | 856 return CREATE_DOM_NODE_WRAPPER(exec, globalObject, ${JSInterfaceName}, eleme
nt.get()); |
| 854 } | 857 } |
| 855 | 858 |
| 856 END | 859 END |
| 857 ; | 860 ; |
| 858 } | 861 } |
| 859 } elsif ($wrapperFactoryType eq "V8") { | 862 } elsif ($wrapperFactoryType eq "V8") { |
| 863 if ($tags{$tagName}{wrapperOnlyIfMediaIsAvailable}) { |
| 864 print F <<END |
| 865 static v8::Handle<v8::Value> create${JSInterfaceName}Wrapper($parameters{namespa
ce}Element* element) |
| 866 { |
| 867 Settings* settings = element->document()->settings(); |
| 868 if (!MediaPlayer::isAvailable() || (settings && !settings->isMediaEnabled())
) |
| 869 return toV8(static_cast<$parameters{namespace}Element*>(element)); |
| 870 return toV8(static_cast<${JSInterfaceName}*>(element)); |
| 871 } |
| 872 |
| 873 END |
| 874 ; |
| 875 } else { |
| 860 print F <<END | 876 print F <<END |
| 861 static v8::Handle<v8::Value> create${JSInterfaceName}Wrapper($parameters{namespa
ce}Element* element) | 877 static v8::Handle<v8::Value> create${JSInterfaceName}Wrapper($parameters{namespa
ce}Element* element) |
| 862 { | 878 { |
| 863 return toV8(static_cast<${JSInterfaceName}*>(element)); | 879 return toV8(static_cast<${JSInterfaceName}*>(element)); |
| 864 } | 880 } |
| 865 | 881 |
| 882 |
| 866 END | 883 END |
| 867 ; | 884 ; |
| 885 } |
| 868 } | 886 } |
| 869 | 887 |
| 870 if ($conditional) { | 888 if ($conditional) { |
| 871 print F "#endif\n\n"; | 889 print F "#endif\n\n"; |
| 872 } | 890 } |
| 873 } | 891 } |
| 874 } | 892 } |
| 875 | 893 |
| 876 sub printWrapperFactoryCppFile | 894 sub printWrapperFactoryCppFile |
| 877 { | 895 { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 888 print F "#if $parameters{guardFactoryWith}\n\n" if $parameters{guardFactoryW
ith}; | 906 print F "#if $parameters{guardFactoryWith}\n\n" if $parameters{guardFactoryW
ith}; |
| 889 | 907 |
| 890 print F "#include \"$wrapperFactoryType$parameters{namespace}ElementWrapperF
actory.h\"\n"; | 908 print F "#include \"$wrapperFactoryType$parameters{namespace}ElementWrapperF
actory.h\"\n"; |
| 891 | 909 |
| 892 printJSElementIncludes($F, $wrapperFactoryType); | 910 printJSElementIncludes($F, $wrapperFactoryType); |
| 893 | 911 |
| 894 print F "\n#include \"$parameters{namespace}Names.h\"\n\n"; | 912 print F "\n#include \"$parameters{namespace}Names.h\"\n\n"; |
| 895 | 913 |
| 896 printElementIncludes($F); | 914 printElementIncludes($F); |
| 897 | 915 |
| 898 print F "\n#include <wtf/StdLibExtras.h>\n\n"; | 916 print F <<END |
| 917 #include <wtf/StdLibExtras.h> |
| 918 |
| 919 #if ENABLE(VIDEO) |
| 920 #include "Document.h" |
| 921 #include "Settings.h" |
| 922 #endif |
| 923 |
| 924 END |
| 925 ; |
| 899 | 926 |
| 900 if ($wrapperFactoryType eq "JS") { | 927 if ($wrapperFactoryType eq "JS") { |
| 901 print F <<END | 928 print F <<END |
| 902 using namespace JSC; | 929 using namespace JSC; |
| 903 END | 930 END |
| 904 ; | 931 ; |
| 905 } elsif ($wrapperFactoryType eq "V8") { | 932 } elsif ($wrapperFactoryType eq "V8") { |
| 906 print F <<END | 933 print F <<END |
| 907 #include "V8$parameters{namespace}Element.h" | 934 #include "V8$parameters{namespace}Element.h" |
| 908 | 935 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1053 END | 1080 END |
| 1054 ; | 1081 ; |
| 1055 } | 1082 } |
| 1056 | 1083 |
| 1057 print F "#endif // $parameters{guardFactoryWith}\n\n" if $parameters{guardFa
ctoryWith}; | 1084 print F "#endif // $parameters{guardFactoryWith}\n\n" if $parameters{guardFa
ctoryWith}; |
| 1058 | 1085 |
| 1059 print F "#endif // $wrapperFactoryType$parameters{namespace}ElementWrapperFa
ctory_h\n"; | 1086 print F "#endif // $wrapperFactoryType$parameters{namespace}ElementWrapperFa
ctory_h\n"; |
| 1060 | 1087 |
| 1061 close F; | 1088 close F; |
| 1062 } | 1089 } |
| OLD | NEW |