OLD | NEW |
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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 'boolean': 'fastHasAttribute', | 247 'boolean': 'fastHasAttribute', |
248 'long': 'getIntegralAttribute', | 248 'long': 'getIntegralAttribute', |
249 'unsigned long': 'getUnsignedIntegralAttribute', | 249 'unsigned long': 'getUnsignedIntegralAttribute', |
250 } | 250 } |
251 | 251 |
252 | 252 |
253 def getter_base_name(interface, attribute, arguments): | 253 def getter_base_name(interface, attribute, arguments): |
254 extended_attributes = attribute.extended_attributes | 254 extended_attributes = attribute.extended_attributes |
255 | 255 |
256 if 'ImplementedInPrivateScript' in extended_attributes: | 256 if 'ImplementedInPrivateScript' in extended_attributes: |
257 return '%sAttributeGetterImplementedInPrivateScript' % uncapitalize(cpp_
name(attribute)) | 257 return '%sAttributeGetter' % uncapitalize(cpp_name(attribute)) |
258 | 258 |
259 if 'Reflect' not in extended_attributes: | 259 if 'Reflect' not in extended_attributes: |
260 return uncapitalize(cpp_name(attribute)) | 260 return uncapitalize(cpp_name(attribute)) |
261 | 261 |
262 content_attribute_name = extended_attributes['Reflect'] or attribute.name.lo
wer() | 262 content_attribute_name = extended_attributes['Reflect'] or attribute.name.lo
wer() |
263 if content_attribute_name in ['class', 'id', 'name']: | 263 if content_attribute_name in ['class', 'id', 'name']: |
264 # Special-case for performance optimization. | 264 # Special-case for performance optimization. |
265 return 'get%sAttribute' % content_attribute_name.capitalize() | 265 return 'get%sAttribute' % content_attribute_name.capitalize() |
266 | 266 |
267 arguments.append(scoped_content_attribute_name(interface, attribute)) | 267 arguments.append(scoped_content_attribute_name(interface, attribute)) |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 | 393 |
394 CONTENT_ATTRIBUTE_SETTER_NAMES = { | 394 CONTENT_ATTRIBUTE_SETTER_NAMES = { |
395 'boolean': 'setBooleanAttribute', | 395 'boolean': 'setBooleanAttribute', |
396 'long': 'setIntegralAttribute', | 396 'long': 'setIntegralAttribute', |
397 'unsigned long': 'setUnsignedIntegralAttribute', | 397 'unsigned long': 'setUnsignedIntegralAttribute', |
398 } | 398 } |
399 | 399 |
400 | 400 |
401 def setter_base_name(interface, attribute, arguments): | 401 def setter_base_name(interface, attribute, arguments): |
402 if 'ImplementedInPrivateScript' in attribute.extended_attributes: | 402 if 'ImplementedInPrivateScript' in attribute.extended_attributes: |
403 return '%sAttributeSetterImplementedInPrivateScript' % uncapitalize(cpp_
name(attribute)) | 403 return '%sAttributeSetter' % uncapitalize(cpp_name(attribute)) |
404 | 404 |
405 if 'Reflect' not in attribute.extended_attributes: | 405 if 'Reflect' not in attribute.extended_attributes: |
406 return 'set%s' % capitalize(cpp_name(attribute)) | 406 return 'set%s' % capitalize(cpp_name(attribute)) |
407 arguments.append(scoped_content_attribute_name(interface, attribute)) | 407 arguments.append(scoped_content_attribute_name(interface, attribute)) |
408 | 408 |
409 base_idl_type = attribute.idl_type.base_type | 409 base_idl_type = attribute.idl_type.base_type |
410 if base_idl_type in CONTENT_ATTRIBUTE_SETTER_NAMES: | 410 if base_idl_type in CONTENT_ATTRIBUTE_SETTER_NAMES: |
411 return CONTENT_ATTRIBUTE_SETTER_NAMES[base_idl_type] | 411 return CONTENT_ATTRIBUTE_SETTER_NAMES[base_idl_type] |
412 return 'setAttribute' | 412 return 'setAttribute' |
413 | 413 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
484 lambda self: strip_suffix(self.base_type, 'Constructor')) | 484 lambda self: strip_suffix(self.base_type, 'Constructor')) |
485 | 485 |
486 | 486 |
487 def is_constructor_attribute(attribute): | 487 def is_constructor_attribute(attribute): |
488 # FIXME: replace this with [ConstructorAttribute] extended attribute | 488 # FIXME: replace this with [ConstructorAttribute] extended attribute |
489 return attribute.idl_type.base_type.endswith('Constructor') | 489 return attribute.idl_type.base_type.endswith('Constructor') |
490 | 490 |
491 | 491 |
492 def constructor_getter_context(interface, attribute, context): | 492 def constructor_getter_context(interface, attribute, context): |
493 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] | 493 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] |
OLD | NEW |