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

Side by Side Diff: tools/dom/scripts/generator.py

Issue 12493003: Exposing Point & Rect types (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Sync to ToT Created 7 years, 9 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 | « tests/html/wheelevent_test.dart ('k') | tools/dom/scripts/htmlrenamer.py » ('j') | 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 systems to generate 6 """This module provides shared functionality for systems to generate
7 Dart APIs from the IDL database.""" 7 Dart APIs from the IDL database."""
8 8
9 import copy 9 import copy
10 import json 10 import json
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after
1082 return self._data.custom_to_dart 1082 return self._data.custom_to_dart
1083 1083
1084 1084
1085 class InterfaceIDLTypeInfo(IDLTypeInfo): 1085 class InterfaceIDLTypeInfo(IDLTypeInfo):
1086 def __init__(self, idl_type, data, dart_interface_name, type_registry): 1086 def __init__(self, idl_type, data, dart_interface_name, type_registry):
1087 super(InterfaceIDLTypeInfo, self).__init__(idl_type, data) 1087 super(InterfaceIDLTypeInfo, self).__init__(idl_type, data)
1088 self._dart_interface_name = dart_interface_name 1088 self._dart_interface_name = dart_interface_name
1089 self._type_registry = type_registry 1089 self._type_registry = type_registry
1090 1090
1091 def dart_type(self): 1091 def dart_type(self):
1092 if self._data.dart_type:
1093 return self._data.dart_type
1092 if self.list_item_type() and not self.has_generated_interface(): 1094 if self.list_item_type() and not self.has_generated_interface():
1093 return 'List<%s>' % self._type_registry.TypeInfo(self._data.item_type).dar t_type() 1095 return 'List<%s>' % self._type_registry.TypeInfo(self._data.item_type).dar t_type()
1094 return self._data.dart_type or self._dart_interface_name 1096 return self._dart_interface_name
1095 1097
1096 def narrow_dart_type(self): 1098 def narrow_dart_type(self):
1097 if self.list_item_type(): 1099 if self.list_item_type():
1098 return self.implementation_name() 1100 return self.implementation_name()
1099 # TODO(podivilov): only primitive and collection types should override 1101 # TODO(podivilov): only primitive and collection types should override
1100 # dart_type. 1102 # dart_type.
1101 if self._data.dart_type != None: 1103 if self._data.dart_type != None:
1102 return self.dart_type() 1104 return self.dart_type()
1103 if IsPureInterface(self.idl_type()): 1105 if IsPureInterface(self.idl_type()):
1104 return self.idl_type() 1106 return self.idl_type()
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 webcore_getter_name='getUnsignedIntegralAttribute' , 1337 webcore_getter_name='getUnsignedIntegralAttribute' ,
1336 webcore_setter_name='setUnsignedIntegralAttribute' ), 1338 webcore_setter_name='setUnsignedIntegralAttribute' ),
1337 'long long': TypeData(clazz='Primitive', dart_type='int'), 1339 'long long': TypeData(clazz='Primitive', dart_type='int'),
1338 'unsigned long long': TypeData(clazz='Primitive', dart_type='int'), 1340 'unsigned long long': TypeData(clazz='Primitive', dart_type='int'),
1339 'float': TypeData(clazz='Primitive', dart_type='num', native_type='double'), 1341 'float': TypeData(clazz='Primitive', dart_type='num', native_type='double'),
1340 'double': TypeData(clazz='Primitive', dart_type='num'), 1342 'double': TypeData(clazz='Primitive', dart_type='num'),
1341 1343
1342 'any': TypeData(clazz='Primitive', dart_type='Object', native_type='ScriptVa lue'), 1344 'any': TypeData(clazz='Primitive', dart_type='Object', native_type='ScriptVa lue'),
1343 'Array': TypeData(clazz='Primitive', dart_type='List'), 1345 'Array': TypeData(clazz='Primitive', dart_type='List'),
1344 'custom': TypeData(clazz='Primitive', dart_type='dynamic'), 1346 'custom': TypeData(clazz='Primitive', dart_type='dynamic'),
1347 'ClientRect': TypeData(clazz='Interface',
1348 dart_type='Rect', suppress_interface=True),
1345 'Date': TypeData(clazz='Primitive', dart_type='DateTime', native_type='doubl e'), 1349 'Date': TypeData(clazz='Primitive', dart_type='DateTime', native_type='doubl e'),
1346 'DOMObject': TypeData(clazz='Primitive', dart_type='Object', native_type='Sc riptValue'), 1350 'DOMObject': TypeData(clazz='Primitive', dart_type='Object', native_type='Sc riptValue'),
1347 'DOMString': TypeData(clazz='Primitive', dart_type='String', native_type='St ring'), 1351 'DOMString': TypeData(clazz='Primitive', dart_type='String', native_type='St ring'),
1348 # TODO(vsm): This won't actually work until we convert the Map to 1352 # TODO(vsm): This won't actually work until we convert the Map to
1349 # a native JS Map for JS DOM. 1353 # a native JS Map for JS DOM.
1350 'Dictionary': TypeData(clazz='Primitive', dart_type='Map'), 1354 'Dictionary': TypeData(clazz='Primitive', dart_type='Map'),
1351 'DOMTimeStamp': TypeData(clazz='Primitive', dart_type='int', native_type='un signed long long'), 1355 'DOMTimeStamp': TypeData(clazz='Primitive', dart_type='int', native_type='un signed long long'),
1352 'object': TypeData(clazz='Primitive', dart_type='Object', native_type='Scrip tValue'), 1356 'object': TypeData(clazz='Primitive', dart_type='Object', native_type='Scrip tValue'),
1353 'ObjectArray': TypeData(clazz='Primitive', dart_type='List'), 1357 'ObjectArray': TypeData(clazz='Primitive', dart_type='List'),
1354 'PositionOptions': TypeData(clazz='Primitive', dart_type='Object'), 1358 'PositionOptions': TypeData(clazz='Primitive', dart_type='Object'),
(...skipping 14 matching lines...) Expand all
1369 'EventTarget': TypeData(clazz='Interface', custom_to_native=True), 1373 'EventTarget': TypeData(clazz='Interface', custom_to_native=True),
1370 'HTMLElement': TypeData(clazz='Interface', merged_into='Element', 1374 'HTMLElement': TypeData(clazz='Interface', merged_into='Element',
1371 custom_to_dart=True), 1375 custom_to_dart=True),
1372 'IDBAny': TypeData(clazz='Interface', dart_type='dynamic', custom_to_native= True), 1376 'IDBAny': TypeData(clazz='Interface', dart_type='dynamic', custom_to_native= True),
1373 'MutationRecordArray': TypeData(clazz='Interface', # C++ pass by pointer. 1377 'MutationRecordArray': TypeData(clazz='Interface', # C++ pass by pointer.
1374 native_type='MutationRecordArray', dart_type='List<MutationRecord>'), 1378 native_type='MutationRecordArray', dart_type='List<MutationRecord>'),
1375 'StyleSheet': TypeData(clazz='Interface', conversion_includes=['CSSStyleShee t']), 1379 'StyleSheet': TypeData(clazz='Interface', conversion_includes=['CSSStyleShee t']),
1376 'SVGElement': TypeData(clazz='Interface', custom_to_dart=True), 1380 'SVGElement': TypeData(clazz='Interface', custom_to_dart=True),
1377 1381
1378 'ClientRectList': TypeData(clazz='Interface', 1382 'ClientRectList': TypeData(clazz='Interface',
1379 item_type='ClientRect', suppress_interface=True), 1383 item_type='ClientRect', dart_type='List<Rect>', suppress_interface=True) ,
1380 'CSSRuleList': TypeData(clazz='Interface', 1384 'CSSRuleList': TypeData(clazz='Interface',
1381 item_type='CSSRule', suppress_interface=True), 1385 item_type='CSSRule', suppress_interface=True),
1382 'CSSValueList': TypeData(clazz='Interface', 1386 'CSSValueList': TypeData(clazz='Interface',
1383 item_type='CSSValue', suppress_interface=True), 1387 item_type='CSSValue', suppress_interface=True),
1384 'DOMMimeTypeArray': TypeData(clazz='Interface', item_type='DOMMimeType'), 1388 'DOMMimeTypeArray': TypeData(clazz='Interface', item_type='DOMMimeType'),
1385 'DOMPluginArray': TypeData(clazz='Interface', item_type='DOMPlugin'), 1389 'DOMPluginArray': TypeData(clazz='Interface', item_type='DOMPlugin'),
1386 'DOMStringList': TypeData(clazz='Interface', item_type='DOMString', 1390 'DOMStringList': TypeData(clazz='Interface', item_type='DOMString',
1387 dart_type='List<String>', custom_to_native=True), 1391 dart_type='List<String>', custom_to_native=True),
1388 'EntryArray': TypeData(clazz='Interface', item_type='Entry', 1392 'EntryArray': TypeData(clazz='Interface', item_type='Entry',
1389 suppress_interface=True), 1393 suppress_interface=True),
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1498 self) 1502 self)
1499 1503
1500 if type_data.clazz == 'SVGTearOff': 1504 if type_data.clazz == 'SVGTearOff':
1501 dart_interface_name = self._renamer.RenameInterface( 1505 dart_interface_name = self._renamer.RenameInterface(
1502 self._database.GetInterface(type_name)) 1506 self._database.GetInterface(type_name))
1503 return SVGTearOffIDLTypeInfo( 1507 return SVGTearOffIDLTypeInfo(
1504 type_name, type_data, dart_interface_name, self) 1508 type_name, type_data, dart_interface_name, self)
1505 1509
1506 class_name = '%sIDLTypeInfo' % type_data.clazz 1510 class_name = '%sIDLTypeInfo' % type_data.clazz
1507 return globals()[class_name](type_name, type_data) 1511 return globals()[class_name](type_name, type_data)
OLDNEW
« no previous file with comments | « tests/html/wheelevent_test.dart ('k') | tools/dom/scripts/htmlrenamer.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698