| 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 re | 10 import re |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 'Element.webkitMatchesSelector': ['@Experimental()'], | 621 'Element.webkitMatchesSelector': ['@Experimental()'], |
| 622 } | 622 } |
| 623 | 623 |
| 624 _indexed_db_annotations = [ | 624 _indexed_db_annotations = [ |
| 625 "@SupportedBrowser(SupportedBrowser.CHROME)", | 625 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 626 "@SupportedBrowser(SupportedBrowser.FIREFOX, '15')", | 626 "@SupportedBrowser(SupportedBrowser.FIREFOX, '15')", |
| 627 "@SupportedBrowser(SupportedBrowser.IE, '10')", | 627 "@SupportedBrowser(SupportedBrowser.IE, '10')", |
| 628 "@Experimental()", | 628 "@Experimental()", |
| 629 ] | 629 ] |
| 630 | 630 |
| 631 _file_system_annotations = [ |
| 632 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 633 "@Experimental()", |
| 634 ] |
| 635 |
| 631 _all_but_ie9_annotations = [ | 636 _all_but_ie9_annotations = [ |
| 632 "@SupportedBrowser(SupportedBrowser.CHROME)", | 637 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 633 "@SupportedBrowser(SupportedBrowser.FIREFOX)", | 638 "@SupportedBrowser(SupportedBrowser.FIREFOX)", |
| 634 "@SupportedBrowser(SupportedBrowser.IE, '10')", | 639 "@SupportedBrowser(SupportedBrowser.IE, '10')", |
| 635 "@SupportedBrowser(SupportedBrowser.SAFARI)", | 640 "@SupportedBrowser(SupportedBrowser.SAFARI)", |
| 636 ] | 641 ] |
| 637 | 642 |
| 638 _history_annotations = _all_but_ie9_annotations | 643 _history_annotations = _all_but_ie9_annotations |
| 639 | 644 |
| 640 # Annotations to be placed on generated members. | 645 # Annotations to be placed on generated members. |
| 641 # The table is indexed as: | 646 # The table is indexed as: |
| 642 # INTERFACE: annotations to be added to the interface declaration | 647 # INTERFACE: annotations to be added to the interface declaration |
| 643 # INTERFACE.MEMBER: annotation to be added to the member declaration | 648 # INTERFACE.MEMBER: annotation to be added to the member declaration |
| 644 dart_annotations = { | 649 dart_annotations = { |
| 645 'ArrayBuffer': _all_but_ie9_annotations, | 650 'ArrayBuffer': _all_but_ie9_annotations, |
| 646 'ArrayBufferView': _all_but_ie9_annotations, | 651 'ArrayBufferView': _all_but_ie9_annotations, |
| 647 'DOMWindow.indexedDB': _indexed_db_annotations, | 652 'DOMWindow.indexedDB': _indexed_db_annotations, |
| 653 'DOMWindow.webkitRequestFileSystem': _file_system_annotations, |
| 654 'DOMWindow.webkitResolveLocalFileSystemURL': _file_system_annotations, |
| 648 'Element.webkitCreateShadowRoot': [ | 655 'Element.webkitCreateShadowRoot': [ |
| 649 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", | 656 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", |
| 650 "@Experimental()", | 657 "@Experimental()", |
| 651 ], | 658 ], |
| 659 'FileSystem': _file_system_annotations, |
| 660 'FileSystemSync': _file_system_annotations, |
| 652 'History.pushState': _history_annotations, | 661 'History.pushState': _history_annotations, |
| 653 'History.replaceState': _history_annotations, | 662 'History.replaceState': _history_annotations, |
| 654 'HTMLContentElement': [ | 663 'HTMLContentElement': [ |
| 655 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", | 664 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", |
| 656 "@Experimental()", | 665 "@Experimental()", |
| 657 ], | 666 ], |
| 658 'HTMLDataListElement': _all_but_ie9_annotations, | 667 'HTMLDataListElement': _all_but_ie9_annotations, |
| 659 'HTMLDetailsElement': [ | 668 'HTMLDetailsElement': [ |
| 660 "@SupportedBrowser(SupportedBrowser.CHROME)", | 669 "@SupportedBrowser(SupportedBrowser.CHROME)", |
| 661 "@SupportedBrowser(SupportedBrowser.SAFARI)", | 670 "@SupportedBrowser(SupportedBrowser.SAFARI)", |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 "@SupportedBrowser(SupportedBrowser.SAFARI)", | 706 "@SupportedBrowser(SupportedBrowser.SAFARI)", |
| 698 ], | 707 ], |
| 699 'IDBFactory': _indexed_db_annotations, | 708 'IDBFactory': _indexed_db_annotations, |
| 700 'IDBDatabase': _indexed_db_annotations, | 709 'IDBDatabase': _indexed_db_annotations, |
| 701 'ShadowRoot': [ | 710 'ShadowRoot': [ |
| 702 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", | 711 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", |
| 703 "@Experimental()", | 712 "@Experimental()", |
| 704 ], | 713 ], |
| 705 'WebSocket': _all_but_ie9_annotations, | 714 'WebSocket': _all_but_ie9_annotations, |
| 706 'WorkerContext.indexedDB': _indexed_db_annotations, | 715 'WorkerContext.indexedDB': _indexed_db_annotations, |
| 716 'WorkerContext.webkitRequestFileSystem': _file_system_annotations, |
| 717 'WorkerContext.webkitRequestFileSystemSync': _file_system_annotations, |
| 718 'WorkerContext.webkitResolveLocalFileSystemSyncURL': _file_system_annotations, |
| 719 'WorkerContext.webkitResolveLocalFileSystemURL': _file_system_annotations, |
| 707 } | 720 } |
| 708 | 721 |
| 709 def FindCommonAnnotations(interface_name, member_name=None): | 722 def FindCommonAnnotations(interface_name, member_name=None): |
| 710 """ Finds annotations common between dart2js and dartium. | 723 """ Finds annotations common between dart2js and dartium. |
| 711 """ | 724 """ |
| 712 if member_name: | 725 if member_name: |
| 713 return dart_annotations.get('%s.%s' % (interface_name, member_name)) | 726 return dart_annotations.get('%s.%s' % (interface_name, member_name)) |
| 714 else: | 727 else: |
| 715 return dart_annotations.get(interface_name) | 728 return dart_annotations.get(interface_name) |
| 716 | 729 |
| (...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1276 self) | 1289 self) |
| 1277 | 1290 |
| 1278 if type_data.clazz == 'SVGTearOff': | 1291 if type_data.clazz == 'SVGTearOff': |
| 1279 dart_interface_name = self._renamer.RenameInterface( | 1292 dart_interface_name = self._renamer.RenameInterface( |
| 1280 self._database.GetInterface(type_name)) | 1293 self._database.GetInterface(type_name)) |
| 1281 return SVGTearOffIDLTypeInfo( | 1294 return SVGTearOffIDLTypeInfo( |
| 1282 type_name, type_data, dart_interface_name, self) | 1295 type_name, type_data, dart_interface_name, self) |
| 1283 | 1296 |
| 1284 class_name = '%sIDLTypeInfo' % type_data.clazz | 1297 class_name = '%sIDLTypeInfo' % type_data.clazz |
| 1285 return globals()[class_name](type_name, type_data) | 1298 return globals()[class_name](type_name, type_data) |
| OLD | NEW |