Chromium Code Reviews| 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 502 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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 # FIXME: We should move all of the following DOM attributes to prototype |
| 523 # chains. | 523 # chains. |
|
bashi
2015/06/18 23:50:53
Is this comment still valid?
Yuki
2015/06/19 06:34:48
No. Updated the comment.
| |
| 524 if (has_custom_getter(attribute) or | 524 if interface.name == 'Window': |
| 525 has_custom_setter(attribute) or | |
| 526 interface.name == 'Window'): | |
| 527 return False | 525 return False |
| 528 | 526 |
| 529 return is_accessor | 527 return is_accessor |
| 530 | 528 |
| 531 | 529 |
| 532 ################################################################################ | 530 ################################################################################ |
| 533 # Constructors | 531 # Constructors |
| 534 ################################################################################ | 532 ################################################################################ |
| 535 | 533 |
| 536 idl_types.IdlType.constructor_type_name = property( | 534 idl_types.IdlType.constructor_type_name = property( |
| 537 # FIXME: replace this with a [ConstructorAttribute] extended attribute | 535 # FIXME: replace this with a [ConstructorAttribute] extended attribute |
| 538 lambda self: strip_suffix(self.base_type, 'Constructor')) | 536 lambda self: strip_suffix(self.base_type, 'Constructor')) |
| 539 | 537 |
| 540 | 538 |
| 541 def is_constructor_attribute(attribute): | 539 def is_constructor_attribute(attribute): |
| 542 # FIXME: replace this with [ConstructorAttribute] extended attribute | 540 # FIXME: replace this with [ConstructorAttribute] extended attribute |
| 543 return attribute.idl_type.name.endswith('Constructor') | 541 return attribute.idl_type.name.endswith('Constructor') |
| 544 | 542 |
| 545 | 543 |
| 546 def update_constructor_attribute_context(interface, attribute, context): | 544 def update_constructor_attribute_context(interface, attribute, context): |
| 547 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'] |
| 548 # 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 |
| 549 # callback functions for each attribute and use | 547 # callback functions for each attribute and use |
| 550 # {{cpp_class}}ConstructorAttributeSetterCallback. Otherwise, generate | 548 # {{cpp_class}}ConstructorAttributeSetterCallback. Otherwise, generate |
| 551 # a callback function in order to hard-code the attribute name. | 549 # a callback function in order to hard-code the attribute name. |
| 552 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 |