| 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 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 | 418 |
| 419 base_idl_type = attribute.idl_type.base_type | 419 base_idl_type = attribute.idl_type.base_type |
| 420 if base_idl_type in CONTENT_ATTRIBUTE_SETTER_NAMES: | 420 if base_idl_type in CONTENT_ATTRIBUTE_SETTER_NAMES: |
| 421 return CONTENT_ATTRIBUTE_SETTER_NAMES[base_idl_type] | 421 return CONTENT_ATTRIBUTE_SETTER_NAMES[base_idl_type] |
| 422 return 'setAttribute' | 422 return 'setAttribute' |
| 423 | 423 |
| 424 | 424 |
| 425 def scoped_content_attribute_name(interface, attribute): | 425 def scoped_content_attribute_name(interface, attribute): |
| 426 content_attribute_name = attribute.extended_attributes['Reflect'] or attribu
te.name.lower() | 426 content_attribute_name = attribute.extended_attributes['Reflect'] or attribu
te.name.lower() |
| 427 if interface.name.startswith('SVG'): | 427 if interface.name.startswith('SVG'): |
| 428 # SVG's xmlbase/xmlspace/xmllang need special behavior, i.e. | 428 namespace = 'SVGNames' |
| 429 # it is in XMLNames namespace and the generated attribute has no xml pre
fix. | |
| 430 if attribute.name.startswith('xml'): | |
| 431 namespace = 'XMLNames' | |
| 432 content_attribute_name = content_attribute_name[3:] | |
| 433 else: | |
| 434 namespace = 'SVGNames' | |
| 435 else: | 429 else: |
| 436 namespace = 'HTMLNames' | 430 namespace = 'HTMLNames' |
| 437 includes.add('core/%s.h' % namespace) | 431 includes.add('core/%s.h' % namespace) |
| 438 return '%s::%sAttr' % (namespace, content_attribute_name) | 432 return '%s::%sAttr' % (namespace, content_attribute_name) |
| 439 | 433 |
| 440 | 434 |
| 441 ################################################################################ | 435 ################################################################################ |
| 442 # Attribute configuration | 436 # Attribute configuration |
| 443 ################################################################################ | 437 ################################################################################ |
| 444 | 438 |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 547 return attribute.idl_type.name.endswith('Constructor') | 541 return attribute.idl_type.name.endswith('Constructor') |
| 548 | 542 |
| 549 | 543 |
| 550 def update_constructor_attribute_context(interface, attribute, context): | 544 def update_constructor_attribute_context(interface, attribute, context): |
| 551 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] | 545 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] |
| 552 # When the attribute name is the same as the interface name, do not generate | 546 # When the attribute name is the same as the interface name, do not generate |
| 553 # callback functions for each attribute and use | 547 # callback functions for each attribute and use |
| 554 # {{cpp_class}}ConstructorAttributeSetterCallback. Otherwise, generate | 548 # {{cpp_class}}ConstructorAttributeSetterCallback. Otherwise, generate |
| 555 # a callback function in order to hard-code the attribute name. | 549 # a callback function in order to hard-code the attribute name. |
| 556 context['needs_constructor_setter_callback'] = context['name'] != context['c
onstructor_type'] | 550 context['needs_constructor_setter_callback'] = context['name'] != context['c
onstructor_type'] |
| OLD | NEW |