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 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 | 332 |
333 return %tagConstructorMap; | 333 return %tagConstructorMap; |
334 } | 334 } |
335 | 335 |
336 # Helper method that print the constructor's signature avoiding | 336 # Helper method that print the constructor's signature avoiding |
337 # unneeded arguments. | 337 # unneeded arguments. |
338 sub printConstructorSignature | 338 sub printConstructorSignature |
339 { | 339 { |
340 my ($F, $tagName, $constructorName, $constructorTagName) = @_; | 340 my ($F, $tagName, $constructorName, $constructorTagName) = @_; |
341 | 341 |
342 print F "static PassRefPtr<$parameters{namespace}Element> ${constructorName}
Constructor(const QualifiedName& $constructorTagName, Document* document"; | 342 print F "static PassRefPtr<$parameters{namespace}Element> ${constructorName}
Constructor(const QualifiedName& $constructorTagName, Document& document"; |
343 if ($parameters{namespace} eq "HTML") { | 343 if ($parameters{namespace} eq "HTML") { |
344 print F ", HTMLFormElement*"; | 344 print F ", HTMLFormElement*"; |
345 print F " formElement" if $enabledTags{$tagName}{constructorNeedsFormEle
ment}; | 345 print F " formElement" if $enabledTags{$tagName}{constructorNeedsFormEle
ment}; |
346 } | 346 } |
347 print F ", bool"; | 347 print F ", bool"; |
348 print F " createdByParser" if $enabledTags{$tagName}{constructorNeedsCreated
ByParser}; | 348 print F " createdByParser" if $enabledTags{$tagName}{constructorNeedsCreated
ByParser}; |
349 print F ")\n{\n"; | 349 print F ")\n{\n"; |
350 } | 350 } |
351 | 351 |
352 # Helper method to dump the constructor interior and call the | 352 # Helper method to dump the constructor interior and call the |
353 # Element constructor with the right arguments. | 353 # Element constructor with the right arguments. |
354 # The variable names should be kept in sync with the previous method. | 354 # The variable names should be kept in sync with the previous method. |
355 sub printConstructorInterior | 355 sub printConstructorInterior |
356 { | 356 { |
357 my ($F, $tagName, $interfaceName, $constructorTagName) = @_; | 357 my ($F, $tagName, $interfaceName, $constructorTagName) = @_; |
358 | 358 |
359 # Handle media elements. | 359 # Handle media elements. |
360 if ($enabledTags{$tagName}{wrapperOnlyIfMediaIsAvailable}) { | 360 if ($enabledTags{$tagName}{wrapperOnlyIfMediaIsAvailable}) { |
361 print F <<END | 361 print F <<END |
362 Settings* settings = document->settings(); | 362 Settings* settings = document.settings(); |
363 if (!RuntimeEnabledFeatures::mediaEnabled() || (settings && !settings->media
Enabled())) | 363 if (!RuntimeEnabledFeatures::mediaEnabled() || (settings && !settings->media
Enabled())) |
364 return 0; | 364 return 0; |
365 | 365 |
366 END | 366 END |
367 ; | 367 ; |
368 } | 368 } |
369 | 369 |
370 my $contextConditional = $enabledTags{$tagName}{contextConditional}; | 370 my $contextConditional = $enabledTags{$tagName}{contextConditional}; |
371 if ($contextConditional) { | 371 if ($contextConditional) { |
372 print F <<END | 372 print F <<END |
373 if (!ContextFeatures::${contextConditional}Enabled(document)) | 373 if (!ContextFeatures::${contextConditional}Enabled(&document)) |
374 return 0; | 374 return 0; |
375 END | 375 END |
376 ; | 376 ; |
377 } | 377 } |
378 | 378 |
379 my $runtimeConditional = $enabledTags{$tagName}{runtimeConditional}; | 379 my $runtimeConditional = $enabledTags{$tagName}{runtimeConditional}; |
380 if ($runtimeConditional) { | 380 if ($runtimeConditional) { |
381 print F <<END | 381 print F <<END |
382 if (!RuntimeEnabledFeatures::${runtimeConditional}Enabled()) | 382 if (!RuntimeEnabledFeatures::${runtimeConditional}Enabled()) |
383 return 0; | 383 return 0; |
(...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
808 #include "RuntimeEnabledFeatures.h" | 808 #include "RuntimeEnabledFeatures.h" |
809 #include "Settings.h" | 809 #include "Settings.h" |
810 | 810 |
811 namespace WebCore { | 811 namespace WebCore { |
812 | 812 |
813 using namespace $parameters{namespace}Names; | 813 using namespace $parameters{namespace}Names; |
814 | 814 |
815 END | 815 END |
816 ; | 816 ; |
817 | 817 |
818 print F "typedef PassRefPtr<$parameters{namespace}Element> (*ConstructorFunction
)(const QualifiedName&, Document*"; | 818 print F "typedef PassRefPtr<$parameters{namespace}Element> (*ConstructorFunction
)(const QualifiedName&, Document&"; |
819 print F ", HTMLFormElement*" if $parameters{namespace} eq "HTML"; | 819 print F ", HTMLFormElement*" if $parameters{namespace} eq "HTML"; |
820 print F ", bool createdByParser);\n"; | 820 print F ", bool createdByParser);\n"; |
821 print F <<END | 821 print F <<END |
822 typedef HashMap<StringImpl*, ConstructorFunction> FunctionMap; | 822 typedef HashMap<StringImpl*, ConstructorFunction> FunctionMap; |
823 | 823 |
824 static FunctionMap* gFunctionMap = 0; | 824 static FunctionMap* gFunctionMap = 0; |
825 | 825 |
826 END | 826 END |
827 ; | 827 ; |
828 | 828 |
(...skipping 25 matching lines...) Expand all Loading... |
854 | 854 |
855 print F "\nPassRefPtr<$parameters{namespace}Element> $parameters{namespace}Eleme
ntFactory::create$parameters{namespace}Element(const QualifiedName& qName, Docum
ent* document"; | 855 print F "\nPassRefPtr<$parameters{namespace}Element> $parameters{namespace}Eleme
ntFactory::create$parameters{namespace}Element(const QualifiedName& qName, Docum
ent* document"; |
856 print F ", HTMLFormElement* formElement" if $parameters{namespace} eq "HTML"; | 856 print F ", HTMLFormElement* formElement" if $parameters{namespace} eq "HTML"; |
857 print F ", bool createdByParser)\n{\n"; | 857 print F ", bool createdByParser)\n{\n"; |
858 | 858 |
859 print F <<END | 859 print F <<END |
860 if (!document) | 860 if (!document) |
861 return 0; | 861 return 0; |
862 | 862 |
863 if (CustomElement::isValidName(qName.localName()) && document->registrationC
ontext()) { | 863 if (CustomElement::isValidName(qName.localName()) && document->registrationC
ontext()) { |
864 RefPtr<Element> element = document->registrationContext()->createCustomT
agElement(document, qName, createdByParser ? CustomElementRegistrationContext::C
reatedByParser : CustomElementRegistrationContext::NotCreatedByParser); | 864 RefPtr<Element> element = document->registrationContext()->createCustomT
agElement(*document, qName, createdByParser ? CustomElementRegistrationContext::
CreatedByParser : CustomElementRegistrationContext::NotCreatedByParser); |
865 ASSERT_WITH_SECURITY_IMPLICATION(element->is$parameters{namespace}Elemen
t()); | 865 ASSERT_WITH_SECURITY_IMPLICATION(element->is$parameters{namespace}Elemen
t()); |
866 return static_pointer_cast<$parameters{namespace}Element>(element.releas
e()); | 866 return static_pointer_cast<$parameters{namespace}Element>(element.releas
e()); |
867 } | 867 } |
868 | 868 |
869 if (!gFunctionMap) | 869 if (!gFunctionMap) |
870 createFunctionMap(); | 870 createFunctionMap(); |
871 if (ConstructorFunction function = gFunctionMap->get(qName.localName().impl(
))) { | 871 if (ConstructorFunction function = gFunctionMap->get(qName.localName().impl(
))) { |
872 END | 872 END |
873 ; | 873 ; |
874 | 874 |
875 if ($parameters{namespace} eq "HTML") { | 875 if ($parameters{namespace} eq "HTML") { |
876 print F " if (PassRefPtr<$parameters{namespace}Element> element = fun
ction(qName, document, formElement, createdByParser))\n"; | 876 print F " if (PassRefPtr<$parameters{namespace}Element> element = fun
ction(qName, *document, formElement, createdByParser))\n"; |
877 print F " return element;\n"; | 877 print F " return element;\n"; |
878 } else { | 878 } else { |
879 print F " if (PassRefPtr<$parameters{namespace}Element> element = fun
ction(qName, document, createdByParser))\n"; | 879 print F " if (PassRefPtr<$parameters{namespace}Element> element = fun
ction(qName, *document, createdByParser))\n"; |
880 print F " return element;\n"; | 880 print F " return element;\n"; |
881 } | 881 } |
882 print F <<END | 882 print F <<END |
883 } | 883 } |
884 | 884 |
885 return $parameters{fallbackInterfaceName}::create(qName, document); | 885 return $parameters{fallbackInterfaceName}::create(qName, *document); |
886 } | 886 } |
887 | 887 |
888 } // namespace WebCore | 888 } // namespace WebCore |
889 | 889 |
890 END | 890 END |
891 ; | 891 ; |
892 | 892 |
893 print F "#endif\n" if $parameters{guardFactoryWith}; | 893 print F "#endif\n" if $parameters{guardFactoryWith}; |
894 | 894 |
895 close F; | 895 close F; |
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1273 print F StaticString::GenerateStringImpls(\%parameters); | 1273 print F StaticString::GenerateStringImpls(\%parameters); |
1274 | 1274 |
1275 while ( my ($name, $identifier) = each %parameters ) { | 1275 while ( my ($name, $identifier) = each %parameters ) { |
1276 print F " new ((void*)&$name) AtomicString(${name}Impl);\n"; | 1276 print F " new ((void*)&$name) AtomicString(${name}Impl);\n"; |
1277 } | 1277 } |
1278 | 1278 |
1279 print F "}\n}\n}\n"; | 1279 print F "}\n}\n}\n"; |
1280 close F; | 1280 close F; |
1281 exit 0; | 1281 exit 0; |
1282 } | 1282 } |
OLD | NEW |