Changeset 94005 in webkit
- Timestamp:
- Aug 29, 2011, 1:03:33 PM (15 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
bindings/scripts/CodeGeneratorJS.pm (modified) (10 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r94003 r94005 1 2011-08-29 Patrick Gansterer <paroga@webkit.org> 2 3 Consider Conditional attribute in CodeGeneratorJS' JSValueToNative and NativeToJSValue function 4 https://bugs.webkit.org/show_bug.cgi?id=65040 5 6 Reviewed by Brent Fulgham. 7 8 JSValueToNative and NativeToJSValue add additional include statements 9 to the implementation and need to handle the Conditional attribute from 10 the IDL file. The Conditional attribute adds appropriate #if ENABLE() 11 lines for the preprocessor around the include statements to remove 12 some unneeded build dependencies. 13 14 * bindings/scripts/CodeGeneratorJS.pm: 15 1 16 2011-08-29 Nate Chapin <japhet@chromium.org> 2 17 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r93980 r94005 310 310 } elsif ($type eq "String") { 311 311 $implIncludes{"PlatformString.h"} = 1; 312 } 313 } 314 315 sub AddToImplIncludes 316 { 317 my $header = shift; 318 my $conditional = shift; 319 320 if (not $conditional) { 321 $implIncludes{$header} = 1; 322 } elsif (not exists($implIncludes{$header})) { 323 $implIncludes{$header} = $conditional; 324 } else { 325 my $oldValue = $implIncludes{$header}; 326 if ($oldValue ne 1) { 327 my %newValue = (); 328 $newValue{$conditional} = 1; 329 foreach my $condition (split(/\|/, $oldValue)) { 330 $newValue{$condition} = 1; 331 } 332 $implIncludes{$header} = join("|", sort keys %newValue); 333 } 312 334 } 313 335 } … … 1786 1808 $constructorType =~ s/Constructor$//; 1787 1809 if ($constructorType ne "DOMObject") { 1788 my $header = "JS" . $constructorType . ".h"; 1789 my $conditional = $attribute->signature->extendedAttributes->{"Conditional"}; 1790 if (not $conditional) { 1791 $implIncludes{$header} = 1; 1792 } elsif (not exists($implIncludes{$header})) { 1793 $implIncludes{$header} = $conditional; 1794 } else { 1795 my $oldValue = $implIncludes{$header}; 1796 if ($oldValue ne 1) { 1797 my %newValue = (); 1798 $newValue{$conditional} = 1; 1799 foreach my $condition (split(/\|/, $oldValue)) { 1800 $newValue{$condition} = 1; 1801 } 1802 $implIncludes{$header} = join("|", sort keys %newValue); 1803 } 1804 } 1810 AddToImplIncludes("JS" . $constructorType . ".h", $attribute->signature->extendedAttributes->{"Conditional"}); 1805 1811 } 1806 1812 push(@implContent, " // Shadowing a built-in constructor\n"); … … 2631 2637 my $value = shift; 2632 2638 2639 my $conditional = $signature->extendedAttributes->{"Conditional"}; 2633 2640 my $type = $codeGenerator->StripModule($signature->type); 2634 2641 … … 2654 2661 2655 2662 if ($type eq "NodeFilter") { 2656 $implIncludes{"JS$type.h"} = 1;2663 AddToImplIncludes("JS$type.h", $conditional); 2657 2664 return "to$type(exec->globalData(), $value)"; 2658 2665 } 2659 2666 2660 2667 if ($type eq "MediaQueryListListener") { 2661 $implIncludes{"MediaQueryListListener.h"} = 1;2668 AddToImplIncludes("MediaQueryListListener.h", $conditional); 2662 2669 return "MediaQueryListListener::create(ScriptValue(exec->globalData(), " . $value ."))"; 2663 2670 } 2664 2671 2665 2672 if ($type eq "SerializedScriptValue" or $type eq "any") { 2666 $implIncludes{"SerializedScriptValue.h"} = 1;2673 AddToImplIncludes("SerializedScriptValue.h", $conditional); 2667 2674 return "SerializedScriptValue::create(exec, $value)"; 2668 2675 } 2669 2676 2670 2677 if ($type eq "IDBKey") { 2671 $implIncludes{"IDBBindingUtilities.h"} = 1;2672 $implIncludes{"IDBKey.h"} = 1;2678 AddToImplIncludes("IDBBindingUtilities.h", $conditional); 2679 AddToImplIncludes("IDBKey.h", $conditional); 2673 2680 return "createIDBKeyFromValue(exec, $value)"; 2674 2681 } 2675 2682 2676 $implIncludes{"HTMLOptionElement.h"} = 1if $type eq "HTMLOptionElement";2677 $implIncludes{"JSCustomVoidCallback.h"} = 1if $type eq "VoidCallback";2678 $implIncludes{"Event.h"} = 1if $type eq "Event";2683 AddToImplIncludes("HTMLOptionElement.h", $conditional) if $type eq "HTMLOptionElement"; 2684 AddToImplIncludes("JSCustomVoidCallback.h", $conditional) if $type eq "VoidCallback"; 2685 AddToImplIncludes("Event.h", $conditional) if $type eq "Event"; 2679 2686 2680 2687 # Default, assume autogenerated type conversion routines 2681 $implIncludes{"JS$type.h"} = 1;2688 AddToImplIncludes("JS$type.h", $conditional); 2682 2689 return "to$type($value)"; 2683 2690 } … … 2691 2698 my $thisValue = shift; 2692 2699 2700 my $conditional = $signature->extendedAttributes->{"Conditional"}; 2693 2701 my $type = $codeGenerator->StripModule($signature->type); 2694 2702 … … 2710 2718 2711 2719 if ($codeGenerator->IsStringType($type)) { 2712 $implIncludes{"KURL.h"} = 1;2720 AddToImplIncludes("KURL.h", $conditional); 2713 2721 my $conv = $signature->extendedAttributes->{"ConvertNullStringTo"}; 2714 2722 if (defined $conv) { … … 2721 2729 $conv = $signature->extendedAttributes->{"ConvertScriptString"}; 2722 2730 return "jsOwnedStringOrNull(exec, $value)" if $conv; 2723 $implIncludes{"<runtime/JSString.h>"} = 1;2731 AddToImplIncludes("<runtime/JSString.h>", $conditional); 2724 2732 return "jsString(exec, $value)"; 2725 2733 } … … 2728 2736 2729 2737 if ($type eq "CSSStyleDeclaration") { 2730 $implIncludes{"CSSMutableStyleDeclaration.h"} = 1;2738 AddToImplIncludes("CSSMutableStyleDeclaration.h", $conditional); 2731 2739 } 2732 2740 2733 2741 if ($type eq "NodeList") { 2734 $implIncludes{"NameNodeList.h"} = 1;2742 AddToImplIncludes("NameNodeList.h", $conditional); 2735 2743 } 2736 2744 2737 2745 if ($type eq "DOMObject") { 2738 2746 if ($implClassName eq "Document") { 2739 $implIncludes{"JSCanvasRenderingContext2D.h"} = 1;2747 AddToImplIncludes("JSCanvasRenderingContext2D.h", $conditional); 2740 2748 } else { 2741 2749 return "($value.hasNoValue() ? jsNull() : $value.jsValue())"; 2742 2750 } 2743 2751 } elsif ($type =~ /SVGPathSeg/) { 2744 $implIncludes{"JS$type.h"} = 1;2752 AddToImplIncludes("JS$type.h", $conditional); 2745 2753 my $joinedName = $type; 2746 2754 $joinedName =~ s/Abs|Rel//; 2747 $implIncludes{"$joinedName.h"} = 1;2755 AddToImplIncludes("$joinedName.h", $conditional); 2748 2756 } elsif ($type eq "SerializedScriptValue" or $type eq "any") { 2749 $implIncludes{"SerializedScriptValue.h"} = 1;2757 AddToImplIncludes("SerializedScriptValue.h", $conditional); 2750 2758 return "$value ? $value->deserialize(exec, castedThis->globalObject()) : jsNull()"; 2751 2759 } else { 2752 2760 # Default, include header with same name. 2753 $implIncludes{"JS$type.h"} = 1;2754 $implIncludes{"$type.h"} = 1if not $codeGenerator->AvoidInclusionOfType($type);2761 AddToImplIncludes("JS$type.h", $conditional); 2762 AddToImplIncludes("$type.h", $conditional) if not $codeGenerator->AvoidInclusionOfType($type); 2755 2763 } 2756 2764 … … 2775 2783 my $selfIsTearOffType = $codeGenerator->IsSVGTypeNeedingTearOff($implClassName); 2776 2784 if ($selfIsTearOffType) { 2777 $implIncludes{"SVGStaticPropertyWithParentTearOff.h"} = 1;2785 AddToImplIncludes("SVGStaticPropertyWithParentTearOff.h", $conditional); 2778 2786 $tearOffType =~ s/SVGPropertyTearOff</SVGStaticPropertyWithParentTearOff<$implClassName, /; 2779 2787 … … 2786 2794 $value = "${tearOffType}::create(castedThis->impl(), $value, $updateMethod)"; 2787 2795 } else { 2788 $implIncludes{"SVGStaticPropertyTearOff.h"} = 1;2796 AddToImplIncludes("SVGStaticPropertyTearOff.h", $conditional); 2789 2797 $tearOffType =~ s/SVGPropertyTearOff</SVGStaticPropertyTearOff<$implClassName, /; 2790 2798 $value = "${tearOffType}::create(imp, $value, $updateMethod)";
Note:
See TracChangeset
for help on using the changeset viewer.