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 | |
636 _all_but_ie9_annotations = [ | 631 _all_but_ie9_annotations = [ |
637 "@SupportedBrowser(SupportedBrowser.CHROME)", | 632 "@SupportedBrowser(SupportedBrowser.CHROME)", |
638 "@SupportedBrowser(SupportedBrowser.FIREFOX)", | 633 "@SupportedBrowser(SupportedBrowser.FIREFOX)", |
639 "@SupportedBrowser(SupportedBrowser.IE, '10')", | 634 "@SupportedBrowser(SupportedBrowser.IE, '10')", |
640 "@SupportedBrowser(SupportedBrowser.SAFARI)", | 635 "@SupportedBrowser(SupportedBrowser.SAFARI)", |
641 ] | 636 ] |
642 | 637 |
643 _history_annotations = _all_but_ie9_annotations | 638 _history_annotations = _all_but_ie9_annotations |
644 | 639 |
645 _performance_annotations = [ | 640 _performance_annotations = [ |
646 "@SupportedBrowser(SupportedBrowser.CHROME)", | 641 "@SupportedBrowser(SupportedBrowser.CHROME)", |
647 "@SupportedBrowser(SupportedBrowser.FIREFOX)", | 642 "@SupportedBrowser(SupportedBrowser.FIREFOX)", |
648 "@SupportedBrowser(SupportedBrowser.IE)", | 643 "@SupportedBrowser(SupportedBrowser.IE)", |
649 ] | 644 ] |
650 | 645 |
651 # Annotations to be placed on generated members. | 646 # Annotations to be placed on generated members. |
652 # The table is indexed as: | 647 # The table is indexed as: |
653 # INTERFACE: annotations to be added to the interface declaration | 648 # INTERFACE: annotations to be added to the interface declaration |
654 # INTERFACE.MEMBER: annotation to be added to the member declaration | 649 # INTERFACE.MEMBER: annotation to be added to the member declaration |
655 dart_annotations = { | 650 dart_annotations = { |
656 'ArrayBuffer': _all_but_ie9_annotations, | 651 'ArrayBuffer': _all_but_ie9_annotations, |
657 'ArrayBufferView': _all_but_ie9_annotations, | 652 'ArrayBufferView': _all_but_ie9_annotations, |
658 'DOMWindow.indexedDB': _indexed_db_annotations, | 653 'DOMWindow.indexedDB': _indexed_db_annotations, |
659 'DOMWindow.performance': _performance_annotations, | 654 'DOMWindow.performance': _performance_annotations, |
660 'DOMWindow.webkitRequestFileSystem': _file_system_annotations, | |
661 'DOMWindow.webkitResolveLocalFileSystemURL': _file_system_annotations, | |
662 'Element.webkitCreateShadowRoot': [ | 655 'Element.webkitCreateShadowRoot': [ |
663 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", | 656 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", |
664 "@Experimental()", | 657 "@Experimental()", |
665 ], | 658 ], |
666 'FileSystem': _file_system_annotations, | |
667 'FileSystemSync': _file_system_annotations, | |
668 'History.pushState': _history_annotations, | 659 'History.pushState': _history_annotations, |
669 'History.replaceState': _history_annotations, | 660 'History.replaceState': _history_annotations, |
670 'HTMLContentElement': [ | 661 'HTMLContentElement': [ |
671 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", | 662 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", |
672 "@Experimental()", | 663 "@Experimental()", |
673 ], | 664 ], |
674 'HTMLDataListElement': _all_but_ie9_annotations, | 665 'HTMLDataListElement': _all_but_ie9_annotations, |
675 'HTMLDetailsElement': [ | 666 'HTMLDetailsElement': [ |
676 "@SupportedBrowser(SupportedBrowser.CHROME)", | 667 "@SupportedBrowser(SupportedBrowser.CHROME)", |
677 "@SupportedBrowser(SupportedBrowser.SAFARI)", | 668 "@SupportedBrowser(SupportedBrowser.SAFARI)", |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
714 ], | 705 ], |
715 'IDBFactory': _indexed_db_annotations, | 706 'IDBFactory': _indexed_db_annotations, |
716 'IDBDatabase': _indexed_db_annotations, | 707 'IDBDatabase': _indexed_db_annotations, |
717 'Performance': _performance_annotations, | 708 'Performance': _performance_annotations, |
718 'ShadowRoot': [ | 709 'ShadowRoot': [ |
719 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", | 710 "@SupportedBrowser(SupportedBrowser.CHROME, '25')", |
720 "@Experimental()", | 711 "@Experimental()", |
721 ], | 712 ], |
722 'WebSocket': _all_but_ie9_annotations, | 713 'WebSocket': _all_but_ie9_annotations, |
723 'WorkerContext.indexedDB': _indexed_db_annotations, | 714 'WorkerContext.indexedDB': _indexed_db_annotations, |
724 'WorkerContext.webkitRequestFileSystem': _file_system_annotations, | |
725 'WorkerContext.webkitRequestFileSystemSync': _file_system_annotations, | |
726 'WorkerContext.webkitResolveLocalFileSystemSyncURL': _file_system_annotations, | |
727 'WorkerContext.webkitResolveLocalFileSystemURL': _file_system_annotations, | |
728 } | 715 } |
729 | 716 |
730 def FindCommonAnnotations(interface_name, member_name=None): | 717 def FindCommonAnnotations(interface_name, member_name=None): |
731 """ Finds annotations common between dart2js and dartium. | 718 """ Finds annotations common between dart2js and dartium. |
732 """ | 719 """ |
733 if member_name: | 720 if member_name: |
734 return dart_annotations.get('%s.%s' % (interface_name, member_name)) | 721 return dart_annotations.get('%s.%s' % (interface_name, member_name)) |
735 else: | 722 else: |
736 return dart_annotations.get(interface_name) | 723 return dart_annotations.get(interface_name) |
737 | 724 |
(...skipping 559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1297 self) | 1284 self) |
1298 | 1285 |
1299 if type_data.clazz == 'SVGTearOff': | 1286 if type_data.clazz == 'SVGTearOff': |
1300 dart_interface_name = self._renamer.RenameInterface( | 1287 dart_interface_name = self._renamer.RenameInterface( |
1301 self._database.GetInterface(type_name)) | 1288 self._database.GetInterface(type_name)) |
1302 return SVGTearOffIDLTypeInfo( | 1289 return SVGTearOffIDLTypeInfo( |
1303 type_name, type_data, dart_interface_name, self) | 1290 type_name, type_data, dart_interface_name, self) |
1304 | 1291 |
1305 class_name = '%sIDLTypeInfo' % type_data.clazz | 1292 class_name = '%sIDLTypeInfo' % type_data.clazz |
1306 return globals()[class_name](type_name, type_data) | 1293 return globals()[class_name](type_name, type_data) |
OLD | NEW |