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 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 arguments.append(scoped_content_attribute_name(interface, attribute)) | 403 arguments.append(scoped_content_attribute_name(interface, attribute)) |
404 | 404 |
405 base_idl_type = attribute.idl_type.base_type | 405 base_idl_type = attribute.idl_type.base_type |
406 if base_idl_type in CONTENT_ATTRIBUTE_SETTER_NAMES: | 406 if base_idl_type in CONTENT_ATTRIBUTE_SETTER_NAMES: |
407 return CONTENT_ATTRIBUTE_SETTER_NAMES[base_idl_type] | 407 return CONTENT_ATTRIBUTE_SETTER_NAMES[base_idl_type] |
408 return 'setAttribute' | 408 return 'setAttribute' |
409 | 409 |
410 | 410 |
411 def scoped_content_attribute_name(interface, attribute): | 411 def scoped_content_attribute_name(interface, attribute): |
412 content_attribute_name = attribute.extended_attributes['Reflect'] or attribu
te.name.lower() | 412 content_attribute_name = attribute.extended_attributes['Reflect'] or attribu
te.name.lower() |
413 namespace = 'SVGNames' if interface.name.startswith('SVG') else 'HTMLNames' | 413 if interface.name.startswith('SVG'): |
| 414 # SVG's xmlbase/xmlspace/xmllang need special behavior, i.e. |
| 415 # it is in XMLNames namespace and the generated attribute has no xml pre
fix. |
| 416 if attribute.name.startswith('xml'): |
| 417 namespace = 'XMLNames' |
| 418 content_attribute_name = content_attribute_name[3:] |
| 419 else: |
| 420 namespace = 'SVGNames' |
| 421 else: |
| 422 namespace = 'HTMLNames' |
414 includes.add('core/%s.h' % namespace) | 423 includes.add('core/%s.h' % namespace) |
415 return '%s::%sAttr' % (namespace, content_attribute_name) | 424 return '%s::%sAttr' % (namespace, content_attribute_name) |
416 | 425 |
417 | 426 |
418 ################################################################################ | 427 ################################################################################ |
419 # Attribute configuration | 428 # Attribute configuration |
420 ################################################################################ | 429 ################################################################################ |
421 | 430 |
422 # [Replaceable] | 431 # [Replaceable] |
423 def setter_callback_name(interface, attribute): | 432 def setter_callback_name(interface, attribute): |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 lambda self: strip_suffix(self.base_type, 'Constructor')) | 480 lambda self: strip_suffix(self.base_type, 'Constructor')) |
472 | 481 |
473 | 482 |
474 def is_constructor_attribute(attribute): | 483 def is_constructor_attribute(attribute): |
475 # FIXME: replace this with [ConstructorAttribute] extended attribute | 484 # FIXME: replace this with [ConstructorAttribute] extended attribute |
476 return attribute.idl_type.base_type.endswith('Constructor') | 485 return attribute.idl_type.base_type.endswith('Constructor') |
477 | 486 |
478 | 487 |
479 def constructor_getter_context(interface, attribute, context): | 488 def constructor_getter_context(interface, attribute, context): |
480 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] | 489 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] |
OLD | NEW |