| 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 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1781 my $interface = shift; | 1781 my $interface = shift; |
| 1782 my $forMainWorldSuffix = shift; | 1782 my $forMainWorldSuffix = shift; |
| 1783 | 1783 |
| 1784 my $implClassName = GetImplName($interface); | 1784 my $implClassName = GetImplName($interface); |
| 1785 my $v8ClassName = GetV8ClassName($interface); | 1785 my $v8ClassName = GetV8ClassName($interface); |
| 1786 my $attrExt = $attribute->extendedAttributes; | 1786 my $attrExt = $attribute->extendedAttributes; |
| 1787 my $attrName = $attribute->name; | 1787 my $attrName = $attribute->name; |
| 1788 | 1788 |
| 1789 my $conditionalString = GenerateConditionalString($attribute); | 1789 my $conditionalString = GenerateConditionalString($attribute); |
| 1790 my $code = ""; | 1790 my $code = ""; |
| 1791 $code .= "#if ${conditionalString}\n\n" if $conditionalString; | 1791 $code .= "#if ${conditionalString}\n" if $conditionalString; |
| 1792 | 1792 |
| 1793 $code .= "static void ${attrName}AttributeSetterCallback${forMainWorldSuffix
}(v8::Local<v8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCa
llbackInfo<void>& info)\n"; | 1793 $code .= "static void ${attrName}AttributeSetterCallback${forMainWorldSuffix
}(v8::Local<v8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCa
llbackInfo<void>& info)\n"; |
| 1794 $code .= "{\n"; | 1794 $code .= "{\n"; |
| 1795 $code .= " TRACE_EVENT_SET_SAMPLING_STATE(\"Blink\", \"DOMSetter\");\n"; | 1795 $code .= " TRACE_EVENT_SET_SAMPLING_STATE(\"Blink\", \"DOMSetter\");\n"; |
| 1796 $code .= GenerateFeatureObservation($attrExt->{"MeasureAs"}); | 1796 $code .= GenerateFeatureObservation($attrExt->{"MeasureAs"}); |
| 1797 $code .= GenerateDeprecationNotification($attrExt->{"DeprecateAs"}); | 1797 $code .= GenerateDeprecationNotification($attrExt->{"DeprecateAs"}); |
| 1798 if (HasActivityLogging($forMainWorldSuffix, $attrExt, "Setter")) { | 1798 if (HasActivityLogging($forMainWorldSuffix, $attrExt, "Setter")) { |
| 1799 $code .= GenerateActivityLogging("Setter", $interface, "${attrName}"); | 1799 $code .= GenerateActivityLogging("Setter", $interface, "${attrName}"); |
| 1800 } | 1800 } |
| 1801 $code .= GenerateCustomElementInvocationScopeIfNeeded($attrExt); | 1801 $code .= GenerateCustomElementInvocationScopeIfNeeded($attrExt); |
| 1802 if (HasCustomSetter($attribute)) { | 1802 if (HasCustomSetter($attribute)) { |
| 1803 $code .= " ${v8ClassName}::${attrName}AttributeSetterCustom(name, jsV
alue, info);\n"; | 1803 $code .= " ${v8ClassName}::${attrName}AttributeSetterCustom(name, jsV
alue, info);\n"; |
| 1804 } else { | 1804 } else { |
| 1805 $code .= " ${implClassName}V8Internal::${attrName}AttributeSetter${fo
rMainWorldSuffix}(name, jsValue, info);\n"; | 1805 $code .= " ${implClassName}V8Internal::${attrName}AttributeSetter${fo
rMainWorldSuffix}(name, jsValue, info);\n"; |
| 1806 } | 1806 } |
| 1807 $code .= " TRACE_EVENT_SET_SAMPLING_STATE(\"V8\", \"Execution\");\n"; | 1807 $code .= " TRACE_EVENT_SET_SAMPLING_STATE(\"V8\", \"Execution\");\n"; |
| 1808 $code .= "}\n\n"; | 1808 $code .= "}\n"; |
| 1809 $code .= "#endif // ${conditionalString}\n\n" if $conditionalString; | 1809 $code .= "#endif // ${conditionalString}\n" if $conditionalString; |
| 1810 $code .= "\n"; |
| 1810 $implementation{nameSpaceInternal}->add($code); | 1811 $implementation{nameSpaceInternal}->add($code); |
| 1811 } | 1812 } |
| 1812 | 1813 |
| 1813 sub FindAttributeWithName | 1814 sub FindAttributeWithName |
| 1814 { | 1815 { |
| 1815 my $interface = shift; | 1816 my $interface = shift; |
| 1816 my $attrName = shift; | 1817 my $attrName = shift; |
| 1817 | 1818 |
| 1818 foreach my $attribute (@{$interface->attributes}) { | 1819 foreach my $attribute (@{$interface->attributes}) { |
| 1819 if ($attribute->name eq $attrName) { | 1820 if ($attribute->name eq $attrName) { |
| (...skipping 15 matching lines...) Expand all Loading... |
| 1835 my $attrExt = $attribute->extendedAttributes; | 1836 my $attrExt = $attribute->extendedAttributes; |
| 1836 my $attrType = $attribute->type; | 1837 my $attrType = $attribute->type; |
| 1837 my $attrCached = GetCachedAttribute($attribute); | 1838 my $attrCached = GetCachedAttribute($attribute); |
| 1838 | 1839 |
| 1839 if (HasCustomSetter($attribute)) { | 1840 if (HasCustomSetter($attribute)) { |
| 1840 return; | 1841 return; |
| 1841 } | 1842 } |
| 1842 | 1843 |
| 1843 my $conditionalString = GenerateConditionalString($attribute); | 1844 my $conditionalString = GenerateConditionalString($attribute); |
| 1844 my $code = ""; | 1845 my $code = ""; |
| 1845 $code .= "#if ${conditionalString}\n\n" if $conditionalString; | 1846 $code .= "#if ${conditionalString}\n" if $conditionalString; |
| 1846 $code .= "static void ${attrName}AttributeSetter${forMainWorldSuffix}(v8::Lo
cal<v8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackIn
fo<void>& info)\n"; | 1847 $code .= "static void ${attrName}AttributeSetter${forMainWorldSuffix}(v8::Lo
cal<v8::String> name, v8::Local<v8::Value> jsValue, const v8::PropertyCallbackIn
fo<void>& info)\n"; |
| 1847 $code .= "{\n"; | 1848 $code .= "{\n"; |
| 1848 | 1849 |
| 1849 # If the "StrictTypeChecking" extended attribute is present, and the attribu
te's type is an | 1850 # If the "StrictTypeChecking" extended attribute is present, and the attribu
te's type is an |
| 1850 # interface type, then if the incoming value does not implement that interfa
ce, a TypeError is | 1851 # interface type, then if the incoming value does not implement that interfa
ce, a TypeError is |
| 1851 # thrown rather than silently passing NULL to the C++ code. | 1852 # thrown rather than silently passing NULL to the C++ code. |
| 1852 # Per the Web IDL and ECMAScript specifications, incoming values can always
be converted to both | 1853 # Per the Web IDL and ECMAScript specifications, incoming values can always
be converted to both |
| 1853 # strings and numbers, so do not throw TypeError if the attribute is of thes
e types. | 1854 # strings and numbers, so do not throw TypeError if the attribute is of thes
e types. |
| 1854 if ($attribute->extendedAttributes->{"StrictTypeChecking"}) { | 1855 if ($attribute->extendedAttributes->{"StrictTypeChecking"}) { |
| 1855 my $argType = $attribute->type; | 1856 my $argType = $attribute->type; |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1905 if ($reflect && InheritsInterface($interface, "Node") && $attrType eq "D
OMString") { | 1906 if ($reflect && InheritsInterface($interface, "Node") && $attrType eq "D
OMString") { |
| 1906 # Generate super-compact call for regular attribute setter: | 1907 # Generate super-compact call for regular attribute setter: |
| 1907 my $contentAttributeName = $reflect eq "VALUE_IS_MISSING" ? lc $attr
Name : $reflect; | 1908 my $contentAttributeName = $reflect eq "VALUE_IS_MISSING" ? lc $attr
Name : $reflect; |
| 1908 my $namespace = NamespaceForAttributeName($interfaceName, $contentAt
tributeName); | 1909 my $namespace = NamespaceForAttributeName($interfaceName, $contentAt
tributeName); |
| 1909 my $mode = GetV8StringResourceMode($attribute->extendedAttributes); | 1910 my $mode = GetV8StringResourceMode($attribute->extendedAttributes); |
| 1910 AddToImplIncludes("${namespace}.h"); | 1911 AddToImplIncludes("${namespace}.h"); |
| 1911 $code .= " Element* imp = V8Element::toNative(info.Holder());\n"; | 1912 $code .= " Element* imp = V8Element::toNative(info.Holder());\n"; |
| 1912 $code .= " V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<
$mode>, stringResource, jsValue);\n"; | 1913 $code .= " V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<
$mode>, stringResource, jsValue);\n"; |
| 1913 # Attr (not Attribute) used in content attributes | 1914 # Attr (not Attribute) used in content attributes |
| 1914 $code .= " imp->setAttribute(${namespace}::${contentAttributeName
}Attr, stringResource);\n"; | 1915 $code .= " imp->setAttribute(${namespace}::${contentAttributeName
}Attr, stringResource);\n"; |
| 1915 $code .= "}\n\n"; | 1916 $code .= "}\n"; |
| 1916 $code .= "#endif // ${conditionalString}\n\n" if $conditionalString; | 1917 $code .= "#endif // ${conditionalString}\n" if $conditionalString; |
| 1918 $code .= "\n"; |
| 1917 $implementation{nameSpaceInternal}->add($code); | 1919 $implementation{nameSpaceInternal}->add($code); |
| 1918 return; | 1920 return; |
| 1919 # Skip the rest of the function! | 1921 # Skip the rest of the function! |
| 1920 } | 1922 } |
| 1921 | 1923 |
| 1922 if (!$attribute->isStatic) { | 1924 if (!$attribute->isStatic) { |
| 1923 $code .= <<END; | 1925 $code .= <<END; |
| 1924 ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()); | 1926 ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()); |
| 1925 END | 1927 END |
| 1926 } | 1928 } |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2033 $code .= " wrapper->commitChange();\n"; | 2035 $code .= " wrapper->commitChange();\n"; |
| 2034 } | 2036 } |
| 2035 } | 2037 } |
| 2036 | 2038 |
| 2037 if ($attrCached) { | 2039 if ($attrCached) { |
| 2038 $code .= <<END; | 2040 $code .= <<END; |
| 2039 info.Holder()->DeleteHiddenValue(v8::String::NewSymbol("${attrName}")); // I
nvalidate the cached value. | 2041 info.Holder()->DeleteHiddenValue(v8::String::NewSymbol("${attrName}")); // I
nvalidate the cached value. |
| 2040 END | 2042 END |
| 2041 } | 2043 } |
| 2042 | 2044 |
| 2043 $code .= "}\n\n"; # end of setter | 2045 $code .= "}\n"; # end of setter |
| 2044 $code .= "#endif // ${conditionalString}\n\n" if $conditionalString; | 2046 $code .= "#endif // ${conditionalString}\n" if $conditionalString; |
| 2047 $code .= "\n"; |
| 2045 $implementation{nameSpaceInternal}->add($code); | 2048 $implementation{nameSpaceInternal}->add($code); |
| 2046 } | 2049 } |
| 2047 | 2050 |
| 2048 sub GenerateParametersCheckExpression | 2051 sub GenerateParametersCheckExpression |
| 2049 { | 2052 { |
| 2050 my $numParameters = shift; | 2053 my $numParameters = shift; |
| 2051 my $function = shift; | 2054 my $function = shift; |
| 2052 | 2055 |
| 2053 my @andExpression = (); | 2056 my @andExpression = (); |
| 2054 push(@andExpression, "args.Length() == $numParameters"); | 2057 push(@andExpression, "args.Length() == $numParameters"); |
| (...skipping 4173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6228 my $interface = shift; | 6231 my $interface = shift; |
| 6229 | 6232 |
| 6230 return 1 if $interface->extendedAttributes->{"CustomToV8"}; | 6233 return 1 if $interface->extendedAttributes->{"CustomToV8"}; |
| 6231 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; | 6234 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; |
| 6232 return 1 if InheritsInterface($interface, "Document"); | 6235 return 1 if InheritsInterface($interface, "Document"); |
| 6233 | 6236 |
| 6234 return 0; | 6237 return 0; |
| 6235 } | 6238 } |
| 6236 | 6239 |
| 6237 1; | 6240 1; |
| OLD | NEW |