OLD | NEW |
---|---|
1 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> | 1 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> |
2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> | 2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> |
3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> | 3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> |
4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> | 4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> |
5 # Copyright (C) 2006 Apple Computer, Inc. | 5 # Copyright (C) 2006 Apple Computer, Inc. |
6 # Copyright (C) 2007, 2008, 2009, 2012 Google Inc. | 6 # Copyright (C) 2007, 2008, 2009, 2012 Google Inc. |
7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> | 7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> |
8 # Copyright (C) Research In Motion Limited 2010. All rights reserved. | 8 # Copyright (C) Research In Motion Limited 2010. All rights reserved. |
9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
10 # Copyright (C) 2012 Ericsson AB. All rights reserved. | 10 # Copyright (C) 2012 Ericsson AB. All rights reserved. |
(...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1112 sub HasCustomMethod | 1112 sub HasCustomMethod |
1113 { | 1113 { |
1114 my $attrExt = shift; | 1114 my $attrExt = shift; |
1115 return $attrExt->{"Custom"}; | 1115 return $attrExt->{"Custom"}; |
1116 } | 1116 } |
1117 | 1117 |
1118 sub IsReadonly | 1118 sub IsReadonly |
1119 { | 1119 { |
1120 my $attribute = shift; | 1120 my $attribute = shift; |
1121 my $attrExt = $attribute->extendedAttributes; | 1121 my $attrExt = $attribute->extendedAttributes; |
1122 return $attribute->isReadOnly && !$attrExt->{"Replaceable"}; | 1122 return $attribute->isReadOnly && !$attrExt->{"Replaceable"} && !$attrExt->{" PutForwards"}; |
1123 } | 1123 } |
1124 | 1124 |
1125 sub GetV8ClassName | 1125 sub GetV8ClassName |
1126 { | 1126 { |
1127 my $interface = shift; | 1127 my $interface = shift; |
1128 return "V8" . $interface->name; | 1128 return "V8" . $interface->name; |
1129 } | 1129 } |
1130 | 1130 |
1131 sub GetImplName | 1131 sub GetImplName |
1132 { | 1132 { |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1782 $code .= " ${v8ClassName}::${attrName}AttributeSetterCustom(name, val ue, info);\n"; | 1782 $code .= " ${v8ClassName}::${attrName}AttributeSetterCustom(name, val ue, info);\n"; |
1783 } else { | 1783 } else { |
1784 $code .= " ${implClassName}V8Internal::${attrName}AttributeSetter${fo rMainWorldSuffix}(name, value, info);\n"; | 1784 $code .= " ${implClassName}V8Internal::${attrName}AttributeSetter${fo rMainWorldSuffix}(name, value, info);\n"; |
1785 } | 1785 } |
1786 $code .= " TRACE_EVENT_SET_SAMPLING_STATE(\"V8\", \"Execution\");\n"; | 1786 $code .= " TRACE_EVENT_SET_SAMPLING_STATE(\"V8\", \"Execution\");\n"; |
1787 $code .= "}\n\n"; | 1787 $code .= "}\n\n"; |
1788 $code .= "#endif // ${conditionalString}\n\n" if $conditionalString; | 1788 $code .= "#endif // ${conditionalString}\n\n" if $conditionalString; |
1789 $implementation{nameSpaceInternal}->add($code); | 1789 $implementation{nameSpaceInternal}->add($code); |
1790 } | 1790 } |
1791 | 1791 |
1792 sub FindAttributeWithName | |
1793 { | |
1794 my $interface = shift; | |
1795 my $attrName = shift; | |
1796 | |
1797 foreach my $attribute (@{$interface->attributes}) { | |
1798 if ($attribute->name eq $attrName) { | |
1799 return $attribute; | |
1800 } | |
1801 } | |
1802 } | |
1803 | |
1792 sub GenerateNormalAttributeSetter | 1804 sub GenerateNormalAttributeSetter |
1793 { | 1805 { |
1794 my $attribute = shift; | 1806 my $attribute = shift; |
1795 my $interface = shift; | 1807 my $interface = shift; |
1796 my $forMainWorldSuffix = shift; | 1808 my $forMainWorldSuffix = shift; |
1797 | 1809 |
1798 my $interfaceName = $interface->name; | 1810 my $interfaceName = $interface->name; |
1799 my $implClassName = GetImplName($interface); | 1811 my $implClassName = GetImplName($interface); |
1800 my $v8ClassName = GetV8ClassName($interface); | 1812 my $v8ClassName = GetV8ClassName($interface); |
1801 my $attrName = $attribute->name; | 1813 my $attrName = $attribute->name; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1843 $code .= " setDOMException(NoModificationAllowedError, Except ionMessages::failedToSet(\"${attrName}\", \"${interfaceName}\", \"The attribute is read-only.\"), info.GetIsolate());\n"; | 1855 $code .= " setDOMException(NoModificationAllowedError, Except ionMessages::failedToSet(\"${attrName}\", \"${interfaceName}\", \"The attribute is read-only.\"), info.GetIsolate());\n"; |
1844 $code .= " return;\n"; | 1856 $code .= " return;\n"; |
1845 $code .= " }\n"; | 1857 $code .= " }\n"; |
1846 $code .= " $svgWrappedNativeType& impInstance = wrapper->property Reference();\n"; | 1858 $code .= " $svgWrappedNativeType& impInstance = wrapper->property Reference();\n"; |
1847 $code .= " $svgWrappedNativeType* imp = &impInstance;\n"; | 1859 $code .= " $svgWrappedNativeType* imp = &impInstance;\n"; |
1848 } | 1860 } |
1849 } elsif ($attrExt->{"OnProto"}) { | 1861 } elsif ($attrExt->{"OnProto"}) { |
1850 $code .= <<END; | 1862 $code .= <<END; |
1851 ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()); | 1863 ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()); |
1852 END | 1864 END |
1865 } elsif($attrExt->{"PutForwards"}) { | |
1866 my $attrType = $attribute->type; | |
haraken
2013/10/15 00:15:37
This is not necessary. $attrType is already define
| |
1867 my $destinationAttrName = $attrExt->{"PutForwards"}; | |
1868 my $destinationInterface = ParseInterface($attrType); | |
1869 die "[PutForwards=x] value must be a wrapper type" unless $destinationIn terface; | |
1870 my $destinationAttribute = FindAttributeWithName($destinationInterface, $destinationAttrName); | |
1871 die "[PutForwards=x] could not find $destinationAttrName in interface $a ttrType" unless $destinationAttribute; | |
1872 $code .= <<END; | |
1873 ${implClassName}* proxyImp = ${v8ClassName}::toNative(info.Holder()); | |
1874 ${attrType}* imp = proxyImp->${attrName}(); | |
1875 if (!imp) | |
1876 return; | |
1877 END | |
1878 # Override attribute and fall through to forward setter call. | |
1879 $attribute = $destinationAttribute; | |
1880 $attrName = $attribute->name; | |
1881 $attrType = $attribute->type; | |
1882 $attrExt = $attribute->extendedAttributes; | |
1853 } else { | 1883 } else { |
1854 my $reflect = $attribute->extendedAttributes->{"Reflect"}; | 1884 my $reflect = $attribute->extendedAttributes->{"Reflect"}; |
1855 if ($reflect && InheritsInterface($interface, "Node") && $attrType eq "D OMString") { | 1885 if ($reflect && InheritsInterface($interface, "Node") && $attrType eq "D OMString") { |
1856 # Generate super-compact call for regular attribute setter: | 1886 # Generate super-compact call for regular attribute setter: |
1857 my $contentAttributeName = $reflect eq "VALUE_IS_MISSING" ? lc $attr Name : $reflect; | 1887 my $contentAttributeName = $reflect eq "VALUE_IS_MISSING" ? lc $attr Name : $reflect; |
1858 my $namespace = NamespaceForAttributeName($interfaceName, $contentAt tributeName); | 1888 my $namespace = NamespaceForAttributeName($interfaceName, $contentAt tributeName); |
1859 my $mode = GetV8StringResourceMode($attribute->extendedAttributes); | 1889 my $mode = GetV8StringResourceMode($attribute->extendedAttributes); |
1860 AddToImplIncludes("${namespace}.h"); | 1890 AddToImplIncludes("${namespace}.h"); |
1861 $code .= " Element* imp = V8Element::toNative(info.Holder());\n"; | 1891 $code .= " Element* imp = V8Element::toNative(info.Holder());\n"; |
1862 $code .= " V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource< $mode>, stringResource, value);\n"; | 1892 $code .= " V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource< $mode>, stringResource, value);\n"; |
(...skipping 4314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6177 my $interface = shift; | 6207 my $interface = shift; |
6178 | 6208 |
6179 return 1 if $interface->extendedAttributes->{"CustomToV8"}; | 6209 return 1 if $interface->extendedAttributes->{"CustomToV8"}; |
6180 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; | 6210 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; |
6181 return 1 if InheritsInterface($interface, "Document"); | 6211 return 1 if InheritsInterface($interface, "Document"); |
6182 | 6212 |
6183 return 0; | 6213 return 0; |
6184 } | 6214 } |
6185 | 6215 |
6186 1; | 6216 1; |
OLD | NEW |