Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1076)

Side by Side Diff: lib/dom/scripts/systemnative.py

Issue 10704100: Do not split attributes on getters and setters in databasebuilder. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: . Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « lib/dom/scripts/systeminterface.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a 3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 """This module provides shared functionality for the systems to generate 6 """This module provides shared functionality for the systems to generate
7 native binding from the IDL database.""" 7 native binding from the IDL database."""
8 8
9 import emitter 9 import emitter
10 import os 10 import os
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 INDEX=len(node.arguments)) 466 INDEX=len(node.arguments))
467 arguments.extend(['scriptArguments', 'scriptCallStack']) 467 arguments.extend(['scriptArguments', 'scriptCallStack'])
468 return True 468 return True
469 469
470 return False 470 return False
471 471
472 def AddConstant(self, constant): 472 def AddConstant(self, constant):
473 # Constants are already defined on the interface. 473 # Constants are already defined on the interface.
474 pass 474 pass
475 475
476 def AddAttribute(self, getter, setter): 476 def AddAttribute(self, attribute):
477 getter = attribute
478 setter = attribute if not systembase.IsReadOnly(attribute) else None
477 if 'CheckSecurityForNode' in (getter or setter).ext_attrs: 479 if 'CheckSecurityForNode' in (getter or setter).ext_attrs:
478 # FIXME: exclude from interface as well. 480 # FIXME: exclude from interface as well.
479 return 481 return
480 482
481 dom_name = DartDomNameOfAttribute(getter or setter) 483 dom_name = DartDomNameOfAttribute(getter or setter)
482 html_getter_name = self._html_system.RenameInHtmlLibrary( 484 html_getter_name = self._html_system.RenameInHtmlLibrary(
483 self._interface.id, dom_name, 'get:', implementation_class=True) 485 self._interface.id, dom_name, 'get:', implementation_class=True)
484 html_setter_name = self._html_system.RenameInHtmlLibrary( 486 html_setter_name = self._html_system.RenameInHtmlLibrary(
485 self._interface.id, dom_name, 'set:', implementation_class=True) 487 self._interface.id, dom_name, 'set:', implementation_class=True)
486 488
487 if getter and html_getter_name: 489 if getter and html_getter_name:
488 self._AddGetter(getter, html_getter_name) 490 self._AddGetter(getter, html_getter_name)
489 if setter and html_setter_name: 491 if setter and html_setter_name:
490 self._AddSetter(setter, html_setter_name) 492 self._AddSetter(setter, html_setter_name)
491 493
492 def AddSecondaryAttribute(self, interface, getter, setter): 494 def AddSecondaryAttribute(self, interface, attribute):
493 self.AddAttribute(getter, setter) 495 self.AddAttribute(attribute)
494 496
495 def _AddGetter(self, attr, html_name): 497 def _AddGetter(self, attr, html_name):
496 type_info = GetIDLTypeInfo(attr.type.id) 498 type_info = GetIDLTypeInfo(attr.type.id)
497 dart_declaration = '%s get %s()' % (self._DartType(attr.type.id), html_name) 499 dart_declaration = '%s get %s()' % (self._DartType(attr.type.id), html_name)
498 is_custom = 'Custom' in attr.ext_attrs or 'CustomGetter' in attr.ext_attrs 500 is_custom = 'Custom' in attr.ext_attrs or 'CustomGetter' in attr.ext_attrs
499 cpp_callback_name = self._GenerateNativeBinding(attr.id, 1, 501 cpp_callback_name = self._GenerateNativeBinding(attr.id, 1,
500 dart_declaration, 'Getter', is_custom) 502 dart_declaration, 'Getter', is_custom)
501 if is_custom: 503 if is_custom:
502 return 504 return
503 505
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
983 985
984 def _IsArgumentOptionalInWebCore(argument): 986 def _IsArgumentOptionalInWebCore(argument):
985 return IsOptional(argument) and not 'Callback' in argument.ext_attrs 987 return IsOptional(argument) and not 'Callback' in argument.ext_attrs
986 988
987 def _ToWebKitName(name): 989 def _ToWebKitName(name):
988 name = name[0].lower() + name[1:] 990 name = name[0].lower() + name[1:]
989 name = re.sub(r'^(hTML|uRL|jS|xML|xSLT)', lambda s: s.group(1).lower(), 991 name = re.sub(r'^(hTML|uRL|jS|xML|xSLT)', lambda s: s.group(1).lower(),
990 name) 992 name)
991 return re.sub(r'^(create|exclusive)', lambda s: 'is' + s.group(1).capitalize() , 993 return re.sub(r'^(create|exclusive)', lambda s: 'is' + s.group(1).capitalize() ,
992 name) 994 name)
OLDNEW
« no previous file with comments | « lib/dom/scripts/systeminterface.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698