| 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 $destinationAttrName = $attrExt->{"PutForwards"}; |
| 1867 my $destinationInterface = ParseInterface($attrType); |
| 1868 die "[PutForwards=x] value must be a wrapper type" unless $destinationIn
terface; |
| 1869 my $destinationAttribute = FindAttributeWithName($destinationInterface,
$destinationAttrName); |
| 1870 die "[PutForwards=x] could not find $destinationAttrName in interface $a
ttrType" unless $destinationAttribute; |
| 1871 $code .= <<END; |
| 1872 ${implClassName}* proxyImp = ${v8ClassName}::toNative(info.Holder()); |
| 1873 ${attrType}* imp = proxyImp->${attrName}(); |
| 1874 if (!imp) |
| 1875 return; |
| 1876 END |
| 1877 # Override attribute and fall through to forward setter call. |
| 1878 $attribute = $destinationAttribute; |
| 1879 $attrName = $attribute->name; |
| 1880 $attrType = $attribute->type; |
| 1881 $attrExt = $attribute->extendedAttributes; |
| 1853 } else { | 1882 } else { |
| 1854 my $reflect = $attribute->extendedAttributes->{"Reflect"}; | 1883 my $reflect = $attribute->extendedAttributes->{"Reflect"}; |
| 1855 if ($reflect && InheritsInterface($interface, "Node") && $attrType eq "D
OMString") { | 1884 if ($reflect && InheritsInterface($interface, "Node") && $attrType eq "D
OMString") { |
| 1856 # Generate super-compact call for regular attribute setter: | 1885 # Generate super-compact call for regular attribute setter: |
| 1857 my $contentAttributeName = $reflect eq "VALUE_IS_MISSING" ? lc $attr
Name : $reflect; | 1886 my $contentAttributeName = $reflect eq "VALUE_IS_MISSING" ? lc $attr
Name : $reflect; |
| 1858 my $namespace = NamespaceForAttributeName($interfaceName, $contentAt
tributeName); | 1887 my $namespace = NamespaceForAttributeName($interfaceName, $contentAt
tributeName); |
| 1859 my $mode = GetV8StringResourceMode($attribute->extendedAttributes); | 1888 my $mode = GetV8StringResourceMode($attribute->extendedAttributes); |
| 1860 AddToImplIncludes("${namespace}.h"); | 1889 AddToImplIncludes("${namespace}.h"); |
| 1861 $code .= " Element* imp = V8Element::toNative(info.Holder());\n"; | 1890 $code .= " Element* imp = V8Element::toNative(info.Holder());\n"; |
| 1862 $code .= " V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<
$mode>, stringResource, value);\n"; | 1891 $code .= " V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<
$mode>, stringResource, value);\n"; |
| (...skipping 4327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6190 my $interface = shift; | 6219 my $interface = shift; |
| 6191 | 6220 |
| 6192 return 1 if $interface->extendedAttributes->{"CustomToV8"}; | 6221 return 1 if $interface->extendedAttributes->{"CustomToV8"}; |
| 6193 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; | 6222 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; |
| 6194 return 1 if InheritsInterface($interface, "Document"); | 6223 return 1 if InheritsInterface($interface, "Document"); |
| 6195 | 6224 |
| 6196 return 0; | 6225 return 0; |
| 6197 } | 6226 } |
| 6198 | 6227 |
| 6199 1; | 6228 1; |
| OLD | NEW |