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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 if 'DoNotExposeJSAccessors' in attribute.extended_attributes: | 512 if 'DoNotExposeJSAccessors' in attribute.extended_attributes: |
513 return False | 513 return False |
514 | 514 |
515 # These attributes must not be accessors on prototype chains. | 515 # These attributes must not be accessors on prototype chains. |
516 if (is_constructor_attribute(attribute) or | 516 if (is_constructor_attribute(attribute) or |
517 attribute.is_static or | 517 attribute.is_static or |
518 is_unforgeable(interface, attribute) or | 518 is_unforgeable(interface, attribute) or |
519 'OverrideBuiltins' in interface.extended_attributes): | 519 'OverrideBuiltins' in interface.extended_attributes): |
520 return False | 520 return False |
521 | 521 |
522 # FIXME: We should move all of the following DOM attributes to prototype | 522 # The members of Window interface must be placed on the instance object. |
523 # chains. | 523 if interface.name == 'Window': |
524 if (has_custom_getter(attribute) or | |
525 has_custom_setter(attribute) or | |
526 interface.name == 'Window'): | |
527 return False | 524 return False |
528 | 525 |
529 return is_accessor | 526 return is_accessor |
530 | 527 |
531 | 528 |
532 ################################################################################ | 529 ################################################################################ |
533 # Constructors | 530 # Constructors |
534 ################################################################################ | 531 ################################################################################ |
535 | 532 |
536 idl_types.IdlType.constructor_type_name = property( | 533 idl_types.IdlType.constructor_type_name = property( |
537 # FIXME: replace this with a [ConstructorAttribute] extended attribute | 534 # FIXME: replace this with a [ConstructorAttribute] extended attribute |
538 lambda self: strip_suffix(self.base_type, 'Constructor')) | 535 lambda self: strip_suffix(self.base_type, 'Constructor')) |
539 | 536 |
540 | 537 |
541 def is_constructor_attribute(attribute): | 538 def is_constructor_attribute(attribute): |
542 # FIXME: replace this with [ConstructorAttribute] extended attribute | 539 # FIXME: replace this with [ConstructorAttribute] extended attribute |
543 return attribute.idl_type.name.endswith('Constructor') | 540 return attribute.idl_type.name.endswith('Constructor') |
544 | 541 |
545 | 542 |
546 def update_constructor_attribute_context(interface, attribute, context): | 543 def update_constructor_attribute_context(interface, attribute, context): |
547 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] | 544 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] |
548 # When the attribute name is the same as the interface name, do not generate | 545 # When the attribute name is the same as the interface name, do not generate |
549 # callback functions for each attribute and use | 546 # callback functions for each attribute and use |
550 # {{cpp_class}}ConstructorAttributeSetterCallback. Otherwise, generate | 547 # {{cpp_class}}ConstructorAttributeSetterCallback. Otherwise, generate |
551 # a callback function in order to hard-code the attribute name. | 548 # a callback function in order to hard-code the attribute name. |
552 context['needs_constructor_setter_callback'] = context['name'] != context['c
onstructor_type'] | 549 context['needs_constructor_setter_callback'] = context['name'] != context['c
onstructor_type'] |
OLD | NEW |