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

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

Issue 9453030: Fix for issue 1814 for dart:dom (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix typo Created 8 years, 10 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 | « client/dom/generated/src/frog/Uint8Array.dart ('k') | client/dom/scripts/systemfrog.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 re 9 import re
10 10
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 # browsers, but are otherwise identical. The alternates are tried in order and 130 # browsers, but are otherwise identical. The alternates are tried in order and
131 # the first one defined is used. 131 # the first one defined is used.
132 # 132 #
133 # This can be probably be removed when Chrome renames initWebKitWheelEvent to 133 # This can be probably be removed when Chrome renames initWebKitWheelEvent to
134 # initWheelEvent. 134 # initWheelEvent.
135 # 135 #
136 _alternate_methods = { 136 _alternate_methods = {
137 ('WheelEvent', 'initWheelEvent'): ['initWebKitWheelEvent', 'initWheelEvent'] 137 ('WheelEvent', 'initWheelEvent'): ['initWebKitWheelEvent', 'initWheelEvent']
138 } 138 }
139 139
140 #
141 # Custom native bodies for frog implementations of dom operations that appear in
142 # dart:dom and dart:html. This is used to work-around the lack of a 'rename'
143 # feature in the 'native' string - the correct name is available on the DartName
144 # extended attribute. See Issue 1814
145 #
146 _dom_frog_native_typed_array_set_operation = """
147 if (offset == null) return this.set(array);
148 return this.set(array, offset);"""
149
150 dom_frog_native_bodies = {
151 'IDBCursor.continueFunction':
152 """
153 if (key == null) return this['continue']();
154 return this['continue'](key);
155 """,
156 'IDBIndex.getObject': """return this.get(key);""",
157 'IDBObjectStore.getObject': """return this.get(key);""",
158 'Float32Array.setElements': _dom_frog_native_typed_array_set_operation,
159 'Float64Array.setElements': _dom_frog_native_typed_array_set_operation,
160 'Int16Array.setElements': _dom_frog_native_typed_array_set_operation,
161 'Int32Array.setElements': _dom_frog_native_typed_array_set_operation,
162 'Int8Array.setElements': _dom_frog_native_typed_array_set_operation,
163 'Uint16Array.setElements': _dom_frog_native_typed_array_set_operation,
164 'Uint32Array.setElements': _dom_frog_native_typed_array_set_operation,
165 'Uint8Array.setElements': _dom_frog_native_typed_array_set_operation,
166 'Uint8ClampedArray.setElements': _dom_frog_native_typed_array_set_operation,
167 }
168
169
140 def ConvertPrimitiveType(type_name): 170 def ConvertPrimitiveType(type_name):
141 if type_name.startswith('unsigned '): 171 if type_name.startswith('unsigned '):
142 type_name = type_name[len('unsigned '):] 172 type_name = type_name[len('unsigned '):]
143 173
144 if type_name in _idl_to_dart_type_conversions: 174 if type_name in _idl_to_dart_type_conversions:
145 # Primitive type conversion 175 # Primitive type conversion
146 return _idl_to_dart_type_conversions[type_name] 176 return _idl_to_dart_type_conversions[type_name]
147 return None 177 return None
148 178
149 def IsPrimitiveType(type_name): 179 def IsPrimitiveType(type_name):
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 561
532 original_idl_types = { 562 original_idl_types = {
533 } 563 }
534 564
535 def GetIDLTypeInfo(idl_type): 565 def GetIDLTypeInfo(idl_type):
536 idl_type_name = original_idl_types.get(idl_type, idl_type.id) 566 idl_type_name = original_idl_types.get(idl_type, idl_type.id)
537 return GetIDLTypeInfoByName(idl_type_name) 567 return GetIDLTypeInfoByName(idl_type_name)
538 568
539 def GetIDLTypeInfoByName(idl_type_name): 569 def GetIDLTypeInfoByName(idl_type_name):
540 return _idl_type_registry.get(idl_type_name, IDLTypeInfo(idl_type_name)) 570 return _idl_type_registry.get(idl_type_name, IDLTypeInfo(idl_type_name))
OLDNEW
« no previous file with comments | « client/dom/generated/src/frog/Uint8Array.dart ('k') | client/dom/scripts/systemfrog.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698