Chromium Code Reviews| 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 1822 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1833 } elsif ($attrExt->{"OnProto"}) { | 1833 } elsif ($attrExt->{"OnProto"}) { |
| 1834 $code .= <<END; | 1834 $code .= <<END; |
| 1835 ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()); | 1835 ${implClassName}* imp = ${v8ClassName}::toNative(info.Holder()); |
| 1836 END | 1836 END |
| 1837 } else { | 1837 } else { |
| 1838 my $reflect = $attribute->extendedAttributes->{"Reflect"}; | 1838 my $reflect = $attribute->extendedAttributes->{"Reflect"}; |
| 1839 if ($reflect && InheritsInterface($interface, "Node") && $attrType eq "D OMString") { | 1839 if ($reflect && InheritsInterface($interface, "Node") && $attrType eq "D OMString") { |
| 1840 # Generate super-compact call for regular attribute setter: | 1840 # Generate super-compact call for regular attribute setter: |
| 1841 my $contentAttributeName = $reflect eq "VALUE_IS_MISSING" ? lc $attr Name : $reflect; | 1841 my $contentAttributeName = $reflect eq "VALUE_IS_MISSING" ? lc $attr Name : $reflect; |
| 1842 my $namespace = NamespaceForAttributeName($interfaceName, $contentAt tributeName); | 1842 my $namespace = NamespaceForAttributeName($interfaceName, $contentAt tributeName); |
| 1843 my $mode = ""; | |
|
arv (Not doing code reviews)
2013/10/09 14:55:19
Can this be extracted to a function.
sub GetStrin
Inactive
2013/10/09 15:17:41
Done.
| |
| 1844 if (($attribute->extendedAttributes->{"TreatNullAs"} and $attribute- >extendedAttributes->{"TreatNullAs"} eq "NullString") and ($attribute->extendedA ttributes->{"TreatUndefinedAs"} and $attribute->extendedAttributes->{"TreatUndef inedAs"} eq "NullString")) { | |
| 1845 $mode = "WithUndefinedOrNullCheck"; | |
| 1846 } elsif ($attribute->extendedAttributes->{"TreatNullAs"} and $attrib ute->extendedAttributes->{"TreatNullAs"} eq "NullString") { | |
| 1847 $mode = "WithNullCheck"; | |
| 1848 } | |
| 1843 AddToImplIncludes("${namespace}.h"); | 1849 AddToImplIncludes("${namespace}.h"); |
| 1844 $code .= " Element* imp = V8Element::toNative(info.Holder());\n"; | 1850 $code .= " Element* imp = V8Element::toNative(info.Holder());\n"; |
| 1845 $code .= " V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource< WithNullCheck>, stringResource, value);\n"; | 1851 $code .= " V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource< $mode>, stringResource, value);\n"; |
| 1846 # Attr (not Attribute) used in content attributes | 1852 # Attr (not Attribute) used in content attributes |
| 1847 $code .= " imp->setAttribute(${namespace}::${contentAttributeName }Attr, stringResource);\n"; | 1853 $code .= " imp->setAttribute(${namespace}::${contentAttributeName }Attr, stringResource);\n"; |
| 1848 $code .= "}\n\n"; | 1854 $code .= "}\n\n"; |
| 1849 $code .= "#endif // ${conditionalString}\n\n" if $conditionalString; | 1855 $code .= "#endif // ${conditionalString}\n\n" if $conditionalString; |
| 1850 $implementation{nameSpaceInternal}->add($code); | 1856 $implementation{nameSpaceInternal}->add($code); |
| 1851 return; | 1857 return; |
| 1852 # Skip the rest of the function! | 1858 # Skip the rest of the function! |
| 1853 } | 1859 } |
| 1854 | 1860 |
| 1855 if (!$attribute->isStatic) { | 1861 if (!$attribute->isStatic) { |
| (...skipping 3277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 5133 return "bool" if $type eq "boolean"; | 5139 return "bool" if $type eq "boolean"; |
| 5134 | 5140 |
| 5135 if (($type eq "DOMString" || IsEnumType($type)) and $isParameter) { | 5141 if (($type eq "DOMString" || IsEnumType($type)) and $isParameter) { |
| 5136 # Blink uses the non-standard identifier NullString instead of Web IDL | 5142 # Blink uses the non-standard identifier NullString instead of Web IDL |
| 5137 # standard EmptyString, in [TreatNullAs=NullString] and [TreatUndefinedA s=NullString], | 5143 # standard EmptyString, in [TreatNullAs=NullString] and [TreatUndefinedA s=NullString], |
| 5138 # and does not support [TreatUndefinedAs=Null] or [TreatUndefinedAs=Miss ing] | 5144 # and does not support [TreatUndefinedAs=Null] or [TreatUndefinedAs=Miss ing] |
| 5139 # https://sites.google.com/a/chromium.org/dev/blink/webidl/blink-idl-ext ended-attributes#TOC-TreatNullAs-a-p-TreatUndefinedAs-a-p- | 5145 # https://sites.google.com/a/chromium.org/dev/blink/webidl/blink-idl-ext ended-attributes#TOC-TreatNullAs-a-p-TreatUndefinedAs-a-p- |
| 5140 my $mode = ""; | 5146 my $mode = ""; |
| 5141 if (($extendedAttributes->{"TreatNullAs"} and $extendedAttributes->{"Tre atNullAs"} eq "NullString") and ($extendedAttributes->{"TreatUndefinedAs"} and $ extendedAttributes->{"TreatUndefinedAs"} eq "NullString")) { | 5147 if (($extendedAttributes->{"TreatNullAs"} and $extendedAttributes->{"Tre atNullAs"} eq "NullString") and ($extendedAttributes->{"TreatUndefinedAs"} and $ extendedAttributes->{"TreatUndefinedAs"} eq "NullString")) { |
| 5142 $mode = "WithUndefinedOrNullCheck"; | 5148 $mode = "WithUndefinedOrNullCheck"; |
| 5143 } elsif (($extendedAttributes->{"TreatNullAs"} and $extendedAttributes-> {"TreatNullAs"} eq "NullString") or $extendedAttributes->{"Reflect"}) { | 5149 } elsif ($extendedAttributes->{"TreatNullAs"} and $extendedAttributes->{ "TreatNullAs"} eq "NullString") { |
| 5144 $mode = "WithNullCheck"; | 5150 $mode = "WithNullCheck"; |
| 5145 } | 5151 } |
| 5146 # FIXME: Add the case for 'elsif ($attributeOrParameter->extendedAttribu tes->{"TreatUndefinedAs"} and $attributeOrParameter->extendedAttributes->{"Treat UndefinedAs"} eq "NullString"))'. | 5152 # FIXME: Add the case for 'elsif ($attributeOrParameter->extendedAttribu tes->{"TreatUndefinedAs"} and $attributeOrParameter->extendedAttributes->{"Treat UndefinedAs"} eq "NullString"))'. |
| 5147 return "V8StringResource<$mode>"; | 5153 return "V8StringResource<$mode>"; |
| 5148 } | 5154 } |
| 5149 | 5155 |
| 5150 return "String" if $type eq "DOMString" or IsEnumType($type); | 5156 return "String" if $type eq "DOMString" or IsEnumType($type); |
| 5151 | 5157 |
| 5152 return "ScriptPromise" if $type eq "Promise"; | 5158 return "ScriptPromise" if $type eq "Promise"; |
| 5153 | 5159 |
| (...skipping 1002 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6156 my $interface = shift; | 6162 my $interface = shift; |
| 6157 | 6163 |
| 6158 return 1 if $interface->extendedAttributes->{"CustomToV8"}; | 6164 return 1 if $interface->extendedAttributes->{"CustomToV8"}; |
| 6159 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; | 6165 return 1 if $interface->extendedAttributes->{"SpecialWrapFor"}; |
| 6160 return 1 if InheritsInterface($interface, "Document"); | 6166 return 1 if InheritsInterface($interface, "Document"); |
| 6161 | 6167 |
| 6162 return 0; | 6168 return 0; |
| 6163 } | 6169 } |
| 6164 | 6170 |
| 6165 1; | 6171 1; |
| OLD | NEW |