OLD | NEW |
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 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 'CSSKeyframeRule,MozCSSKeyframeRule,WebKitCSSKeyframeRule', | 325 'CSSKeyframeRule,MozCSSKeyframeRule,WebKitCSSKeyframeRule', |
326 | 326 |
327 'CSSKeyframesRule': | 327 'CSSKeyframesRule': |
328 'CSSKeyframesRule,MozCSSKeyframesRule,WebKitCSSKeyframesRule', | 328 'CSSKeyframesRule,MozCSSKeyframesRule,WebKitCSSKeyframesRule', |
329 | 329 |
330 # webgl extensions are sometimes named directly after the getExtension | 330 # webgl extensions are sometimes named directly after the getExtension |
331 # parameter (e.g on Firefox). | 331 # parameter (e.g on Firefox). |
332 | 332 |
333 'ANGLEInstancedArrays': 'ANGLEInstancedArrays,ANGLE_instanced_arrays', | 333 'ANGLEInstancedArrays': 'ANGLEInstancedArrays,ANGLE_instanced_arrays', |
334 'EXTsRGB': 'EXTsRGB,EXT_sRGB', | 334 'EXTsRGB': 'EXTsRGB,EXT_sRGB', |
335 'EXTBlendMinMax': 'EXTBlendMinMax,EXT_blend_min_max', | 335 'EXTBlendMinMax': 'EXTBlendMinMax,EXT_blend_minmax', |
336 'EXTFragDepth': 'EXTFragDepth,EXT_frag_depth', | 336 'EXTFragDepth': 'EXTFragDepth,EXT_frag_depth', |
337 'EXTShaderTextureLOD': 'EXTShaderTextureLOD,EXT_shader_texture_lod', | 337 'EXTShaderTextureLOD': 'EXTShaderTextureLOD,EXT_shader_texture_lod', |
338 'EXTTextureFilterAnisotropic': | 338 'EXTTextureFilterAnisotropic': |
339 'EXTTextureFilterAnisotropic,EXT_texture_filter_anisotropic', | 339 'EXTTextureFilterAnisotropic,EXT_texture_filter_anisotropic', |
340 'OESElementIndexUint': 'OESElementIndexUint,OES_element_index_uint', | 340 'OESElementIndexUint': 'OESElementIndexUint,OES_element_index_uint', |
341 'OESStandardDerivatives': 'OESStandardDerivatives,OES_standard_derivatives', | 341 'OESStandardDerivatives': 'OESStandardDerivatives,OES_standard_derivatives', |
342 'OESTextureFloat': 'OESTextureFloat,OES_texture_float', | 342 'OESTextureFloat': 'OESTextureFloat,OES_texture_float', |
343 'OESTextureFloatLinear': 'OESTextureFloatLinear,OES_texture_float_linear', | 343 'OESTextureFloatLinear': 'OESTextureFloatLinear,OES_texture_float_linear', |
344 'OESTextureHalfFloat': 'OESTextureHalfFloat,OES_texture_half_float', | 344 'OESTextureHalfFloat': 'OESTextureHalfFloat,OES_texture_half_float', |
345 'OESTextureHalfFloatLinear': | 345 'OESTextureHalfFloatLinear': |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 # it's a dynamic/any type | 724 # it's a dynamic/any type |
725 # - type is Object | 725 # - type is Object |
726 # | 726 # |
727 if (wrap_unwrap_type_blink(type_id, type_registry)): | 727 if (wrap_unwrap_type_blink(type_id, type_registry)): |
728 type_is_callback = self.isCallback(type_registry, type_id) | 728 type_is_callback = self.isCallback(type_registry, type_id) |
729 if (dart_js_interop and type_id == 'EventListener' and | 729 if (dart_js_interop and type_id == 'EventListener' and |
730 self.name in ['addEventListener', 'removeEventListener']): | 730 self.name in ['addEventListener', 'removeEventListener']): |
731 # Events fired need use a JSFunction not a anonymous closure to | 731 # Events fired need use a JSFunction not a anonymous closure to |
732 # insure the event can really be removed. | 732 # insure the event can really be removed. |
733 parameters.append('js.allowInterop(%s)' % p.name) | 733 parameters.append('js.allowInterop(%s)' % p.name) |
734 # These commented out cases don't actually generate any code. | 734 # These commented out cases don't actually generate any code. |
735 # elif dart_js_interop and type_id == 'FontFaceSetForEachCallback': | 735 # elif dart_js_interop and type_id == 'FontFaceSetForEachCallback': |
736 # forEach is supported in the DOM for FontFaceSet as it iterates | 736 # forEach is supported in the DOM for FontFaceSet as it iterates |
737 # over the Javascript Object the callback parameters are also | 737 # over the Javascript Object the callback parameters are also |
738 # Javascript objects and must be wrapped. | 738 # Javascript objects and must be wrapped. |
739 # parameters.append('(fontFace, fontFaceAgain, set) => %s(fontFace,
fontFaceAgain, wrap_jso(set))' % p.name) | 739 # parameters.append('(fontFace, fontFaceAgain, set) => %s(fontFace,
fontFaceAgain, wrap_jso(set))' % p.name) |
740 # elif dart_js_interop and type_id == 'HeadersForEachCallback': | 740 # elif dart_js_interop and type_id == 'HeadersForEachCallback': |
741 # forEach is supported in the DOM for Headers as it iterates | 741 # forEach is supported in the DOM for Headers as it iterates |
742 # over the Javascript Object the callback parameters are also | 742 # over the Javascript Object the callback parameters are also |
743 # Javascript objects and must be wrapped. | 743 # Javascript objects and must be wrapped. |
744 # parameters.append('(String value, String key, map) => %s(value, k
ey, wrap_jso(map))' % p.name) | 744 # parameters.append('(String value, String key, map) => %s(value, k
ey, wrap_jso(map))' % p.name) |
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1697 return_type == 'Rectangle') | 1697 return_type == 'Rectangle') |
1698 | 1698 |
1699 def wrap_return_type_blink(return_type, type_name, type_registry): | 1699 def wrap_return_type_blink(return_type, type_name, type_registry): |
1700 """Returns True if we should wrap the returned value. This checks | 1700 """Returns True if we should wrap the returned value. This checks |
1701 a number of different variations, calling the more basic functions | 1701 a number of different variations, calling the more basic functions |
1702 above.""" | 1702 above.""" |
1703 return (wrap_unwrap_type_blink(return_type, type_registry) or | 1703 return (wrap_unwrap_type_blink(return_type, type_registry) or |
1704 wrap_unwrap_type_blink(type_name, type_registry) or | 1704 wrap_unwrap_type_blink(type_name, type_registry) or |
1705 wrap_type_blink(return_type, type_registry) or | 1705 wrap_type_blink(return_type, type_registry) or |
1706 wrap_unwrap_list_blink(return_type, type_registry)) | 1706 wrap_unwrap_list_blink(return_type, type_registry)) |
OLD | NEW |