Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(287)

Side by Side Diff: third_party/WebKit/Source/bindings/scripts/v8_types.py

Issue 1730323002: Make nullable DOMString always treat undefined as null (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase test results Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # 2 #
3 # Redistribution and use in source and binary forms, with or without 3 # Redistribution and use in source and binary forms, with or without
4 # modification, are permitted provided that the following conditions are 4 # modification, are permitted provided that the following conditions are
5 # met: 5 # met:
6 # 6 #
7 # * Redistributions of source code must retain the above copyright 7 # * Redistributions of source code must retain the above copyright
8 # notice, this list of conditions and the following disclaimer. 8 # notice, this list of conditions and the following disclaimer.
9 # * Redistributions in binary form must reproduce the above 9 # * Redistributions in binary form must reproduce the above
10 # copyright notice, this list of conditions and the following disclaimer 10 # copyright notice, this list of conditions and the following disclaimer
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 type of a method. 137 type of a method.
138 used_as_variadic_argument: 138 used_as_variadic_argument:
139 bool, True if the C++ type is used as a variadic argument of a metho d. 139 bool, True if the C++ type is used as a variadic argument of a metho d.
140 used_in_cpp_sequence: 140 used_in_cpp_sequence:
141 bool, True if the C++ type is used as an element of a container. 141 bool, True if the C++ type is used as an element of a container.
142 Containers can be an array, a sequence or a dictionary. 142 Containers can be an array, a sequence or a dictionary.
143 """ 143 """
144 def string_mode(): 144 def string_mode():
145 if extended_attributes.get('TreatNullAs') == 'EmptyString': 145 if extended_attributes.get('TreatNullAs') == 'EmptyString':
146 return 'TreatNullAsEmptyString' 146 return 'TreatNullAsEmptyString'
147 if idl_type.is_nullable or extended_attributes.get('TreatNullAs') == 'Nu llString': 147 if extended_attributes.get('TreatNullAs') == 'NullString':
148 if extended_attributes.get('TreatUndefinedAs') == 'NullString': 148 if extended_attributes.get('TreatUndefinedAs') == 'NullString':
149 return 'TreatNullAndUndefinedAsNullString' 149 return 'TreatNullAndUndefinedAsNullString'
150 return 'TreatNullAsNullString' 150 return 'TreatNullAsNullString'
151 if idl_type.is_nullable:
152 return 'TreatNullAndUndefinedAsNullString'
151 return '' 153 return ''
152 154
153 extended_attributes = extended_attributes or {} 155 extended_attributes = extended_attributes or {}
154 idl_type = idl_type.preprocessed_type 156 idl_type = idl_type.preprocessed_type
155 157
156 # Array or sequence types 158 # Array or sequence types
157 if used_as_variadic_argument: 159 if used_as_variadic_argument:
158 native_array_element_type = idl_type 160 native_array_element_type = idl_type
159 else: 161 else:
160 native_array_element_type = idl_type.native_array_element_type 162 native_array_element_type = idl_type.native_array_element_type
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
1006 number_of_nullable_member_types_union) 1008 number_of_nullable_member_types_union)
1007 1009
1008 1010
1009 def includes_nullable_type_union(idl_type): 1011 def includes_nullable_type_union(idl_type):
1010 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type 1012 # http://heycam.github.io/webidl/#dfn-includes-a-nullable-type
1011 return idl_type.number_of_nullable_member_types == 1 1013 return idl_type.number_of_nullable_member_types == 1
1012 1014
1013 IdlTypeBase.includes_nullable_type = False 1015 IdlTypeBase.includes_nullable_type = False
1014 IdlNullableType.includes_nullable_type = True 1016 IdlNullableType.includes_nullable_type = True
1015 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union) 1017 IdlUnionType.includes_nullable_type = property(includes_nullable_type_union)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698